diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2017-10-24 21:38:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-24 21:38:40 +0300 |
commit | a82b56b1c7146ddb3085f3e03e18be4700d95a0e (patch) | |
tree | 0ca894c89b1617fb8b20c489a1104381eb22ee09 /lib | |
parent | b88db3a389c8211e58bcbc63674e336783ce81fe (diff) | |
parent | 80e4d48db919024ab1168c478cf2e0227caf2dfd (diff) |
Merge pull request #6918 from nextcloud/rotate_job_by_default
Add logrote as a default background job
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 13 | ||||
-rw-r--r-- | lib/composer/composer/autoload_classmap.php | 1 | ||||
-rw-r--r-- | lib/composer/composer/autoload_static.php | 1 | ||||
-rw-r--r-- | lib/private/Repair.php | 2 | ||||
-rw-r--r-- | lib/private/Repair/NC13/AddLogRotateJob.php | 47 | ||||
-rw-r--r-- | lib/private/Setup.php | 5 |
6 files changed, 55 insertions, 14 deletions
diff --git a/lib/base.php b/lib/base.php index c76d83cd220..b9862e73194 100644 --- a/lib/base.php +++ b/lib/base.php @@ -730,7 +730,6 @@ class OC { self::registerCacheHooks(); self::registerFilesystemHooks(); self::registerShareHooks(); - self::registerLogRotate(); self::registerEncryptionWrapper(); self::registerEncryptionHooks(); self::registerAccountHooks(); @@ -863,18 +862,6 @@ class OC { } /** - * register hooks for the cache - */ - public static function registerLogRotate() { - $systemConfig = \OC::$server->getSystemConfig(); - if ($systemConfig->getValue('installed', false) && $systemConfig->getValue('log_rotate_size', false) && !self::checkUpgrade(false)) { - //don't try to do this before we are properly setup - //use custom logfile path if defined, otherwise use default of nextcloud.log in data directory - \OC::$server->getJobList()->add('OC\Log\Rotate'); - } - } - - /** * register hooks for the filesystem */ public static function registerFilesystemHooks() { diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index 07f815f85ce..cea600bf59c 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -780,6 +780,7 @@ return array( 'OC\\Repair\\NC12\\InstallCoreBundle' => $baseDir . '/lib/private/Repair/NC12/InstallCoreBundle.php', 'OC\\Repair\\NC12\\RepairIdentityProofKeyFolders' => $baseDir . '/lib/private/Repair/NC12/RepairIdentityProofKeyFolders.php', 'OC\\Repair\\NC12\\UpdateLanguageCodes' => $baseDir . '/lib/private/Repair/NC12/UpdateLanguageCodes.php', + 'OC\\Repair\\NC13\\AddLogRotateJob' => $baseDir . '/lib/private/Repair/NC13/AddLogRotateJob.php', 'OC\\Repair\\NC13\\RepairInvalidPaths' => $baseDir . '/lib/private/Repair/NC13/RepairInvalidPaths.php', 'OC\\Repair\\OldGroupMembershipShares' => $baseDir . '/lib/private/Repair/OldGroupMembershipShares.php', 'OC\\Repair\\Owncloud\\DropAccountTermsTable' => $baseDir . '/lib/private/Repair/Owncloud/DropAccountTermsTable.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 0d327b7267f..f476777e667 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -810,6 +810,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\Repair\\NC12\\InstallCoreBundle' => __DIR__ . '/../../..' . '/lib/private/Repair/NC12/InstallCoreBundle.php', 'OC\\Repair\\NC12\\RepairIdentityProofKeyFolders' => __DIR__ . '/../../..' . '/lib/private/Repair/NC12/RepairIdentityProofKeyFolders.php', 'OC\\Repair\\NC12\\UpdateLanguageCodes' => __DIR__ . '/../../..' . '/lib/private/Repair/NC12/UpdateLanguageCodes.php', + 'OC\\Repair\\NC13\\AddLogRotateJob' => __DIR__ . '/../../..' . '/lib/private/Repair/NC13/AddLogRotateJob.php', 'OC\\Repair\\NC13\\RepairInvalidPaths' => __DIR__ . '/../../..' . '/lib/private/Repair/NC13/RepairInvalidPaths.php', 'OC\\Repair\\OldGroupMembershipShares' => __DIR__ . '/../../..' . '/lib/private/Repair/OldGroupMembershipShares.php', 'OC\\Repair\\Owncloud\\DropAccountTermsTable' => __DIR__ . '/../../..' . '/lib/private/Repair/Owncloud/DropAccountTermsTable.php', 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 @@ +<?php +/** + * @copyright 2017, Roeland Jago Douma <roeland@famdouma.nl> + * + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @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 <http://www.gnu.org/licenses/>. + * + */ +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); } /** |