diff --git a/Module.php b/Module.php index 93a894a..349018e 100644 --- a/Module.php +++ b/Module.php @@ -13,18 +13,31 @@ class Module extends BaseModule */ public $resourcesPath = 'resources'; + // Define the namespace for web controllers public $controllerNamespace = 'humhub\modules\composer\controllers'; + // Define the namespace for console commands + public $commandNamespace = 'humhub\modules\composer\commands'; + public function init() { parent::init(); + if (Yii::$app instanceof \yii\console\Application) { + // Set controller namespace to default web controllers namespace for console application + $this->controllerNamespace = 'humhub\modules\composer\controllers'; + // Define console command mappings + $this->controllerMap = [ + 'theme' => 'humhub\modules\composer\commands\ThemeController', + 'refresh' => 'humhub\modules\composer\commands\RefreshAssetsController', + ]; + } } public function actions() { return [ - 'theme/compile' => 'composer\commands\ThemeController', - 'refresh-assets' => 'composer\commands\RefreshAssetsController', + 'theme/compile' => 'humhub\modules\composer\commands\ThemeController', + 'refresh-assets' => 'humhub\modules\composer\commands\RefreshAssetsController', ]; }