summaryrefslogtreecommitdiffstats
path: root/lib/private/app.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-07-24 17:16:34 +0200
committerRobin Appelman <icewind@owncloud.com>2014-08-04 13:41:04 +0200
commit4608f8a3b5f3f88ce033817f682103c31f8a934f (patch)
tree65c8df3bb84a35a43f553e7ae2bf0a4cdb7882a0 /lib/private/app.php
parent43d790239d44e1af6109f244920c3f8ca6513022 (diff)
downloadnextcloud-server-4608f8a3b5f3f88ce033817f682103c31f8a934f.tar.gz
nextcloud-server-4608f8a3b5f3f88ce033817f682103c31f8a934f.zip
Throw an exception when we try to load an app that needs to be upgraded
Diffstat (limited to 'lib/private/app.php')
-rw-r--r--lib/private/app.php38
1 files changed, 4 insertions, 34 deletions
diff --git a/lib/private/app.php b/lib/private/app.php
index 7bf04f11267..603bc0104e0 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -81,10 +81,13 @@ class OC_App {
* load a single app
*
* @param string $app
+ * @throws \OC\NeedsUpdateException
*/
public static function loadApp($app) {
if (is_file(self::getAppPath($app) . '/appinfo/app.php')) {
- self::checkUpgrade($app);
+ if (self::shouldUpgrade($app)) {
+ throw new \OC\NeedsUpdateException();
+ }
require_once $app . '/appinfo/app.php';
}
}
@@ -955,39 +958,6 @@ class OC_App {
}
/**
- * check if the app needs updating and update when needed
- *
- * @param string $app
- */
- public static function checkUpgrade($app) {
- if (in_array($app, self::$checkedApps)) {
- return;
- }
- self::$checkedApps[] = $app;
- if (!self::shouldUpgrade($app)) {
- return;
- }
- $versions = self::getAppVersions();
- $installedVersion = $versions[$app];
- $currentVersion = OC_App::getAppVersion($app);
- OC_Log::write(
- $app,
- 'starting app upgrade from ' . $installedVersion . ' to ' . $currentVersion,
- OC_Log::DEBUG
- );
- $info = self::getAppInfo($app);
- try {
- OC_App::updateApp($app);
- OC_Hook::emit('update', 'success', 'Updated ' . $info['name'] . ' app');
- } catch (Exception $e) {
- OC_Hook::emit('update', 'failure', 'Failed to update ' . $info['name'] . ' app: ' . $e->getMessage());
- $l = OC_L10N::get('lib');
- throw new RuntimeException($l->t('Failed to upgrade "%s".', array($app)), 0, $e);
- }
- OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app));
- }
-
- /**
* check if the current enabled apps are compatible with the current
* ownCloud version. disable them if not.
* This is important if you upgrade ownCloud and have non ported 3rd