0
|
1 |
<?php |
|
2 |
/** |
|
3 |
* WordPress core upgrade functionality. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
* @since 2.7.0 |
|
8 |
*/ |
|
9 |
|
|
10 |
/** |
|
11 |
* Stores files to be deleted. |
|
12 |
* |
|
13 |
* @since 2.7.0 |
|
14 |
* @global array $_old_files |
|
15 |
* @var array |
|
16 |
* @name $_old_files |
|
17 |
*/ |
|
18 |
global $_old_files; |
|
19 |
|
|
20 |
$_old_files = array( |
|
21 |
// 2.0 |
|
22 |
'wp-admin/import-b2.php', |
|
23 |
'wp-admin/import-blogger.php', |
|
24 |
'wp-admin/import-greymatter.php', |
|
25 |
'wp-admin/import-livejournal.php', |
|
26 |
'wp-admin/import-mt.php', |
|
27 |
'wp-admin/import-rss.php', |
|
28 |
'wp-admin/import-textpattern.php', |
|
29 |
'wp-admin/quicktags.js', |
|
30 |
'wp-images/fade-butt.png', |
|
31 |
'wp-images/get-firefox.png', |
|
32 |
'wp-images/header-shadow.png', |
|
33 |
'wp-images/smilies', |
|
34 |
'wp-images/wp-small.png', |
|
35 |
'wp-images/wpminilogo.png', |
|
36 |
'wp.php', |
|
37 |
// 2.0.8 |
|
38 |
'wp-includes/js/tinymce/plugins/inlinepopups/readme.txt', |
|
39 |
// 2.1 |
|
40 |
'wp-admin/edit-form-ajax-cat.php', |
|
41 |
'wp-admin/execute-pings.php', |
|
42 |
'wp-admin/inline-uploading.php', |
|
43 |
'wp-admin/link-categories.php', |
|
44 |
'wp-admin/list-manipulation.js', |
|
45 |
'wp-admin/list-manipulation.php', |
|
46 |
'wp-includes/comment-functions.php', |
|
47 |
'wp-includes/feed-functions.php', |
|
48 |
'wp-includes/functions-compat.php', |
|
49 |
'wp-includes/functions-formatting.php', |
|
50 |
'wp-includes/functions-post.php', |
|
51 |
'wp-includes/js/dbx-key.js', |
|
52 |
'wp-includes/js/tinymce/plugins/autosave/langs/cs.js', |
|
53 |
'wp-includes/js/tinymce/plugins/autosave/langs/sv.js', |
|
54 |
'wp-includes/links.php', |
|
55 |
'wp-includes/pluggable-functions.php', |
|
56 |
'wp-includes/template-functions-author.php', |
|
57 |
'wp-includes/template-functions-category.php', |
|
58 |
'wp-includes/template-functions-general.php', |
|
59 |
'wp-includes/template-functions-links.php', |
|
60 |
'wp-includes/template-functions-post.php', |
|
61 |
'wp-includes/wp-l10n.php', |
|
62 |
// 2.2 |
|
63 |
'wp-admin/cat-js.php', |
|
64 |
'wp-admin/import/b2.php', |
|
65 |
'wp-includes/js/autosave-js.php', |
|
66 |
'wp-includes/js/list-manipulation-js.php', |
|
67 |
'wp-includes/js/wp-ajax-js.php', |
|
68 |
// 2.3 |
|
69 |
'wp-admin/admin-db.php', |
|
70 |
'wp-admin/cat.js', |
|
71 |
'wp-admin/categories.js', |
|
72 |
'wp-admin/custom-fields.js', |
|
73 |
'wp-admin/dbx-admin-key.js', |
|
74 |
'wp-admin/edit-comments.js', |
|
75 |
'wp-admin/install-rtl.css', |
|
76 |
'wp-admin/install.css', |
|
77 |
'wp-admin/upgrade-schema.php', |
|
78 |
'wp-admin/upload-functions.php', |
|
79 |
'wp-admin/upload-rtl.css', |
|
80 |
'wp-admin/upload.css', |
|
81 |
'wp-admin/upload.js', |
|
82 |
'wp-admin/users.js', |
|
83 |
'wp-admin/widgets-rtl.css', |
|
84 |
'wp-admin/widgets.css', |
|
85 |
'wp-admin/xfn.js', |
|
86 |
'wp-includes/js/tinymce/license.html', |
|
87 |
// 2.5 |
|
88 |
'wp-admin/css/upload.css', |
|
89 |
'wp-admin/images/box-bg-left.gif', |
|
90 |
'wp-admin/images/box-bg-right.gif', |
|
91 |
'wp-admin/images/box-bg.gif', |
|
92 |
'wp-admin/images/box-butt-left.gif', |
|
93 |
'wp-admin/images/box-butt-right.gif', |
|
94 |
'wp-admin/images/box-butt.gif', |
|
95 |
'wp-admin/images/box-head-left.gif', |
|
96 |
'wp-admin/images/box-head-right.gif', |
|
97 |
'wp-admin/images/box-head.gif', |
|
98 |
'wp-admin/images/heading-bg.gif', |
|
99 |
'wp-admin/images/login-bkg-bottom.gif', |
|
100 |
'wp-admin/images/login-bkg-tile.gif', |
|
101 |
'wp-admin/images/notice.gif', |
|
102 |
'wp-admin/images/toggle.gif', |
|
103 |
'wp-admin/includes/upload.php', |
|
104 |
'wp-admin/js/dbx-admin-key.js', |
|
105 |
'wp-admin/js/link-cat.js', |
|
106 |
'wp-admin/profile-update.php', |
|
107 |
'wp-admin/templates.php', |
|
108 |
'wp-includes/images/wlw/WpComments.png', |
|
109 |
'wp-includes/images/wlw/WpIcon.png', |
|
110 |
'wp-includes/images/wlw/WpWatermark.png', |
|
111 |
'wp-includes/js/dbx.js', |
|
112 |
'wp-includes/js/fat.js', |
|
113 |
'wp-includes/js/list-manipulation.js', |
|
114 |
'wp-includes/js/tinymce/langs/en.js', |
|
115 |
'wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js', |
|
116 |
'wp-includes/js/tinymce/plugins/autosave/langs', |
|
117 |
'wp-includes/js/tinymce/plugins/directionality/images', |
|
118 |
'wp-includes/js/tinymce/plugins/directionality/langs', |
|
119 |
'wp-includes/js/tinymce/plugins/inlinepopups/css', |
|
120 |
'wp-includes/js/tinymce/plugins/inlinepopups/images', |
|
121 |
'wp-includes/js/tinymce/plugins/inlinepopups/jscripts', |
|
122 |
'wp-includes/js/tinymce/plugins/paste/images', |
|
123 |
'wp-includes/js/tinymce/plugins/paste/jscripts', |
|
124 |
'wp-includes/js/tinymce/plugins/paste/langs', |
|
125 |
'wp-includes/js/tinymce/plugins/spellchecker/classes/HttpClient.class.php', |
|
126 |
'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php', |
|
127 |
'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php', |
|
128 |
'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php', |
|
129 |
'wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css', |
|
130 |
'wp-includes/js/tinymce/plugins/spellchecker/images', |
|
131 |
'wp-includes/js/tinymce/plugins/spellchecker/langs', |
|
132 |
'wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php', |
|
133 |
'wp-includes/js/tinymce/plugins/wordpress/images', |
|
134 |
'wp-includes/js/tinymce/plugins/wordpress/langs', |
|
135 |
'wp-includes/js/tinymce/plugins/wordpress/wordpress.css', |
|
136 |
'wp-includes/js/tinymce/plugins/wphelp', |
|
137 |
'wp-includes/js/tinymce/themes/advanced/css', |
|
138 |
'wp-includes/js/tinymce/themes/advanced/images', |
|
139 |
'wp-includes/js/tinymce/themes/advanced/jscripts', |
|
140 |
'wp-includes/js/tinymce/themes/advanced/langs', |
|
141 |
// 2.5.1 |
|
142 |
'wp-includes/js/tinymce/tiny_mce_gzip.php', |
|
143 |
// 2.6 |
|
144 |
'wp-admin/bookmarklet.php', |
|
145 |
'wp-includes/js/jquery/jquery.dimensions.min.js', |
|
146 |
'wp-includes/js/tinymce/plugins/wordpress/popups.css', |
|
147 |
'wp-includes/js/wp-ajax.js', |
|
148 |
// 2.7 |
|
149 |
'wp-admin/css/press-this-ie-rtl.css', |
|
150 |
'wp-admin/css/press-this-ie.css', |
|
151 |
'wp-admin/css/upload-rtl.css', |
|
152 |
'wp-admin/edit-form.php', |
|
153 |
'wp-admin/images/comment-pill.gif', |
|
154 |
'wp-admin/images/comment-stalk-classic.gif', |
|
155 |
'wp-admin/images/comment-stalk-fresh.gif', |
|
156 |
'wp-admin/images/comment-stalk-rtl.gif', |
|
157 |
'wp-admin/images/del.png', |
|
158 |
'wp-admin/images/gear.png', |
|
159 |
'wp-admin/images/media-button-gallery.gif', |
|
160 |
'wp-admin/images/media-buttons.gif', |
|
161 |
'wp-admin/images/postbox-bg.gif', |
|
162 |
'wp-admin/images/tab.png', |
|
163 |
'wp-admin/images/tail.gif', |
|
164 |
'wp-admin/js/forms.js', |
|
165 |
'wp-admin/js/upload.js', |
|
166 |
'wp-admin/link-import.php', |
|
167 |
'wp-includes/images/audio.png', |
|
168 |
'wp-includes/images/css.png', |
|
169 |
'wp-includes/images/default.png', |
|
170 |
'wp-includes/images/doc.png', |
|
171 |
'wp-includes/images/exe.png', |
|
172 |
'wp-includes/images/html.png', |
|
173 |
'wp-includes/images/js.png', |
|
174 |
'wp-includes/images/pdf.png', |
|
175 |
'wp-includes/images/swf.png', |
|
176 |
'wp-includes/images/tar.png', |
|
177 |
'wp-includes/images/text.png', |
|
178 |
'wp-includes/images/video.png', |
|
179 |
'wp-includes/images/zip.png', |
|
180 |
'wp-includes/js/tinymce/tiny_mce_config.php', |
|
181 |
'wp-includes/js/tinymce/tiny_mce_ext.js', |
|
182 |
// 2.8 |
|
183 |
'wp-admin/js/users.js', |
|
184 |
'wp-includes/js/swfupload/plugins/swfupload.documentready.js', |
|
185 |
'wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', |
|
186 |
'wp-includes/js/swfupload/swfupload_f9.swf', |
|
187 |
'wp-includes/js/tinymce/plugins/autosave', |
|
188 |
'wp-includes/js/tinymce/plugins/paste/css', |
|
189 |
'wp-includes/js/tinymce/utils/mclayer.js', |
|
190 |
'wp-includes/js/tinymce/wordpress.css', |
|
191 |
// 2.8.5 |
|
192 |
'wp-admin/import/btt.php', |
|
193 |
'wp-admin/import/jkw.php', |
|
194 |
// 2.9 |
|
195 |
'wp-admin/js/page.dev.js', |
|
196 |
'wp-admin/js/page.js', |
|
197 |
'wp-admin/js/set-post-thumbnail-handler.dev.js', |
|
198 |
'wp-admin/js/set-post-thumbnail-handler.js', |
|
199 |
'wp-admin/js/slug.dev.js', |
|
200 |
'wp-admin/js/slug.js', |
|
201 |
'wp-includes/gettext.php', |
|
202 |
'wp-includes/js/tinymce/plugins/wordpress/js', |
|
203 |
'wp-includes/streams.php', |
|
204 |
// MU |
|
205 |
'README.txt', |
|
206 |
'htaccess.dist', |
|
207 |
'index-install.php', |
|
208 |
'wp-admin/css/mu-rtl.css', |
|
209 |
'wp-admin/css/mu.css', |
|
210 |
'wp-admin/images/site-admin.png', |
|
211 |
'wp-admin/includes/mu.php', |
|
212 |
'wp-admin/wpmu-admin.php', |
|
213 |
'wp-admin/wpmu-blogs.php', |
|
214 |
'wp-admin/wpmu-edit.php', |
|
215 |
'wp-admin/wpmu-options.php', |
|
216 |
'wp-admin/wpmu-themes.php', |
|
217 |
'wp-admin/wpmu-upgrade-site.php', |
|
218 |
'wp-admin/wpmu-users.php', |
|
219 |
'wp-includes/images/wordpress-mu.png', |
|
220 |
'wp-includes/wpmu-default-filters.php', |
|
221 |
'wp-includes/wpmu-functions.php', |
|
222 |
'wpmu-settings.php', |
|
223 |
// 3.0 |
|
224 |
'wp-admin/categories.php', |
|
225 |
'wp-admin/edit-category-form.php', |
|
226 |
'wp-admin/edit-page-form.php', |
|
227 |
'wp-admin/edit-pages.php', |
|
228 |
'wp-admin/images/admin-header-footer.png', |
|
229 |
'wp-admin/images/browse-happy.gif', |
|
230 |
'wp-admin/images/ico-add.png', |
|
231 |
'wp-admin/images/ico-close.png', |
|
232 |
'wp-admin/images/ico-edit.png', |
|
233 |
'wp-admin/images/ico-viewpage.png', |
|
234 |
'wp-admin/images/fav-top.png', |
|
235 |
'wp-admin/images/screen-options-left.gif', |
|
236 |
'wp-admin/images/wp-logo-vs.gif', |
|
237 |
'wp-admin/images/wp-logo.gif', |
|
238 |
'wp-admin/import', |
|
239 |
'wp-admin/js/wp-gears.dev.js', |
|
240 |
'wp-admin/js/wp-gears.js', |
|
241 |
'wp-admin/options-misc.php', |
|
242 |
'wp-admin/page-new.php', |
|
243 |
'wp-admin/page.php', |
|
244 |
'wp-admin/rtl.css', |
|
245 |
'wp-admin/rtl.dev.css', |
|
246 |
'wp-admin/update-links.php', |
|
247 |
'wp-admin/wp-admin.css', |
|
248 |
'wp-admin/wp-admin.dev.css', |
|
249 |
'wp-includes/js/codepress', |
|
250 |
'wp-includes/js/codepress/engines/khtml.js', |
|
251 |
'wp-includes/js/codepress/engines/older.js', |
|
252 |
'wp-includes/js/jquery/autocomplete.dev.js', |
|
253 |
'wp-includes/js/jquery/autocomplete.js', |
|
254 |
'wp-includes/js/jquery/interface.js', |
|
255 |
'wp-includes/js/scriptaculous/prototype.js', |
|
256 |
'wp-includes/js/tinymce/wp-tinymce.js', |
|
257 |
// 3.1 |
|
258 |
'wp-admin/edit-attachment-rows.php', |
|
259 |
'wp-admin/edit-link-categories.php', |
|
260 |
'wp-admin/edit-link-category-form.php', |
|
261 |
'wp-admin/edit-post-rows.php', |
|
262 |
'wp-admin/images/button-grad-active-vs.png', |
|
263 |
'wp-admin/images/button-grad-vs.png', |
|
264 |
'wp-admin/images/fav-arrow-vs-rtl.gif', |
|
265 |
'wp-admin/images/fav-arrow-vs.gif', |
|
266 |
'wp-admin/images/fav-top-vs.gif', |
|
267 |
'wp-admin/images/list-vs.png', |
|
268 |
'wp-admin/images/screen-options-right-up.gif', |
|
269 |
'wp-admin/images/screen-options-right.gif', |
|
270 |
'wp-admin/images/visit-site-button-grad-vs.gif', |
|
271 |
'wp-admin/images/visit-site-button-grad.gif', |
|
272 |
'wp-admin/link-category.php', |
|
273 |
'wp-admin/sidebar.php', |
|
274 |
'wp-includes/classes.php', |
|
275 |
'wp-includes/js/tinymce/blank.htm', |
|
276 |
'wp-includes/js/tinymce/plugins/media/css/content.css', |
|
277 |
'wp-includes/js/tinymce/plugins/media/img', |
|
278 |
'wp-includes/js/tinymce/plugins/safari', |
|
279 |
// 3.2 |
|
280 |
'wp-admin/images/logo-login.gif', |
|
281 |
'wp-admin/images/star.gif', |
|
282 |
'wp-admin/js/list-table.dev.js', |
|
283 |
'wp-admin/js/list-table.js', |
|
284 |
'wp-includes/default-embeds.php', |
|
285 |
'wp-includes/js/tinymce/plugins/wordpress/img/help.gif', |
|
286 |
'wp-includes/js/tinymce/plugins/wordpress/img/more.gif', |
|
287 |
'wp-includes/js/tinymce/plugins/wordpress/img/toolbars.gif', |
|
288 |
'wp-includes/js/tinymce/themes/advanced/img/fm.gif', |
|
289 |
'wp-includes/js/tinymce/themes/advanced/img/sflogo.png', |
|
290 |
// 3.3 |
|
291 |
'wp-admin/css/colors-classic-rtl.css', |
|
292 |
'wp-admin/css/colors-classic-rtl.dev.css', |
|
293 |
'wp-admin/css/colors-fresh-rtl.css', |
|
294 |
'wp-admin/css/colors-fresh-rtl.dev.css', |
|
295 |
'wp-admin/css/dashboard-rtl.css', |
|
296 |
'wp-admin/css/dashboard-rtl.dev.css', |
|
297 |
'wp-admin/css/dashboard.css', |
|
298 |
'wp-admin/css/dashboard.dev.css', |
|
299 |
'wp-admin/css/farbtastic-rtl.css', |
|
300 |
'wp-admin/css/global-rtl.css', |
|
301 |
'wp-admin/css/global-rtl.dev.css', |
|
302 |
'wp-admin/css/global.css', |
|
303 |
'wp-admin/css/global.dev.css', |
|
304 |
'wp-admin/css/install-rtl.css', |
|
305 |
'wp-admin/css/install-rtl.dev.css', |
|
306 |
'wp-admin/css/login-rtl.css', |
|
307 |
'wp-admin/css/login-rtl.dev.css', |
|
308 |
'wp-admin/css/login.css', |
|
309 |
'wp-admin/css/login.dev.css', |
|
310 |
'wp-admin/css/ms.css', |
|
311 |
'wp-admin/css/ms.dev.css', |
|
312 |
'wp-admin/css/nav-menu-rtl.css', |
|
313 |
'wp-admin/css/nav-menu-rtl.dev.css', |
|
314 |
'wp-admin/css/nav-menu.css', |
|
315 |
'wp-admin/css/nav-menu.dev.css', |
|
316 |
'wp-admin/css/plugin-install-rtl.css', |
|
317 |
'wp-admin/css/plugin-install-rtl.dev.css', |
|
318 |
'wp-admin/css/plugin-install.css', |
|
319 |
'wp-admin/css/plugin-install.dev.css', |
|
320 |
'wp-admin/css/press-this-rtl.css', |
|
321 |
'wp-admin/css/press-this-rtl.dev.css', |
|
322 |
'wp-admin/css/press-this.css', |
|
323 |
'wp-admin/css/press-this.dev.css', |
|
324 |
'wp-admin/css/theme-editor-rtl.css', |
|
325 |
'wp-admin/css/theme-editor-rtl.dev.css', |
|
326 |
'wp-admin/css/theme-editor.css', |
|
327 |
'wp-admin/css/theme-editor.dev.css', |
|
328 |
'wp-admin/css/theme-install-rtl.css', |
|
329 |
'wp-admin/css/theme-install-rtl.dev.css', |
|
330 |
'wp-admin/css/theme-install.css', |
|
331 |
'wp-admin/css/theme-install.dev.css', |
|
332 |
'wp-admin/css/widgets-rtl.css', |
|
333 |
'wp-admin/css/widgets-rtl.dev.css', |
|
334 |
'wp-admin/css/widgets.css', |
|
335 |
'wp-admin/css/widgets.dev.css', |
|
336 |
'wp-admin/includes/internal-linking.php', |
|
337 |
'wp-includes/images/admin-bar-sprite-rtl.png', |
|
338 |
'wp-includes/js/jquery/ui.button.js', |
|
339 |
'wp-includes/js/jquery/ui.core.js', |
|
340 |
'wp-includes/js/jquery/ui.dialog.js', |
|
341 |
'wp-includes/js/jquery/ui.draggable.js', |
|
342 |
'wp-includes/js/jquery/ui.droppable.js', |
|
343 |
'wp-includes/js/jquery/ui.mouse.js', |
|
344 |
'wp-includes/js/jquery/ui.position.js', |
|
345 |
'wp-includes/js/jquery/ui.resizable.js', |
|
346 |
'wp-includes/js/jquery/ui.selectable.js', |
|
347 |
'wp-includes/js/jquery/ui.sortable.js', |
|
348 |
'wp-includes/js/jquery/ui.tabs.js', |
|
349 |
'wp-includes/js/jquery/ui.widget.js', |
|
350 |
'wp-includes/js/l10n.dev.js', |
|
351 |
'wp-includes/js/l10n.js', |
|
352 |
'wp-includes/js/tinymce/plugins/wplink/css', |
|
353 |
'wp-includes/js/tinymce/plugins/wplink/img', |
|
354 |
'wp-includes/js/tinymce/plugins/wplink/js', |
|
355 |
'wp-includes/js/tinymce/themes/advanced/img/wpicons.png', |
|
356 |
'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png', |
|
357 |
'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/button_bg.png', |
|
358 |
'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif', |
|
359 |
'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png', |
|
360 |
'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/separator.gif', |
|
361 |
// Don't delete, yet: 'wp-rss.php', |
|
362 |
// Don't delete, yet: 'wp-rdf.php', |
|
363 |
// Don't delete, yet: 'wp-rss2.php', |
|
364 |
// Don't delete, yet: 'wp-commentsrss2.php', |
|
365 |
// Don't delete, yet: 'wp-atom.php', |
|
366 |
// Don't delete, yet: 'wp-feed.php', |
|
367 |
// 3.4 |
|
368 |
'wp-admin/images/gray-star.png', |
|
369 |
'wp-admin/images/logo-login.png', |
|
370 |
'wp-admin/images/star.png', |
|
371 |
'wp-admin/index-extra.php', |
|
372 |
'wp-admin/network/index-extra.php', |
|
373 |
'wp-admin/user/index-extra.php', |
|
374 |
'wp-admin/images/screenshots/admin-flyouts.png', |
|
375 |
'wp-admin/images/screenshots/coediting.png', |
|
376 |
'wp-admin/images/screenshots/drag-and-drop.png', |
|
377 |
'wp-admin/images/screenshots/help-screen.png', |
|
378 |
'wp-admin/images/screenshots/media-icon.png', |
|
379 |
'wp-admin/images/screenshots/new-feature-pointer.png', |
|
380 |
'wp-admin/images/screenshots/welcome-screen.png', |
|
381 |
'wp-includes/css/editor-buttons.css', |
|
382 |
'wp-includes/css/editor-buttons.dev.css', |
|
383 |
'wp-includes/js/tinymce/plugins/paste/blank.htm', |
|
384 |
'wp-includes/js/tinymce/plugins/wordpress/css', |
|
385 |
'wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js', |
|
386 |
'wp-includes/js/tinymce/plugins/wordpress/img/embedded.png', |
|
387 |
'wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif', |
|
388 |
'wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif', |
|
389 |
'wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js', |
|
390 |
'wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css', |
|
391 |
'wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.dev.js', |
|
392 |
'wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin.dev.js', |
|
393 |
'wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.dev.js', |
|
394 |
'wp-includes/js/tinymce/plugins/wpgallery/img/gallery.png', |
|
395 |
'wp-includes/js/tinymce/plugins/wplink/editor_plugin.dev.js', |
|
396 |
// Don't delete, yet: 'wp-pass.php', |
|
397 |
// Don't delete, yet: 'wp-register.php', |
|
398 |
// 3.5 |
|
399 |
'wp-admin/gears-manifest.php', |
|
400 |
'wp-admin/includes/manifest.php', |
|
401 |
'wp-admin/images/archive-link.png', |
|
402 |
'wp-admin/images/blue-grad.png', |
|
403 |
'wp-admin/images/button-grad-active.png', |
|
404 |
'wp-admin/images/button-grad.png', |
|
405 |
'wp-admin/images/ed-bg-vs.gif', |
|
406 |
'wp-admin/images/ed-bg.gif', |
|
407 |
'wp-admin/images/fade-butt.png', |
|
408 |
'wp-admin/images/fav-arrow-rtl.gif', |
|
409 |
'wp-admin/images/fav-arrow.gif', |
|
410 |
'wp-admin/images/fav-vs.png', |
|
411 |
'wp-admin/images/fav.png', |
|
412 |
'wp-admin/images/gray-grad.png', |
|
413 |
'wp-admin/images/loading-publish.gif', |
|
414 |
'wp-admin/images/logo-ghost.png', |
|
415 |
'wp-admin/images/logo.gif', |
|
416 |
'wp-admin/images/menu-arrow-frame-rtl.png', |
|
417 |
'wp-admin/images/menu-arrow-frame.png', |
|
418 |
'wp-admin/images/menu-arrows.gif', |
|
419 |
'wp-admin/images/menu-bits-rtl-vs.gif', |
|
420 |
'wp-admin/images/menu-bits-rtl.gif', |
|
421 |
'wp-admin/images/menu-bits-vs.gif', |
|
422 |
'wp-admin/images/menu-bits.gif', |
|
423 |
'wp-admin/images/menu-dark-rtl-vs.gif', |
|
424 |
'wp-admin/images/menu-dark-rtl.gif', |
|
425 |
'wp-admin/images/menu-dark-vs.gif', |
|
426 |
'wp-admin/images/menu-dark.gif', |
|
427 |
'wp-admin/images/required.gif', |
|
428 |
'wp-admin/images/screen-options-toggle-vs.gif', |
|
429 |
'wp-admin/images/screen-options-toggle.gif', |
|
430 |
'wp-admin/images/toggle-arrow-rtl.gif', |
|
431 |
'wp-admin/images/toggle-arrow.gif', |
|
432 |
'wp-admin/images/upload-classic.png', |
|
433 |
'wp-admin/images/upload-fresh.png', |
|
434 |
'wp-admin/images/white-grad-active.png', |
|
435 |
'wp-admin/images/white-grad.png', |
|
436 |
'wp-admin/images/widgets-arrow-vs.gif', |
|
437 |
'wp-admin/images/widgets-arrow.gif', |
|
438 |
'wp-admin/images/wpspin_dark.gif', |
|
439 |
'wp-includes/images/upload.png', |
|
440 |
'wp-includes/js/prototype.js', |
|
441 |
'wp-includes/js/scriptaculous', |
|
442 |
'wp-admin/css/wp-admin-rtl.dev.css', |
|
443 |
'wp-admin/css/wp-admin.dev.css', |
|
444 |
'wp-admin/css/media-rtl.dev.css', |
|
445 |
'wp-admin/css/media.dev.css', |
|
446 |
'wp-admin/css/colors-classic.dev.css', |
|
447 |
'wp-admin/css/customize-controls-rtl.dev.css', |
|
448 |
'wp-admin/css/customize-controls.dev.css', |
|
449 |
'wp-admin/css/ie-rtl.dev.css', |
|
450 |
'wp-admin/css/ie.dev.css', |
|
451 |
'wp-admin/css/install.dev.css', |
|
452 |
'wp-admin/css/colors-fresh.dev.css', |
|
453 |
'wp-includes/js/customize-base.dev.js', |
|
454 |
'wp-includes/js/json2.dev.js', |
|
455 |
'wp-includes/js/comment-reply.dev.js', |
|
456 |
'wp-includes/js/customize-preview.dev.js', |
|
457 |
'wp-includes/js/wplink.dev.js', |
|
458 |
'wp-includes/js/tw-sack.dev.js', |
|
459 |
'wp-includes/js/wp-list-revisions.dev.js', |
|
460 |
'wp-includes/js/autosave.dev.js', |
|
461 |
'wp-includes/js/admin-bar.dev.js', |
|
462 |
'wp-includes/js/quicktags.dev.js', |
|
463 |
'wp-includes/js/wp-ajax-response.dev.js', |
|
464 |
'wp-includes/js/wp-pointer.dev.js', |
|
465 |
'wp-includes/js/hoverIntent.dev.js', |
|
466 |
'wp-includes/js/colorpicker.dev.js', |
|
467 |
'wp-includes/js/wp-lists.dev.js', |
|
468 |
'wp-includes/js/customize-loader.dev.js', |
|
469 |
'wp-includes/js/jquery/jquery.table-hotkeys.dev.js', |
|
470 |
'wp-includes/js/jquery/jquery.color.dev.js', |
|
471 |
'wp-includes/js/jquery/jquery.color.js', |
|
472 |
'wp-includes/js/jquery/jquery.hotkeys.dev.js', |
|
473 |
'wp-includes/js/jquery/jquery.form.dev.js', |
|
474 |
'wp-includes/js/jquery/suggest.dev.js', |
|
475 |
'wp-admin/js/xfn.dev.js', |
|
476 |
'wp-admin/js/set-post-thumbnail.dev.js', |
|
477 |
'wp-admin/js/comment.dev.js', |
|
478 |
'wp-admin/js/theme.dev.js', |
|
479 |
'wp-admin/js/cat.dev.js', |
|
480 |
'wp-admin/js/password-strength-meter.dev.js', |
|
481 |
'wp-admin/js/user-profile.dev.js', |
|
482 |
'wp-admin/js/theme-preview.dev.js', |
|
483 |
'wp-admin/js/post.dev.js', |
|
484 |
'wp-admin/js/media-upload.dev.js', |
|
485 |
'wp-admin/js/word-count.dev.js', |
|
486 |
'wp-admin/js/plugin-install.dev.js', |
|
487 |
'wp-admin/js/edit-comments.dev.js', |
|
488 |
'wp-admin/js/media-gallery.dev.js', |
|
489 |
'wp-admin/js/custom-fields.dev.js', |
|
490 |
'wp-admin/js/custom-background.dev.js', |
|
491 |
'wp-admin/js/common.dev.js', |
|
492 |
'wp-admin/js/inline-edit-tax.dev.js', |
|
493 |
'wp-admin/js/gallery.dev.js', |
|
494 |
'wp-admin/js/utils.dev.js', |
|
495 |
'wp-admin/js/widgets.dev.js', |
|
496 |
'wp-admin/js/wp-fullscreen.dev.js', |
|
497 |
'wp-admin/js/nav-menu.dev.js', |
|
498 |
'wp-admin/js/dashboard.dev.js', |
|
499 |
'wp-admin/js/link.dev.js', |
|
500 |
'wp-admin/js/user-suggest.dev.js', |
|
501 |
'wp-admin/js/postbox.dev.js', |
|
502 |
'wp-admin/js/tags.dev.js', |
|
503 |
'wp-admin/js/image-edit.dev.js', |
|
504 |
'wp-admin/js/media.dev.js', |
|
505 |
'wp-admin/js/customize-controls.dev.js', |
|
506 |
'wp-admin/js/inline-edit-post.dev.js', |
|
507 |
'wp-admin/js/categories.dev.js', |
|
508 |
'wp-admin/js/editor.dev.js', |
|
509 |
'wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js', |
|
510 |
'wp-includes/js/tinymce/plugins/wpdialogs/js/popup.dev.js', |
|
511 |
'wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.dev.js', |
|
512 |
'wp-includes/js/plupload/handlers.dev.js', |
|
513 |
'wp-includes/js/plupload/wp-plupload.dev.js', |
|
514 |
'wp-includes/js/swfupload/handlers.dev.js', |
|
515 |
'wp-includes/js/jcrop/jquery.Jcrop.dev.js', |
|
516 |
'wp-includes/js/jcrop/jquery.Jcrop.js', |
|
517 |
'wp-includes/js/jcrop/jquery.Jcrop.css', |
|
518 |
'wp-includes/js/imgareaselect/jquery.imgareaselect.dev.js', |
|
519 |
'wp-includes/css/wp-pointer.dev.css', |
|
520 |
'wp-includes/css/editor.dev.css', |
|
521 |
'wp-includes/css/jquery-ui-dialog.dev.css', |
|
522 |
'wp-includes/css/admin-bar-rtl.dev.css', |
|
523 |
'wp-includes/css/admin-bar.dev.css', |
|
524 |
'wp-includes/js/jquery/ui/jquery.effects.clip.min.js', |
|
525 |
'wp-includes/js/jquery/ui/jquery.effects.scale.min.js', |
|
526 |
'wp-includes/js/jquery/ui/jquery.effects.blind.min.js', |
|
527 |
'wp-includes/js/jquery/ui/jquery.effects.core.min.js', |
|
528 |
'wp-includes/js/jquery/ui/jquery.effects.shake.min.js', |
|
529 |
'wp-includes/js/jquery/ui/jquery.effects.fade.min.js', |
|
530 |
'wp-includes/js/jquery/ui/jquery.effects.explode.min.js', |
|
531 |
'wp-includes/js/jquery/ui/jquery.effects.slide.min.js', |
|
532 |
'wp-includes/js/jquery/ui/jquery.effects.drop.min.js', |
|
533 |
'wp-includes/js/jquery/ui/jquery.effects.highlight.min.js', |
|
534 |
'wp-includes/js/jquery/ui/jquery.effects.bounce.min.js', |
|
535 |
'wp-includes/js/jquery/ui/jquery.effects.pulsate.min.js', |
|
536 |
'wp-includes/js/jquery/ui/jquery.effects.transfer.min.js', |
|
537 |
'wp-includes/js/jquery/ui/jquery.effects.fold.min.js', |
|
538 |
'wp-admin/images/screenshots/captions-1.png', |
|
539 |
'wp-admin/images/screenshots/captions-2.png', |
|
540 |
'wp-admin/images/screenshots/flex-header-1.png', |
|
541 |
'wp-admin/images/screenshots/flex-header-2.png', |
|
542 |
'wp-admin/images/screenshots/flex-header-3.png', |
|
543 |
'wp-admin/images/screenshots/flex-header-media-library.png', |
|
544 |
'wp-admin/images/screenshots/theme-customizer.png', |
|
545 |
'wp-admin/images/screenshots/twitter-embed-1.png', |
|
546 |
'wp-admin/images/screenshots/twitter-embed-2.png', |
|
547 |
'wp-admin/js/utils.js', |
|
548 |
'wp-admin/options-privacy.php', |
|
549 |
'wp-app.php', |
|
550 |
'wp-includes/class-wp-atom-server.php', |
|
551 |
'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css', |
|
552 |
// 3.5.2 |
|
553 |
'wp-includes/js/swfupload/swfupload-all.js', |
|
554 |
// 3.6 |
|
555 |
'wp-admin/js/revisions-js.php', |
|
556 |
'wp-admin/images/screenshots', |
|
557 |
'wp-admin/js/categories.js', |
|
558 |
'wp-admin/js/categories.min.js', |
|
559 |
'wp-admin/js/custom-fields.js', |
|
560 |
'wp-admin/js/custom-fields.min.js', |
|
561 |
// 3.7 |
|
562 |
'wp-admin/js/cat.js', |
|
563 |
'wp-admin/js/cat.min.js', |
|
564 |
'wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.min.js', |
|
565 |
); |
|
566 |
|
|
567 |
/** |
|
568 |
* Stores new files in wp-content to copy |
|
569 |
* |
|
570 |
* The contents of this array indicate any new bundled plugins/themes which |
|
571 |
* should be installed with the WordPress Upgrade. These items will not be |
|
572 |
* re-installed in future upgrades, this behaviour is controlled by the |
|
573 |
* introduced version present here being older than the current installed version. |
|
574 |
* |
|
575 |
* The content of this array should follow the following format: |
|
576 |
* Filename (relative to wp-content) => Introduced version |
|
577 |
* Directories should be noted by suffixing it with a trailing slash (/) |
|
578 |
* |
|
579 |
* @since 3.2.0 |
|
580 |
* @global array $_new_bundled_files |
|
581 |
* @var array |
|
582 |
* @name $_new_bundled_files |
|
583 |
*/ |
|
584 |
global $_new_bundled_files; |
|
585 |
|
|
586 |
$_new_bundled_files = array( |
|
587 |
'plugins/akismet/' => '2.0', |
|
588 |
'themes/twentyten/' => '3.0', |
|
589 |
'themes/twentyeleven/' => '3.2', |
|
590 |
'themes/twentytwelve/' => '3.5', |
|
591 |
'themes/twentythirteen/' => '3.6', |
|
592 |
); |
|
593 |
|
|
594 |
/** |
|
595 |
* Upgrade the core of WordPress. |
|
596 |
* |
|
597 |
* This will create a .maintenance file at the base of the WordPress directory |
|
598 |
* to ensure that people can not access the web site, when the files are being |
|
599 |
* copied to their locations. |
|
600 |
* |
|
601 |
* The files in the {@link $_old_files} list will be removed and the new files |
|
602 |
* copied from the zip file after the database is upgraded. |
|
603 |
* |
|
604 |
* The files in the {@link $_new_bundled_files} list will be added to the installation |
|
605 |
* if the version is greater than or equal to the old version being upgraded. |
|
606 |
* |
|
607 |
* The steps for the upgrader for after the new release is downloaded and |
|
608 |
* unzipped is: |
|
609 |
* 1. Test unzipped location for select files to ensure that unzipped worked. |
|
610 |
* 2. Create the .maintenance file in current WordPress base. |
|
611 |
* 3. Copy new WordPress directory over old WordPress files. |
|
612 |
* 4. Upgrade WordPress to new version. |
|
613 |
* 4.1. Copy all files/folders other than wp-content |
|
614 |
* 4.2. Copy any language files to WP_LANG_DIR (which may differ from WP_CONTENT_DIR |
|
615 |
* 4.3. Copy any new bundled themes/plugins to their respective locations |
|
616 |
* 5. Delete new WordPress directory path. |
|
617 |
* 6. Delete .maintenance file. |
|
618 |
* 7. Remove old files. |
|
619 |
* 8. Delete 'update_core' option. |
|
620 |
* |
|
621 |
* There are several areas of failure. For instance if PHP times out before step |
|
622 |
* 6, then you will not be able to access any portion of your site. Also, since |
|
623 |
* the upgrade will not continue where it left off, you will not be able to |
|
624 |
* automatically remove old files and remove the 'update_core' option. This |
|
625 |
* isn't that bad. |
|
626 |
* |
|
627 |
* If the copy of the new WordPress over the old fails, then the worse is that |
|
628 |
* the new WordPress directory will remain. |
|
629 |
* |
|
630 |
* If it is assumed that every file will be copied over, including plugins and |
|
631 |
* themes, then if you edit the default theme, you should rename it, so that |
|
632 |
* your changes remain. |
|
633 |
* |
|
634 |
* @since 2.7.0 |
|
635 |
* |
|
636 |
* @param string $from New release unzipped path. |
|
637 |
* @param string $to Path to old WordPress installation. |
|
638 |
* @return WP_Error|null WP_Error on failure, null on success. |
|
639 |
*/ |
|
640 |
function update_core($from, $to) { |
|
641 |
global $wp_filesystem, $_old_files, $_new_bundled_files, $wpdb; |
|
642 |
|
|
643 |
@set_time_limit( 300 ); |
|
644 |
|
|
645 |
// Sanity check the unzipped distribution |
|
646 |
apply_filters( 'update_feedback', __('Verifying the unpacked files…') ); |
|
647 |
$distro = ''; |
|
648 |
$roots = array( '/wordpress/', '/wordpress-mu/' ); |
|
649 |
foreach ( $roots as $root ) { |
|
650 |
if ( $wp_filesystem->exists( $from . $root . 'readme.html' ) && $wp_filesystem->exists( $from . $root . 'wp-includes/version.php' ) ) { |
|
651 |
$distro = $root; |
|
652 |
break; |
|
653 |
} |
|
654 |
} |
|
655 |
if ( ! $distro ) { |
|
656 |
$wp_filesystem->delete( $from, true ); |
|
657 |
return new WP_Error( 'insane_distro', __('The update could not be unpacked') ); |
|
658 |
} |
|
659 |
|
|
660 |
// Import $wp_version, $required_php_version, and $required_mysql_version from the new version |
|
661 |
// $wp_filesystem->wp_content_dir() returned unslashed pre-2.8 |
|
662 |
$versions_file = trailingslashit( $wp_filesystem->wp_content_dir() ) . 'upgrade/version-current.php'; |
|
663 |
if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $versions_file ) ) { |
|
664 |
$wp_filesystem->delete( $from, true ); |
|
665 |
return new WP_Error( 'copy_failed_for_version_file', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), 'wp-includes/version.php' ); |
|
666 |
} |
|
667 |
|
|
668 |
$wp_filesystem->chmod( $versions_file, FS_CHMOD_FILE ); |
|
669 |
require( WP_CONTENT_DIR . '/upgrade/version-current.php' ); |
|
670 |
$wp_filesystem->delete( $versions_file ); |
|
671 |
|
|
672 |
$php_version = phpversion(); |
|
673 |
$mysql_version = $wpdb->db_version(); |
|
674 |
$old_wp_version = $GLOBALS['wp_version']; // The version of WordPress we're updating from |
|
675 |
$development_build = ( false !== strpos( $old_wp_version . $wp_version, '-' ) ); // a dash in the version indicates a Development release |
|
676 |
$php_compat = version_compare( $php_version, $required_php_version, '>=' ); |
|
677 |
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) |
|
678 |
$mysql_compat = true; |
|
679 |
else |
|
680 |
$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ); |
|
681 |
|
|
682 |
if ( !$mysql_compat || !$php_compat ) |
|
683 |
$wp_filesystem->delete($from, true); |
|
684 |
|
|
685 |
if ( !$mysql_compat && !$php_compat ) |
|
686 |
return new WP_Error( 'php_mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ) ); |
|
687 |
elseif ( !$php_compat ) |
|
688 |
return new WP_Error( 'php_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ) ); |
|
689 |
elseif ( !$mysql_compat ) |
|
690 |
return new WP_Error( 'mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ) ); |
|
691 |
|
|
692 |
apply_filters( 'update_feedback', __( 'Preparing to install the latest version…' ) ); |
|
693 |
|
|
694 |
// Don't copy wp-content, we'll deal with that below |
|
695 |
$skip = array( 'wp-content' ); |
|
696 |
$check_is_writable = array(); |
|
697 |
|
|
698 |
// Check to see which files don't really need updating - only available for 3.7 and higher |
|
699 |
if ( function_exists( 'get_core_checksums' ) ) { |
|
700 |
$checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' ); |
|
701 |
if ( is_array( $checksums ) && isset( $checksums[ $wp_version ] ) ) |
|
702 |
$checksums = $checksums[ $wp_version ]; // Compat code for 3.7-beta2 |
|
703 |
if ( is_array( $checksums ) ) { |
|
704 |
foreach( $checksums as $file => $checksum ) { |
|
705 |
if ( 'wp-content' == substr( $file, 0, 10 ) ) |
|
706 |
continue; |
|
707 |
if ( ! file_exists( ABSPATH . $file ) ) |
|
708 |
continue; |
|
709 |
if ( md5_file( ABSPATH . $file ) === $checksum ) |
|
710 |
$skip[] = $file; |
|
711 |
else |
|
712 |
$check_is_writable[ $file ] = ABSPATH . $file; |
|
713 |
} |
|
714 |
} |
|
715 |
} |
|
716 |
|
|
717 |
// If we're using the direct method, we can predict write failures that are due to permissions. |
|
718 |
if ( $check_is_writable && 'direct' === $wp_filesystem->method ) { |
|
719 |
$files_writable = array_filter( $check_is_writable, array( $wp_filesystem, 'is_writable' ) ); |
|
720 |
if ( $files_writable !== $check_is_writable ) { |
|
721 |
$files_not_writable = array_diff_key( $check_is_writable, $files_writable ); |
|
722 |
foreach ( $files_not_writable as $relative_file_not_writable => $file_not_writable ) { |
|
723 |
// If the writable check failed, chmod file to 0644 and try again, same as copy_dir(). |
|
724 |
$wp_filesystem->chmod( $file_not_writable, FS_CHMOD_FILE ); |
|
725 |
if ( $wp_filesystem->is_writable( $file_not_writable ) ) |
|
726 |
unset( $files_not_writable[ $relative_file_not_writable ] ); |
|
727 |
} |
|
728 |
|
|
729 |
// Store package-relative paths (the key) of non-writable files in the WP_Error object. |
|
730 |
$error_data = version_compare( $old_wp_version, '3.7-beta2', '>' ) ? array_keys( $files_not_writable ) : ''; |
|
731 |
|
|
732 |
if ( $files_not_writable ) |
|
733 |
return new WP_Error( 'files_not_writable', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), implode( ', ', $error_data ) ); |
|
734 |
} |
|
735 |
} |
|
736 |
|
|
737 |
apply_filters( 'update_feedback', __( 'Enabling Maintenance mode…' ) ); |
|
738 |
// Create maintenance file to signal that we are upgrading |
|
739 |
$maintenance_string = '<?php $upgrading = ' . time() . '; ?>'; |
|
740 |
$maintenance_file = $to . '.maintenance'; |
|
741 |
$wp_filesystem->delete($maintenance_file); |
|
742 |
$wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE); |
|
743 |
|
|
744 |
apply_filters( 'update_feedback', __( 'Copying the required files…' ) ); |
|
745 |
// Copy new versions of WP files into place. |
|
746 |
$result = _copy_dir( $from . $distro, $to, $skip ); |
|
747 |
if ( is_wp_error( $result ) ) |
|
748 |
$result = new WP_Error( $result->get_error_code(), $result->get_error_message(), substr( $result->get_error_data(), strlen( $to ) ) ); |
|
749 |
|
|
750 |
// Check to make sure everything copied correctly, ignoring the contents of wp-content |
|
751 |
$skip = array( 'wp-content' ); |
|
752 |
$failed = array(); |
|
753 |
if ( isset( $checksums ) && is_array( $checksums ) ) { |
|
754 |
foreach ( $checksums as $file => $checksum ) { |
|
755 |
if ( 0 === strpos( $file, 'wp-content' ) ) |
|
756 |
continue; |
|
757 |
|
|
758 |
if ( file_exists( ABSPATH . $file ) && md5_file( ABSPATH . $file ) == $checksum ) |
|
759 |
$skip[] = $file; |
|
760 |
else |
|
761 |
$failed[] = $file; |
|
762 |
} |
|
763 |
} |
|
764 |
|
|
765 |
// Some files didn't copy properly |
|
766 |
if ( ! empty( $failed ) ) { |
|
767 |
$total_size = 0; |
|
768 |
// Find the local version of the working directory |
|
769 |
$working_dir_local = WP_CONTENT_DIR . '/upgrade/' . basename( $from ) . $distro; |
|
770 |
foreach ( $failed as $file ) { |
|
771 |
if ( file_exists( $working_dir_local . $file ) ) |
|
772 |
$total_size += filesize( $working_dir_local . $file ); |
|
773 |
} |
|
774 |
|
|
775 |
// If we don't have enough free space, it isn't worth trying again. |
|
776 |
// Unlikely to be hit due to the check in unzip_file(). |
|
777 |
$available_space = @disk_free_space( ABSPATH ); |
|
778 |
if ( $available_space && $total_size >= $available_space ) { |
|
779 |
$result = new WP_Error( 'disk_full', __( 'There is not enough free disk space to complete the update.' ) ); |
|
780 |
} else { |
|
781 |
$result = _copy_dir( $from . $distro, $to, $skip ); |
|
782 |
if ( is_wp_error( $result ) ) |
|
783 |
$result = new WP_Error( $result->get_error_code() . '_retry', $result->get_error_message(), substr( $result->get_error_data(), strlen( $to ) ) ); |
|
784 |
} |
|
785 |
} |
|
786 |
|
|
787 |
// Custom Content Directory needs updating now. |
|
788 |
// Copy Languages |
|
789 |
if ( !is_wp_error($result) && $wp_filesystem->is_dir($from . $distro . 'wp-content/languages') ) { |
|
790 |
if ( WP_LANG_DIR != ABSPATH . WPINC . '/languages' || @is_dir(WP_LANG_DIR) ) |
|
791 |
$lang_dir = WP_LANG_DIR; |
|
792 |
else |
|
793 |
$lang_dir = WP_CONTENT_DIR . '/languages'; |
|
794 |
|
|
795 |
if ( !@is_dir($lang_dir) && 0 === strpos($lang_dir, ABSPATH) ) { // Check the language directory exists first |
|
796 |
$wp_filesystem->mkdir($to . str_replace(ABSPATH, '', $lang_dir), FS_CHMOD_DIR); // If it's within the ABSPATH we can handle it here, otherwise they're out of luck. |
|
797 |
clearstatcache(); // for FTP, Need to clear the stat cache |
|
798 |
} |
|
799 |
|
|
800 |
if ( @is_dir($lang_dir) ) { |
|
801 |
$wp_lang_dir = $wp_filesystem->find_folder($lang_dir); |
|
802 |
if ( $wp_lang_dir ) { |
|
803 |
$result = copy_dir($from . $distro . 'wp-content/languages/', $wp_lang_dir); |
|
804 |
if ( is_wp_error( $result ) ) |
|
805 |
$result = new WP_Error( $result->get_error_code() . '_languages', $result->get_error_message(), substr( $result->get_error_data(), strlen( $wp_lang_dir ) ) ); |
|
806 |
} |
|
807 |
} |
|
808 |
} |
|
809 |
|
|
810 |
apply_filters( 'update_feedback', __( 'Disabling Maintenance mode…' ) ); |
|
811 |
// Remove maintenance file, we're done with potential site-breaking changes |
|
812 |
$wp_filesystem->delete( $maintenance_file ); |
|
813 |
|
|
814 |
// 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users, preventing installation of Twenty Twelve. |
|
815 |
if ( '3.5' == $old_wp_version ) { |
|
816 |
if ( is_dir( WP_CONTENT_DIR . '/themes/twentytwelve' ) && ! file_exists( WP_CONTENT_DIR . '/themes/twentytwelve/style.css' ) ) { |
|
817 |
$wp_filesystem->delete( $wp_filesystem->wp_themes_dir() . 'twentytwelve/' ); |
|
818 |
} |
|
819 |
} |
|
820 |
|
|
821 |
// Copy New bundled plugins & themes |
|
822 |
// This gives us the ability to install new plugins & themes bundled with future versions of WordPress whilst avoiding the re-install upon upgrade issue. |
|
823 |
// $development_build controls us overwriting bundled themes and plugins when a non-stable release is being updated |
|
824 |
if ( !is_wp_error($result) && ( ! defined('CORE_UPGRADE_SKIP_NEW_BUNDLED') || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) { |
|
825 |
foreach ( (array) $_new_bundled_files as $file => $introduced_version ) { |
|
826 |
// If a $development_build or if $introduced version is greater than what the site was previously running |
|
827 |
if ( $development_build || version_compare( $introduced_version, $old_wp_version, '>' ) ) { |
|
828 |
$directory = ('/' == $file[ strlen($file)-1 ]); |
|
829 |
list($type, $filename) = explode('/', $file, 2); |
|
830 |
|
|
831 |
// Check to see if the bundled items exist before attempting to copy them |
|
832 |
if ( ! $wp_filesystem->exists( $from . $distro . 'wp-content/' . $file ) ) |
|
833 |
continue; |
|
834 |
|
|
835 |
if ( 'plugins' == $type ) |
|
836 |
$dest = $wp_filesystem->wp_plugins_dir(); |
|
837 |
elseif ( 'themes' == $type ) |
|
838 |
$dest = trailingslashit($wp_filesystem->wp_themes_dir()); // Back-compat, ::wp_themes_dir() did not return trailingslash'd pre-3.2 |
|
839 |
else |
|
840 |
continue; |
|
841 |
|
|
842 |
if ( ! $directory ) { |
|
843 |
if ( ! $development_build && $wp_filesystem->exists( $dest . $filename ) ) |
|
844 |
continue; |
|
845 |
|
|
846 |
if ( ! $wp_filesystem->copy($from . $distro . 'wp-content/' . $file, $dest . $filename, FS_CHMOD_FILE) ) |
|
847 |
$result = new WP_Error( "copy_failed_for_new_bundled_$type", __( 'Could not copy file.' ), $dest . $filename ); |
|
848 |
} else { |
|
849 |
if ( ! $development_build && $wp_filesystem->is_dir( $dest . $filename ) ) |
|
850 |
continue; |
|
851 |
|
|
852 |
$wp_filesystem->mkdir($dest . $filename, FS_CHMOD_DIR); |
|
853 |
$_result = copy_dir( $from . $distro . 'wp-content/' . $file, $dest . $filename); |
|
854 |
|
|
855 |
// If a error occurs partway through this final step, keep the error flowing through, but keep process going. |
|
856 |
if ( is_wp_error( $_result ) ) { |
|
857 |
if ( ! is_wp_error( $result ) ) |
|
858 |
$result = new WP_Error; |
|
859 |
$result->add( $_result->get_error_code() . "_$type", $_result->get_error_message(), substr( $_result->get_error_data(), strlen( $dest ) ) ); |
|
860 |
} |
|
861 |
} |
|
862 |
} |
|
863 |
} //end foreach |
|
864 |
} |
|
865 |
|
|
866 |
// Handle $result error from the above blocks |
|
867 |
if ( is_wp_error($result) ) { |
|
868 |
$wp_filesystem->delete($from, true); |
|
869 |
return $result; |
|
870 |
} |
|
871 |
|
|
872 |
// Remove old files |
|
873 |
foreach ( $_old_files as $old_file ) { |
|
874 |
$old_file = $to . $old_file; |
|
875 |
if ( !$wp_filesystem->exists($old_file) ) |
|
876 |
continue; |
|
877 |
$wp_filesystem->delete($old_file, true); |
|
878 |
} |
|
879 |
|
|
880 |
// Upgrade DB with separate request |
|
881 |
apply_filters('update_feedback', __('Upgrading database…')); |
|
882 |
$db_upgrade_url = admin_url('upgrade.php?step=upgrade_db'); |
|
883 |
wp_remote_post($db_upgrade_url, array('timeout' => 60)); |
|
884 |
|
|
885 |
// Remove working directory |
|
886 |
$wp_filesystem->delete($from, true); |
|
887 |
|
|
888 |
// Force refresh of update information |
|
889 |
if ( function_exists('delete_site_transient') ) |
|
890 |
delete_site_transient('update_core'); |
|
891 |
else |
|
892 |
delete_option('update_core'); |
|
893 |
|
|
894 |
// If we made it this far: |
|
895 |
do_action( '_core_updated_successfully', $wp_version ); |
|
896 |
|
|
897 |
// Clear the option that blocks auto updates after failures, now that we've been successful. |
|
898 |
if ( function_exists( 'delete_site_option' ) ) |
|
899 |
delete_site_option( 'auto_core_update_failed' ); |
|
900 |
|
|
901 |
return $wp_version; |
|
902 |
} |
|
903 |
|
|
904 |
/** |
|
905 |
* Copies a directory from one location to another via the WordPress Filesystem Abstraction. |
|
906 |
* Assumes that WP_Filesystem() has already been called and setup. |
|
907 |
* |
|
908 |
* This is a temporary function for the 3.1 -> 3.2 upgrade, as well as for those upgrading to |
|
909 |
* 3.7+ |
|
910 |
* |
|
911 |
* @ignore |
|
912 |
* @since 3.2.0 |
|
913 |
* @since 3.7.0 Updated not to use a regular expression for the skip list |
|
914 |
* @see copy_dir() |
|
915 |
* |
|
916 |
* @param string $from source directory |
|
917 |
* @param string $to destination directory |
|
918 |
* @param array $skip_list a list of files/folders to skip copying |
|
919 |
* @return mixed WP_Error on failure, True on success. |
|
920 |
*/ |
|
921 |
function _copy_dir($from, $to, $skip_list = array() ) { |
|
922 |
global $wp_filesystem; |
|
923 |
|
|
924 |
$dirlist = $wp_filesystem->dirlist($from); |
|
925 |
|
|
926 |
$from = trailingslashit($from); |
|
927 |
$to = trailingslashit($to); |
|
928 |
|
|
929 |
foreach ( (array) $dirlist as $filename => $fileinfo ) { |
|
930 |
if ( in_array( $filename, $skip_list ) ) |
|
931 |
continue; |
|
932 |
|
|
933 |
if ( 'f' == $fileinfo['type'] ) { |
|
934 |
if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) { |
|
935 |
// If copy failed, chmod file to 0644 and try again. |
|
936 |
$wp_filesystem->chmod( $to . $filename, FS_CHMOD_FILE ); |
|
937 |
if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) |
|
938 |
return new WP_Error( 'copy_failed__copy_dir', __( 'Could not copy file.' ), $to . $filename ); |
|
939 |
} |
|
940 |
} elseif ( 'd' == $fileinfo['type'] ) { |
|
941 |
if ( !$wp_filesystem->is_dir($to . $filename) ) { |
|
942 |
if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) ) |
|
943 |
return new WP_Error( 'mkdir_failed__copy_dir', __( 'Could not create directory.' ), $to . $filename ); |
|
944 |
} |
|
945 |
|
|
946 |
// generate the $sub_skip_list for the subdirectory as a sub-set of the existing $skip_list |
|
947 |
$sub_skip_list = array(); |
|
948 |
foreach ( $skip_list as $skip_item ) { |
|
949 |
if ( 0 === strpos( $skip_item, $filename . '/' ) ) |
|
950 |
$sub_skip_list[] = preg_replace( '!^' . preg_quote( $filename, '!' ) . '/!i', '', $skip_item ); |
|
951 |
} |
|
952 |
|
|
953 |
$result = _copy_dir($from . $filename, $to . $filename, $sub_skip_list); |
|
954 |
if ( is_wp_error($result) ) |
|
955 |
return $result; |
|
956 |
} |
|
957 |
} |
|
958 |
return true; |
|
959 |
} |
|
960 |
|
|
961 |
/** |
|
962 |
* Redirect to the About WordPress page after a successful upgrade. |
|
963 |
* |
|
964 |
* This function is only needed when the existing install is older than 3.4.0. |
|
965 |
* |
|
966 |
* @since 3.3.0 |
|
967 |
* |
|
968 |
*/ |
|
969 |
function _redirect_to_about_wordpress( $new_version ) { |
|
970 |
global $wp_version, $pagenow, $action; |
|
971 |
|
|
972 |
if ( version_compare( $wp_version, '3.4-RC1', '>=' ) ) |
|
973 |
return; |
|
974 |
|
|
975 |
// Ensure we only run this on the update-core.php page. The Core_Upgrader may be used in other contexts. |
|
976 |
if ( 'update-core.php' != $pagenow ) |
|
977 |
return; |
|
978 |
|
|
979 |
if ( 'do-core-upgrade' != $action && 'do-core-reinstall' != $action ) |
|
980 |
return; |
|
981 |
|
|
982 |
// Load the updated default text localization domain for new strings |
|
983 |
load_default_textdomain(); |
|
984 |
|
|
985 |
// See do_core_upgrade() |
|
986 |
show_message( __('WordPress updated successfully') ); |
|
987 |
|
|
988 |
// self_admin_url() won't exist when upgrading from <= 3.0, so relative URLs are intentional. |
|
989 |
show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ), $new_version, 'about.php?updated' ) . '</span>' ); |
|
990 |
show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $new_version, 'about.php?updated' ) . '</span>' ); |
|
991 |
echo '</div>'; |
|
992 |
?> |
|
993 |
<script type="text/javascript"> |
|
994 |
window.location = 'about.php?updated'; |
|
995 |
</script> |
|
996 |
<?php |
|
997 |
|
|
998 |
// Include admin-footer.php and exit |
|
999 |
include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
1000 |
exit(); |
|
1001 |
} |
|
1002 |
add_action( '_core_updated_successfully', '_redirect_to_about_wordpress' ); |