-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix for blank settings pages that would appear on some hosting prov…
…iders. * Fixed bugs when Media Cloud is being used on a C-Panel/WHM managed servers. * Fixed background processing when "Skip DNS" is enabled on C-Panel/WHM managed servers. * Troubleshooter tool has been renamed System Compatibility Test. * Running the system compatibility test will automatically tweak background processing settings until it finds a configuration that works. * Ability to sort the media to be imported when using the Migrate to Cloud tool * Fix for some hosts that have `allow_url_fopen` disabled * Added 'Unlink From Cloud' bulk action that will remove Media Cloud metadata from selected files in the Media Library list view * Fix for compatibility with Offload Media where the url contained an errant '-'
- Loading branch information
Showing
31 changed files
with
1,281 additions
and
484 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?php | ||
|
||
// Copyright (c) 2016 Interfacelab LLC. All rights reserved. | ||
// | ||
// Released under the GPLv3 license | ||
// http://www.gnu.org/licenses/gpl-3.0.html | ||
// | ||
// ********************************************************************** | ||
// This program is distributed in the hope that it will be useful, but | ||
// WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
// ********************************************************************** | ||
|
||
namespace ILAB\MediaCloud\Tools\Debugging\System\Batch; | ||
|
||
use ILAB\MediaCloud\Tasks\BackgroundProcess; | ||
use ILAB\MediaCloud\Tasks\BatchManager; | ||
use ILAB\MediaCloud\Tools\Storage\StorageTool; | ||
use ILAB\MediaCloud\Tools\ToolsManager; | ||
use ILAB\MediaCloud\Utilities\Logging\Logger; | ||
|
||
if (!defined( 'ABSPATH')) { header( 'Location: /'); die; } | ||
|
||
/** | ||
* Class TestBatchProcess | ||
* @package ILAB\MediaCloud\Tools\Debugging\System\Batch | ||
*/ | ||
class TestBatchProcess extends BackgroundProcess { | ||
protected $action = 'mcloud_system_test_process'; | ||
|
||
protected function shouldHandle() { | ||
return !BatchManager::instance()->shouldCancel('system-testing'); | ||
} | ||
|
||
public function task($item) { | ||
$startTime = microtime(true); | ||
|
||
Logger::info( 'Start Task', $item); | ||
if (!$this->shouldHandle()) { | ||
Logger::info( 'Task cancelled', $item); | ||
return false; | ||
} | ||
|
||
$index = $item['index']; | ||
$post_id = $item['post']; | ||
|
||
BatchManager::instance()->setLastUpdateToNow('system-testing'); | ||
BatchManager::instance()->setCurrentID('system-testing', $post_id); | ||
BatchManager::instance()->setCurrent('system-testing', $index + 1); | ||
|
||
sleep(1); | ||
|
||
$endTime = microtime(true) - $startTime; | ||
BatchManager::instance()->incrementTotalTime('system-testing', $endTime); | ||
|
||
return false; | ||
} | ||
|
||
protected function complete() { | ||
Logger::info( 'Task complete'); | ||
BatchManager::instance()->reset('system-testing'); | ||
parent::complete(); | ||
} | ||
|
||
public function cancel_process() { | ||
Logger::info( 'Cancel process'); | ||
|
||
parent::cancel_process(); | ||
|
||
BatchManager::instance()->reset('system-testing'); | ||
} | ||
|
||
public static function cancelAll() { | ||
Logger::info( 'Cancel all processes'); | ||
|
||
wp_clear_scheduled_hook('wp_mcloud_system_test_process_cron'); | ||
|
||
global $wpdb; | ||
|
||
$res = $wpdb->get_results("select * from {$wpdb->options} where option_name like 'wp_mcloud_system_test_process_batch_%'"); | ||
foreach($res as $batch) { | ||
Logger::info( "Deleting batch {$batch->option_name}"); | ||
delete_option($batch->option_name); | ||
} | ||
|
||
$res = $wpdb->get_results("select * from {$wpdb->options} where option_name like '__wp_mcloud_system_test_process_batch_%'"); | ||
foreach($res as $batch) { | ||
delete_option($batch->option_name); | ||
} | ||
|
||
BatchManager::instance()->reset('system-testing'); | ||
|
||
Logger::info( "Current cron", get_option( 'cron', [])); | ||
Logger::info( 'End cancel all processes'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?php | ||
|
||
// Copyright (c) 2016 Interfacelab LLC. All rights reserved. | ||
// | ||
// Released under the GPLv3 license | ||
// http://www.gnu.org/licenses/gpl-3.0.html | ||
// | ||
// ********************************************************************** | ||
// This program is distributed in the hope that it will be useful, but | ||
// WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
// ********************************************************************** | ||
|
||
namespace ILAB\MediaCloud\Tools\Debugging\System\Batch; | ||
|
||
use ILAB\MediaCloud\Tools\BatchTool; | ||
use function ILAB\MediaCloud\Utilities\json_response; | ||
|
||
class TestBatchTool extends BatchTool { | ||
//region Properties | ||
/** | ||
* Name/ID of the batch | ||
* @return string | ||
*/ | ||
public static function BatchIdentifier() { | ||
return 'system-testing'; | ||
} | ||
|
||
/** | ||
* Title of the batch | ||
* @return string | ||
*/ | ||
public function title() { | ||
return null; | ||
} | ||
|
||
public function menuTitle() { | ||
return null; | ||
} | ||
|
||
/** | ||
* The prefix to use for action names | ||
* @return string | ||
*/ | ||
public function batchPrefix() { | ||
return 'mcloud_system_testing'; | ||
} | ||
|
||
/** | ||
* Fully qualified class name for the BatchProcess class | ||
* @return string | ||
*/ | ||
public static function BatchProcessClassName() { | ||
return TestBatchProcess::class; | ||
} | ||
|
||
/** | ||
* The view to render for instructions | ||
* @return string | ||
*/ | ||
public function instructionView() { | ||
return null; | ||
} | ||
|
||
/** | ||
* The menu slug for the tool | ||
* @return string | ||
*/ | ||
function menuSlug() { | ||
return null; | ||
} | ||
|
||
public function enabled() { | ||
return true; | ||
} | ||
//endregion | ||
|
||
//region Actions | ||
public function manualAction() { | ||
json_response(["status" => 'ok']); | ||
} | ||
//endregion | ||
|
||
|
||
/** | ||
* Gets the post data to process for this batch. Data is paged to minimize memory usage. | ||
* @param $page | ||
* @param bool $forceImages | ||
* @param bool $allInfo | ||
* | ||
* @return array | ||
*/ | ||
protected function getImportBatch($page, $forceImages = false, $allInfo = false) { | ||
return [ | ||
'total' => 15, | ||
'posts' => [ | ||
1, 1, 1, 1, 1, | ||
1, 1, 1, 1, 1, | ||
1, 1, 1, 1, 1, | ||
], | ||
'options' => [] | ||
]; | ||
} | ||
} |
Oops, something went wrong.