Remove system dependency on cms module

Refit #2970
This commit is contained in:
Samuel Georges 2017-07-15 10:14:15 +10:00
parent c2d99e6d92
commit e1629a9413
1 changed files with 11 additions and 15 deletions

View File

@ -85,11 +85,6 @@ class UpdateManager
*/
protected $productCache;
/**
* @var boolean Checks if the Cms module is loaded (true) or not (false).
*/
protected $cmsLoaded;
/**
* @var Illuminate\Database\Migrations\Migrator
*/
@ -105,10 +100,8 @@ class UpdateManager
*/
protected function init()
{
$this->cmsLoaded = in_array('Cms', Config::get('cms.loadModules', []));
$this->pluginManager = PluginManager::instance();
$this->themeManager = $this->cmsLoaded ? ThemeManager::instance() : null;
$this->themeManager = class_exists(ThemeManager::class) ? ThemeManager::instance() : null;
$this->versionManager = VersionManager::instance();
$this->tempDirectory = temp_path();
$this->baseDirectory = base_path();
@ -281,13 +274,15 @@ class UpdateManager
/*
* Strip out themes that have been installed before
*/
$themes = [];
foreach (array_get($result, 'themes', []) as $code => $info) {
if ($this->cmsLoaded && !$this->themeManager->isInstalled($code)) {
$themes[$code] = $info;
if ($this->themeManager) {
$themes = [];
foreach (array_get($result, 'themes', []) as $code => $info) {
if (!$this->themeManager->isInstalled($code)) {
$themes[$code] = $info;
}
}
$result['themes'] = $themes;
}
$result['themes'] = $themes;
/*
* If there is a core update and core updates are disabled,
@ -612,9 +607,10 @@ class UpdateManager
throw new ApplicationException(Lang::get('system::lang.zip.extract_failed', ['file' => $filePath]));
}
if ($this->cmsLoaded) {
$this->themeManager->setInstalled($name);
if ($this->themeManager) {
$this->themeManager->setInstalled($name);
}
@unlink($filePath);
}