summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-04-11 16:58:08 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2016-04-18 17:09:21 +0200
commit739dfb5c6638301799ee8dafd6b10460b493319d (patch)
tree1bb734784ec8ca83653068f21d59e0a27d0f6323 /lib
parentfd1740deb604894a8bef515d98c5992a392e6f0a (diff)
downloadnextcloud-server-739dfb5c6638301799ee8dafd6b10460b493319d.tar.gz
nextcloud-server-739dfb5c6638301799ee8dafd6b10460b493319d.zip
Suggest cli based updater in case the instance is bigger - #23913
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php46
1 files changed, 34 insertions, 12 deletions
diff --git a/lib/base.php b/lib/base.php
index 818e13fbef2..27967588360 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -337,27 +337,49 @@ class OC {
*/
private static function printUpgradePage() {
$systemConfig = \OC::$server->getSystemConfig();
+
+ $disableWebUpdater = $systemConfig->getValue('upgrade.disable-web', false);
+ $tooBig = false;
+ if (!$disableWebUpdater) {
+ // count users
+ $stats = \OC::$server->getUserManager()->countUsers();
+ $totalUsers = array_sum($stats);
+ $tooBig = ($totalUsers > 50);
+ }
+ if ($disableWebUpdater || $tooBig) {
+ // send http status 503
+ header('HTTP/1.1 503 Service Temporarily Unavailable');
+ header('Status: 503 Service Temporarily Unavailable');
+ header('Retry-After: 120');
+
+ // render error page
+ $template = new OC_Template('', 'update.use-cli', 'guest');
+ $template->assign('productName', 'ownCloud'); // for now
+ $template->assign('version', OC_Util::getVersionString());
+ $template->assign('tooBig', $tooBig);
+
+ $template->printPage();
+ die();
+ }
+
+ // check whether this is a core update or apps update
+ $installedVersion = $systemConfig->getValue('version', '0.0.0');
+ $currentVersion = implode('.', \OCP\Util::getVersion());
+
+ // if not a core upgrade, then it's apps upgrade
+ $isAppsOnlyUpgrade = (version_compare($currentVersion, $installedVersion, '='));
+
$oldTheme = $systemConfig->getValue('theme');
$systemConfig->setValue('theme', '');
\OCP\Util::addScript('config'); // needed for web root
\OCP\Util::addScript('update');
\OCP\Util::addStyle('update');
- // check whether this is a core update or apps update
- $installedVersion = $systemConfig->getValue('version', '0.0.0');
- $currentVersion = implode('.', \OCP\Util::getVersion());
-
$appManager = \OC::$server->getAppManager();
$tmpl = new OC_Template('', 'update.admin', 'guest');
$tmpl->assign('version', OC_Util::getVersionString());
-
- // if not a core upgrade, then it's apps upgrade
- if (version_compare($currentVersion, $installedVersion, '=')) {
- $tmpl->assign('isAppsOnlyUpgrade', true);
- } else {
- $tmpl->assign('isAppsOnlyUpgrade', false);
- }
+ $tmpl->assign('isAppsOnlyUpgrade', $isAppsOnlyUpgrade);
// get third party apps
$ocVersion = \OCP\Util::getVersion();
@@ -423,7 +445,7 @@ class OC {
}
public static function loadAppClassPaths() {
- foreach (OC_APP::getEnabledApps() as $app) {
+ foreach (OC_App::getEnabledApps() as $app) {
$appPath = OC_App::getAppPath($app);
if ($appPath === false) {
continue;