我正在尝试使用复制目录WP_Filesystem API
使用该方法copy_dir()
关于插件激活,但它是给我以下错误消息:
Plugin could not be activated because it triggered a fatal error.
Fatal error: Call to undefined method WP_Filesystem_Direct::copy_dir()
in D:\\xampp\\htdocs\\wordpress\\wp-content\\plugins\\xxxxxxxx\\xxxxxx.php on line 98
Here is my codes:
function sstssfb_activation_hook_vcheck() {
delete_option(esc_attr("sstssfb_stop_showingvchecknotice"));
/* INITIALIZE WPFilesytem */
$access_type = get_filesystem_method();
if($access_type === \'direct\') {
$url = \'http://\'.$_SERVER[\'HTTP_HOST\'].$_SERVER[\'REQUEST_URI\'];
$creds = request_filesystem_credentials($url, \'\', false, false, array());
// initialize the API
if ( ! WP_Filesystem($creds) ) {
// any problems and we exit
return;
}
global $wp_filesystem;
/* CREATE SSTSSFB_ASSETS DIRECTORY */
if(!$wp_filesystem->is_dir(SSTSSFB_ASSET_DIR))
{
$wp_filesystem->mkdir(SSTSSFB_ASSET_DIR);
}
/* MOVE ADDITIONAL assets TO THAT (sstssfb_assets) DIRECTORY */
// addons
if(file_exists(SSTSSFBDIR_ADDONS_ORI))
$wp_filesystem->copy_dir(SSTSSFBDIR_ADDONS_ORI, SSTSSFB_ASSET_DIR, true);
$wp_filesystem->delete(SSTSSFBDIR_ADDONS_ORI);
// themes
if(file_exists(SSTSSFB_THEMEDIR_ORI))
$wp_filesystem->copy_dir(SSTSSFB_THEMEDIR_ORI, SSTSSFB_ASSET_DIR, true);
$wp_filesystem->delete(SSTSSFBDIR_ADDONS_ORI);
}
}
register_activation_hook(__FILE__, "sstssfb_activation_hook_vcheck");
这里有什么问题?