Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cron: [InvalidArgumentException] There are no commands defined in the "core" namespace. #7356

Closed
ulfw opened this issue Mar 4, 2015 · 15 comments
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@ulfw
Copy link

ulfw commented Mar 4, 2015

After updating to 2.11 and adjusting the cron (removed the force-all-websites parameter)
I get the mentioned error.

A direct call to console gives the following output:

Console Tool

Usage:
 [options] command [arguments]

Options:
 --help (-h)           Display this help message
 --quiet (-q)          Do not output any message
 --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 --version (-V)        Display this application version
 --ansi                Force ANSI output
 --no-ansi             Disable ANSI output
 --no-interaction (-n) Do not ask any interactive question
 --piwik-domain        Piwik URL (protocol and domain) eg. "http://piwik.example.org"

Available commands:
 help               Displays help for a command
 list               Lists commands
climulti
 climulti:request   Parses and executes the given query. See Piwik\CliMulti. Intended only for system usage.

console list core gives the following

Console Tool

Usage:
 [options] command [arguments]

Options:
 --help (-h)           Display this help message
 --quiet (-q)          Do not output any message
 --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 --version (-V)        Display this application version
 --ansi                Force ANSI output
 --no-ansi             Disable ANSI output
 --no-interaction (-n) Do not ask any interactive question
 --piwik-domain        Piwik URL (protocol and domain) eg. "http://piwik.example.org"




  [InvalidArgumentException]
  There are no commands defined in the "core" namespace.



list [--xml] [--raw] [--format="..."] [namespace]

So there are no commands? What I have missed during the updates? Can I check for any missing files?

@ulfw
Copy link
Author

ulfw commented Mar 4, 2015

And I thought to update to 2.11.2 will fix this, but I cannot run the update command, because of the same error.

@mattab
Copy link
Member

mattab commented Mar 6, 2015

Hi @ulfw that's strange that it does not list the other commands. I think it's the first time this issue was reported... Maybe you can try re-upload all files from 2.11.2 and see if that fixes it?

@ulfw
Copy link
Author

ulfw commented Mar 6, 2015

No, it does not fix it.
I have event installed piwik again (using existing databases) to avoid misconfiguration in the ini file, but nothing helps.

A parallel existing version 2.8.3 does run the command "./console list core". So I have no idea what to do?

All files are belonging to the web server user, so there can´t be any filesystem issues.

@jadwigo
Copy link

jadwigo commented Mar 6, 2015

I have the same problem after upgrading from 2.8.3 to 2.11.2
The console tells:

  [InvalidArgumentException]
  There are no commands defined in the "core" namespace.

The upgrade could not be run from the console command, and cronjobs stopped working.
It might be related to the fact that the server is running an ancient PHP 5.3.3

@ulfw
Copy link
Author

ulfw commented Mar 6, 2015

Puuh, thanks that I´m not the only one ;-)
Same to me with the PHP version, running 5.3.8

Piwik 2.10 is running fine.

@dawnbreak
Copy link
Contributor

On an old local test system I updated from Piwik 2.8.0 to 2.11.2 and I have the same problem. It is a CentOS7 with PHP5.4.16. In config/config.ini.php there exists an entry PluginsInstalled[] = "CoreConsole".

@mnapoli mnapoli added the Bug For errors / faults / flaws / inconsistencies etc. label Mar 8, 2015
@mpiscaer
Copy link

mpiscaer commented Mar 9, 2015

I have the same problem, I'm using a default ubuntu precise setup. The webserver is apache and PHP.

The database is an MariaDB with Galera in an multi master setup.

The command below, I run on an just fresh installed database, where I just finished my piwik setup guide.

nginx_piwik@piwik01-[LOC]:/home/support$ /usr/bin/php5 /var/www/console core:archive --piwik-domain=http://piwik01/ -vvv
DEBUG SitesManager[2015-03-09 11:31:46] Db::fetchAll() executing SQL: SELECT idsite FROM piwik_site



  [InvalidArgumentException]                              
  There are no commands defined in the "core" namespace.  



