Ejemplo n.º 1
0
 function __construct($plugin_file_path)
 {
     parent::__construct($plugin_file_path);
     if (!version_compare(PHP_VERSION, $this->php_version_required, '>=')) {
         return;
     }
     global $wpmdb;
     $this->wpmdb = $wpmdb;
 }
Ejemplo n.º 2
0
 function __construct($plugin_file_path)
 {
     parent::__construct($plugin_file_path);
     if (!version_compare(PHP_VERSION, $this->php_version_required, '>=')) {
         return;
     }
     global $wpmdb;
     $this->wpmdb = $wpmdb;
     add_filter('wpmdb_cli_finalize_migration_response', array($this, 'finalize_ajax'), 10, 1);
 }
Ejemplo n.º 3
0
 function __construct($plugin_file_path)
 {
     parent::__construct($plugin_file_path);
     $this->plugin_version = $GLOBALS['wpmdb_meta'][$this->core_slug]['version'];
     $this->max_insert_string_len = 50000;
     // 50000 is the default as defined by PhpMyAdmin
     add_filter('plugin_action_links_' . $this->plugin_basename, array($this, 'plugin_action_links'));
     add_filter('network_admin_plugin_action_links_' . $this->plugin_basename, array($this, 'plugin_action_links'));
     // internal AJAX handlers
     add_action('wp_ajax_wpmdb_delete_migration_profile', array($this, 'ajax_delete_migration_profile'));
     add_action('wp_ajax_wpmdb_save_profile', array($this, 'ajax_save_profile'));
     add_action('wp_ajax_wpmdb_initiate_migration', array($this, 'ajax_initiate_migration'));
     add_action('wp_ajax_wpmdb_migrate_table', array($this, 'ajax_migrate_table'));
     add_action('wp_ajax_wpmdb_finalize_migration', array($this, 'ajax_finalize_migration'));
     add_action('wp_ajax_wpmdb_clear_log', array($this, 'ajax_clear_log'));
     add_action('wp_ajax_wpmdb_get_log', array($this, 'ajax_get_log'));
     add_action('wp_ajax_wpmdb_fire_migration_complete', array($this, 'fire_migration_complete'));
     add_action('wp_ajax_wpmdb_plugin_compatibility', array($this, 'ajax_plugin_compatibility'));
     add_action('wp_ajax_wpmdb_blacklist_plugins', array($this, 'ajax_blacklist_plugins'));
     add_action('wp_ajax_wpmdb_update_max_request_size', array($this, 'ajax_update_max_request_size'));
     add_action('wp_ajax_wpmdb_cancel_migration', array($this, 'ajax_cancel_migration'));
     $absolute_path = rtrim(ABSPATH, '\\/');
     $site_url = rtrim(site_url('', 'http'), '\\/');
     $home_url = rtrim(home_url('', 'http'), '\\/');
     if ($site_url != $home_url) {
         $difference = str_replace($home_url, '', $site_url);
         if (strpos($absolute_path, $difference) !== false) {
             $absolute_path = rtrim(substr($absolute_path, 0, -strlen($difference)), '\\/');
         }
     }
     $this->absolute_root_file_path = $absolute_path;
     $this->accepted_fields = array('action', 'save_computer', 'gzip_file', 'connection_info', 'replace_old', 'replace_new', 'table_migrate_option', 'select_tables', 'replace_guids', 'exclude_spam', 'save_migration_profile', 'save_migration_profile_option', 'create_new_profile', 'create_backup', 'remove_backup', 'keep_active_plugins', 'select_post_types', 'backup_option', 'select_backup', 'exclude_transients', 'exclude_post_types', 'exclude_post_revisions', 'compatibility_older_mysql');
     $this->default_profile = array('action' => 'savefile', 'save_computer' => '1', 'gzip_file' => '1', 'table_migrate_option' => 'migrate_only_with_prefix', 'replace_guids' => '1', 'default_profile' => true, 'name' => '', 'select_tables' => array(), 'select_post_types' => array(), 'backup_option' => 'backup_only_with_prefix', 'exclude_transients' => '1', 'compatibility_older_mysql' => '1');
     $this->checkbox_options = array('save_computer' => '0', 'gzip_file' => '0', 'replace_guids' => '0', 'exclude_spam' => '0', 'keep_active_plugins' => '0', 'create_backup' => '0', 'exclude_post_types' => '0', 'compatibility_older_mysql' => '0');
     $this->plugin_tabs = array('<a href="#" class="nav-tab nav-tab-active js-action-link migrate" data-div-name="migrate-tab">' . esc_html(_x('Migrate', 'Configure a migration or export', 'wp-migrate-db')) . '</a>', '<a href="#" class="nav-tab js-action-link settings" data-div-name="settings-tab">' . esc_html(_x('Settings', 'Plugin configuration and preferences', 'wp-migrate-db')) . '</a>', '<a href="#" class="nav-tab js-action-link help" data-div-name="help-tab">' . esc_html(_x('Help', 'Get help or contact support', 'wp-migrate-db')) . '</a>');
     // automatically deactivate WPMDB Pro / Free if the other is already active
     add_action('activated_plugin', array($this, 'deactivate_other_instances'));
     // display a notice when either WP Migrate DB or WP Migrate DB Pro is automatically deactivated
     add_action('pre_current_active_plugins', array($this, 'plugin_deactivated_notice'));
     // check if WP Engine is filtering the buffer and prevent it
     add_action('plugins_loaded', array($this, 'maybe_disable_wp_engine_filtering'));
     // this is how many DB rows are processed at a time, allow devs to change this value
     $this->rows_per_segment = apply_filters('wpmdb_rows_per_segment', $this->rows_per_segment);
     if (is_multisite()) {
         add_action('network_admin_menu', array($this, 'network_admin_menu'));
         /*
          * The URL find & replace is locked down (delete & reorder disabled) on multisite installations as we require the URL
          * of the remote site for export migrations. This URL is parsed into it's various components and
          * used to change values in the 'domain' & 'path' columns in the wp_blogs and wp_site tables.
          */
         $this->lock_url_find_replace_row = true;
     } else {
         add_action('admin_menu', array($this, 'admin_menu'));
     }
 }
