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;
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;
/// - 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");
+ }
+ }
}