Exception trace:
 () at /var/www/vendor/symfony/console/Symfony/Component/Console/Application.php:501
 Symfony\Component\Console\Application->findNamespace() at /var/www/vendor/symfony/console/Symfony/Component/Console/Application.php:535
 Symfony\Component\Console\Application->find() at /var/www/vendor/symfony/console/Symfony/Component/Console/Application.php:192
 Symfony\Component\Console\Application->doRun() at n/a:n/a
 call_user_func() at /var/www/core/Console.php:58
 Piwik\{closure}() at /var/www/core/Access.php:454
 Piwik\Access::doAsSuperUser() at /var/www/core/Console.php:59
 Piwik\Console->doRun() at /var/www/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at /var/www/console:27

@mnapoli
Copy link
Contributor

mnapoli commented Mar 9, 2015

@mpiscaer thanks for the additional info, what's interesting here is that the logging works correctly so Piwik and plugins seem to work correctly except for the error… That's really weird because the code that loads the commands is very simple.

Could you try to run the ./console plugin:list command to see the plugins that are installed and activated?

@mpiscaer
Copy link

mpiscaer commented Mar 9, 2015

@mnapoli I get the following:

nginx_piwik@piwik01-[LOC]:/home/support$ /usr/bin/php5 /var/www/console plugin:list -vvv
DEBUG SitesManager[2015-03-09 22:40:32] Db::fetchAll() executing SQL: SELECT idsite FROM piwik_site

[InvalidArgumentException]
There are no commands defined in the "plugin" namespace.

Exception trace:
() at /var/www/vendor/symfony/console/Symfony/Component/Console/Application.php:501
Symfony\Component\Console\Application->findNamespace() at /var/www/vendor/symfony/console/Symfony/Component/Console/Application.php:535
Symfony\Component\Console\Application->find() at /var/www/vendor/symfony/console/Symfony/Component/Console/Application.php:192
Symfony\Component\Console\Application->doRun() at n/a:n/a
call_user_func() at /var/www/core/Console.php:58
Piwik{closure}() at /var/www/core/Access.php:454
Piwik\Access::doAsSuperUser() at /var/www/core/Console.php:59
Piwik\Console->doRun() at /var/www/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at /var/www/console:27

nginx_piwik@piwik01-[LOC]:$

My configuration is:

; DO NOT REMOVE THIS LINE
; file automatically generated or modified by Piwik; you can manually override the default values in global.ini.php by redefining them in this file.
[database]
host = "10.20.20.146"
username = "piwik"
password = "piwikww"
dbname = "piwik"
tables_prefix = "piwik_"
charset = "utf8"

[General]
salt = salt
trusted_hosts[] = "piwik01"
;bulk_requests_use_transaction = 0

[PluginsInstalled]
PluginsInstalled[] = "Login"
PluginsInstalled[] = "CoreAdminHome"
PluginsInstalled[] = "UsersManager"
PluginsInstalled[] = "SitesManager"
PluginsInstalled[] = "Installation"
PluginsInstalled[] = "CorePluginsAdmin"
PluginsInstalled[] = "CoreHome"
PluginsInstalled[] = "CoreVisualizations"
PluginsInstalled[] = "Proxy"
PluginsInstalled[] = "API"
PluginsInstalled[] = "ExamplePlugin"
PluginsInstalled[] = "Widgetize"
PluginsInstalled[] = "Transitions"
PluginsInstalled[] = "LanguagesManager"
PluginsInstalled[] = "Actions"
PluginsInstalled[] = "Dashboard"
PluginsInstalled[] = "MultiSites"
PluginsInstalled[] = "Referrers"
PluginsInstalled[] = "UserSettings"
PluginsInstalled[] = "DevicesDetection"
PluginsInstalled[] = "Goals"
PluginsInstalled[] = "SEO"
PluginsInstalled[] = "Events"
PluginsInstalled[] = "UserCountry"
PluginsInstalled[] = "VisitsSummary"
PluginsInstalled[] = "VisitFrequency"
PluginsInstalled[] = "VisitTime"
PluginsInstalled[] = "VisitorInterest"
PluginsInstalled[] = "ExampleAPI"
PluginsInstalled[] = "ExampleRssWidget"
PluginsInstalled[] = "Provider"
PluginsInstalled[] = "Feedback"
PluginsInstalled[] = "CoreUpdater"
PluginsInstalled[] = "CoreConsole"
PluginsInstalled[] = "ScheduledReports"
PluginsInstalled[] = "UserCountryMap"
PluginsInstalled[] = "Live"
PluginsInstalled[] = "CustomVariables"
PluginsInstalled[] = "PrivacyManager"
PluginsInstalled[] = "ImageGraph"
PluginsInstalled[] = "Annotations"
PluginsInstalled[] = "MobileMessaging"
PluginsInstalled[] = "Overlay"
PluginsInstalled[] = "SegmentEditor"
PluginsInstalled[] = "Insights"
PluginsInstalled[] = "ZenMode"
PluginsInstalled[] = "LeftMenu"
PluginsInstalled[] = "Morpheus"
PluginsInstalled[] = "Contents"
PluginsInstalled[] = "IPv6Usage"
PluginsInstalled[] = "BulkTracking"
PluginsInstalled[] = "Resolution"
PluginsInstalled[] = "DevicePlugins"

@mnapoli
Copy link
Contributor

mnapoli commented Mar 10, 2015

There is no [Plugins] section in your config: that section contains the list of enabled plugins. So I think that's the root of the problem. But why is there not the list of activated plugins in the config…

If you go in the administration (in the web interface) can you have a look at the Plugins management page? Try to enable all the plugins that are installed.

@mpiscaer
Copy link

In the administration web interface the plugins are active.

@diosmosis
Copy link
Member

Typo in commit message, 42da3f8 refs this issue.

@mpiscaer
Copy link

After applying the above patch, I get the flowing message:

nginx_piwik@piwik01-[LOC]:/var/www$ ./console plugin:list -vvv
DEBUG Piwik\Console[2015-03-10 15:45:36] Could not initialize plugins: The directory "/var/www/tmp/cache/tracker/" is not writable.
#0 /var/www/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php(37): Doctrine\Common\Cache\FileCache->__construct('/var/www/tmp/ca...', NULL)
#1 /var/www/vendor/piwik/cache/src/Backend/File.php(42): Doctrine\Common\Cache\PhpFileCache->__construct('/var/www/tmp/ca...', NULL)
#2 /var/www/vendor/piwik/cache/src/Backend/Factory.php(22): Piwik\Cache\Backend\File->__construct('/var/www/tmp/ca...')
#3 /var/www/vendor/piwik/cache/src/Backend/Factory.php(92): Piwik\Cache\Backend\Factory->buildFileCache(Array)
#4 /var/www/vendor/piwik/cache/src/Backend/Factory.php(41): Piwik\Cache\Backend\Factory->buildBackend('file', Array)
#5 /var/www/vendor/piwik/cache/src/Backend/Factory.php(96): Piwik\Cache\Backend\Factory->buildChainedCache(Array)
#6 /var/www/core/Cache.php(75): Piwik\Cache\Backend\Factory->buildBackend('chained', Array)
#7 /var/www/config/global.php(47): Piwik\Cache::buildBackend('chained')
#8 [internal function]: {closure}(Object(DI\Container))
#9 /var/www/vendor/mnapoli/php-di/src/DI/Definition/Resolver/FactoryDefinitionResolver.php(63): call_user_func(Object(Closure), Object(DI\Container))
#10 /var/www/vendor/mnapoli/php-di/src/DI/Container.php(300): DI\Definition\Resolver\FactoryDefinitionResolver->resolve(Object(DI\Definition\FactoryDefinition), Array)
#11 /var/www/vendor/mnapoli/php-di/src/DI/Container.php(129): DI\Container->resolveDefinition(Object(DI\Definition\FactoryDefinition))
#12 /var/www/config/global.php(28): DI\Container->get('Piwik\Cache\Bac...')
#13 [internal function]: {closure}(Object(DI\Container))
#14 /var/www/vendor/mnapoli/php-di/src/DI/Definition/Resolver/FactoryDefinitionResolver.php(63): call_user_func(Object(Closure), Object(DI\Container))
#15 /var/www/vendor/mnapoli/php-di/src/DI/Container.php(300): DI\Definition\Resolver\FactoryDefinitionResolver->resolve(Object(DI\Definition\FactoryDefinition), Array)
#16 /var/www/vendor/mnapoli/php-di/src/DI/Container.php(129): DI\Container->resolveDefinition(Object(DI\Definition\FactoryDefinition))
#17 /var/www/core/Container/StaticContainer.php(89): DI\Container->get('Piwik\Cache\Eag...')
#18 /var/www/core/Cache.php(56): Piwik\Container\StaticContainer::get('Piwik\Cache\Eag...')
#19 /var/www/core/Plugin.php(134): Piwik\Cache::getEagerCache()
#20 /var/www/core/Plugin/Manager.php(908): Piwik\Plugin->__construct()
#21 /var/www/core/Plugin/Manager.php(874): Piwik\Plugin\Manager->makePluginClass('CorePluginsAdmi...')
#22 /var/www/core/Plugin/Manager.php(813): Piwik\Plugin\Manager->loadPlugin('CorePluginsAdmi...')
#23 /var/www/core/Plugin/Manager.php(668): Piwik\Plugin\Manager->reloadActivatedPlugins()
#24 /var/www/core/Plugin/Manager.php(101): Piwik\Plugin\Manager->loadPlugins(Array)
#25 /var/www/core/Console.php(167): Piwik\Plugin\Manager->loadActivatedPlugins()
#26 /var/www/core/Console.php(45): Piwik\Console::initPlugins()
#27 /var/www/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /var/www/console(27): Symfony\Component\Console\Application->run()
#29 {main}
DEBUG SitesManager[2015-03-10 15:45:36] Db::fetchAll() executing SQL: SELECT idsite FROM piwik_site

[InvalidArgumentException]
There are no commands defined in the "plugin" namespace.

Exception trace:
() at /var/www/vendor/symfony/console/Symfony/Component/Console/Application.php:501
Symfony\Component\Console\Application->findNamespace() at /var/www/vendor/symfony/console/Symfony/Component/Console/Application.php:535
Symfony\Component\Console\Application->find() at /var/www/vendor/symfony/console/Symfony/Component/Console/Application.php:192
Symfony\Component\Console\Application->doRun() at n/a:n/a
call_user_func() at /var/www/core/Console.php:60
Piwik{closure}() at /var/www/core/Access.php:454
Piwik\Access::doAsSuperUser() at /var/www/core/Console.php:61
Piwik\Console->doRun() at /var/www/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at /var/www/console:27

It looks like I don't have write rights to the directory /var/www/tmp/cache/tracker/.

After fixing that, the problem got fixed and it is working now.

@mnapoli
Copy link
Contributor

mnapoli commented Mar 10, 2015

The directory "/var/www/tmp/cache/tracker/" is not writable.

Ah finally we get to the bottom of this. I guess it should also show in the System Check in the administration panel, so people that don't want to apply the patch can go check that.

@mnapoli
Copy link
Contributor

mnapoli commented Mar 10, 2015

I've pushed a fix so that errors like the one above will not be silently ignored anymore: instead the ./console will fail with an explicit error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

7 participants