Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
+14
-4
@@ -322,6 +322,10 @@ class _Amazon extends \IPS\File
|
||||
{
|
||||
throw new \IPS\File\Exception( $this->container ? "{$this->container}/{$this->filename}" : "{$this->filename}", \IPS\File\Exception::DOES_NOT_EXIST );
|
||||
}
|
||||
elseif( $response->httpResponseCode == 403 )
|
||||
{
|
||||
throw new \IPS\File\Exception( $this->container ? "{$this->container}/{$this->filename}" : "{$this->filename}", \IPS\File\Exception::CANNOT_COPY );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->contents = (string) $response;
|
||||
@@ -339,13 +343,19 @@ class _Amazon extends \IPS\File
|
||||
{
|
||||
$this->container = trim( $this->container, '/' );
|
||||
$path = $this->container ? "{$this->container}/{$this->filename}" : "{$this->filename}";
|
||||
|
||||
|
||||
$debug = array_map( function( $row ) {
|
||||
return array_filter( $row, function( $key ) {
|
||||
return in_array( $key, array( 'class', 'function', 'line' ) );
|
||||
}, ARRAY_FILTER_USE_KEY );
|
||||
}, debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ) );
|
||||
|
||||
try
|
||||
{
|
||||
$response = static::makeRequest( $path, 'DELETE', $this->configuration, $this->configurationId );
|
||||
|
||||
/* Log deletion request */
|
||||
$this->log( "file_deletion", 'delete', NULL, 'log' );
|
||||
$this->log( "file_deletion", 'delete', $debug, 'log' );
|
||||
|
||||
if ( $response->httpResponseCode == 204 )
|
||||
{
|
||||
@@ -361,13 +371,13 @@ class _Amazon extends \IPS\File
|
||||
|
||||
if ( $response->httpResponseCode != 200 )
|
||||
{
|
||||
$this->log( 'COULD_NOT_DELETE_FILE', 'delete', array( $response->httpResponseCode, $response->httpResponseText ), 'error' );
|
||||
$this->log( 'COULD_NOT_DELETE_FILE', 'delete', array( $response->httpResponseCode, $response->httpResponseText, $debug ), 'error' );
|
||||
}
|
||||
}
|
||||
catch( \IPS\Http\Request\Exception $e )
|
||||
{
|
||||
/* If there was a problem deleting the file, don't stop code execution just because of that */
|
||||
$this->log( 'HTTP_ERROR_DELETE_FILE', 'delete', array( $e->getCode(), $e->getMessage() ), 'error' );
|
||||
$this->log( 'HTTP_ERROR_DELETE_FILE', 'delete', array( $e->getCode(), $e->getMessage(), $debug ), 'error' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,13 @@ class _Database extends \IPS\File
|
||||
\IPS\Db::i()->delete( 'core_files', array( 'filename=? AND container=?', $this->filename, $this->container ) );
|
||||
|
||||
/* Log deletion request */
|
||||
$this->log( "file_deletion", 'delete', NULL, 'log' );
|
||||
$immediateCaller = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 1 );
|
||||
$debug = array_map( function( $row ) {
|
||||
return array_filter( $row, function( $key ) {
|
||||
return in_array( $key, array( 'class', 'function', 'line' ) );
|
||||
}, ARRAY_FILTER_USE_KEY );
|
||||
}, debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ) );
|
||||
$this->log( "file_deletion", 'delete', $debug, 'log' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -60,12 +60,12 @@ abstract class _File
|
||||
/**
|
||||
* Get class
|
||||
*
|
||||
* @param string|int $storageExtension Storage extension or configuration ID
|
||||
* @param string|\IPS\Http\Url|NULL $url URL to validate storage configs with
|
||||
* @param string|int $storageExtension Storage extension or configuration ID
|
||||
* @param bool $tryOldFirst Whether to try the old file storage config first or not
|
||||
* @throws \RuntimeException
|
||||
* @return \IPS\File
|
||||
*/
|
||||
public static function getClass( $storageExtension, $url=NULL )
|
||||
public static function getClass( $storageExtension, $tryOldFirst=FALSE )
|
||||
{
|
||||
static::getConfigurations();
|
||||
|
||||
@@ -114,8 +114,8 @@ abstract class _File
|
||||
/* We have an array of IDs when a move is in progress, the first ID is the new storage method, the second ID is the old */
|
||||
if ( is_array( $settings[ "filestorage__{$storageExtension}" ] ) )
|
||||
{
|
||||
/* Do we have a URL to check? */
|
||||
if ( $url )
|
||||
/* Do we want to use the old storage config if available? */
|
||||
if ( $tryOldFirst === TRUE )
|
||||
{
|
||||
/* We want the old storage method as we know the file is on the old server, but may not have moved to the new yet */
|
||||
$copyOfSettings = $settings["filestorage__{$storageExtension}"];
|
||||
@@ -522,13 +522,12 @@ abstract class _File
|
||||
*/
|
||||
public static function get( $storageExtension, $url )
|
||||
{
|
||||
/* Don't allow something/../../../../etc/passwd */
|
||||
if( mb_strpos( rawurldecode( $url ), '../' ) !== FALSE )
|
||||
{
|
||||
throw new \OutOfRangeException( 'INVALID_PATH' );
|
||||
}
|
||||
|
||||
$class = static::getClass( $storageExtension, $url );
|
||||
$class = static::getClass( $storageExtension, TRUE );
|
||||
$class->storageExtension = $storageExtension;
|
||||
$class->url = $url;
|
||||
$class->load();
|
||||
|
||||
@@ -362,9 +362,15 @@ class _FileSystem extends \IPS\File
|
||||
* @return bool
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
{
|
||||
/* Log deletion request */
|
||||
$this->log( "file_deletion", 'delete', NULL, 'log' );
|
||||
$immediateCaller = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 1 );
|
||||
$debug = array_map( function( $row ) {
|
||||
return array_filter( $row, function( $key ) {
|
||||
return in_array( $key, array( 'class', 'function', 'line' ) );
|
||||
}, ARRAY_FILTER_USE_KEY );
|
||||
}, debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ) );
|
||||
$this->log( "file_deletion", 'delete', $debug, 'log' );
|
||||
|
||||
if( file_exists( "{$this->configuration['dir']}/{$this->container}/{$this->filename}" ) )
|
||||
{
|
||||
|
||||
+7
-1
@@ -198,7 +198,13 @@ class _Ftp extends \IPS\File
|
||||
}
|
||||
|
||||
/* Log deletion request */
|
||||
$this->log( "file_deletion", 'delete', NULL, 'log' );
|
||||
$immediateCaller = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 1 );
|
||||
$debug = array_map( function( $row ) {
|
||||
return array_filter( $row, function( $key ) {
|
||||
return in_array( $key, array( 'class', 'function', 'line' ) );
|
||||
}, ARRAY_FILTER_USE_KEY );
|
||||
}, debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ) );
|
||||
$this->log( "file_deletion", 'delete', $debug, 'log' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user