From e2139d4b56e6daf1f45c72c1dc0c4ace48d7e9c5 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 23 Oct 2017 21:26:24 +0200 Subject: Add logrote as a default background job Signed-off-by: Roeland Jago Douma --- lib/private/Repair.php | 2 ++ lib/private/Repair/NC13/AddLogRotateJob.php | 47 +++++++++++++++++++++++++++++ lib/private/Setup.php | 5 ++- 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 lib/private/Repair/NC13/AddLogRotateJob.php (limited to 'lib/private') diff --git a/lib/private/Repair.php b/lib/private/Repair.php index 80cd3c7fd45..ac824095d53 100644 --- a/lib/private/Repair.php +++ b/lib/private/Repair.php @@ -41,6 +41,7 @@ use OC\Repair\NC11\MoveAvatars; use OC\Repair\NC12\InstallCoreBundle; use OC\Repair\NC12\UpdateLanguageCodes; use OC\Repair\NC12\RepairIdentityProofKeyFolders; +use OC\Repair\NC13\AddLogRotateJob; use OC\Repair\OldGroupMembershipShares; use OC\Repair\Owncloud\DropAccountTermsTable; use OC\Repair\Owncloud\SaveAccountsTableData; @@ -150,6 +151,7 @@ class Repair implements IOutput{ ), new RepairInvalidPaths(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()), new RepairIdentityProofKeyFolders(\OC::$server->getConfig(), \OC::$server->query(Factory::class), \OC::$server->getRootFolder()), + new AddLogRotateJob(\OC::$server->getJobList()), ]; } diff --git a/lib/private/Repair/NC13/AddLogRotateJob.php b/lib/private/Repair/NC13/AddLogRotateJob.php new file mode 100644 index 00000000000..c65ea47f02b --- /dev/null +++ b/lib/private/Repair/NC13/AddLogRotateJob.php @@ -0,0 +1,47 @@ + + * + * @author Roeland Jago Douma + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ +namespace OC\Repair\NC13; + +use OC\Log\Rotate; +use OCP\BackgroundJob\IJobList; +use OCP\Migration\IOutput; +use OCP\Migration\IRepairStep; + +class AddLogRotateJob implements IRepairStep { + + /** @var IJobList */ + private $jobList; + + public function __construct(IJobList $jobList) { + $this->jobList = $jobList; + } + + public function getName() { + return 'Add log rotate job'; + } + + public function run(IOutput $output) { + $this->jobList->add(Rotate::class); + } + +} diff --git a/lib/private/Setup.php b/lib/private/Setup.php index 5228d52b05f..4e1e4ece62d 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -44,6 +44,7 @@ use Exception; use OC\App\AppStore\Bundles\BundleFetcher; use OC\Authentication\Token\DefaultTokenCleanupJob; use OC\Authentication\Token\DefaultTokenProvider; +use OC\Log\Rotate; use OCP\Defaults; use OCP\IL10N; use OCP\ILogger; @@ -426,7 +427,9 @@ class Setup { } public static function installBackgroundJobs() { - \OC::$server->getJobList()->add(DefaultTokenCleanupJob::class); + $jobList = \OC::$server->getJobList(); + $jobList->add(DefaultTokenCleanupJob::class); + $jobList->add(Rotate::class); } /** -- cgit v1.2.3