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

+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;