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

Installation through wp-cli don't create database tables #858

Closed
patriksima opened this issue Jun 21, 2016 · 6 comments
Closed

Installation through wp-cli don't create database tables #858

patriksima opened this issue Jun 21, 2016 · 6 comments

Comments

@patriksima
Copy link
Contributor

patriksima commented Jun 21, 2016

If I tried for example:

wp plugin install stream --activate
wp plugin deactivate stream

then I got error:

Chyba databáze WordPressu: Table 'wpscaffolding.prefix_stream' doesn't exist. Konkrétní dotaz: SHOW FULL COLUMNS FROM prefix_stream. Příslušná funkce: include('phar:///usr/local/bin/wp/php/boot-phar.php'), include('phar:///usr/local/bin/wp/php/wp-cli.php'), WP_CLI\Runner->start, WP_CLI\Runner->_run_command, WP_CLI\Runner->run_command, WP_CLI\Dispatcher\Subcommand->invoke, call_user_func, WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher{closure}, call_user_func, Plugin_Command->deactivate, deactivate_plugins, do_action('deactivate_plugin'), call_user_func_array, WP_Stream\Connector->callback, call_user_func_array, WP_Stream\Connector_Installer->callback_deactivate_plugin, WP_Stream\Connector->log, call_user_func_array, WP_Stream\Log->log, WP_Stream\DB->insert.
Success: Plugin 'stream' deactivated.

If i ran wp server and then I open WordPress administration, the tables were created.

@tylerhcarter
Copy link
Contributor

It appears that the tables are only created when we run the Install::check() method which only happens when an init hook is ran. This likely means that the tables wouldn't be installed until a command gets ran on WP-CLI that triggers the init hook.

After a quick review of WP-CLI, it doesn't look like the init hook is ran on activation, which is likely the cause of the problem. Currently looking for a way to do a manual firing of init, but that isn't proving to be simple.

@patriksima
Copy link
Contributor Author

Maybe it might help wp-cli/wp-cli#1997

@patriksima
Copy link
Contributor Author

Hi,

I was a little digging and I have found command for plugin activation
and there is an action that should trigger your installation procedure.

(Sry for EN, i am not native)

@lukecarbis
Copy link
Contributor

Hi wrongware - I'm not sure I see the action which you're referring to. Could you please send a pull request as an example?

@patriksima
Copy link
Contributor Author

Hi Luke,

So I figured it out. This condition will never happen when it is triggered via wp-cli.

I've sent pull-request here.

lukecarbis pushed a commit that referenced this issue Sep 15, 2016
Fix wp-cli plugin activation #858
@thefrosty
Copy link

Glad this is solved, but how about Bedrock autoload activation via mu-plugin installs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants