Whitespaces removed

This commit is contained in:
Michael 2022-05-02 14:36:21 +00:00
parent 76789acace
commit 6e394ac6ff

View file

@ -168,8 +168,8 @@ class Worker
/** /**
* Check and fix the priority of a worker task * Check and fix the priority of a worker task
* @param array $entry * @param array $entry
* @return array * @return array
*/ */
private static function checkPriority(array $entry) private static function checkPriority(array $entry)
{ {
@ -177,7 +177,7 @@ class Worker
if (!in_array($entry['priority'], PRIORITIES)) { if (!in_array($entry['priority'], PRIORITIES)) {
Logger::warning('Invalid priority', ['entry' => $entry, 'callstack' => System::callstack(20)]); Logger::warning('Invalid priority', ['entry' => $entry, 'callstack' => System::callstack(20)]);
DBA::update('workerqueue', ['priority' => PRIORITY_MEDIUM], ['id' => $entry['id']]); DBA::update('workerqueue', ['priority' => PRIORITY_MEDIUM], ['id' => $entry['id']]);
$entry['priority'] = PRIORITY_MEDIUM; $entry['priority'] = PRIORITY_MEDIUM;
} }
@ -300,41 +300,41 @@ class Worker
/** /**
* Checks if the given file is valid to be included * Checks if the given file is valid to be included
* *
* @param mixed $file * @param mixed $file
* @return bool * @return bool
*/ */
private static function validateInclude(&$file) private static function validateInclude(&$file)
{ {
$orig_file = $file; $orig_file = $file;
$file = realpath($file); $file = realpath($file);
if (strpos($file, getcwd()) !== 0) { if (strpos($file, getcwd()) !== 0) {
return false; return false;
} }
$file = str_replace(getcwd() . "/", "", $file, $count); $file = str_replace(getcwd() . "/", "", $file, $count);
if ($count != 1) { if ($count != 1) {
return false; return false;
} }
if ($orig_file !== $file) { if ($orig_file !== $file) {
return false; return false;
} }
$valid = false; $valid = false;
if (strpos($file, "include/") === 0) { if (strpos($file, "include/") === 0) {
$valid = true; $valid = true;
} }
if (strpos($file, "addon/") === 0) { if (strpos($file, "addon/") === 0) {
$valid = true; $valid = true;
} }
// Simply return flag // Simply return flag
return $valid; return $valid;
} }
/** /**
* Execute a worker entry * Execute a worker entry
* *
@ -1169,7 +1169,7 @@ class Worker
if (DI::lock()->acquire(Worker::LOCK_PROCESS, 10)) { if (DI::lock()->acquire(Worker::LOCK_PROCESS, 10)) {
if (DI::lock()->acquire(Worker::LOCK_WORKER, 10)) { if (DI::lock()->acquire(Worker::LOCK_WORKER, 10)) {
DBA::e("OPTIMIZE TABLE `workerqueue`"); DBA::e("OPTIMIZE TABLE `workerqueue`");
DBA::e("OPTIMIZE TABLE `process`"); DBA::e("OPTIMIZE TABLE `process`");
DI::lock()->release(Worker::LOCK_WORKER); DI::lock()->release(Worker::LOCK_WORKER);
} }
DI::lock()->release(Worker::LOCK_PROCESS); DI::lock()->release(Worker::LOCK_PROCESS);