humhub / calendar

Create one-time or recurring events, invite and manage attendees, and keep track of all your events with the Calendar module.
28 stars 46 forks source link

CLI Error when no REST module is installed #243

Closed luke- closed 3 years ago

luke- commented 3 years ago
root@s22:/srv/www/htdocs/people# php yii.php settings/get
An Error occurred while handling another error:
Error: Class 'humhub\modules\rest\components\BaseContentController' not found in /srv/www/htdocs/people/modules/calendar/controllers/rest/CalendarController.php:21
Stack trace:
#0 /srv/humhub/protected/vendor/yiisoft/yii2/BaseYii.php(293): include()
#1 [internal function]: yii\BaseYii::autoload('humhub\\modules\\...')
#2 [internal function]: spl_autoload_call('humhub\\modules\\...')
#3 /srv/humhub/protected/vendor/yiisoft/yii2/console/controllers/HelpController.php(279): class_exists('humhub\\modules\\...')
#4 /srv/humhub/protected/vendor/yiisoft/yii2/console/controllers/HelpController.php(257): yii\console\controllers\HelpController->validateControllerClass('humhub\\modules\\...')
#5 /srv/humhub/protected/vendor/yiisoft/yii2/console/controllers/HelpController.php(240): yii\console\controllers\HelpController->getModuleCommands(Object(humhub\modules\calendar\Module))
#6 /srv/humhub/protected/vendor/yiisoft/yii2/console/controllers/HelpController.php(172): yii\console\controllers\HelpController->getModuleCommands(Object(humhub\components\console\Application))
#7 /srv/humhub/protected/vendor/yiisoft/yii2/console/UnknownCommandException.php(77): yii\console\controllers\HelpController->getCommands()
#8 /srv/humhub/protected/vendor/yiisoft/yii2/console/ErrorHandler.php(36): yii\console\UnknownCommandException->getSuggestedAlternatives()
#9 /srv/humhub/protected/vendor/yiisoft/yii2/base/ErrorHandler.php(135): yii\console\ErrorHandler->renderException(Object(yii\console\UnknownCommandException))
#10 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\console\UnknownCommandException))
#11 {main}
Previous exception:
yii\base\InvalidRouteException: Unable to resolve the request: settings/get in /srv/humhub/protected/vendor/yiisoft/yii2/base/Controller.php:152
Stack trace:
#0 /srv/humhub/protected/vendor/yiisoft/yii2/console/Controller.php(184): yii\base\Controller->runAction('get', Array)
#1 /srv/humhub/protected/vendor/yiisoft/yii2/base/Module.php(534): yii\console\Controller->runAction('get', Array)
#2 /srv/humhub/protected/vendor/yiisoft/yii2/console/Application.php(181): yii\base\Module->runAction('settings/get', Array)
#3 /srv/humhub/protected/vendor/yiisoft/yii2/console/Application.php(148): yii\console\Application->runAction('settings/get', Array)
#4 /srv/humhub/protected/vendor/yiisoft/yii2/base/Application.php(392): yii\console\Application->handleRequest(Object(yii\console\Request))
#5 /srv/www/htdocs/people/yii.php(38): yii\base\Application->run()
#6 {main}
luke- commented 3 years ago

@yurabakhtin Can you please take a look into this?

yurabakhtin commented 3 years ago

@luke- We solved similar issue here https://github.com/humhub/mail/issues/221. There we have a bug on call php yii. Now we have a bug on call php yii settings/get.

Yes, I could reproduce this, i.e. I see the error Class 'humhub\modules\rest\components\BaseContentController' not found but in additional I see also Next yii\console\UnknownCommandException: Unknown command "settings/get". And yes this command doesn't exist in develop and master branch. Do you use some other branch?

If I go to https://github.com/humhub/humhub/blob/master/protected/humhub/commands/SettingsController.php and add new method public function actionGet($moduleId, $name) { } then the command php yii settings/get works well without the errors. Do you think we should find a solution for unknown commands? Or tell me branch where the command settings/get is implemented, thanks.

luke- commented 3 years ago

@yurabakhtin The problem really only seems to affect console commands that cannot be resolved.

Nevertheless, the following output should be generated:

root@s20:/srv/www/htdocs/community# php yii.php  test
Unknown command: test

Did you mean one of these?
    - test/email
    - theme

Currently:


root@s20:/srv/www/htdocs/doku2# php yii.php test
An Error occurred while handling another error:
Error: Class 'humhub\modules\rest\components\BaseController' not found in /srv/www/htdocs/doku2/modules/wiki/controllers/rest/RevisionController.php:15
Stack trace:
#0 /srv/humhub/protected/vendor/yiisoft/yii2/BaseYii.php(293): include()
#1 [internal function]: yii\BaseYii::autoload('humhub\\modules\\...')
#2 [internal function]: spl_autoload_call('humhub\\modules\\...')
...

The problem occurs on the latest master.
yurabakhtin commented 3 years ago

@luke- I have fixed this for 4 modules, please see mentioned PRs above.

For me it looks like this:

unknown_command

I don't think we should fix the Exception 'yii\base\InvalidRouteException'.

luke- commented 3 years ago

@yurabakhtin Thanks for the fixes! Can you please add this workaround also here: https://github.com/humhub/rest/blob/master/docs/DEVELOPER.md#other-module-support

yurabakhtin commented 3 years ago

@luke- I found additional module where the REST API module is used - https://github.com/humhub/cfiles/pull/117, also I fixed all modules to use master branch instead of deleted develop of the REST module, see a change like this https://github.com/humhub/tasks/pull/157/commits/da03d0a3e7319620965954a9d4a00e798c9b7878#diff-acf3e0c6c881e3230ee20ea7499891845048d94362e17e496f06dafa7757f110R126, but I still cannot fix tests of the calendar module https://github.com/humhub/calendar/pull/244/checks?check_run_id=2673809948#step:26:50 and https://github.com/humhub/calendar/pull/244/checks?check_run_id=2673809981#step:26:44 because I cannot reproduce them. Do you have any idea?

luke- commented 3 years ago

@yurabakhtin It is probably due to the update here: https://github.com/humhub/humhub/commit/72ff0f4687acc9c1f847ab695dd67f3e1d894c2a

Sorry I forgot to inform you about it.

Can you adjust it?

yurabakhtin commented 3 years ago

@luke-

Can you please add this workaround also here: https://github.com/humhub/rest/blob/master/docs/DEVELOPER.md#other-module-support

Commit https://github.com/humhub/rest/commit/bc6834c23aff7b652c4dd0a06bc7f9ca36e7c576

yurabakhtin commented 3 years ago

@luke-

It is probably due to the update here: humhub/humhub@72ff0f4 Can you adjust it?

Thanks for the info, it helped to fix. PR https://github.com/humhub/calendar/pull/245