Version 4.3.0

This commit is contained in:
Neo committed 2025-12-19 05:47:12 -08:00
1 parent 96997ddd8e
commit fe1acf984a
1349 files changed
+116159 -67711

No files matched your search

+15 -7
View File
@@ -71,7 +71,7 @@ class _Amazon extends \IPS\File
$values['bucket_path'] = trim( $values['bucket_path'], '/' );
$values['bucket'] = trim( $values['bucket'], '/' );
$filename = md5( uniqid() ) . '.ips.txt';
$filename = md5( mt_rand() ) . '.ips.txt';
try
{
@@ -282,7 +282,7 @@ class _Amazon extends \IPS\File
}
catch( \Exception $e ) { }
throw new \RuntimeException('COULD_NOT_SAVE_FILE');
throw new \IPS\File\Exception( $path, \IPS\File\Exception::CANNOT_WRITE );
}
/* Write the gzip version */
@@ -302,7 +302,7 @@ class _Amazon extends \IPS\File
}
catch( \Exception $e ) { }
throw new \RuntimeException('COULD_NOT_SAVE_FILE');
throw new \IPS\File\Exception( $path . '.gz', \IPS\File\Exception::CANNOT_WRITE );
}
}
}
@@ -317,7 +317,15 @@ class _Amazon extends \IPS\File
{
if ( $this->contents === NULL or $refresh === TRUE )
{
$this->contents = (string) static::makeRequest( $this->container ? "{$this->container}/{$this->filename}" : "{$this->filename}", 'GET', $this->configuration, $this->configurationId );
$response = static::makeRequest( $this->container ? "{$this->container}/{$this->filename}" : "{$this->filename}", 'GET', $this->configuration, $this->configurationId );
if ( $response->httpResponseCode == 404 )
{
throw new \IPS\File\Exception( $this->container ? "{$this->container}/{$this->filename}" : "{$this->filename}", \IPS\File\Exception::DOES_NOT_EXIST );
}
else
{
$this->contents = (string) $response;
}
}
return $this->contents;
}
@@ -448,7 +456,8 @@ class _Amazon extends \IPS\File
$headers = array();
$queryString = array(
'X-Amz-Expires' => $validForSeconds,
'response-content-disposition' => 'attachment; filename*=UTF-8\'\'' . rawurlencode( $this->originalFilename )
'response-content-disposition' => 'attachment; filename*=UTF-8\'\'' . rawurlencode( $this->originalFilename ),
'response-content-type' => static::getMimeType( $this->originalFilename ) . ";charset=UTF-8"
);
$signature = $this->signature( $this->configuration, 'GET', $fileUrl, $headers, $queryString, NULL, TRUE );
$queryString['X-Amz-Signature'] = $signature;
@@ -461,14 +470,13 @@ class _Amazon extends \IPS\File
$xml = $url->request()->get()->decodeXml();
if ( !isset( $xml->Region ) )
{
throw new \RuntimeException;
throw new \IPS\File\Exception( $fileUrl, \IPS\File\Exception::MISSING_REGION );
}
$this->configuration['region'] = (string) $xml->Region;
\IPS\Db::i()->update( 'core_file_storage', array( 'configuration' => json_encode( $this->configuration ) ), array( 'id=?', $this->configurationId ) );
unset( \IPS\Data\Store::i()->storageConfigurations );
return $this->generateTemporaryDownloadUrl( $validForSeconds );
}
return $url;