Add logrote as a default background job

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
pull/6918/head
Roeland Jago Douma 7 years ago
parent 1860190305
commit e2139d4b56
No known key found for this signature in database
GPG Key ID: F941078878347C0C

@ -730,7 +730,6 @@ class OC {
self::registerCacheHooks();
self::registerFilesystemHooks();
self::registerShareHooks();
self::registerLogRotate();
self::registerEncryptionWrapper();
self::registerEncryptionHooks();
self::registerAccountHooks();
@ -862,18 +861,6 @@ class OC {
\OCP\Util::connectHook('OC_User', 'changeUser', $hookHandler, 'changeUserHook');
}
/**
* 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
*/

@ -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()),
];
}

@ -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);
}
}

@ -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);
}
/**

Loading…
Cancel
Save