Class WP_Data_Access_Switch

author Peter Schulz
since 1.0.0
see \WP_Data_Access_Switch::activate()
see \WP_Data_Access_Switch::deactivate()
package plugin\includes


Activate plugin WP Data Access


The user must have the appropriate privileges to perform this operation.

For single site installation \WP_Data_Access_Switch::activate_blog() will be called. For multi site installations \WP_Data_Access_Switch::activate_blog() must be called for every blog.


For blogs installed on multi site installations after activation of the plugin, activation of the plugin for that blog will not be performed if the plugin is network activated. In that case the admin user of the blog will receive a message when viewing a plugin page with an option to follow these steps manually.

since 1.0.0
see \WP_Data_Access_Switch::activate_blog()

Deactivate plugin WP Data Access


On deactivation we leave the repository and options as they are in case the user wants to reactivate the plugin later again. Tables and options are deleted when the plugin is uninstalled. To keep tables and options on uninstall change plugin settings (see uninstall settings).

since 1.0.0

Activate blog


The user must have the appropriate privileges to perform this operation.

On activation this method checks whether there has previously been a version of the plugin installed. For this purpose the wp_options table read directly (usually done via class WPDA). If a value is found, this method checks if the version number in wp_options is the same as the plugin version. If these are equal, no action is needed. If they are not equal, this method will check if there is an upgrade or downgrade for the delta between these releases.

This action is performed on the 'active WordPress blog'. On single site there is only one blog. On multisite installations it must be executed for every blog.

On a fresh installation the following actions are performed:

since 1.0.0
see \WPDataAccess\WPDA::set_option()
see \WPDataAccess\Utilities\WPDA_Repository::create()

(re)create plugin repository


If no repository is found, a new one is created If a repository is found, the table structures are update and the data transferred