Fail hard if shipped.json is missing

This commit is contained in:
Thomas Müller 2015-10-26 09:52:47 +01:00
parent 5a5bcccd0d
commit 2038b2ec34
1 changed files with 5 additions and 9 deletions

View File

@ -297,16 +297,12 @@ class AppManager implements IAppManager {
private function loadShippedJson() {
if (is_null($this->shippedApps)) {
$shippedJson = \OC::$SERVERROOT . '/core/shipped.json';
if (file_exists($shippedJson)) {
$content = json_decode(file_get_contents($shippedJson), true);
$this->shippedApps = $content['shippedApps'];
$this->alwaysEnabled = $content['alwaysEnabled'];
} else {
$this->shippedApps = ['files', 'encryption', 'files_external',
'files_sharing', 'files_trashbin', 'files_versions', 'provisioning_api',
'user_ldap', 'user_webdavauth'];
$this->alwaysEnabled = ['files', 'dav'];
if (!file_exists($shippedJson)) {
throw new \Exception("File not found: $shippedJson");
}
$content = json_decode(file_get_contents($shippedJson), true);
$this->shippedApps = $content['shippedApps'];
$this->alwaysEnabled = $content['alwaysEnabled'];
}
}