本文整理汇总了PHP中MainWP_Utility::fix_option方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility::fix_option方法的具体用法?PHP MainWP_Utility::fix_option怎么用?PHP MainWP_Utility::fix_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWP_Utility
的用法示例。
在下文中一共展示了MainWP_Utility::fix_option方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_update
function post_update()
{
$currentVersion = get_site_option('mainwp_db_version');
if ($currentVersion === false) {
return;
}
if (version_compare($currentVersion, '2.8', '<')) {
$this->wpdb->update($this->tableName('wp_backup'), array('subfolder' => 'MainWP Backups/%url%/%type%/%date%'), array('template' => '0'));
}
if (version_compare($currentVersion, '4.3', '<')) {
$row = $this->wpdb->get_row('SELECT * FROM ' . $this->tableName('users'), OBJECT);
if ($row != null) {
$row->userid = 0;
$this->updateUserExtension($row);
}
}
if (version_compare($currentVersion, '5.3', '<')) {
if (MainWP_System::Instance()->isSingleUser()) {
$row = $this->wpdb->get_row('SELECT * FROM ' . $this->tableName('ga'), OBJECT);
$this->wpdb->update($this->tableName('ga'), array('userid' => 0), array('userid' => $row->userid));
}
}
if (version_compare($currentVersion, '6.0', '=')) {
$this->wpdb->query('ALTER TABLE ' . $this->tableName('request_log') . ' CHANGE micro_timestamp_stop micro_timestamp_stop DECIMAL( 12, 2 ) NOT NULL DEFAULT 0');
$this->wpdb->query('ALTER TABLE ' . $this->tableName('request_log') . ' CHANGE micro_timestamp_start micro_timestamp_start DECIMAL( 12, 2 ) NOT NULL DEFAULT 0');
$this->wpdb->query('DELETE FROM ' . $this->tableName('request_log') . ' WHERE 1 ');
}
if (version_compare($currentVersion, '6.2', '<')) {
$options = array('mainwp_db_version', 'mainwp_requests', 'mainwp_plugin_version', 'mainwp_upgradeVersionInfo', 'mainwp_cron_last_offlinecheck', 'mainwp_cron_last_updatescheck', 'mainwp_automaticUpdate_backupChecks', 'mainwp_updatescheck_mail_update_core_new', 'mainwp_updatescheck_mail_update_plugins_new', 'mainwp_updatescheck_mail_update_themes_new', 'mainwp_updatescheck_mail_update_core', 'mainwp_updatescheck_mail_update_plugins', 'mainwp_updatescheck_mail_update_themes', 'mainwp_updatescheck_mail_ignore_core', 'mainwp_updatescheck_mail_ignore_plugins', 'mainwp_updatescheck_mail_ignore_themes', 'mainwp_updatescheck_mail_ignore_core_new', 'mainwp_updatescheck_mail_ignore_plugins_new', 'mainwp_updatescheck_mail_ignore_themes_new', 'mainwp_updatescheck_mail_pluginconflicts', 'mainwp_updatescheck_mail_themeconflicts', 'mainwp_updatescheck_last', 'mainwp_updatescheck_mail_email', 'mainwp_cron_last_ping', 'mainwp_cron_last_cronconflicts', 'mainwp_pluginConflicts', 'mainwp_themeConflicts', 'mainwp_cron_last_backups_continue', 'mainwp_cron_last_backups', 'mainwp_cron_last_stats', 'mainwp_backupsOnServer', 'mainwp_maximumFileDescriptors', 'mainwp_backupOnExternalSources', 'mainwp_notificationOnBackupFail', 'mainwp_notificationOnBackupStart', 'mainwp_chunkedBackupTasks', 'mainwp_maximumRequests', 'mainwp_minimumDelay', 'mainwp_maximumIPRequests', 'mainwp_minimumIPDelay', 'mainwp_extensions', 'mainwp_extloaded', 'mainwp_api_username', 'mainwp_api_password', 'mainwp_extension_widget_view', 'mainwp_news', 'mainwp_news_timestamp', 'mainwp_optimize', 'mainwp_seo', 'mainwp_automaticDailyUpdate', 'mainwp_backup_before_upgrade', 'mainwp_maximumPosts', 'mainwp_maximumComments', 'mainwp_cron_jobs', 'mainwp_wp_cron');
foreach ($options as $option) {
MainWP_Utility::fix_option($option);
}
}
if (version_compare($currentVersion, '7.3', '<')) {
//get all sites
$sites = $this->wpdb->get_results('SELECT id FROM ' . $this->tableName('wp'));
if (!empty($sites)) {
foreach ($sites as $site) {
$this->wpdb->insert($this->tableName('wp_settings_backup'), array('wpid' => $site->id, 'archiveFormat' => 'global'));
}
}
}
if (version_compare($currentVersion, '8', '<')) {
$apiPass = get_option('mainwp_api_password');
MainWP_Utility::update_option('mainwp_api_password', MainWP_Utility::encrypt($apiPass, 'MainWPAPI'));
}
if (version_compare($currentVersion, '8.1', '<')) {
//We can't split up here!
$wpSyncColumns = array('version', 'totalsize', 'dbsize', 'extauth', 'last_post_gmt', 'uptodate', 'sync_errors', 'dtsSync', 'dtsSyncStart', 'dtsAutomaticSync', 'dtsAutomaticSyncStart');
foreach ($wpSyncColumns as $wpSyncColumn) {
$rslts = $this->wpdb->get_results('SELECT id,' . $wpSyncColumn . ' FROM ' . $this->tableName('wp'), ARRAY_A);
if (empty($rslts)) {
continue;
}
foreach ($rslts as $rslt) {
$exists = $this->wpdb->get_results('SELECT wpid FROM ' . $this->tableName('wp_sync') . ' WHERE wpid = ' . $rslt['id'], ARRAY_A);
if (empty($exists)) {
$this->wpdb->insert($this->tableName('wp_sync'), array('wpid' => $rslt['id'], $wpSyncColumn => $rslt[$wpSyncColumn]));
} else {
$this->wpdb->update($this->tableName('wp_sync'), array($wpSyncColumn => $rslt[$wpSyncColumn]), array('wpid' => $rslt['id']));
}
}
$suppress = $this->wpdb->suppress_errors();
$this->wpdb->query('ALTER TABLE ' . $this->tableName('wp') . ' DROP COLUMN ' . $wpSyncColumn);
$this->wpdb->suppress_errors($suppress);
}
$optionColumns = array('last_wp_upgrades', 'last_plugin_upgrades', 'last_theme_upgrades', 'wp_upgrades', 'recent_comments', 'recent_posts', 'recent_pages');
foreach ($optionColumns as $optionColumn) {
$rslts = $this->wpdb->get_results('SELECT id,' . $optionColumn . ' FROM ' . $this->tableName('wp'), ARRAY_A);
if (empty($rslts)) {
continue;
}
foreach ($rslts as $rslt) {
MainWP_DB::updateWebsiteOption((object) $rslt, $optionColumn, $rslt[$optionColumn]);
}
$suppress = $this->wpdb->suppress_errors();
$this->wpdb->query('ALTER TABLE ' . $this->tableName('wp') . ' DROP COLUMN ' . $optionColumn);
$this->wpdb->suppress_errors($suppress);
}
}
}