forcing deactivating of plugins via mysql

 In the WordPress database, you find there's a table called

wp_options

inside that table is an option called active_plugins. You can see it by typing:

mysql> describe wp_options;

This will show the following structure:

+--------------+-----------------+------+-----+---------+----------------+

| Field        | Type            | Null | Key | Default | Extra          |

+--------------+-----------------+------+-----+---------+----------------+

| option_id    | bigint unsigned | NO   | PRI | NULL    | auto_increment |

| option_name  | varchar(191)    | NO   | UNI |         |                |

| option_value | longtext        | NO   |     | NULL    |                |

| autoload     | varchar(20)     | NO   | MUL | yes     |                |

+--------------+-----------------+------+-----+---------+----------------+

The relevant option is called active_plugins, so to see its content, type:

mysql> select * from wp_options where option_name = "active_plugins";

This will return a row with what looks like garbage. The garbage is the data in "option_value".

Here's an example of the apparent garbage:

a:17:{i:0;s:19:"akismet/akismet.php";i:1;s:33:"classic-editor/classic-editor.php";i:2;s:36:"contact-form-7/wp-contact-form-7.php";i:3;s:42:"contact-form-cfdb7/contact-form-cfdb-7.php";i:4;s:37:"disable-comments/disable-comments.php";i:5;s:33:"duplicate-post/duplicate-post.php";i:6;s:31:"easy-fancybox/easy-fancybox.php";i:7;s:59:"force-regenerate-thumbnails/force-regenerate-thumbnails.php";i:8;s:37:"iq-block-country/iq-block-country.php";i:9;s:27:"js_composer/js_composer.php";i:10;s:33:"mfn-migrate-cb/mfn-migrate-cb.php";i:11;s:47:"really-simple-ssl/rlrsssl-really-simple-ssl.php";i:12;s:25:"simple-css/simple-css.php";i:13;s:25:"sucuri-scanner/sucuri.php";i:14;s:23:"wordfence/wordfence.php";i:15;s:41:"wp-gdpr-compliance/wp-gdpr-compliance.php";i:16;s:41:"wrc-pricing-tables/wrc-pricing-tables.php";} 

This is actually JSON code or JSON-like line of parameters. If you copy paste this garbage into a text editor like TextWrangler, you can make it human-readable by finding and replacing the sequence "; with ";\r  (quotes semicolon backslash R). That will put a newline/linefeed after every "; sequence.

The result looks like this:

a:17:{i:0;s:19:"akismet/akismet.php";

i:1;s:33:"classic-editor/classic-editor.php";

i:2;s:36:"contact-form-7/wp-contact-form-7.php";

i:3;s:42:"contact-form-cfdb7/contact-form-cfdb-7.php";

i:4;s:37:"disable-comments/disable-comments.php";

i:5;s:33:"duplicate-post/duplicate-post.php";

i:6;s:31:"easy-fancybox/easy-fancybox.php";

i:7;s:59:"force-regenerate-thumbnails/force-regenerate-thumbnails.php";

i:8;s:37:"iq-block-country/iq-block-country.php";

i:9;s:33:"mfn-migrate-cb/mfn-migrate-cb.php";

i:10;s:47:"really-simple-ssl/rlrsssl-really-simple-ssl.php";

i:11;s:25:"simple-css/simple-css.php";

i:12;s:25:"sucuri-scanner/sucuri.php";

i:14;s:23:"wordfence/wordfence.php";

i:15;s:41:"wp-gdpr-compliance/wp-gdpr-compliance.php";

i:16;s:41:"wrc-pricing-tables/wrc-pricing-tables.php";

i:17;s:48:"js_composer/js_composer.php";

}

If you look at this now you can see what is going on. The option itself is just an "a" with parameters after it. We'll see what that does later. (**)

After that "a" it says, in this case, 17. That means there are 17 plugins. Inside the curly brackets / braces, you see the list of plugins, numbered 0 to 17. Probably it should read 18. Anyway. 

Each line in the JSON code is structured as follows:

    i:14;s:23:"wordfence/wordfence.php";

item: item number ; s (no idea what that is); s-number (I think these show which plugins are related to each other): then the path to the plugin. The top level path is 

    /var/www/yourwebsite/wp-content/plugins

so if you go onto your server command line, you can find out what the plugin name is.

So for example, wordfence is:

    /var/www/yourwebsite/wp-content/plugins/wordfence

If you then type the "ls" command to list it, it shows there's one PHP file in there. That's the actual plugin.

ls /var/www/yourwebsite/wp-content/plugins/wordfence


crypto fonts index.php  languages  models   readme.txt  vendor  waf

css images js   lib       modules  tmp   views   wordfence.php


The rest of the stuff is stuff the plugin uses.

So, to enable or disable these, just add or remove them. IF you remove one of the plugins, make sure you reduce the number after the first "a" above. (see above at **)

When you login again the plugin should be disabled/enabled accordingly.

Popular posts from this blog

turning on debug mode