我正在尝试从wordpress导入主题单元测试xml文件。通过导入部分组织到我自己的wordpress(4.0)。这是我的php。ini设置
但仍然得到最大执行时间限制错误。我又试了一种方法。htaccess访问我的WorpAddress站点。
php_value max_execution_time 3000
但它也不起作用。这就是确切的错误:
Fatal error: Maximum execution time of 60 seconds exceeded in C:\\wamp\\www\\omnipress\\wp-includes\\class-http.php on line 1498
然后我决定进入核心文件并检查该行是否有以下方法:
private function stream_body( $handle, $data ) {
$data_length = strlen( $data );
if ( $this->max_body_length && ( strlen( $this->body ) + $data_length ) > $this->max_body_length )
$data = substr( $data, 0, ( $this->max_body_length - $data_length ) );
if ( $this->stream_handle ) {
$bytes_written = fwrite( $this->stream_handle, $data );
} else {
$this->body .= $data;
$bytes_written = $data_length;
}
// Upon event of this function returning less than strlen( $data ) curl will error with CURLE_WRITE_ERROR.
return $bytes_written;
}
在以下CURL请求中调用此方法:
if ( true === $r[\'blocking\'] ) {
curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( $this, \'stream_headers\' ) );
curl_setopt( $handle, CURLOPT_WRITEFUNCTION, array( $this, \'stream_body\' ) );
}
此CURL请求具有连接超时参数,我将其设置为0(表示无限超时)
$timeout = (int) ceil( 0 );
curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout );
但它仍然不起作用:(请给我正确的方向来实现这一点,我错过了什么。这是我想导入wordpress的测试数据链接。
https://wpcom-themes.svn.automattic.com/demo/theme-unit-test-data.xml