Version 5.0.6

This commit is contained in:
Neo committed 2025-12-19 18:55:49 -08:00
1 parent a3a4a9ccbd
commit b89858b2ff
1214 files changed
+92828 -14859

No files matched your search

+23 -11
View File
@@ -14,6 +14,7 @@ namespace IPS\File;
use DomainException;
use Exception;
use IPS\Application;
use IPS\Data\Store;
use IPS\Db;
use IPS\File;
@@ -24,6 +25,7 @@ use IPS\Platform\Bridge;
use IPS\Request;
use IPS\Xml\SimpleXML;
use LogicException;
use OutOfRangeException;
use RuntimeException;
use UnderflowException;
use function count;
@@ -241,12 +243,15 @@ class Amazon extends File
if( mb_strpos( $this->storageExtension, '_' ) !== FALSE )
{
$bits = explode( '_', $this->storageExtension );
$class = '\IPS\\' . $bits[0] . '\extensions\core\FileStorage\\' . $bits[1];
if ( isset( $class::$storeGzipExtensions ) and is_array( $class::$storeGzipExtensions ) and count( $class::$storeGzipExtensions ) )
try
{
static::$gzipExtensions[ $this->storageExtension ] = $class::$storeGzipExtensions;
$class = Application::getExtensionClass( $bits[0], 'FileStorage', $bits[1] );
if ( isset( $class::$storeGzipExtensions ) and is_array( $class::$storeGzipExtensions ) and count( $class::$storeGzipExtensions ) )
{
static::$gzipExtensions[ $this->storageExtension ] = $class::$storeGzipExtensions;
}
}
catch( OutOfRangeException ){}
}
}
@@ -266,12 +271,15 @@ class Amazon extends File
if ( mb_strpos( $this->storageExtension, '_' ) !== FALSE )
{
$bits = explode( '_', $this->storageExtension );
$class = '\IPS\\' . $bits[0] . '\extensions\core\FileStorage\\' . $bits[1];
if ( isset( $class::$isPrivate ) )
try
{
return $class::$isPrivate;
$class = Application::getExtensionClass( $bits[0], 'FileStorage', $bits[1] );
if ( isset( $class::$isPrivate ) )
{
return $class::$isPrivate;
}
}
catch( OutOfRangeException ){}
}
}
@@ -776,12 +784,16 @@ class Amazon extends File
if( $storageExtension !== NULL AND mb_strpos( $storageExtension, '_' ) !== FALSE )
{
$bits = explode( '_', $storageExtension );
$class = '\IPS\\' . $bits[0] . '\extensions\core\FileStorage\\' . $bits[1];
if ( isset( $class::$cacheControlTtl ) and $class::$cacheControlTtl )
try
{
$cacheSeconds = $class::$cacheControlTtl;
$class = Application::getExtensionClass( $bits[0], 'FileStorage', $bits[1] );
if ( isset( $class::$cacheControlTtl ) and $class::$cacheControlTtl )
{
$cacheSeconds = $class::$cacheControlTtl;
}
}
catch( OutOfRangeException ){}
}
$headers['Cache-Control'] = 'public, max-age=' . $cacheSeconds;
+13 -19
View File
@@ -11,38 +11,29 @@
namespace IPS\File;
/* Set use statements to make Uncle Matt happy */
use IPS\Application;
use IPS\Platform\Bridge;
use IPS\DateTime AS DT;
use IPS\Data\Store;
use IPS\Db;
use IPS\File;
use IPS\File\Amazon;
use IPS\Http\Url;
use IPS\Http\Response;
use IPS\Request;
use IPS\Http\Request\Exception as RequestException;
use IPS\Member;
use DateInterval;
use function array_filter;
use function array_map;
use function debug_backtrace;
use OutOfRangeException;
use function defined;
use function header;
use function in_array;
use function mb_strstr;
use function trim;
use function strlen;
use const ARRAY_FILTER_USE_KEY;
use const DEBUG_BACKTRACE_IGNORE_ARGS;
use const IPS\VERY_LONG_REQUEST_TIMEOUT;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
@@ -85,13 +76,13 @@ class Backblaze extends Amazon
* @param string $uri The URI (relative to the bucket)
* @param string $verb The HTTP verb to use
* @param array $configuration The configuration for this instance
* @param int $configurationId The configuration ID
* @param int|null $configurationId The configuration ID
* @param string|null $content The content to send
* @param string|null $storageExtension Storage extension
* @param bool $skipExtraChecks Skips the endpoint check (to prevent infinite looping)
* @param bool $isPrivate This can be set to true to access/store private files (i.e. that are not publicly readable)
* @param array $queryString Array of key => value pairs
* @return \IPS\Http\Response
* @return Response
* @throws \IPS\Http\Request\Exception
*/
protected static function makeRequest( string $uri, string $verb, array $configuration, ?int $configurationId, ?string $content=NULL, ?string $storageExtension=NULL, bool $skipExtraChecks=FALSE, ?bool $isPrivate=false, array $queryString=array() ): Response
@@ -132,12 +123,15 @@ class Backblaze extends Amazon
if( $storageExtension !== NULL AND mb_strpos( $storageExtension, '_' ) !== FALSE )
{
$bits = explode( '_', $storageExtension );
$class = '\IPS\\' . $bits[0] . '\extensions\core\FileStorage\\' . $bits[1];
if ( isset( $class::$cacheControlTtl ) and $class::$cacheControlTtl )
try
{
$cacheSeconds = $class::$cacheControlTtl;
$class = Application::getExtensionClass( $bits[0], 'FileStorage', $bits[1] );
if ( isset( $class::$cacheControlTtl ) and $class::$cacheControlTtl )
{
$cacheSeconds = $class::$cacheControlTtl;
}
}
catch( OutOfRangeException ){}
}
$headers['Cache-Control'] = 'public, max-age=' . $cacheSeconds;
+11 -5
View File
@@ -19,6 +19,7 @@ use IPS\Data\Store;
use IPS\File\FileSystem;
use IPS\Http\Url;
use IPS\Output\Plugin\Filesize;
use IPS\Platform\Bridge;
use LogicException;
use OutOfRangeException;
use RuntimeException;
@@ -85,6 +86,8 @@ abstract class File
$return['Ftp'] = 'IPS\\File\\Ftp';
}
$return = Bridge::i()->fileHandlers( $return );
return $return;
}
@@ -1173,13 +1176,16 @@ abstract class File
{
if ( $id == $this->configurationId )
{
$exploded = explode( '_', str_replace( 'filestorage__', '', $method ) );
$classname = "IPS\\{$exploded[0]}\\extensions\\core\\FileStorage\\{$exploded[1]}";
if ( method_exists( $classname, 'settingsUpdated' ) )
$exploded = explode( '_', str_replace( 'filestorage__', '', $method ) );
try
{
$classname::settingsUpdated( $this->configuration );
$classname = Application::getExtensionClass( $exploded[0], 'FileStorage', $exploded[1] );
if ( method_exists( $classname, 'settingsUpdated' ) )
{
$classname::settingsUpdated( $this->configuration );
}
}
catch( OutOfRangeException ){}
}
}