WordPress 3.5移植方法

WordPress for SAE
今天移植了wordpress3.5经过测试未发现致命错误,只有编码问题,把文档保存为ansi或者无bom的utf-8就成了。
步骤如下
一、设置在线安装向导,根目录sae_app_wizard.xml文件。
PHP代码

<appwizard>
<introduction>
<name>WordPress 3.5 for SAE</name>
<author>WH</author>
<homepage>"\"https://fairydevil.com\"" target="\"_blank\"">https://fairydevil.com</homepage>
<description>
<![CDATA[
<p>WordPress 3.5 for sae。</p>
]]>
</description>
</introduction>
<platform>
<services>
<service name="images" params="public">Storage</service>
<service>Mysql</service>
</services>
</platform>
<code>
<initScript>index.php</initScript>
</code>
</appwizard>

二、创建SAE的上传路径变量,将sae_upload.php文件放置于wp-includes
PHP代码

<?php
define('SAE_STORAGE',images);
/* 设置文件上传的路径和文件路径的URL,不要更改 */
define('SAE_DIR', 'saestor://'.SAE_STORAGE.'/uploads');
define('SAE_URL', 'https://'.$_SERVER['HTTP_APPNAME'].'-'.SAE_STORAGE.'.stor.sinaapp.com/uploads');
?>

三、配置wp-config.php数据库参数
PHP代码

/** WordPress 数据库的名称 */
define('DB_NAME', SAE_MYSQL_DB);
/** MySQL 数据库用户名 */
define('DB_USER', SAE_MYSQL_USER);
/** MySQL 数据库密码 */
define('DB_PASSWORD', SAE_MYSQL_PASS);
/** MySQL 主机 */
define('DB_HOST', SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT);

四、修改上传文件的函数为Storage目录,wp-includes/functions.php文件
PHP代码

require( ABSPATH . WPINC . '/option.php' );

前面加上一句:
PHP代码

include( ABSPATH. WPINC  . '/sae_upload.php' ); //调用SAE的Storage文件域名设置

注释掉如下代码:
PHP代码

$wrapper = null;
//strip the protocol
if( wp_is_stream( $target ) ) {
    list( $wrapper, $target ) = explode( '://', $target, 2 );
}
//from php.net/mkdir user contributed notes
$target = str_replace( '//', '/', $target );
//put the wrapper back on the target
if( $wrapper !== null ) {
    $target = $wrapper . '://' . $target;
}

在下面加上:
PHP代码

//for SAE begin
// from php.net/mkdir user contributed notes
if ( substr($target, 0, 10) == 'saestor://' ) {
return true;
}
$target = str_replace( '//', '/', $target );
//for SAE end

找到
PHP代码

$basedir = $dir;

在上面加上:
PHP代码

// for SAE begin
$dir = SAE_DIR;
$url = SAE_URL;
//for SAE end

找到:
PHP代码

Send a HTTP header to limit rendering of pages to same origin iframes.

在上面加上:
PHP代码

// for SAE begin
if ( !function_exists('utf8_encode') ) {
function utf8_encode($str) {
$encoding_in = mb_detect_encoding($str);
return mb_convert_encoding($str, 'UTF-8', $encoding_in);
}
}
//for SAE end

五、修改文件调用和查看权限,wp-admin/includes/file.php文件
注释掉如下代码:
PHP代码

// Set correct file permissions
$stat = stat( dirname( $new_file ));
$perms = $stat['mode'] & 0000666;
@ chmod( $new_file, $perms );

六、在sae管理面板中添加storage Domain Name为“images”

wordpress 3.5.2版本下载

[Download](/2013/03/wordpress-3.5.2-for-sae-v0720-multiple-db.zip)

click to begin

6.6MB .zip

效验码: CRC32: 363631F1 MD5: aed323d9dbdbfc4893e5e11ec06884df SHA-1: 67dd60fc633ead672bb93f94ec0e2d9f3b82e10f