Skip to content

Commit

Permalink
* Fixes for direct uploads for huge image files
Browse files Browse the repository at this point in the history
* Fix for hyperdb not storing null values
* Fix for support links
* Fixes for migrate task
* Updated to latest Freemius SDK
  • Loading branch information
jawngee committed Feb 15, 2021
1 parent bbeff08 commit 68c4bd5
Show file tree
Hide file tree
Showing 31 changed files with 576 additions and 433 deletions.
49 changes: 47 additions & 2 deletions classes/Tools/Storage/StorageTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ public function updateAttachmentMetadata(

$upload_info = wp_upload_dir();
$upload_path = $upload_info['basedir'];
$path_base = pathinfo( $data['file'] )['dirname'];
$path_base = pathinfo( $data['file'], PATHINFO_DIRNAME );
if ( $path_base === '.' ) {
$path_base = '';
}
Expand All @@ -873,9 +873,54 @@ public function updateAttachmentMetadata(
$path_base = '';
}

if ( !file_exists( $upload_path . DIRECTORY_SEPARATOR . $data['file'] ) ) {
$sourceFile = $upload_path . DIRECTORY_SEPARATOR . $data['file'];
Logger::info(
"Metadata:" . json_encode( $originalData, JSON_PRETTY_PRINT ),
[],
__METHOD__,
__LINE__
);

if ( !file_exists( $sourceFile ) ) {
Logger::error(
"Missing {$sourceFile}",
[],
__METHOD__,
__LINE__
);
return $originalData;
}


if ( is_dir( $sourceFile ) ) {
Logger::error(
"{$sourceFile} is directory. Skipping.",
[],
__METHOD__,
__LINE__
);
return $originalData;
}

$sourceFileSize = filesize( $sourceFile );

if ( filesize( $sourceFile ) < 512 ) {
Logger::error(
"File too small {$sourceFile} => {$sourceFileSize} bytes",
[],
__METHOD__,
__LINE__
);
return $originalData;
} else {
Logger::info(
"File size {$sourceFile} => {$sourceFileSize} bytes",
[],
__METHOD__,
__LINE__
);
}

if ( !$mime ) {
$mime = wp_get_image_mime( $upload_path . DIRECTORY_SEPARATOR . $data['file'] );
}
Expand Down
5 changes: 3 additions & 2 deletions classes/Tools/ToolsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function ( $value, $option, $old_value ) {
if ( empty($value) && strpos( $option, 'mcloud' ) === 0 ) {
$type = strtolower( gettype( $value ) );
if ( in_array( $type, [ 'boolean', 'null' ] ) ) {
return (string) '0';
return (string) '';
}
}

Expand Down Expand Up @@ -165,7 +165,8 @@ function ( $value, $option, $old_value ) {
$actionLinksPrefix = ( is_multisite() ? 'network_admin_' : '' );
add_filter( $actionLinksPrefix . 'plugin_action_links_' . ILAB_PLUGIN_NAME, function ( $links ) {
$links[] = "<a href='" . ilab_admin_url( 'admin.php?page=media-cloud-settings' ) . "'>Settings</a>";
$links[] = "<a href='https://discourse.interfacelab.io' target='_blank'>Support</a>";
global $media_cloud_licensing ;
$links[] = "<a href='https://users.freemius.com' target='_blank'>Billing</a>";
return $links;
} );
$maxTime = ini_get( 'max_execution_time' );
Expand Down
2 changes: 1 addition & 1 deletion external/Freemius/assets/css/admin/common.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion external/Freemius/assets/css/admin/connect.css

Large diffs are not rendered by default.

Loading

0 comments on commit 68c4bd5

Please sign in to comment.