upgrade_210() - WordPress 函数参考中文文档

返回介绍

upgrade_210()

发布于 2017-09-11 字数1673 浏览 926 评论 0

upgrade_210()

Execute changes made in WordPress 2.1.


描述


源代码

File: wp-admin/includes/upgrade.php

		$objects = $wpdb->get_results("SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'");
		foreach ($objects as $object) {
			$wpdb->update( $wpdb->posts, array(	'post_status' => 'attachment',
	'post_mime_type' => $object->post_type,
	'post_type' => ''),
			 array( 'ID' => $object->ID ) );

			$meta = get_post_meta($object->ID, 'imagedata', true);
			if ( ! empty($meta['file']) )
				update_attached_file( $object->ID, $meta['file'] );
		}
	}
}

/**
 * Execute changes made in WordPress 2.1.
 *
 * @ignore
 * @since 2.1.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 * @global int  $wp_current_db_version
 */
function upgrade_210() {
	global $wpdb, $wp_current_db_version;

	if ( $wp_current_db_version < 3506 ) {
		// Update status and type.
		$posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts");

		if ( ! empty($posts) ) foreach ($posts as $post) {
			$status = $post->post_status;
			$type = 'post';

			if ( 'static' == $status ) {
				$status = 'publish';
				$type = 'page';
			} elseif ( 'attachment' == $status ) {

更新日志

Version 描述
2.1.0 Introduced.

User Contributed Notes

上一篇:upgrade_160()

下一篇:upgrade_230()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!