|
|
|
@ -176,7 +176,8 @@ class OC { |
|
|
|
|
|
|
|
|
|
public static function checkConfig() { |
|
|
|
|
if (file_exists(OC::$SERVERROOT . "/config/config.php") |
|
|
|
|
and !is_writable(OC::$SERVERROOT . "/config/config.php")) { |
|
|
|
|
and !is_writable(OC::$SERVERROOT . "/config/config.php") |
|
|
|
|
) { |
|
|
|
|
$defaults = new OC_Defaults(); |
|
|
|
|
if (self::$CLI) { |
|
|
|
|
echo "Can't write into config directory!\n"; |
|
|
|
@ -254,11 +255,23 @@ class OC { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static function checkUpgrade($showTemplate = true) { |
|
|
|
|
/** |
|
|
|
|
* check if the instance needs to preform an upgrade |
|
|
|
|
* |
|
|
|
|
* @return bool |
|
|
|
|
*/ |
|
|
|
|
public static function needUpgrade() { |
|
|
|
|
if (OC_Config::getValue('installed', false)) { |
|
|
|
|
$installedVersion = OC_Config::getValue('version', '0.0.0'); |
|
|
|
|
$currentVersion = implode('.', OC_Util::getVersion()); |
|
|
|
|
if (version_compare($currentVersion, $installedVersion, '>')) { |
|
|
|
|
return version_compare($currentVersion, $installedVersion, '>'); |
|
|
|
|
} else { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static function checkUpgrade($showTemplate = true) { |
|
|
|
|
if (self::needUpgrade()) { |
|
|
|
|
if ($showTemplate && !OC_Config::getValue('maintenance', false)) { |
|
|
|
|
OC_Config::setValue('theme', ''); |
|
|
|
|
$minimizerCSS = new OC_Minimizer_CSS(); |
|
|
|
@ -277,7 +290,6 @@ class OC { |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static function initTemplateEngine() { |
|
|
|
|
// Add the stuff we need always |
|
|
|
@ -602,13 +614,9 @@ class OC { |
|
|
|
|
* register hooks for the cache |
|
|
|
|
*/ |
|
|
|
|
public static function registerCacheHooks() { |
|
|
|
|
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 |
|
|
|
|
if (OC_Config::getValue('installed', false) && !self::needUpgrade()) { //don't try to do this before we are properly setup |
|
|
|
|
\OCP\BackgroundJob::registerJob('OC\Cache\FileGlobalGC'); |
|
|
|
|
} catch (Exception $e) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
// NOTE: This will be replaced to use OCP |
|
|
|
|
$userSession = \OC_User::getUserSession(); |
|
|
|
|
$userSession->listen('postLogin', '\OC\Cache\File', 'loginListener'); |
|
|
|
@ -619,14 +627,9 @@ class OC { |
|
|
|
|
* register hooks for the cache |
|
|
|
|
*/ |
|
|
|
|
public static function registerLogRotate() { |
|
|
|
|
if (OC_Config::getValue('installed', false) && OC_Config::getValue('log_rotate_size', false)) { |
|
|
|
|
if (OC_Config::getValue('installed', false) && OC_Config::getValue('log_rotate_size', false) && !self::needUpgrade()) { |
|
|
|
|
//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) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -794,12 +797,10 @@ class OC { |
|
|
|
|
// auth possible via apache module? |
|
|
|
|
if (OC::tryApacheAuth()) { |
|
|
|
|
$error[] = 'apacheauthfailed'; |
|
|
|
|
} |
|
|
|
|
// remember was checked after last login |
|
|
|
|
} // remember was checked after last login |
|
|
|
|
elseif (OC::tryRememberLogin()) { |
|
|
|
|
$error[] = 'invalidcookie'; |
|
|
|
|
} |
|
|
|
|
// logon via web form |
|
|
|
|
} // logon via web form |
|
|
|
|
elseif (OC::tryFormLogin()) { |
|
|
|
|
$error[] = 'invalidpassword'; |
|
|
|
|
if ( OC_Config::getValue('log_authfailip', false) ) { |
|
|
|
|