本文整理汇总了PHP中wp_should_upgrade_global_tables函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_should_upgrade_global_tables函数的具体用法?PHP wp_should_upgrade_global_tables怎么用?PHP wp_should_upgrade_global_tables使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_should_upgrade_global_tables函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: pre_schema_upgrade
/**
* Runs before the schema is upgraded.
*
* @since 2.9.0
*
* @global int $wp_current_db_version
* @global wpdb $wpdb
*/
function pre_schema_upgrade()
{
global $wp_current_db_version, $wpdb;
// Unused in Project Nami.
// To be removed.
// Multisite schema upgrades.
if ($wp_current_db_version < 25448 && is_multisite() && wp_should_upgrade_global_tables()) {
// Upgrade verions prior to 3.7
if ($wp_current_db_version < 25179) {
// New primary key for signups.
$wpdb->query("ALTER TABLE {$wpdb->signups} ADD signup_id INT NOT NULL IDENTITY(1,1)");
}
}
if ($wp_current_db_version < 30133) {
// dbDelta() can recreate but can't drop the index.
$wpdb->query("ALTER TABLE {$wpdb->terms} DROP INDEX slug");
}
}
开发者ID:leonardopires,项目名称:projectnami,代码行数:26,代码来源:upgrade.php
示例2: pre_schema_upgrade
/**
* Runs before the schema is upgraded.
*
* @since 2.9.0
*
* @global int $wp_current_db_version
* @global wpdb $wpdb
*/
function pre_schema_upgrade()
{
global $wp_current_db_version, $wpdb;
// Upgrade versions prior to 2.9
if ($wp_current_db_version < 11557) {
// Delete duplicate options. Keep the option with the highest option_id.
$wpdb->query("DELETE o1 FROM {$wpdb->options} AS o1 JOIN {$wpdb->options} AS o2 USING (`option_name`) WHERE o2.option_id > o1.option_id");
// Drop the old primary key and add the new.
$wpdb->query("ALTER TABLE {$wpdb->options} DROP PRIMARY KEY, ADD PRIMARY KEY(option_id)");
// Drop the old option_name index. dbDelta() doesn't do the drop.
$wpdb->query("ALTER TABLE {$wpdb->options} DROP INDEX option_name");
}
// Multisite schema upgrades.
if ($wp_current_db_version < 25448 && is_multisite() && wp_should_upgrade_global_tables()) {
// Upgrade verions prior to 3.7
if ($wp_current_db_version < 25179) {
// New primary key for signups.
$wpdb->query("ALTER TABLE {$wpdb->signups} ADD signup_id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST");
$wpdb->query("ALTER TABLE {$wpdb->signups} DROP INDEX domain");
}
if ($wp_current_db_version < 25448) {
// Convert archived from enum to tinyint.
$wpdb->query("ALTER TABLE {$wpdb->blogs} CHANGE COLUMN archived archived varchar(1) NOT NULL default '0'");
$wpdb->query("ALTER TABLE {$wpdb->blogs} CHANGE COLUMN archived archived tinyint(2) NOT NULL default 0");
}
}
// Upgrade versions prior to 4.2.
if ($wp_current_db_version < 31351) {
if (!is_multisite() && wp_should_upgrade_global_tables()) {
$wpdb->query("ALTER TABLE {$wpdb->usermeta} DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))");
}
$wpdb->query("ALTER TABLE {$wpdb->terms} DROP INDEX slug, ADD INDEX slug(slug(191))");
$wpdb->query("ALTER TABLE {$wpdb->terms} DROP INDEX name, ADD INDEX name(name(191))");
$wpdb->query("ALTER TABLE {$wpdb->commentmeta} DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))");
$wpdb->query("ALTER TABLE {$wpdb->postmeta} DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))");
$wpdb->query("ALTER TABLE {$wpdb->posts} DROP INDEX post_name, ADD INDEX post_name(post_name(191))");
}
}
开发者ID:ryan2407,项目名称:Vision,代码行数:46,代码来源:upgrade.php
示例3: pre_schema_upgrade
/**
* Runs before the schema is upgraded.
*
* @since 2.9.0
*
* @global int $wp_current_db_version
* @global wpdb $wpdb WordPress database abstraction object.
*/
function pre_schema_upgrade()
{
global $wp_current_db_version, $wpdb;
// Upgrade versions prior to 2.9
if ($wp_current_db_version < 11557) {
// Delete duplicate options. Keep the option with the highest option_id.
$wpdb->query("DELETE o1 FROM {$wpdb->options} AS o1 JOIN {$wpdb->options} AS o2 USING (`option_name`) WHERE o2.option_id > o1.option_id");
// Drop the old primary key and add the new.
$wpdb->query("ALTER TABLE {$wpdb->options} DROP PRIMARY KEY, ADD PRIMARY KEY(option_id)");
// Drop the old option_name index. dbDelta() doesn't do the drop.
$wpdb->query("ALTER TABLE {$wpdb->options} DROP INDEX option_name");
}
// Upgrade versions prior to 4.2.
if ($wp_current_db_version < 31351) {
if (wp_should_upgrade_global_tables()) {
$wpdb->query("ALTER TABLE {$wpdb->usermeta} DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))");
}
$wpdb->query("ALTER TABLE {$wpdb->terms} DROP INDEX slug, ADD INDEX slug(slug(191))");
$wpdb->query("ALTER TABLE {$wpdb->terms} DROP INDEX name, ADD INDEX name(name(191))");
$wpdb->query("ALTER TABLE {$wpdb->commentmeta} DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))");
$wpdb->query("ALTER TABLE {$wpdb->postmeta} DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))");
$wpdb->query("ALTER TABLE {$wpdb->posts} DROP INDEX post_name, ADD INDEX post_name(post_name(191))");
}
// Upgrade versions prior to 4.4.
if ($wp_current_db_version < 34978) {
// If compatible termmeta table is found, use it, but enforce a proper index and update collation.
if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->termmeta}'") && $wpdb->get_results("SHOW INDEX FROM {$wpdb->termmeta} WHERE Column_name = 'meta_key'")) {
$wpdb->query("ALTER TABLE {$wpdb->termmeta} DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))");
maybe_convert_table_to_utf8mb4($wpdb->termmeta);
}
}
}
开发者ID:7press,项目名称:7press,代码行数:40,代码来源:upgrade.php
注:本文中的wp_should_upgrade_global_tables函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论