diff options
-rw-r--r-- | lib/base.php | 16 | ||||
-rw-r--r-- | lib/log/rotate.php | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/lib/base.php b/lib/base.php index 22aed1c5664..f45012bb83c 100644 --- a/lib/base.php +++ b/lib/base.php @@ -491,7 +491,7 @@ class OC { self::registerCacheHooks(); self::registerFilesystemHooks(); self::registerShareHooks(); - \OCP\BackgroundJob::registerJob('OC\Log\Rotate', OC_Config::getValue("datadirectory", OC::$SERVERROOT.'/data').'/owncloud.log'); + self::registerLogRotate(); //make sure temporary files are cleaned up register_shutdown_function(array('OC_Helper', 'cleanTmp')); @@ -554,6 +554,20 @@ class OC { } /** + * register hooks for the cache + */ + public static function registerLogRotate() { + if (OC_Config::getValue('installed', false)) { //don't try to do this before we are properly setup + // register cache cleanup jobs + try { //if this is executed before the upgrade to the new backgroundjob system is completed it will throw an exception + \OCP\BackgroundJob::registerJob('OC\Log\Rotate', OC_Config::getValue("datadirectory", OC::$SERVERROOT.'/data').'/owncloud.log'); + } catch (Exception $e) { + + } + } + } + + /** * register hooks for the filesystem */ public static function registerFilesystemHooks() { diff --git a/lib/log/rotate.php b/lib/log/rotate.php index 3b976d50dce..41ef2ea299c 100644 --- a/lib/log/rotate.php +++ b/lib/log/rotate.php @@ -16,7 +16,7 @@ namespace OC\Log; * location and manage that with your own tools. */ class Rotate extends \OC\BackgroundJob\Job { - const LOG_SIZE_LIMIT = 104857600; // 100 MB + const LOG_SIZE_LIMIT = 104857600; // 100 MiB public function run($logFile) { $filesize = @filesize($logFile); if ($filesize >= self::LOG_SIZE_LIMIT) { |