Commit 0adcb991 authored by Morris Jobke's avatar Morris Jobke
Browse files

Merge pull request #14862 from owncloud/introduce-shipped.json-master

shipped apps are now defined in core/shipped.json - the shipped tag in i...
parents c93e4c80 33cd60ab
{
"core-version": "8.1.0.0",
"shippedApps": [
"activity",
"admin_audit",
"enterprise_key",
"external",
"files",
"files_antivirus",
"files_encryption",
"files_external",
"files_ldap_home",
"files_locking",
"files_pdfviewer",
"files_sharing",
"files_sharing_log",
"files_texteditor",
"files_trashbin",
"files_versions",
"files_videoviewer",
"firewall",
"firstrunwizard",
"gallery",
"objectstore",
"provisioning_api",
"sharepoint",
"templateeditor",
"updater",
"user_external",
"user_ldap",
"user_shibboleth",
"user_webdavauth",
"windows_network_drive"
]
}
......@@ -42,6 +42,7 @@ class OC_App {
static private $appTypes = array();
static private $loadedApps = array();
static private $altLogin = array();
private static $shippedApps = null;
/**
* clean the appId
......@@ -182,12 +183,18 @@ class OC_App {
* Check if an app that is installed is a shipped app or installed from the appstore.
*/
public static function isShipped($appId) {
$info = self::getAppInfo($appId);
if (isset($info['shipped']) && $info['shipped'] == 'true') {
return true;
} else {
return false;
if (is_null(self::$shippedApps)) {
$shippedJson = \OC::$SERVERROOT . '/core/shipped.json';
if (file_exists($shippedJson)) {
self::$shippedApps = json_decode(file_get_contents($shippedJson), true);
self::$shippedApps = self::$shippedApps['shippedApps'];
} else {
self::$shippedApps = ['files', 'files_encryption', 'files_external',
'files_sharing', 'files_trashbin', 'files_versions', 'provisioning_api',
'user_ldap', 'user_webdavauth'];
}
}
return in_array($appId, self::$shippedApps);
}
/**
......
......@@ -10,6 +10,7 @@ namespace OC;
use OC\Hooks\BasicEmitter;
use OC_App;
use OC_Installer;
use OC_Util;
use OCP\IConfig;
use OC\Setup;
......@@ -233,9 +234,14 @@ class Updater extends BasicEmitter {
if ($this->updateStepEnabled) {
$this->doCoreUpgrade();
$this->checkAppsRequirements();
// update all shipped apps
$disabledApps = $this->checkAppsRequirements();
$this->doAppUpgrade();
// upgrade appstore apps
$this->upgradeAppStoreApps($disabledApps);
// post-upgrade repairs
$repair = new Repair(Repair::getRepairSteps());
$this->emitRepairMessages($repair);
......@@ -356,6 +362,7 @@ class Updater extends BasicEmitter {
$isCoreUpgrade = $this->isCodeUpgrade();
$apps = OC_App::getEnabledApps();
$version = OC_Util::getVersion();
$disabledApps = [];
foreach ($apps as $app) {
// check if the app is compatible with this version of ownCloud
$info = OC_App::getAppInfo($app);
......@@ -378,8 +385,10 @@ class Updater extends BasicEmitter {
// disable any other 3rd party apps
\OC_App::disable($app);
$disabledApps[]= $app;
$this->emit('\OC\Updater', 'thirdPartyAppDisabled', array($app));
}
return $disabledApps;
}
private function isCodeUpgrade() {
......@@ -390,5 +399,16 @@ class Updater extends BasicEmitter {
}
return false;
}
private function upgradeAppStoreApps($disabledApps) {
foreach($disabledApps as $app) {
if (OC_Installer::isUpdateAvailable($app)) {
$ocsId = \OC::$server->getConfig()->getAppValue($app, 'ocsid', '');
$this->emit('\OC\Updater', 'upgradeAppStoreApp', array($app));
OC_Installer::updateAppByOCSId($ocsId);
}
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment