summaryrefslogtreecommitdiffstats
path: root/lib/base.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/base.php')
-rw-r--r--lib/base.php51
1 files changed, 19 insertions, 32 deletions
diff --git a/lib/base.php b/lib/base.php
index e55cc4b3f93..6e66005b28f 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -236,7 +236,7 @@ class OC {
// Check if config is writable
$configFileWritable = is_writable($configFilePath);
if (!$configFileWritable && !OC_Helper::isReadOnlyConfigEnabled()
- || !$configFileWritable && self::checkUpgrade(false)) {
+ || !$configFileWritable && \OCP\Util::needUpgrade()) {
$urlGenerator = \OC::$server->getURLGenerator();
@@ -290,37 +290,15 @@ class OC {
}
/**
- * Checks if the version requires an update and shows
- * @param bool $showTemplate Whether an update screen should get shown
- * @return bool|void
- */
- public static function checkUpgrade($showTemplate = true) {
- if (\OCP\Util::needUpgrade()) {
- if (function_exists('opcache_reset')) {
- opcache_reset();
- }
- $systemConfig = \OC::$server->getSystemConfig();
- if ($showTemplate && !$systemConfig->getValue('maintenance', false)) {
- self::printUpgradePage();
- exit();
- } else {
- return true;
- }
- }
- return false;
- }
-
- /**
* Prints the upgrade page
+ *
+ * @param \OC\SystemConfig $systemConfig
*/
- private static function printUpgradePage() {
- $systemConfig = \OC::$server->getSystemConfig();
-
+ private static function printUpgradePage(\OC\SystemConfig $systemConfig) {
$disableWebUpdater = $systemConfig->getValue('upgrade.disable-web', false);
$tooBig = false;
if (!$disableWebUpdater) {
$apps = \OC::$server->getAppManager();
- $tooBig = false;
if ($apps->isInstalled('user_ldap')) {
$qb = \OC::$server->getDatabaseConnection()->getQueryBuilder();
@@ -724,7 +702,7 @@ class OC {
);
//setup extra user backends
- if (!self::checkUpgrade(false)) {
+ if (!\OCP\Util::needUpgrade()) {
OC_User::setupBackends();
} else {
// Run upgrades in incognito mode
@@ -807,7 +785,7 @@ class OC {
*/
public static function registerCleanupHooks() {
//don't try to do this before we are properly setup
- if (\OC::$server->getSystemConfig()->getValue('installed', false) && !self::checkUpgrade(false)) {
+ if (\OC::$server->getSystemConfig()->getValue('installed', false) && !\OCP\Util::needUpgrade()) {
// NOTE: This will be replaced to use OCP
$userSession = self::$server->getUserSession();
@@ -929,7 +907,7 @@ class OC {
if (!$systemConfig->getValue('installed', false)) {
\OC::$server->getSession()->clear();
$setupHelper = new OC\Setup(
- \OC::$server->getSystemConfig(),
+ $systemConfig,
\OC::$server->getIniWrapper(),
\OC::$server->getL10N('lib'),
\OC::$server->query(\OCP\Defaults::class),
@@ -949,7 +927,16 @@ class OC {
}
if (substr($requestPath, -3) !== '.js') { // we need these files during the upgrade
self::checkMaintenanceMode();
- self::checkUpgrade();
+
+ if (\OCP\Util::needUpgrade()) {
+ if (function_exists('opcache_reset')) {
+ opcache_reset();
+ }
+ if (!$systemConfig->getValue('maintenance', false)) {
+ self::printUpgradePage($systemConfig);
+ exit();
+ }
+ }
}
// emergency app disabling
@@ -972,7 +959,7 @@ class OC {
OC_App::loadApps(['authentication']);
// Load minimum set of apps
- if (!self::checkUpgrade(false)
+ if (!\OCP\Util::needUpgrade()
&& !$systemConfig->getValue('maintenance', false)) {
// For logged-in users: Load everything
if(\OC::$server->getUserSession()->isLoggedIn()) {
@@ -986,7 +973,7 @@ class OC {
if (!self::$CLI) {
try {
- if (!$systemConfig->getValue('maintenance', false) && !self::checkUpgrade(false)) {
+ if (!$systemConfig->getValue('maintenance', false) && !\OCP\Util::needUpgrade()) {
OC_App::loadApps(array('filesystem', 'logging'));
OC_App::loadApps();
}