]> source.dussan.org Git - nextcloud-server.git/commitdiff
Check for installed state before registering the logrotate background job
authorBart Visscher <bartv@thisnet.nl>
Wed, 10 Jul 2013 16:07:43 +0000 (18:07 +0200)
committerBart Visscher <bartv@thisnet.nl>
Wed, 28 Aug 2013 15:11:43 +0000 (17:11 +0200)
lib/base.php
lib/log/rotate.php

index 22aed1c566455ec20a2ea05ba305b1f0a88bc2eb..f45012bb83c3f51f31bf0ba6510913b9624f2567 100644 (file)
@@ -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'));
@@ -553,6 +553,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
         */
index 3b976d50dceb66a3003f331fde2fa2a93881f170..41ef2ea299c71510b63c5ddf9a3279ed09ccdbde 100644 (file)
@@ -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) {