From: Michael Date: Tue, 1 Sep 2020 13:40:37 +0000 (+0000) Subject: Renamed classes X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1c5801ca8e21906c4564cac0e1417f8458d2f5c0;p=friendica.git Renamed classes --- diff --git a/src/Worker/CheckDeletedContacts.php b/src/Worker/CheckDeletedContacts.php new file mode 100644 index 0000000000..e1aa57fc7f --- /dev/null +++ b/src/Worker/CheckDeletedContacts.php @@ -0,0 +1,41 @@ +. + * + */ + +namespace Friendica\Worker; + +use Friendica\Core\Worker; +use Friendica\Database\DBA; + +/** + * Checks for contacts that are about to be deleted and ensures that they are removed. + * This should be done automatically in the "remove" function. This here is a cleanup job. + */ +class CheckDeletedContacts +{ + public static function execute() + { + $contacts = DBA::select('contact', ['id'], ['deleted' => true]); + while ($contact = DBA::fetch($contacts)) { + Worker::add(PRIORITY_MEDIUM, 'RemoveContact', $contact['id']); + } + DBA::close($contacts); + } +} diff --git a/src/Worker/CheckdeletedContacts.php b/src/Worker/CheckdeletedContacts.php deleted file mode 100644 index c47495211c..0000000000 --- a/src/Worker/CheckdeletedContacts.php +++ /dev/null @@ -1,41 +0,0 @@ -. - * - */ - -namespace Friendica\Worker; - -use Friendica\Core\Worker; -use Friendica\Database\DBA; - -/** - * Checks for contacts that are about to be deleted and ensures that they are removed. - * This should be done automatically in the "remove" function. This here is a cleanup job. - */ -class CheckdeletedContacts -{ - public static function execute() - { - $contacts = DBA::select('contact', ['id'], ['deleted' => true]); - while ($contact = DBA::fetch($contacts)) { - Worker::add(PRIORITY_MEDIUM, 'RemoveContact', $contact['id']); - } - DBA::close($contacts); - } -} diff --git a/src/Worker/CleanWorkerqueue.php b/src/Worker/CleanWorkerqueue.php new file mode 100644 index 0000000000..00559f7508 --- /dev/null +++ b/src/Worker/CleanWorkerqueue.php @@ -0,0 +1,50 @@ +. + * + */ + +namespace Friendica\Worker; + +use Friendica\Core\Worker; +use Friendica\Database\DBA; +use Friendica\DI; + +/** + * Delete all done workerqueue entries + */ +class CleanWorkerQueue +{ + public static function execute() + { + DBA::delete('workerqueue', ['`done` AND `executed` < UTC_TIMESTAMP() - INTERVAL 1 HOUR']); + + // Optimizing this table only last seconds + if (DI::config()->get('system', 'optimize_tables')) { + // We are acquiring the two locks from the worker to avoid locking problems + if (DI::lock()->acquire(Worker::LOCK_PROCESS, 10)) { + if (DI::lock()->acquire(Worker::LOCK_WORKER, 10)) { + DBA::e("OPTIMIZE TABLE `workerqueue`"); + DBA::e("OPTIMIZE TABLE `process`"); + DI::lock()->release(Worker::LOCK_WORKER); + } + DI::lock()->release(Worker::LOCK_PROCESS); + } + } + } +} diff --git a/src/Worker/ClearWorkerqueue.php b/src/Worker/ClearWorkerqueue.php deleted file mode 100644 index c46eba62f8..0000000000 --- a/src/Worker/ClearWorkerqueue.php +++ /dev/null @@ -1,50 +0,0 @@ -. - * - */ - -namespace Friendica\Worker; - -use Friendica\Core\Worker; -use Friendica\Database\DBA; -use Friendica\DI; - -/** - * Delete all done workerqueue entries - */ -class ClearWorkerqueue -{ - public static function execute() - { - DBA::delete('workerqueue', ['`done` AND `executed` < UTC_TIMESTAMP() - INTERVAL 1 HOUR']); - - // Optimizing this table only last seconds - if (DI::config()->get('system', 'optimize_tables')) { - // We are acquiring the two locks from the worker to avoid locking problems - if (DI::lock()->acquire(Worker::LOCK_PROCESS, 10)) { - if (DI::lock()->acquire(Worker::LOCK_WORKER, 10)) { - DBA::e("OPTIMIZE TABLE `workerqueue`"); - DBA::e("OPTIMIZE TABLE `process`"); - DI::lock()->release(Worker::LOCK_WORKER); - } - DI::lock()->release(Worker::LOCK_PROCESS); - } - } - } -} diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index 2a2e5e57a9..7a23a2c705 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -83,7 +83,7 @@ class Cron } // Delete all done workerqueue entries - Worker::add(PRIORITY_LOW, 'ClearWorkerqueue'); + Worker::add(PRIORITY_LOW, 'CleanWorkerQueue'); // Clear cache entries Worker::add(PRIORITY_LOW, 'ClearCache'); @@ -114,7 +114,7 @@ class Cron // check upstream version? Worker::add(PRIORITY_LOW, 'CheckVersion'); - Worker::add(PRIORITY_LOW, 'CheckdeletedContacts'); + Worker::add(PRIORITY_LOW, 'CheckDeletedContacts'); if (DI::config()->get('system', 'optimize_tables')) { Worker::add(PRIORITY_LOW, 'OptimizeTables');