Reformat code

- Reformat Console\Storage
- Reformat Core\StorageManager
- Simplify logic in Worker\CronJobs
This commit is contained in:
Hypolite Petovan 2019-03-17 19:04:42 -04:00
parent 3a0a6cd659
commit f225a6c51a
3 changed files with 44 additions and 56 deletions

View file

@ -51,13 +51,13 @@ HELP;
switch ($this->args[0]) {
case 'list':
return $this->do_list();
return $this->doList();
break;
case 'set':
return $this->do_set();
return $this->doSet();
break;
case 'move':
return $this->do_move();
return $this->doMove();
break;
}
@ -65,7 +65,7 @@ HELP;
return -1;
}
protected function do_list()
protected function doList()
{
$rowfmt = ' %-3s | %-20s';
$current = StorageManager::getBackend();
@ -92,7 +92,7 @@ HELP;
return 0;
}
protected function do_set()
protected function doSet()
{
if (count($this->args) !== 2) {
throw new CommandArgsException('Invalid arguments');
@ -110,7 +110,7 @@ HELP;
return 0;
}
protected function do_move()
protected function doMove()
{
$tables = null;
if (count($this->args) < 1 || count($this->args) > 2) {

View file

@ -35,54 +35,42 @@ class CronJobs
Logger::log("Starting cronjob " . $command, Logger::DEBUG);
// Call possible post update functions
// see src/Database/PostUpdate.php for more details
if ($command == 'post_update') {
switch($command) {
case 'post_update':
PostUpdate::update();
return;
}
break;
// update nodeinfo data
if ($command == 'nodeinfo') {
case 'nodeinfo':
nodeinfo_cron();
return;
}
break;
// Expire and remove user entries
if ($command == 'expire_and_remove_users') {
case 'expire_and_remove_users':
self::expireAndRemoveUsers();
return;
}
break;
if ($command == 'update_contact_birthdays') {
case 'update_contact_birthdays':
Contact::updateBirthdays();
return;
}
break;
if ($command == 'update_photo_albums') {
case 'update_photo_albums':
self::updatePhotoAlbums();
return;
}
break;
// Clear cache entries
if ($command == 'clear_cache') {
case 'clear_cache':
self::clearCache($a);
return;
}
break;
// Repair missing Diaspora values in contacts
if ($command == 'repair_diaspora') {
case 'repair_diaspora':
self::repairDiaspora($a);
return;
}
break;
// Repair entries in the database
if ($command == 'repair_database') {
case 'repair_database':
self::repairDatabase();
return;
}
break;
default:
Logger::log("Xronjob " . $command . " is unknown.", Logger::DEBUG);
}
return;
}