变更集55720
图例:
未修改 补充 远离的
-
trunk/src/wp-admin/includes/class-plugin-upgrader.php 53426兰特 55720兰特 227 227 “clear_working”=>true, 228 228 “hook_extra”=>数组( 229 “插件”=>$plugin, 230 “类型”=>“插件”, 231 '操作'=>'更新', 229 “插件”=>$plugin, 230 “type”=>“plugin”, 231 “action”=>“update”, 232 “temp_backup”=>数组( 233 “slug”=>目录名($plugin), 234 “src”=>WP_PLUGIN_DIR, 235 “dir”=>“插件”, 236 ), 232 237 ), 233 238 ) … … 343 348 “is_multi”=>为真, 344 349 “hook_extra”=>数组( 345 “插件”=>$plugin, 350 “插件”=>$plugin, 351 “temp_backup”=>数组( 352 “slug”=>目录名($plugin), 353 “src”=>WP_PLUGIN_DIR, 354 “dir”=>“插件”, 355 ), 346 356 ), 347 357 ) -
trunk/src/wp-admin/includes/class-theme-upgrader.php 53426兰特 55720兰特 329 329 'clear_working'=>真, 330 330 “hook_extra”=>数组( 331 “主题”=>$theme, 332 “type”=>“theme”, 333 “action”=>“update”, 331 “主题”=>$theme, 332 “type”=>“theme”, 333 “action”=>“update”, 334 “temp_backup”=>数组( 335 'slug'=>$theme, 336 'src'=>get_theme_root($theme), 337 “dir”=>“themes”, 338 ), 334 339 ), 335 340 ) … … 444 449 “is_multi”=>为真, 445 450 “hook_extra”=>数组( 446 “主题”=>$theme, 451 “主题”=>$theme, 452 “temp_backup”=>数组( 453 “slug”=>$theme, 454 “src”=>get_theme_root($theme), 455 “dir”=>“themes”, 456 ), 447 457 ), 448 458 ) -
trunk/src/wp-admin/includes/class-wp-site-health.php 55703兰特 55720兰特 1927 1927 1928 1928 /** 1929 *测试可用磁盘空间以进行更新。 1930 * 1931 *@自6.3.0起 1932 * 1933 *@return数组测试结果。 1934 */ 1935 公共函数get_test_available_updates_disk_space(){ 1936 $available_space=函数存在('disk_free_space')@ disk_free_space(WP_CONTENT_DIR.'/upgrade/'):false; 1937 1938 $available_space=false!==$ 可用空间 1939 ? (int)$available_space 1940 : 0; 1941 1942 $result=数组( 1943 “label”=>__(“可用于安全执行更新的磁盘空间”), 1944 “状态”=>“良好”, 1945 “徽章”=>阵列( 1946 '标签'=>__('安全性'), 1947 “颜色”=>“蓝色”, 1948 ), 1949 “描述”=>sprintf( 1950 /*转换器:%s:可用磁盘空间(MB或GB)*/ 1951 “<p>”__ (检测到“%s可用磁盘空间,可以安全地执行更新例程。”)</ p> ', 1952 大小格式($available_space) 1953 ), 1954 “操作”=>“”, 1955 “test”=>“available_updates_disk_space”, 1956 ); 1957 1958 如果($available_space<100*MB_IN_BYTES){ 1959 $result['description']=__('可用磁盘空间不足,不足100 MB可用。'); 1960 $result['status']='推荐'; 1961 } 1962 1963 如果($available_space<20*MB_IN_BYTES){ 1964 $result['description']=__('可用磁盘空间严重不足,不足20 MB。请谨慎操作,更新可能会失败。'); 1965 $result['status']='critical'; 1966 } 1967 1968 if(!$available_space){ 1969 $result['description']=__('无法确定用于更新的可用磁盘空间。'); 1970 $result['status']='推荐'; 1971 } 1972 1973 返回$result; 1974 } 1975 1976 /** 1977 *测试插件和主题临时备份目录是否可写或可以创建。 1978 * 1979 *@自6.3.0起 1980 * 1981 *@global WP_Filesystem_Base$WP_Filesystem WordPress文件系统子类。 1982 * 1983 *@return数组测试结果。 1984 */ 1985 公共函数get_test_update_temp_backup_writeable(){ 1986 全局$wp_filesystem; 1987 1988 $result=数组( 1989 “label”=>__(“插件和主题临时备份目录可写”), 1990 “状态”=>“良好”, 1991 “徽章”=>阵列( 1992 “标签”=>__(“安全”), 1993 “颜色”=>“蓝色”, 1994 ), 1995 “描述”=>sprintf( 1996 /*转换器:%s:wp-content/upgrade-tempbackup*/ 1997 “<p>”__ (“用于提高插件和主题更新稳定性的%s目录是可写的。”)</ p> ', 1998 “<code>wp-content/upgrade-temp-backup</code>” 1999 ), 2000 “操作”=>“”, 2001 “test”=>“update_temp_backup_writable”, 2002 ); 2003 2004 if(!$wp_filesystem){ 2005 需要一次ABSPATH。”/ wp-admin/includes/file.php'; 2006 WP_Filesystem(); 2007 } 2008 2009 $wp_content=$wp_filesystem->wp_condent_dir(); 2010 2011 if(!$wp_content){ 2012 $result['status']='critical'; 2013 $result['label']=冲刺( 2014 /*转换器:%s:wp-content*/ 2015 __('找不到WordPress内容目录(%s)'), 2016 “<code>wp-content</code>” 2017 ); 2018 $result['description']=冲刺( 2019 /*转换器:%s:wp-content*/ 2020 “<p>”__ (“找不到%s目录。”)。”</ p> ', 2021 “<code>wp-content</code>” 2022 ); 2023 返回$result; 2024 } 2025 2026 $upgrade_dir_exists=$wp_filesystem->is_dir(“$wp_content/upgrade”); 2027 $upgrade_dir_is_writable=$wp_filesystem->is_writeable(“$wp_content/upgrade”); 2028 $backup_dir_exists=$wp_filesystem->is_dir(“$wp_content/upgrade-temp-backup”); 2029 $backup_dir_is_writable=$wp_filesystem->is_writeable(“$wp_content/upgrade-temp-backup”); 2030 2031 $plugins_dir_exists=$wp_filesystem->is_dir(“$wp_content/upgrade-temp-backup/plugins”); 2032 $plugins_dir_is_writable=$wp_filesystem->is_writeable(“$wp_content/upgrade-temp-backup/plugins”); 2033 $themes_dir_exists=$wp_filesystem->is_dir(“$wp_content/upgrade-temp-backup/themes”); 2034 $themes_dir_is_writable=$wp_filesystem->is_writeable(“$wp_content/upgrade-temp-backup/themes”); 2035 2036 if($plugins_dir_exists&&!$plugins_dir_is_writeable&&$themes_dir_ists&&&!$themes_dir _is_writable){ 2037 $result[“状态”]=“关键”; 2038 $result['label']=__('插件和主题临时备份目录存在,但不可写'); 2039 $result['description']=冲刺( 2040 /*翻译人员:1:wp-content/upgrade-tempbackup/plugins,2:wp-content/upgrade.tempbackup/themes*/ 2041 “<p>”__ (“%1$s和%2$s目录存在,但不可写入。这些目录用于提高插件更新的稳定性。请确保服务器对这些目录具有写入权限。”)</ p> ', 2042 “<code>wp-content/upgrade-temp-backup/plugins</code>”, 2043 “<code>wp-content/upgrade-temp-backup/themes</code>” 2044 ); 2045 返回$result; 2046 } 2047 2048 if($plugins_dir_exists&&!$plugins_dir_is_writeable){ 2049 $result['status']='critical'; 2050 $result['label']=__('插件临时备份目录存在但不可写'); 2051 $result['description']=冲刺( 2052 /*转换器:%s:wp-content/upgrade-temp-backup/plugins*/ 2053 “<p>”__ (“%s目录存在,但不可写入。此目录用于提高插件更新的稳定性。请确保服务器具有对此目录的写入权限。”)</ p> ', 2054 “<code>wp-content/upgrade-temp-backup/plugins</code>” 2055 ); 2056 返回$result; 2057 } 2058 2059 if($themes_dir_exists&&!$themes-dir_is_writeable){ 2060 $result[“状态”]=“关键”; 2061 $result['label']=__('主题临时备份目录存在但不可写'); 2062 $result['description']=冲刺( 2063 /*转换器:%s:wp-content/upgrade-temp-backup/themes*/ 2064 “<p>”__ (“%s目录存在,但不可写入。此目录用于提高主题更新的稳定性。请确保服务器具有对此目录的写入权限。”)</ p> ', 2065 “<code>wp-content/upgrade-temp-backup/themes</code>” 2066 ); 2067 返回$result; 2068 } 2069 2070 if((!$plugins_dir_exists||!$themes_dir_exexists)&&$backup_dir_xists&&$ backup_dir_is_writeable){ 2071 $result['status']='critical'; 2072 $result['label']=__('临时备份目录存在但不可写'); 2073 $result['description']=冲刺( 2074 /*转换器:%s:wp-content/upgrade-tempbackup*/ 2075 “<p>”__ (“%s目录存在,但不可写入。此目录用于提高插件和主题更新的稳定性。请确保服务器具有对此目录的写入权限。”)</ p> ', 2076 “<code>wp-content/upgrade-temp-backup</code>” 2077 ); 2078 返回$result; 2079 } 2080 2081 如果(!$backup_dir_exists&&$upgrade_dir_xists&&!$upgrate_dir_is_writeable){ 2082 $result['status']='critical'; 2083 $result['label']=冲刺( 2084 /*转换器:%s:升级*/ 2085 __('%s目录存在但不可写'), 2086 “升级” 2087 ); 2088 $result['description']=冲刺( 2089 /*转换器:%s:wp-content/upgrade*/ 2090 “<p>”__ (“%s目录存在,但不可写。此目录用于插件和主题更新。请确保服务器具有此目录的写入权限。”)</ p> ', 2091 “<code>wp-content/upgrade</code>” 2092 ); 2093 返回$result; 2094 } 2095 2096 如果(!$upgradedir_exists&&!$wp_filesystem->is_writable($wp_content)){ 2097 $result['status']='critical'; 2098 $result['label']=冲刺( 2099 /*转换器:%s:升级*/ 2100 __('无法创建%s目录'), 2101 “升级” 2102 ); 2103 $result['description']=冲刺( 2104 /*翻译人员:1:wp-content/upgrade,2:wp-content*/ 2105 “<p>”__ (“%1$s目录不存在,服务器在%2$s中没有写入权限来创建它。此目录用于插件和主题更新。请确保服务器在%2$s中具有写入权限。”)</ p> ', 2106 “<code>wp-content/upgrade</code>”, 2107 “<code>wp-content</code>” 2108 ); 2109 返回$result; 2110 } 2111 2112 返回$result; 2113 } 2114 2115 /** 1929 2116 *测试环回是否按预期工作。 1930 2117 * … … 2533 2720 $tests=数组( 2534 2721 “direct”=>数组( 2535 '文字印刷版本' =>数组( 2722 '文字印刷版本' =>数组( 2536 2723 “label”=>__(“WordPress版本”), 2537 2724 “测试”=>“wordpress_version”, 2538 2725 ), 2539 '插件版本' =>数组( 2726 '插件版本' =>数组( 2540 2727 “label”=>__(“插件版本”), 2541 2728 “测试”=>“插件版本”, 2542 2729 ), 2543 '主题_版本' =>数组( 2730 '主题_版本' =>数组( 2544 2731 “标签”=>__(“主题版本”), 2545 2732 “test”=>“theme_version”, 2546 2733 ), 2547 “php_version” =>数组( 2734 “php_version” =>数组( 2548 2735 “label”=>__(“PHP版本”), 2549 2736 “测试”=>“php_version”, 2550 2737 ), 2551 “php_extensions” =>数组( 2738 “php_extensions” =>数组( 2552 2739 “label”=>__(“PHP扩展”), 2553 2740 “test”=>“php_extensions”, 2554 2741 ), 2555 “php_default_timezone” =>数组( 2742 “php_default_timezone” =>数组( 2556 2743 “label”=>__(“PHP默认时区”), 2557 2744 “test”=>“php_default_timezone”, 2558 2745 ), 2559 “php_sessions” =>数组( 2746 'php会话' =>数组( 2560 2747 “label”=>__(“PHP会话”), 2561 2748 “test”=>“php_sessions”, 2562 2749 ), 2563 'sql服务器' =>阵列( 2750 “sql_server” =>数组( 2564 2751 '标签'=>__('数据库服务器版本'), 2565 2752 “测试”=>“sql_server”, 2566 2753 ), 2567 'utf8mb4_支持' =>数组( 2754 'utf8mb4_支持' =>数组( 2568 2755 “label”=>__(“MySQL utf8mb4支持”), 2569 2756 “测试”=>“utf8mb4_support”, 2570 2757 ), 2571 “ssl_support” =>数组( 2758 'ssl_support' =>数组( 2572 2759 “标签”=>__(“安全通信”), 2573 2760 “测试”=>“ssl_support”, 2574 2761 ), 2575 '计划的事件' =>数组( 2762 '已调度事件' =>数组( 2576 2763 “标签”=>__(“预定事件”), 2577 2764 “test”=>“scheduled_events”, 2578 2765 ), 2579 “http_requests” =>数组( 2766 “http_requests” =>数组( 2580 2767 “标签”=>__(“HTTP请求”), 2581 2768 “测试”=>“http_requests”, 2582 2769 ), 2583 '恢复可用性' =>数组( 2770 '恢复可用性' =>数组( 2584 2771 “标签”=>__(“REST API可用性”), 2585 2772 “test”=>“rest_availability”, 2586 2773 “skip_cron”=>true, 2587 2774 ), 2588 “debug_enabled” =>阵列( 2775 “debug_enabled” =>数组( 2589 2776 “label”=>__(“启用调试”), 2590 2777 “测试”=>“is_in_debug_mode”, 2591 2778 ), 2592 '文件上传' =>数组( 2779 '文件上传' =>数组( 2593 2780 '标签'=>__('文件上传'), 2594 2781 “test”=>“file_uploads”, 2595 2782 ), 2596 '插件_主题_自动更新' =>数组( 2783 '插件_主题_自动更新' =>数组( 2597 2784 “label”=>__(“插件和主题自动更新”), 2598 2785 “test”=>“plugin_theme_auto_updates”, 2786 ), 2787 “update_temp_backup_writable”=>数组( 2788 “label”=>__(“插件和主题临时备份目录访问”), 2789 “test”=>“update_temp_backup_writable”, 2790 ), 2791 “available_updates_disk_space”=>数组( 2792 '标签'=>__('可用磁盘空间'), 2793 “test”=>“available_updates_disk_space”, 2599 2794 ), 2600 2795 ), -
trunk/src/wp-admin/includes/class-wp-upgrader.php 55258兰特 55720兰特 114 114 115 115 /** 116 *存储添加到临时备份目录的插件或主题列表。 117 * 118 *由回滚功能使用。 119 * 120 *@自6.3.0起 121 *@var数组 122 */ 123 私有$temp_backups=array(); 124 125 /** 126 *存储要从临时备份目录还原的插件或主题列表。 127 * 128 *由回滚功能使用。 129 * 130 *@自6.3.0起 131 *@var数组 132 */ 133 私有$temp_restores=数组(); 134 135 /** 116 136 *用皮肤构建升级程序。 117 137 * … … 135 155 *并将通用字符串添加到`WP_Upgrader::$strings`。 136 156 * 157 *此外,它将安排每周清理临时备份目录的任务。 158 * 137 159 *@自2.8.0起 160 *@自6.3.0起添加了`schedule_temp_backup_cleanup()`任务。 138 161 */ 139 162 公共函数init(){ 140 163 $this->skin->set_upgrader($this); 141 164 $this->generic_strings(); 165 166 if(!wp_installing()){ 167 $this->schedule_temp_backup_cleanup(); 168 } 169 } 170 171 /** 172 *安排临时备份目录的清理。 173 * 174 *@自6.3.0起 175 */ 176 受保护函数schedule_temp_backup_cleanup(){ 177 if(false===wp_next_scheduled('wp_delete_temp_updater_backups')){ 178 wp_schedule_event(时间(),'每周','wp_delete_temp_updater_backups'); 179 } 142 180 } 143 181 … … 168 206 $this->strings['maintenance_start']=__('启用维护模式…;'); 169 207 $this->strings['maintenance_end']=__('禁用维护模式…;'); 208 209 /*转换器:%s:upgrade-tempbackup*/ 210 $this->strings['temp_backup_mkdir_failed']=sprintf(__('无法创建%s目录'),'upgrade-temp-backup'); 211 /*转换器:%s:升级临时备份*/ 212 $this->strings['temp_backup_move_failed']=sprintf(__('无法将旧版本移动到%s目录。'),'upgrade-temp-backup'); 213 /*转换器:%s:插件或主题slug*/ 214 $this->strings['temp_backup_restore_failed']=__('无法还原%s的原始版本'); 215 /*转换器:%s:插件或主题slug*/ 216 $this->strings['temp_backup_delete_failed']=__('无法删除%s的临时备份目录'); 170 217 } 171 218 … … 309 356 $this->skin->反馈(“unpack_package”); 310 357 358 if(!$wp_filesystem->wp_content_dir()){ 359 返回新的WP_Error(“fs_no_content_dir”,$this->strings['fs_no_content_dir']); 360 } 361 311 362 $upgrade_folder=$wp_filesystem->wp_content_dir()。' 升级/'; 312 363 … … 533 584 if(iswp_error($source)){ 534 585 返回$source; 586 } 587 588 if(!空($args['hook_extra']['temp_backup']){ 589 $temp_backup=$this->move_to_temp_backup_dir($args['hook_extra']['temp_backup']); 590 591 if(iswp_error($temp_backup)){ 592 返回$temp_backup; 593 } 594 595 $this->temp_backups[]=$args['hook_extra']['temp_backup']; 535 596 } 536 597 … … 615 676 } 616 677 617 //清除工作 文件夹 ? 678 //清除工作 目录 ? 618 679 if($args['clear_working']){ 619 680 $wp_filesystem->delete($remote_source,true); … … 828 889 829 890 $this->skin->set_result($result); 891 830 892 if(iswp_error($result)){ 893 if(!empty($options['book_extra']['temp_backup']){ 894 $this->temp_restore[]=$options['hook_extra']['temp_backup']; 895 896 /* 897 *关闭时恢复备份。 898 *在“shutdown”上运行的操作不会受到PHP超时的影响, 899 *因此,如果故障是由于PHP超时造成的, 900 *它仍然能够正确恢复以前的版本。 901 */ 902 add_action('shutdown',数组($this,'restore_temp_backup')); 903 } 831 904 $this->skin->error($result); 832 905 … … 840 913 841 914 $this->skin->after(); 915 916 //清理临时备份目录中保存的备份。 917 if(!空($options['hook_extra']['temp_backup']){ 918 //删除“shutdown”时的备份以避免PHP超时。 919 add_action('shutdown',数组($this,'delete_temp_backup'),100,0); 920 } 842 921 843 922 if(!$options['is_multi']){ … … 967 1046 return delete_option($lock_name.'.lock'); 968 1047 } 1048 1049 /** 1050 *将要更新的插件或主题移动到临时备份目录中。 1051 * 1052 *@自6.3.0起 1053 * 1054 *@global WP_Filesystem_Base$WP_Filesystem WordPress文件系统子类。 1055 * 1056 *@param字符串[]$args{ 1057 *用于临时备份的数据阵列。 1058 * 1059 *@type string$slug插件或主题slug。 1060 *@type string$src插件或主题的根目录路径。 1061 *@type string$dir目标子目录名称。 接受“插件”或“主题”。 1062 * } 1063 * 1064 *@return bool|WP_Error成功时为True,提前退出时为false,否则为WP_Error。 1065 */ 1066 公共函数move_to_temp_backup_dir($args){ 1067 全局$wp_filesystem; 1068 1069 if(空($args['slug'])||empty($args['src']){ 1070 返回false; 1071 } 1072 1073 /* 1074 *跳过任何以“.”作为其slug的插件。 1075 *插入“.”将导致`$src`值以句点结尾。 1076 * 1077 *在Windows上,这将导致“插件”文件夹被移动, 1078 *并在尝试调用“mkdir()”时导致失败。 1079 */ 1080 if('.'===$args['slug']){ 1081 返回false; 1082 } 1083 1084 if(!$wp_filesystem->wp_content_dir()){ 1085 返回新的WP_Error(“fs_no_content_dir”,$this->strings['fs_no_content_dir']); 1086 } 1087 1088 $dest_dir=$wp_filesystem->wp_content_dir()。' upgrade-tempbackup/'; 1089 $sub_dir=$dest_dir$ args['dir'].'/'; 1090 1091 //如果临时备份目录不存在,则创建该目录。 1092 if(!$wp_filesystem->is_dir($sub_dir)){ 1093 if(!$wp_filesystem->is_dir($dest_dir)){ 1094 $wp_filesystem->mkdir($dest_dir,FS_CHMOD_dir); 1095 } 1096 1097 if(!$wp_filesystem->mkdir($sub_dir,FS_CHMOD_dir)){ 1098 //无法创建备份目录。 1099 返回新的WP_Error('fs_temp_backup_mkdir',$this->strings['temp_backup_mkdir_failed']); 1100 } 1101 } 1102 1103 $src_dir=$wp_filesystem->find_folder($args['src']); 1104 $src=拖尾斜杠($src_dir)$ args['slug']; 1105 $dest=$dest_dir。 拖尾斜杠($args['dir'])$ args['slug']; 1106 1107 //如果临时备份目录已经存在,则删除该目录。 1108 if($wp_filesystem->is_dir($dest)){ 1109 $wp_filesystem->delete($dest,true); 1110 } 1111 1112 //移动到临时备份目录。 1113 $result=move_dir($src,$dest,true); 1114 if(iswp_error($result)){ 1115 return new WP_Error('fs_temp_backup_move',$this->strings['temp_backup.move_failed']); 1116 } 1117 1118 返回true; 1119 } 1120 1121 /** 1122 *从临时备份中恢复插件或主题。 1123 * 1124 *@自6.3.0起 1125 * 1126 *@global WP_Filesystem_Base$WP_Filesystem WordPress文件系统子类。 1127 * 1128 *@return bool|WP_Error成功时为True,提前退出时为false,否则为WP_Error。 1129 */ 1130 公共函数restore_temp_backup(){ 1131 全局$wp_filesystem; 1132 1133 $errors=新WP_Error(); 1134 1135 foreach($this->temp_restores作为$args){ 1136 if(空($args['slug'])||empty($args['src']){ 1137 返回false; 1138 } 1139 1140 if(!$wp_filesystem->wp_content_dir()){ 1141 $errors->add(“fs_no_content_dir”,$this->strings['fs_no_content_dir']); 1142 返回$errors; 1143 } 1144 1145 $src=$wp_filesystem->wp_content_dir()。' upgrade-tempbackup/'$ args['dir'].'/'$ args['slug']; 1146 $dest_dir=$wp_filesystem->find_folder($args['src']); 1147 $dest=拖尾斜杠($dest_dir)$ args['slug']; 1148 1149 if($wp_filesystem->is_dir($src)){ 1150 //清理。 1151 if($wp_filesystem->is_dir($dest)&$ wp_filesystem->delete($dest,true){ 1152 $错误->添加( 1153 “fs_temp_backup_delete”, 1154 sprintf($this->strings['temp_backup_restore_failed'],$args['slug']) 1155 ); 1156 继续; 1157 } 1158 1159 //移动它。 1160 $result=move_dir($src,$dest,true); 1161 if(iswp_error($result)){ 1162 $错误->添加( 1163 “fs_temp_backup_delete”, 1164 sprintf($this->strings['temp_backup_restore_failed'],$args['slug']) 1165 ); 1166 继续; 1167 } 1168 } 1169 } 1170 1171 返回$errors->has_errors()$ 错误:true; 1172 } 1173 1174 /** 1175 *删除临时备份。 1176 * 1177 *@自6.3.0起 1178 * 1179 *@global WP_Filesystem_Base$WP_Filesystem WordPress文件系统子类。 1180 * 1181 *@return bool|WP_Error成功时为True,提前退出时为false,否则为WP_Error。 1182 */ 1183 公共函数delete_temp_backup(){ 1184 全局$wp_filesystem; 1185 1186 $errors=新WP_Error(); 1187 1188 foreach($this->temp_backups作为$args){ 1189 if(空($args['slug'])||empty($args['dir'])){ 1190 返回false; 1191 } 1192 1193 if(!$wp_filesystem->wp_content_dir()){ 1194 $errors->add(“fs_no_content_dir”,$this->strings['fs_no_content_dir']); 1195 返回$errors; 1196 } 1197 1198 $temp_backup_dir=$wp_filesystem->wp_content_dir()。 “upgrade-temp-backup/{$args['dir']}/{$args['slug']}”; 1199 1200 if(!$wp_filesystem->delete($temp_backup_dir,true)){ 1201 $错误->添加( 1202 '临时备份删除失败', 1203 sprintf($this->strings['temp_backup_delete_failed']), 1204 $args[“插入”] 1205 ); 1206 继续; 1207 } 1208 } 1209 1210 返回$errors->has_errors()$ 错误:true; 1211 } 969 1212 } 970 1213 -
trunk/src/wp-includes/update.php 55641兰特 55720兰特 1078 1078 } 1079 1079 1080 /** 1081 *计划删除临时备份目录中的所有内容。 1082 * 1083 *@自6.3.0起 1084 */ 1085 函数wp_delete_all_temp_backups(){ 1086 /* 1087 *检查是否有锁,或者当前是否正在执行Ajax请求, 1088 *在这种情况下,可能正在运行更新。 1089 *从现在开始重新安排一个小时,并提前退出。 1090 */ 1091 if(get_option('core_updater.lock')||get_option['auto_updater.lock')|| wp_doing_ajax()){ 1092 wp_schedule_single_event(时间()+小时_IN_SECONDS,'wp_delete_temp_updater_backups'); 1093 回报; 1094 } 1095 1096 //此操作在关闭时运行,以确保当前没有正在运行的插件更新。 1097 add_action('关机','_wp_delete_all_temp_backups'); 1098 } 1099 1100 /** 1101 *删除临时备份目录中的所有内容。 1102 * 1103 *@自6.3.0起 1104 * 1105 *@access私有 1106 * 1107 *@global WP_Filesystem_Base$WP_Filesystem WordPress文件系统子类。 1108 * 1109 *@return void |成功时为WP_Error void,失败时为WP-Error对象。 1110 */ 1111 函数_wp_delete_all_temp_backups(){ 1112 全局$wp_filesystem; 1113 1114 if(!$wp_filesystem){ 1115 需要一次ABSPATH。”/ wp-admin/includs/file.php’; 1116 WP_Filesystem(); 1117 } 1118 1119 if(!$wp_filesystem->wp_content_dir()){ 1120 return new WP_Error('fs_no_content_dir',__('找不到WordPress内容目录(WP-content)。'); 1121 } 1122 1123 $temp_backup_dir=$wp_filesystem->wp_content_dir()。' upgrade-tempbackup/'; 1124 $dirlist=$wp_filesystem->目录列表($temp_backup_dir); 1125 $dirlist=$dirlist$ 目录列表:array(); 1126 1127 foreach(array_keys($dirlist)作为$dir){ 1128 if('.'===$dir | |'..'==$dir){ 1129 继续; 1130 } 1131 1132 $wp_filesystem->delete($temp_backup_dir.$dir,true); 1133 } 1134 } 1135 1080 1136 if((!is_main_site()&&!)! is_network_admin()||wp_doing_ajax()){ 1081 1137 回报; … … 1102 1158 1103 1159 add_action('init','wp_schedule_update_checks'); 1160 1161 add_action('wp_delete_temp_updater_backups','wp_delete_all_temp_备份');