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' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user