FIX: fix content dependency on categories

This commit is contained in:
Michal Kváček
2017-08-24 02:50:30 +02:00
parent ac8e3aeacc
commit 5abd7d9151
36 changed files with 574 additions and 71 deletions
+10 -11
View File
@@ -15,13 +15,11 @@ class InstallModule extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'module:install {name} {parentModuleId?}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Custom installation of CMS module. Name given as directory name in /modules.';
@@ -31,7 +29,6 @@ class InstallModule extends Command
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
@@ -56,8 +53,9 @@ class InstallModule extends Command
// get config
$config = $this->loadConfig();
if (empty($config))
if (empty($config)) {
return;
}
// check if it is valid
$this->checkMandatoryFields($config);
@@ -69,14 +67,15 @@ class InstallModule extends Command
Cache::forget('enabled-modules');
Cache::forget('module-handler-to-id-enumeration');
exec('composer dump-autoload');
// inform user
$this->line('Module ' . $name . ' successfuly installed');
$this->line('Module ' . $name . ' successfuly installed.');
}
/**
* Load config from Config/config.php in module files. We cannot use config() because the file have not published
* yet.
*
* @return array
* @throws FileNotFoundException
*/
@@ -85,8 +84,9 @@ class InstallModule extends Command
$basePath = $this->modulesPath . DIRECTORY_SEPARATOR . $this->moduleName . DIRECTORY_SEPARATOR;
$path = $basePath . 'Config' . DIRECTORY_SEPARATOR . 'config.php';
if (basename($basePath) == 'Database')
if (basename($basePath) == 'Database') {
return [];
}
// check if module has Config/config.php file
if (!file_exists($path)) {
@@ -121,7 +121,6 @@ class InstallModule extends Command
/**
* Installs module into database.
*
* This method calls Module::install, which handles specific installation of module. In this way we should be able
* to install any module even with some other database structures.
*
@@ -155,9 +154,9 @@ class InstallModule extends Command
if (is_null($module)) {
// insert module into database
$settings = [
'providers' => $providers,
'order' => isset($config['order']) ? $config['order'] : 0,
'files' => isset($config['files']) ? $config['files'] : []
'providers' => $providers,
'order' => isset($config['order']) ? $config['order'] : 0,
'files' => isset($config['files']) ? $config['files'] : []
];
$module = Installer::install($name, $alias, $this->moduleName, $description, $handler, $this->parentModuleId, $settings);
+1 -1
View File
@@ -59,7 +59,7 @@ class SetTemplate extends Command
}
try {
Installer::install($config['name'], $config['alias'], $current->static_name, $config['description'], $config['handler'], false, $config);
Installer::install($config['name'], $config['alias'], $config['staticName'], $config['description'], $config['handler'], false, $config);
} catch (\Exception $e) {
$this->error('Cannot install template ' . $template . '. Message: ' . $e->getMessage());
return;