Merge pull request #6925 from MrPetovan/task/6778-add-storage-move-to-cron
6778 Part 2: Add storage move cron job (redux)
This commit is contained in:
commit
ed4a9f8b8a
|
@ -10,6 +10,7 @@ Version 2019.06 (UNRELEASED) (2019-06-?)
|
|||
General Code cleaning and restructuring [nupplaphil]
|
||||
Added frio color scheme sharing [JeroenED]
|
||||
Added syslog and stream Logger [nupplaphil]
|
||||
Added storage move cronjob [MrPetovan]
|
||||
Added collapsible panel for connector permission fields [MrPetovan]
|
||||
|
||||
Closed Issues:
|
||||
|
|
|
@ -84,7 +84,7 @@ HELP;
|
|||
|
||||
if ($current === '') {
|
||||
$this->out();
|
||||
$this->out('This sistem is using legacy storage system');
|
||||
$this->out('This system is using legacy storage system');
|
||||
}
|
||||
if ($current !== '' && !$isregisterd) {
|
||||
$this->out();
|
||||
|
|
|
@ -10,6 +10,8 @@ use Friendica\Core\Cache;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\StorageManager;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\PostUpdate;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -68,8 +70,12 @@ class CronJobs
|
|||
self::repairDatabase();
|
||||
break;
|
||||
|
||||
case 'move_storage':
|
||||
self::moveStorage();
|
||||
break;
|
||||
|
||||
default:
|
||||
Logger::log("Xronjob " . $command . " is unknown.", Logger::DEBUG);
|
||||
Logger::log("Cronjob " . $command . " is unknown.", Logger::DEBUG);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -289,4 +295,20 @@ class CronJobs
|
|||
/// - remove children when parent got lost
|
||||
/// - set contact-id in item when not present
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves up to 5000 attachments and photos to the current storage system.
|
||||
* Self-replicates if legacy items have been found and moved.
|
||||
*
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
private static function moveStorage()
|
||||
{
|
||||
$current = StorageManager::getBackend();
|
||||
$moved = StorageManager::move($current);
|
||||
|
||||
if ($moved) {
|
||||
Worker::add(PRIORITY_LOW, "CronJobs", "move_storage");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue