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

revslider - tables not being created on activation #1997

Closed
nick255 opened this issue Aug 23, 2015 · 3 comments
Closed

revslider - tables not being created on activation #1997

nick255 opened this issue Aug 23, 2015 · 3 comments

Comments

@nick255
Copy link

nick255 commented Aug 23, 2015

I'm having an issue with activating the revslider plugin using wp-cli, it reports that it is activated on the command line but I noticed that the tables required by the plugin are not being created:

If I install the plugin on the command line but then activate through wp-admin page, the tables get created or if I install and activate though wp-admin.
This is on a Linux container, on my windows desktop it activates fine so might be something that is wp-cli and Linux specific but I've run out of ideas as to what maybe causing the problem.

command im running
wp plugin install /var/somepath/revslider.zip --path=/var/www/html --activate

PHP binary: /usr/local/bin/php
PHP version: 5.6.10
php.ini used:
WP-CLI root dir: phar://wp-cli.phar
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 0.19.2

@szepeviktor
Copy link
Contributor

register_activation_hook() is buried in a class.

class UniteBaseAdminClassRev extends UniteBaseClassRev{

/**
 *
 * register the "onActivate" event
 */
protected function addEvent_onActivate($eventFunc = "onActivate"){
        register_activation_hook( self::$mainFile, array(self::$t, $eventFunc) );
}

There are 😢 poor quality plugins out there.

@MatthewEppelsheimer
Copy link

Same problem with Query Monitor, which also calls register_activation_hook() from inside of a class. (Related WP.org support ticket)

Is putting register_activation_hook() inside of a class really a bad practice? It seems common. Is the __construct() method's protected keyword the problem?

@danielbachhuber
Copy link
Member

Is putting register_activation_hook() inside of a class really a bad practice? It seems common.

I don't know that it's necessarily a bad practice, but you do need to make sure your code is executing as you expect it to.

Is the __construct() method's protected keyword the problem?

I don't see __construct() in the example. However, if you were to register a protected method as your registration callback, it wouldn't be executed because the callback is executed by call_user_func_array() which doesn't have access to private scope.

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