diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-02-06 12:05:20 +0100 |
---|---|---|
committer | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2024-02-08 10:28:29 +0100 |
commit | e78e27187a11d395d12d55bf01f62f95abe48f55 (patch) | |
tree | baeaeebfd175b6aa920d0fdce64e665247bb11ed /lib | |
parent | 65981f99bfaa4f05469b32eaf0faa21e3b01d812 (diff) | |
download | nextcloud-server-e78e27187a11d395d12d55bf01f62f95abe48f55.tar.gz nextcloud-server-e78e27187a11d395d12d55bf01f62f95abe48f55.zip |
chore: Delete deprecated internal Job classes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/composer/composer/autoload_classmap.php | 3 | ||||
-rw-r--r-- | lib/composer/composer/autoload_static.php | 3 | ||||
-rw-r--r-- | lib/private/BackgroundJob/Job.php | 98 | ||||
-rw-r--r-- | lib/private/BackgroundJob/QueuedJob.php | 49 | ||||
-rw-r--r-- | lib/private/BackgroundJob/TimedJob.php | 63 |
5 files changed, 0 insertions, 216 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index 2fffd0c2f2d..90ab0c8e207 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -955,10 +955,7 @@ return array( 'OC\\Avatar\\GuestAvatar' => $baseDir . '/lib/private/Avatar/GuestAvatar.php', 'OC\\Avatar\\PlaceholderAvatar' => $baseDir . '/lib/private/Avatar/PlaceholderAvatar.php', 'OC\\Avatar\\UserAvatar' => $baseDir . '/lib/private/Avatar/UserAvatar.php', - 'OC\\BackgroundJob\\Job' => $baseDir . '/lib/private/BackgroundJob/Job.php', 'OC\\BackgroundJob\\JobList' => $baseDir . '/lib/private/BackgroundJob/JobList.php', - 'OC\\BackgroundJob\\QueuedJob' => $baseDir . '/lib/private/BackgroundJob/QueuedJob.php', - 'OC\\BackgroundJob\\TimedJob' => $baseDir . '/lib/private/BackgroundJob/TimedJob.php', 'OC\\BinaryFinder' => $baseDir . '/lib/private/BinaryFinder.php', 'OC\\Blurhash\\Listener\\GenerateBlurhashMetadata' => $baseDir . '/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php', 'OC\\Broadcast\\Events\\BroadcastEvent' => $baseDir . '/lib/private/Broadcast/Events/BroadcastEvent.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index d38db8050cc..983a1081621 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -988,10 +988,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2 'OC\\Avatar\\GuestAvatar' => __DIR__ . '/../../..' . '/lib/private/Avatar/GuestAvatar.php', 'OC\\Avatar\\PlaceholderAvatar' => __DIR__ . '/../../..' . '/lib/private/Avatar/PlaceholderAvatar.php', 'OC\\Avatar\\UserAvatar' => __DIR__ . '/../../..' . '/lib/private/Avatar/UserAvatar.php', - 'OC\\BackgroundJob\\Job' => __DIR__ . '/../../..' . '/lib/private/BackgroundJob/Job.php', 'OC\\BackgroundJob\\JobList' => __DIR__ . '/../../..' . '/lib/private/BackgroundJob/JobList.php', - 'OC\\BackgroundJob\\QueuedJob' => __DIR__ . '/../../..' . '/lib/private/BackgroundJob/QueuedJob.php', - 'OC\\BackgroundJob\\TimedJob' => __DIR__ . '/../../..' . '/lib/private/BackgroundJob/TimedJob.php', 'OC\\BinaryFinder' => __DIR__ . '/../../..' . '/lib/private/BinaryFinder.php', 'OC\\Blurhash\\Listener\\GenerateBlurhashMetadata' => __DIR__ . '/../../..' . '/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php', 'OC\\Broadcast\\Events\\BroadcastEvent' => __DIR__ . '/../../..' . '/lib/private/Broadcast/Events/BroadcastEvent.php', diff --git a/lib/private/BackgroundJob/Job.php b/lib/private/BackgroundJob/Job.php deleted file mode 100644 index ffcaaf8c36d..00000000000 --- a/lib/private/BackgroundJob/Job.php +++ /dev/null @@ -1,98 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Daniel Kesselberg <mail@danielkesselberg.de> - * @author Morris Jobke <hey@morrisjobke.de> - * @author Noveen Sachdeva <noveen.sachdeva@research.iiit.ac.in> - * @author Robin Appelman <robin@icewind.nl> - * @author Thomas Müller <thomas.mueller@tmit.eu> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ -namespace OC\BackgroundJob; - -use OCP\BackgroundJob\IJob; -use OCP\BackgroundJob\IJobList; -use OCP\ILogger; - -/** - * @deprecated internal class, use \OCP\BackgroundJob\Job - */ -abstract class Job implements IJob { - /** @var int */ - protected $id; - - /** @var int */ - protected $lastRun; - - /** @var mixed */ - protected $argument; - - public function execute(IJobList $jobList, ILogger $logger = null) { - $jobList->setLastRun($this); - if ($logger === null) { - $logger = \OC::$server->getLogger(); - } - - try { - $jobStartTime = time(); - $logger->debug('Run ' . get_class($this) . ' job with ID ' . $this->getId(), ['app' => 'cron']); - $this->run($this->argument); - $timeTaken = time() - $jobStartTime; - - $logger->debug('Finished ' . get_class($this) . ' job with ID ' . $this->getId() . ' in ' . $timeTaken . ' seconds', ['app' => 'cron']); - $jobList->setExecutionTime($this, $timeTaken); - } catch (\Throwable $e) { - if ($logger) { - $logger->logException($e, [ - 'app' => 'core', - 'message' => 'Error while running background job (class: ' . get_class($this) . ', arguments: ' . print_r($this->argument, true) . ')' - ]); - } - } - } - - public function start(IJobList $jobList): void { - $this->execute($jobList); - } - - abstract protected function run($argument); - - public function setId(int $id) { - $this->id = $id; - } - - public function setLastRun(int $lastRun) { - $this->lastRun = $lastRun; - } - - public function setArgument($argument) { - $this->argument = $argument; - } - - public function getId() { - return $this->id; - } - - public function getLastRun() { - return $this->lastRun; - } - - public function getArgument() { - return $this->argument; - } -} diff --git a/lib/private/BackgroundJob/QueuedJob.php b/lib/private/BackgroundJob/QueuedJob.php deleted file mode 100644 index 28d86481e62..00000000000 --- a/lib/private/BackgroundJob/QueuedJob.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author Lukas Reschke <lukas@statuscode.ch> - * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin Appelman <robin@icewind.nl> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ -namespace OC\BackgroundJob; - -use OCP\ILogger; - -/** - * Class QueuedJob - * - * create a background job that is to be executed once - * - * @package OC\BackgroundJob - * - * @deprecated internal class, use \OCP\BackgroundJob\QueuedJob - */ -abstract class QueuedJob extends Job { - /** - * run the job, then remove it from the joblist - * - * @param JobList $jobList - * @param ILogger|null $logger - */ - public function execute($jobList, ILogger $logger = null) { - $jobList->remove($this, $this->argument); - parent::execute($jobList, $logger); - } -} diff --git a/lib/private/BackgroundJob/TimedJob.php b/lib/private/BackgroundJob/TimedJob.php deleted file mode 100644 index 0f0951e1aec..00000000000 --- a/lib/private/BackgroundJob/TimedJob.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author Daniel Kesselberg <mail@danielkesselberg.de> - * @author Lukas Reschke <lukas@statuscode.ch> - * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin Appelman <robin@icewind.nl> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ -namespace OC\BackgroundJob; - -use OCP\BackgroundJob\IJobList; -use OCP\ILogger; - -/** - * Class QueuedJob - * - * create a background job that is to be executed at an interval - * - * @package OC\BackgroundJob - * - * @deprecated internal class, use \OCP\BackgroundJob\TimedJob - */ -abstract class TimedJob extends Job { - protected $interval = 0; - - /** - * set the interval for the job - * - * @param int $interval - */ - public function setInterval($interval) { - $this->interval = $interval; - } - - /** - * run the job if - * - * @param IJobList $jobList - * @param ILogger|null $logger - */ - public function execute($jobList, ILogger $logger = null) { - if ((time() - $this->lastRun) > $this->interval) { - parent::execute($jobList, $logger); - } - } -} |