Ejemplo n.º 4
0
 function __construct($plugin_file_path)
 {
     $this->is_addon = true;
     parent::__construct($plugin_file_path);
 }
Ejemplo n.º 5
0
Archivo: wpmdb.php Proyecto: eresyyl/mk
 function __construct($plugin_file_path)
 {
     parent::__construct($plugin_file_path);
     $this->plugin_version = $GLOBALS['wpmdb_meta'][$this->core_slug]['version'];
     $this->max_insert_string_len = 50000;
     // 50000 is the default as defined by phphmyadmin
     $default_settings = array('key' => $this->generate_key(), 'allow_pull' => false, 'allow_push' => false, 'profiles' => array(), 'licence' => '', 'verify_ssl' => false, 'blacklist_plugins' => array());
     if (empty($this->settings['max_request'])) {
         $this->settings['max_request'] = min(1024 * 1024, $this->get_bottleneck('max'));
         update_option('wpmdb_settings', $this->settings);
     }
     // if no settings exist then this is a fresh install, set up some default settings
     if (empty($this->settings)) {
         $this->settings = $default_settings;
         update_option('wpmdb_settings', $this->settings);
     } else {
         // When we add a new setting, an existing customer's db won't have this
         // new setting, so we need to add it. Otherwise, they'll see
         // array index errors in debug mode
         $update_settings = false;
         foreach ($default_settings as $key => $value) {
             if (!isset($this->settings[$key])) {
                 $this->settings[$key] = $value;
                 $update_settings = true;
             }
         }
         if ($update_settings) {
             update_option('wpmdb_settings', $this->settings);
         }
     }
     add_filter('plugin_action_links_' . $this->plugin_basename, array($this, 'plugin_action_links'));
     add_filter('network_admin_plugin_action_links_' . $this->plugin_basename, array($this, 'plugin_action_links'));
     // internal AJAX handlers
     add_action('wp_ajax_wpmdb_delete_migration_profile', array($this, 'ajax_delete_migration_profile'));
     add_action('wp_ajax_wpmdb_save_profile', array($this, 'ajax_save_profile'));
     add_action('wp_ajax_wpmdb_initiate_migration', array($this, 'ajax_initiate_migration'));
     add_action('wp_ajax_wpmdb_migrate_table', array($this, 'ajax_migrate_table'));
     add_action('wp_ajax_wpmdb_finalize_migration', array($this, 'ajax_finalize_migration'));
     add_action('wp_ajax_wpmdb_clear_log', array($this, 'ajax_clear_log'));
     add_action('wp_ajax_wpmdb_get_log', array($this, 'ajax_get_log'));
     add_action('wp_ajax_wpmdb_fire_migration_complete', array($this, 'fire_migration_complete'));
     add_action('wp_ajax_wpmdb_plugin_compatibility', array($this, 'ajax_plugin_compatibility'));
     add_action('wp_ajax_wpmdb_blacklist_plugins', array($this, 'ajax_blacklist_plugins'));
     add_action('wp_ajax_wpmdb_update_max_request_size', array($this, 'ajax_update_max_request_size'));
     add_action('wp_ajax_wpmdb_cancel_migration', array($this, 'ajax_cancel_migration'));
     $absolute_path = rtrim(ABSPATH, '\\/');
     $site_url = rtrim(site_url('', 'http'), '\\/');
     $home_url = rtrim(home_url('', 'http'), '\\/');
     if ($site_url != $home_url) {
         $difference = str_replace($home_url, '', $site_url);
         if (strpos($absolute_path, $difference) !== false) {
             $absolute_path = rtrim(substr($absolute_path, 0, -strlen($difference)), '\\/');
         }
     }
     $this->absolute_root_file_path = $absolute_path;
     $this->accepted_fields = array('action', 'save_computer', 'gzip_file', 'connection_info', 'replace_old', 'replace_new', 'table_migrate_option', 'select_tables', 'replace_guids', 'exclude_spam', 'save_migration_profile', 'save_migration_profile_option', 'create_new_profile', 'create_backup', 'remove_backup', 'keep_active_plugins', 'select_post_types', 'backup_option', 'select_backup', 'exclude_transients', 'exclude_post_types', 'exclude_post_revisions');
     $this->default_profile = array('action' => 'savefile', 'save_computer' => '1', 'gzip_file' => '1', 'table_migrate_option' => 'migrate_only_with_prefix', 'replace_guids' => '1', 'default_profile' => true, 'name' => '', 'select_tables' => array(), 'select_post_types' => array(), 'backup_option' => 'backup_only_with_prefix', 'exclude_transients' => '1');
     $this->checkbox_options = array('save_computer' => '0', 'gzip_file' => '0', 'replace_guids' => '0', 'exclude_spam' => '0', 'keep_active_plugins' => '0', 'create_backup' => '0', 'exclude_post_types' => '0');
     $this->plugin_tabs = array('<a href="#" class="nav-tab nav-tab-active js-action-link migrate" data-div-name="migrate-tab">' . __('Migrate', 'wp-migrate-db') . '</a>', '<a href="#" class="nav-tab js-action-link settings" data-div-name="settings-tab">' . __('Settings', 'wp-migrate-db') . '</a>', '<a href="#" class="nav-tab js-action-link help" data-div-name="help-tab">' . __('Help', 'wp-migrate-db') . '</a>');
     // automatically deactivate WPMDB Pro / Free if the other is already active
     add_action('activated_plugin', array($this, 'deactivate_other_instances'));
     // display a notice when either WP Migrate DB or WP Migrate DB Pro is automatically deactivated
     add_action('pre_current_active_plugins', array($this, 'plugin_deactivated_notice'));
     // this is how many DB rows are processed at a time, allow devs to change this value
     $this->rows_per_segment = apply_filters('wpmdb_rows_per_segment', $this->rows_per_segment);
     if (is_multisite()) {
         add_action('network_admin_menu', array($this, 'network_admin_menu'));
         /*
          * The URL find & replace is locked down (delete & reorder disabled) on multisite installations as we require the URL
          * of the remote site for export migrations. This URL is parsed into it's various components and
          * used to change values in the 'domain' & 'path' columns in the wp_blogs and wp_site tables.
          */
         $this->lock_url_find_replace_row = true;
     } else {
         add_action('admin_menu', array($this, 'admin_menu'));
     }
 }