|
|
@ -71,24 +71,32 @@ class ModuleController extends Controller |
|
|
|
mkdir($path); |
|
|
|
mkdir($path); |
|
|
|
// git clone |
|
|
|
// git clone |
|
|
|
chdir($path); |
|
|
|
chdir($path); |
|
|
|
|
|
|
|
echo ConsoleColor::log('Git clone: ', 'normal'); |
|
|
|
shell_exec('git clone https://gitlab.com/zertex/zxcms-' . $name . '.git .'); |
|
|
|
shell_exec('git clone https://gitlab.com/zertex/zxcms-' . $name . '.git .'); |
|
|
|
|
|
|
|
echo ConsoleColor::log('complete', 'white') . PHP_EOL; |
|
|
|
// get module manifest |
|
|
|
// get module manifest |
|
|
|
$manifest = require \Yii::getAlias('@common/modules/' . $name . '/manifest.php'); |
|
|
|
$manifest = require \Yii::getAlias('@common/modules/' . $name . '/manifest.php'); |
|
|
|
// migration |
|
|
|
// migration |
|
|
|
|
|
|
|
echo ConsoleColor::log('Database: ', 'normal'); |
|
|
|
if (file_exists($path . '/migrations')) { |
|
|
|
if (file_exists($path . '/migrations')) { |
|
|
|
shell_exec('php ' . __DIR__ . '/yii migrate --migrationPath=' . $path . '/migrations --interactive=0'); |
|
|
|
shell_exec('php ' . __DIR__ . '/yii migrate --migrationPath=' . $path . '/migrations --interactive=0'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
echo ConsoleColor::log('complete', 'white') . PHP_EOL; |
|
|
|
// add module record with active flag |
|
|
|
// add module record with active flag |
|
|
|
$db_module = ModuleRecord::find()->andWhere(['name' => $name])->one(); |
|
|
|
$db_module = ModuleRecord::find()->andWhere(['name' => $name])->one(); |
|
|
|
if (!$db_module) { |
|
|
|
if (!$db_module) { |
|
|
|
$this->_service->create($name, 'common\\modules\\' . $name . '\\' . $manifest['vjlule'], 'common', 1); |
|
|
|
$this->_service->create($name, 'common\\modules\\' . $name . '\\' . $manifest['vjlule'], 'common', 1); |
|
|
|
} |
|
|
|
} |
|
|
|
// init permissions |
|
|
|
// init permissions |
|
|
|
|
|
|
|
echo ConsoleColor::log('Database: ', 'normal'); |
|
|
|
if (isset($manifest['permissions']) && is_array($manifest['permissions'])) { |
|
|
|
if (isset($manifest['permissions']) && is_array($manifest['permissions'])) { |
|
|
|
$this->assignPermissions($manifest['permissions']); |
|
|
|
$this->assignPermissions($manifest['permissions']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
echo ConsoleColor::log('complete', 'white') . PHP_EOL; |
|
|
|
// regenerate cp global search |
|
|
|
// regenerate cp global search |
|
|
|
|
|
|
|
echo ConsoleColor::log('Search database: ', 'normal'); |
|
|
|
SearchPerformance::init(); |
|
|
|
SearchPerformance::init(); |
|
|
|
|
|
|
|
echo ConsoleColor::log('complete', 'white') . PHP_EOL; |
|
|
|
|
|
|
|
|
|
|
|
echo ConsoleColor::log('Module ' . $name . ' successfully installed', 'light_green') . PHP_EOL; |
|
|
|
echo ConsoleColor::log('Module ' . $name . ' successfully installed', 'light_green') . PHP_EOL; |
|
|
|
} |
|
|
|
} |
|
|
|