如何将 WordPress 的 upload 文件夹导入 SAE 的 storage
展开全部
应用根目录,创建sae.php,
<?php
/* 在SAE的Storage中新建的Domain名,比如“wordpress” */
define('SAE_STORAGE',wordpress);
/* 设置文件上传的路径和文件路径的URL,不要更改 */
define('SAE_DIR', 'saestor://'.SAE_STORAGE.'/uploads');
define('SAE_URL', 'http://'.$_SERVER['HTTP_APPNAME'].'-'.SAE_STORAGE.'.stor.sinaapp.com/uploads');
?>
修改wp-includes/functions.php文件,
require( ABSPATH . WPINC . '/option.php' );
前添加
include( ABSPATH . '/sae.php' ); //调用SAE的Storage文件域名设置 //for SAE
注释掉如下代码,
//$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;
//}
替换为,
//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
$basedir = $dir;
的上面添加
// for SAE begin
$dir = SAE_DIR;
$url = SAE_URL;
//for SAE end
/** * Send a HTTP header to limit rendering of pages to same origin iframes.
的上面添加,
// 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,注释掉如下代码,
// Set correct file permissions
//$stat = stat( dirname( $new_file ));
//$perms = $stat['mode'] & 0000666;
//@ chmod( $new_file, $perms );
作者:李君南
<?php
/* 在SAE的Storage中新建的Domain名,比如“wordpress” */
define('SAE_STORAGE',wordpress);
/* 设置文件上传的路径和文件路径的URL,不要更改 */
define('SAE_DIR', 'saestor://'.SAE_STORAGE.'/uploads');
define('SAE_URL', 'http://'.$_SERVER['HTTP_APPNAME'].'-'.SAE_STORAGE.'.stor.sinaapp.com/uploads');
?>
修改wp-includes/functions.php文件,
require( ABSPATH . WPINC . '/option.php' );
前添加
include( ABSPATH . '/sae.php' ); //调用SAE的Storage文件域名设置 //for SAE
注释掉如下代码,
//$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;
//}
替换为,
//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
$basedir = $dir;
的上面添加
// for SAE begin
$dir = SAE_DIR;
$url = SAE_URL;
//for SAE end
/** * Send a HTTP header to limit rendering of pages to same origin iframes.
的上面添加,
// 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,注释掉如下代码,
// Set correct file permissions
//$stat = stat( dirname( $new_file ));
//$perms = $stat['mode'] & 0000666;
//@ chmod( $new_file, $perms );
作者:李君南
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询