Loading inc/class-s3-uploads-local-stream-wrapper.php +76 −80 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ class S3_Uploads_Local_Stream_Wrapper { * * @var resource */ public $handle = NULL; public $handle = null; /** * Instance URI (stream). Loading Loading @@ -64,7 +64,7 @@ class S3_Uploads_Local_Stream_Wrapper { * Returns a string representing a location suitable for writing of a file, * or FALSE if unable to write to the file such as with read-only streams. */ protected function getTarget($uri = NULL) { protected function getTarget( $uri = null ) { if ( ! isset( $uri ) ) { $uri = $this->uri; } Loading @@ -75,7 +75,7 @@ class S3_Uploads_Local_Stream_Wrapper { return trim( $target, '\/' ); } static function getMimeType($uri, $mapping = NULL) { static function getMimeType( $uri, $mapping = null ) { $extension = ''; $file_parts = explode( '.', basename( $uri ) ); Loading @@ -102,7 +102,7 @@ class S3_Uploads_Local_Stream_Wrapper { $output = @chmod( $this->getLocalPath(), $mode ); // We are modifying the underlying file here, so we have to clear the stat // cache so that PHP understands that URI has changed too. clearstatcache(TRUE, $this->getLocalPath()); clearstatcache( true, $this->getLocalPath() ); return $output; } Loading @@ -123,7 +123,7 @@ class S3_Uploads_Local_Stream_Wrapper { * path, as determined by the realpath() function. If $uri is set but not * valid, returns FALSE. */ protected function getLocalPath($uri = NULL) { protected function getLocalPath( $uri = null ) { if ( ! isset( $uri ) ) { $uri = $this->uri; } Loading @@ -133,7 +133,7 @@ class S3_Uploads_Local_Stream_Wrapper { $directory = realpath( $this->getDirectoryPath() ); if ( ! $realpath || ! $directory || strpos( $realpath, $directory ) !== 0 ) { return FALSE; return false; } return $realpath; } Loading Loading @@ -188,7 +188,7 @@ class S3_Uploads_Local_Stream_Wrapper { return flock( $this->handle, $operation ); } return TRUE; return true; } /** Loading Loading @@ -372,14 +372,12 @@ class S3_Uploads_Local_Stream_Wrapper { // $this->getLocalPath() fails if $uri has multiple levels of directories // that do not yet exist. $localpath = $this->getDirectoryPath() . '/' . $this->getTarget( $uri ); } else { } else { $localpath = $this->getLocalPath( $uri ); } if ( $options & STREAM_REPORT_ERRORS ) { return mkdir( $localpath, $mode, $recursive ); } else { } else { return @mkdir( $localpath, $mode, $recursive ); } } Loading @@ -401,8 +399,7 @@ class S3_Uploads_Local_Stream_Wrapper { $this->uri = $uri; if ( $options & STREAM_REPORT_ERRORS ) { return rmdir( $this->getLocalPath() ); } else { } else { return @rmdir( $this->getLocalPath() ); } } Loading @@ -428,8 +425,7 @@ class S3_Uploads_Local_Stream_Wrapper { // exist. This is consistent with PHP's plain filesystem stream wrapper. if ( $flags & STREAM_URL_STAT_QUIET || ! file_exists( $path ) ) { return @stat( $path ); } else { } else { return stat( $path ); } } Loading Loading @@ -479,7 +475,7 @@ class S3_Uploads_Local_Stream_Wrapper { // We do not really have a way to signal a failure as rewinddir() does not // have a return value and there is no way to read a directory handler // without advancing to the next file. return TRUE; return true; } /** Loading @@ -494,6 +490,6 @@ class S3_Uploads_Local_Stream_Wrapper { closedir( $this->handle ); // We do not really have a way to signal a failure as closedir() does not // have a return value. return TRUE; return true; } } inc/class-s3-uploads-stream-wrapper.php +8 −8 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ class S3_Uploads_Stream_Wrapper extends Aws\S3\StreamWrapper { $mode_short = substr( $mode, 0, 1 ); if ( $mode_short === 'r' || $mode_short === 'a' ) { if ( 'r' === $mode_short || 'a' === $mode_short ) { return $result; } Loading inc/class-s3-uploads-uploadsyncbuilder.php +38 −39 Original line number Diff line number Diff line Loading @@ -11,8 +11,7 @@ class S3_Uploads_UploadSyncBuilder extends Aws\S3\Sync\UploadSyncBuilder { * * @return AbstractSync */ public function build() { public function build() { $this->validateRequirements(); $this->sourceConverter = $this->sourceConverter ?: $this->getDefaultSourceConverter(); $this->targetConverter = $this->targetConverter ?: $this->getDefaultTargetConverter(); Loading inc/class-s3-uploads.php +5 −3 Original line number Diff line number Diff line Loading @@ -129,8 +129,9 @@ class S3_Uploads { public function get_original_upload_dir() { if ( empty( $this->original_upload_dir ) ) if ( empty( $this->original_upload_dir ) ) { wp_upload_dir(); } return $this->original_upload_dir; } Loading @@ -140,8 +141,9 @@ class S3_Uploads { */ public function s3() { if ( ! empty( $this->s3 ) ) if ( ! empty( $this->s3 ) ) { return $this->s3; } $params = array(); Loading inc/class-s3-uploads-changed-files-iterator.php +4 −4 File changed.Contains only whitespace changes. Show changes s3-uploads.php +1 −1 File changed.Contains only whitespace changes. Show changes Loading
inc/class-s3-uploads-local-stream-wrapper.php +76 −80 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ class S3_Uploads_Local_Stream_Wrapper { * * @var resource */ public $handle = NULL; public $handle = null; /** * Instance URI (stream). Loading Loading @@ -64,7 +64,7 @@ class S3_Uploads_Local_Stream_Wrapper { * Returns a string representing a location suitable for writing of a file, * or FALSE if unable to write to the file such as with read-only streams. */ protected function getTarget($uri = NULL) { protected function getTarget( $uri = null ) { if ( ! isset( $uri ) ) { $uri = $this->uri; } Loading @@ -75,7 +75,7 @@ class S3_Uploads_Local_Stream_Wrapper { return trim( $target, '\/' ); } static function getMimeType($uri, $mapping = NULL) { static function getMimeType( $uri, $mapping = null ) { $extension = ''; $file_parts = explode( '.', basename( $uri ) ); Loading @@ -102,7 +102,7 @@ class S3_Uploads_Local_Stream_Wrapper { $output = @chmod( $this->getLocalPath(), $mode ); // We are modifying the underlying file here, so we have to clear the stat // cache so that PHP understands that URI has changed too. clearstatcache(TRUE, $this->getLocalPath()); clearstatcache( true, $this->getLocalPath() ); return $output; } Loading @@ -123,7 +123,7 @@ class S3_Uploads_Local_Stream_Wrapper { * path, as determined by the realpath() function. If $uri is set but not * valid, returns FALSE. */ protected function getLocalPath($uri = NULL) { protected function getLocalPath( $uri = null ) { if ( ! isset( $uri ) ) { $uri = $this->uri; } Loading @@ -133,7 +133,7 @@ class S3_Uploads_Local_Stream_Wrapper { $directory = realpath( $this->getDirectoryPath() ); if ( ! $realpath || ! $directory || strpos( $realpath, $directory ) !== 0 ) { return FALSE; return false; } return $realpath; } Loading Loading @@ -188,7 +188,7 @@ class S3_Uploads_Local_Stream_Wrapper { return flock( $this->handle, $operation ); } return TRUE; return true; } /** Loading Loading @@ -372,14 +372,12 @@ class S3_Uploads_Local_Stream_Wrapper { // $this->getLocalPath() fails if $uri has multiple levels of directories // that do not yet exist. $localpath = $this->getDirectoryPath() . '/' . $this->getTarget( $uri ); } else { } else { $localpath = $this->getLocalPath( $uri ); } if ( $options & STREAM_REPORT_ERRORS ) { return mkdir( $localpath, $mode, $recursive ); } else { } else { return @mkdir( $localpath, $mode, $recursive ); } } Loading @@ -401,8 +399,7 @@ class S3_Uploads_Local_Stream_Wrapper { $this->uri = $uri; if ( $options & STREAM_REPORT_ERRORS ) { return rmdir( $this->getLocalPath() ); } else { } else { return @rmdir( $this->getLocalPath() ); } } Loading @@ -428,8 +425,7 @@ class S3_Uploads_Local_Stream_Wrapper { // exist. This is consistent with PHP's plain filesystem stream wrapper. if ( $flags & STREAM_URL_STAT_QUIET || ! file_exists( $path ) ) { return @stat( $path ); } else { } else { return stat( $path ); } } Loading Loading @@ -479,7 +475,7 @@ class S3_Uploads_Local_Stream_Wrapper { // We do not really have a way to signal a failure as rewinddir() does not // have a return value and there is no way to read a directory handler // without advancing to the next file. return TRUE; return true; } /** Loading @@ -494,6 +490,6 @@ class S3_Uploads_Local_Stream_Wrapper { closedir( $this->handle ); // We do not really have a way to signal a failure as closedir() does not // have a return value. return TRUE; return true; } }
inc/class-s3-uploads-stream-wrapper.php +8 −8 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ class S3_Uploads_Stream_Wrapper extends Aws\S3\StreamWrapper { $mode_short = substr( $mode, 0, 1 ); if ( $mode_short === 'r' || $mode_short === 'a' ) { if ( 'r' === $mode_short || 'a' === $mode_short ) { return $result; } Loading
inc/class-s3-uploads-uploadsyncbuilder.php +38 −39 Original line number Diff line number Diff line Loading @@ -11,8 +11,7 @@ class S3_Uploads_UploadSyncBuilder extends Aws\S3\Sync\UploadSyncBuilder { * * @return AbstractSync */ public function build() { public function build() { $this->validateRequirements(); $this->sourceConverter = $this->sourceConverter ?: $this->getDefaultSourceConverter(); $this->targetConverter = $this->targetConverter ?: $this->getDefaultTargetConverter(); Loading
inc/class-s3-uploads.php +5 −3 Original line number Diff line number Diff line Loading @@ -129,8 +129,9 @@ class S3_Uploads { public function get_original_upload_dir() { if ( empty( $this->original_upload_dir ) ) if ( empty( $this->original_upload_dir ) ) { wp_upload_dir(); } return $this->original_upload_dir; } Loading @@ -140,8 +141,9 @@ class S3_Uploads { */ public function s3() { if ( ! empty( $this->s3 ) ) if ( ! empty( $this->s3 ) ) { return $this->s3; } $params = array(); Loading
inc/class-s3-uploads-changed-files-iterator.php +4 −4 File changed.Contains only whitespace changes. Show changes