PageRenderTime 55ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-admin/includes/update-core.php

https://bitbucket.org/crafttheweb/wordpress-fold
PHP | 755 lines | 564 code | 43 blank | 148 comment | 53 complexity | 53b52b188124471a7ac45f6f666cbe4d MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * WordPress core upgrade functionality.
  4. *
  5. * @package WordPress
  6. * @subpackage Administration
  7. * @since 2.7.0
  8. */
  9. /**
  10. * Stores files to be deleted.
  11. *
  12. * @since 2.7.0
  13. * @global array $_old_files
  14. * @var array
  15. * @name $_old_files
  16. */
  17. global $_old_files;
  18. $_old_files = array(
  19. // 2.0
  20. 'wp-admin/import-b2.php',
  21. 'wp-admin/import-blogger.php',
  22. 'wp-admin/import-greymatter.php',
  23. 'wp-admin/import-livejournal.php',
  24. 'wp-admin/import-mt.php',
  25. 'wp-admin/import-rss.php',
  26. 'wp-admin/import-textpattern.php',
  27. 'wp-admin/quicktags.js',
  28. 'wp-images/fade-butt.png',
  29. 'wp-images/get-firefox.png',
  30. 'wp-images/header-shadow.png',
  31. 'wp-images/smilies',
  32. 'wp-images/wp-small.png',
  33. 'wp-images/wpminilogo.png',
  34. 'wp.php',
  35. // 2.0.8
  36. 'wp-includes/js/tinymce/plugins/inlinepopups/readme.txt',
  37. // 2.1
  38. 'wp-admin/edit-form-ajax-cat.php',
  39. 'wp-admin/execute-pings.php',
  40. 'wp-admin/inline-uploading.php',
  41. 'wp-admin/link-categories.php',
  42. 'wp-admin/list-manipulation.js',
  43. 'wp-admin/list-manipulation.php',
  44. 'wp-includes/comment-functions.php',
  45. 'wp-includes/feed-functions.php',
  46. 'wp-includes/functions-compat.php',
  47. 'wp-includes/functions-formatting.php',
  48. 'wp-includes/functions-post.php',
  49. 'wp-includes/js/dbx-key.js',
  50. 'wp-includes/js/tinymce/plugins/autosave/langs/cs.js',
  51. 'wp-includes/js/tinymce/plugins/autosave/langs/sv.js',
  52. 'wp-includes/links.php',
  53. 'wp-includes/pluggable-functions.php',
  54. 'wp-includes/template-functions-author.php',
  55. 'wp-includes/template-functions-category.php',
  56. 'wp-includes/template-functions-general.php',
  57. 'wp-includes/template-functions-links.php',
  58. 'wp-includes/template-functions-post.php',
  59. 'wp-includes/wp-l10n.php',
  60. // 2.2
  61. 'wp-admin/cat-js.php',
  62. 'wp-admin/import/b2.php',
  63. 'wp-includes/js/autosave-js.php',
  64. 'wp-includes/js/list-manipulation-js.php',
  65. 'wp-includes/js/wp-ajax-js.php',
  66. // 2.3
  67. 'wp-admin/admin-db.php',
  68. 'wp-admin/cat.js',
  69. 'wp-admin/categories.js',
  70. 'wp-admin/custom-fields.js',
  71. 'wp-admin/dbx-admin-key.js',
  72. 'wp-admin/edit-comments.js',
  73. 'wp-admin/install-rtl.css',
  74. 'wp-admin/install.css',
  75. 'wp-admin/upgrade-schema.php',
  76. 'wp-admin/upload-functions.php',
  77. 'wp-admin/upload-rtl.css',
  78. 'wp-admin/upload.css',
  79. 'wp-admin/upload.js',
  80. 'wp-admin/users.js',
  81. 'wp-admin/widgets-rtl.css',
  82. 'wp-admin/widgets.css',
  83. 'wp-admin/xfn.js',
  84. 'wp-includes/js/tinymce/license.html',
  85. // 2.5
  86. 'wp-admin/css/upload.css',
  87. 'wp-admin/images/box-bg-left.gif',
  88. 'wp-admin/images/box-bg-right.gif',
  89. 'wp-admin/images/box-bg.gif',
  90. 'wp-admin/images/box-butt-left.gif',
  91. 'wp-admin/images/box-butt-right.gif',
  92. 'wp-admin/images/box-butt.gif',
  93. 'wp-admin/images/box-head-left.gif',
  94. 'wp-admin/images/box-head-right.gif',
  95. 'wp-admin/images/box-head.gif',
  96. 'wp-admin/images/heading-bg.gif',
  97. 'wp-admin/images/login-bkg-bottom.gif',
  98. 'wp-admin/images/login-bkg-tile.gif',
  99. 'wp-admin/images/notice.gif',
  100. 'wp-admin/images/toggle.gif',
  101. 'wp-admin/includes/upload.php',
  102. 'wp-admin/js/dbx-admin-key.js',
  103. 'wp-admin/js/link-cat.js',
  104. 'wp-admin/profile-update.php',
  105. 'wp-admin/templates.php',
  106. 'wp-includes/images/wlw/WpComments.png',
  107. 'wp-includes/images/wlw/WpIcon.png',
  108. 'wp-includes/images/wlw/WpWatermark.png',
  109. 'wp-includes/js/dbx.js',
  110. 'wp-includes/js/fat.js',
  111. 'wp-includes/js/list-manipulation.js',
  112. 'wp-includes/js/tinymce/langs/en.js',
  113. 'wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js',
  114. 'wp-includes/js/tinymce/plugins/autosave/langs',
  115. 'wp-includes/js/tinymce/plugins/directionality/images',
  116. 'wp-includes/js/tinymce/plugins/directionality/langs',
  117. 'wp-includes/js/tinymce/plugins/inlinepopups/css',
  118. 'wp-includes/js/tinymce/plugins/inlinepopups/images',
  119. 'wp-includes/js/tinymce/plugins/inlinepopups/jscripts',
  120. 'wp-includes/js/tinymce/plugins/paste/images',
  121. 'wp-includes/js/tinymce/plugins/paste/jscripts',
  122. 'wp-includes/js/tinymce/plugins/paste/langs',
  123. 'wp-includes/js/tinymce/plugins/spellchecker/classes/HttpClient.class.php',
  124. 'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php',
  125. 'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php',
  126. 'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php',
  127. 'wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css',
  128. 'wp-includes/js/tinymce/plugins/spellchecker/images',
  129. 'wp-includes/js/tinymce/plugins/spellchecker/langs',
  130. 'wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php',
  131. 'wp-includes/js/tinymce/plugins/wordpress/images',
  132. 'wp-includes/js/tinymce/plugins/wordpress/langs',
  133. 'wp-includes/js/tinymce/plugins/wordpress/wordpress.css',
  134. 'wp-includes/js/tinymce/plugins/wphelp',
  135. 'wp-includes/js/tinymce/themes/advanced/css',
  136. 'wp-includes/js/tinymce/themes/advanced/images',
  137. 'wp-includes/js/tinymce/themes/advanced/jscripts',
  138. 'wp-includes/js/tinymce/themes/advanced/langs',
  139. // 2.5.1
  140. 'wp-includes/js/tinymce/tiny_mce_gzip.php',
  141. // 2.6
  142. 'wp-admin/bookmarklet.php',
  143. 'wp-includes/js/jquery/jquery.dimensions.min.js',
  144. 'wp-includes/js/tinymce/plugins/wordpress/popups.css',
  145. 'wp-includes/js/wp-ajax.js',
  146. // 2.7
  147. 'wp-admin/css/press-this-ie-rtl.css',
  148. 'wp-admin/css/press-this-ie.css',
  149. 'wp-admin/css/upload-rtl.css',
  150. 'wp-admin/edit-form.php',
  151. 'wp-admin/images/comment-pill.gif',
  152. 'wp-admin/images/comment-stalk-classic.gif',
  153. 'wp-admin/images/comment-stalk-fresh.gif',
  154. 'wp-admin/images/comment-stalk-rtl.gif',
  155. 'wp-admin/images/del.png',
  156. 'wp-admin/images/gear.png',
  157. 'wp-admin/images/media-button-gallery.gif',
  158. 'wp-admin/images/media-buttons.gif',
  159. 'wp-admin/images/postbox-bg.gif',
  160. 'wp-admin/images/tab.png',
  161. 'wp-admin/images/tail.gif',
  162. 'wp-admin/js/forms.js',
  163. 'wp-admin/js/upload.js',
  164. 'wp-admin/link-import.php',
  165. 'wp-includes/images/audio.png',
  166. 'wp-includes/images/css.png',
  167. 'wp-includes/images/default.png',
  168. 'wp-includes/images/doc.png',
  169. 'wp-includes/images/exe.png',
  170. 'wp-includes/images/html.png',
  171. 'wp-includes/images/js.png',
  172. 'wp-includes/images/pdf.png',
  173. 'wp-includes/images/swf.png',
  174. 'wp-includes/images/tar.png',
  175. 'wp-includes/images/text.png',
  176. 'wp-includes/images/video.png',
  177. 'wp-includes/images/zip.png',
  178. 'wp-includes/js/tinymce/tiny_mce_config.php',
  179. 'wp-includes/js/tinymce/tiny_mce_ext.js',
  180. // 2.8
  181. 'wp-admin/js/users.js',
  182. 'wp-includes/js/swfupload/plugins/swfupload.documentready.js',
  183. 'wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js',
  184. 'wp-includes/js/swfupload/swfupload_f9.swf',
  185. 'wp-includes/js/tinymce/plugins/autosave',
  186. 'wp-includes/js/tinymce/plugins/paste/css',
  187. 'wp-includes/js/tinymce/utils/mclayer.js',
  188. 'wp-includes/js/tinymce/wordpress.css',
  189. // 2.8.5
  190. 'wp-admin/import/btt.php',
  191. 'wp-admin/import/jkw.php',
  192. // 2.9
  193. 'wp-admin/js/page.dev.js',
  194. 'wp-admin/js/page.js',
  195. 'wp-admin/js/set-post-thumbnail-handler.dev.js',
  196. 'wp-admin/js/set-post-thumbnail-handler.js',
  197. 'wp-admin/js/slug.dev.js',
  198. 'wp-admin/js/slug.js',
  199. 'wp-includes/gettext.php',
  200. 'wp-includes/js/tinymce/plugins/wordpress/js',
  201. 'wp-includes/streams.php',
  202. // MU
  203. 'README.txt',
  204. 'htaccess.dist',
  205. 'index-install.php',
  206. 'wp-admin/css/mu-rtl.css',
  207. 'wp-admin/css/mu.css',
  208. 'wp-admin/images/site-admin.png',
  209. 'wp-admin/includes/mu.php',
  210. 'wp-admin/wpmu-admin.php',
  211. 'wp-admin/wpmu-blogs.php',
  212. 'wp-admin/wpmu-edit.php',
  213. 'wp-admin/wpmu-options.php',
  214. 'wp-admin/wpmu-themes.php',
  215. 'wp-admin/wpmu-upgrade-site.php',
  216. 'wp-admin/wpmu-users.php',
  217. 'wp-includes/images/wordpress-mu.png',
  218. 'wp-includes/wpmu-default-filters.php',
  219. 'wp-includes/wpmu-functions.php',
  220. 'wpmu-settings.php',
  221. // 3.0
  222. 'wp-admin/categories.php',
  223. 'wp-admin/edit-category-form.php',
  224. 'wp-admin/edit-page-form.php',
  225. 'wp-admin/edit-pages.php',
  226. 'wp-admin/images/admin-header-footer.png',
  227. 'wp-admin/images/browse-happy.gif',
  228. 'wp-admin/images/ico-add.png',
  229. 'wp-admin/images/ico-close.png',
  230. 'wp-admin/images/ico-edit.png',
  231. 'wp-admin/images/ico-viewpage.png',
  232. 'wp-admin/images/fav-top.png',
  233. 'wp-admin/images/screen-options-left.gif',
  234. 'wp-admin/images/wp-logo-vs.gif',
  235. 'wp-admin/images/wp-logo.gif',
  236. 'wp-admin/import',
  237. 'wp-admin/js/wp-gears.dev.js',
  238. 'wp-admin/js/wp-gears.js',
  239. 'wp-admin/options-misc.php',
  240. 'wp-admin/page-new.php',
  241. 'wp-admin/page.php',
  242. 'wp-admin/rtl.css',
  243. 'wp-admin/rtl.dev.css',
  244. 'wp-admin/update-links.php',
  245. 'wp-admin/wp-admin.css',
  246. 'wp-admin/wp-admin.dev.css',
  247. 'wp-includes/js/codepress',
  248. 'wp-includes/js/codepress/engines/khtml.js',
  249. 'wp-includes/js/codepress/engines/older.js',
  250. 'wp-includes/js/jquery/autocomplete.dev.js',
  251. 'wp-includes/js/jquery/autocomplete.js',
  252. 'wp-includes/js/jquery/interface.js',
  253. 'wp-includes/js/scriptaculous/prototype.js',
  254. 'wp-includes/js/tinymce/wp-tinymce.js',
  255. // 3.1
  256. 'wp-admin/edit-attachment-rows.php',
  257. 'wp-admin/edit-link-categories.php',
  258. 'wp-admin/edit-link-category-form.php',
  259. 'wp-admin/edit-post-rows.php',
  260. 'wp-admin/images/button-grad-active-vs.png',
  261. 'wp-admin/images/button-grad-vs.png',
  262. 'wp-admin/images/fav-arrow-vs-rtl.gif',
  263. 'wp-admin/images/fav-arrow-vs.gif',
  264. 'wp-admin/images/fav-top-vs.gif',
  265. 'wp-admin/images/list-vs.png',
  266. 'wp-admin/images/screen-options-right-up.gif',
  267. 'wp-admin/images/screen-options-right.gif',
  268. 'wp-admin/images/visit-site-button-grad-vs.gif',
  269. 'wp-admin/images/visit-site-button-grad.gif',
  270. 'wp-admin/link-category.php',
  271. 'wp-admin/sidebar.php',
  272. 'wp-includes/classes.php',
  273. 'wp-includes/js/tinymce/blank.htm',
  274. 'wp-includes/js/tinymce/plugins/media/css/content.css',
  275. 'wp-includes/js/tinymce/plugins/media/img',
  276. 'wp-includes/js/tinymce/plugins/safari',
  277. // 3.2
  278. 'wp-admin/images/logo-login.gif',
  279. 'wp-admin/images/star.gif',
  280. 'wp-admin/js/list-table.dev.js',
  281. 'wp-admin/js/list-table.js',
  282. 'wp-includes/default-embeds.php',
  283. 'wp-includes/js/tinymce/plugins/wordpress/img/help.gif',
  284. 'wp-includes/js/tinymce/plugins/wordpress/img/more.gif',
  285. 'wp-includes/js/tinymce/plugins/wordpress/img/toolbars.gif',
  286. 'wp-includes/js/tinymce/themes/advanced/img/fm.gif',
  287. 'wp-includes/js/tinymce/themes/advanced/img/sflogo.png',
  288. // 3.3
  289. 'wp-admin/css/colors-classic-rtl.css',
  290. 'wp-admin/css/colors-classic-rtl.dev.css',
  291. 'wp-admin/css/colors-fresh-rtl.css',
  292. 'wp-admin/css/colors-fresh-rtl.dev.css',
  293. 'wp-admin/css/dashboard-rtl.css',
  294. 'wp-admin/css/dashboard-rtl.dev.css',
  295. 'wp-admin/css/dashboard.css',
  296. 'wp-admin/css/dashboard.dev.css',
  297. 'wp-admin/css/farbtastic-rtl.css',
  298. 'wp-admin/css/global-rtl.css',
  299. 'wp-admin/css/global-rtl.dev.css',
  300. 'wp-admin/css/global.css',
  301. 'wp-admin/css/global.dev.css',
  302. 'wp-admin/css/install-rtl.css',
  303. 'wp-admin/css/install-rtl.dev.css',
  304. 'wp-admin/css/login-rtl.css',
  305. 'wp-admin/css/login-rtl.dev.css',
  306. 'wp-admin/css/login.css',
  307. 'wp-admin/css/login.dev.css',
  308. 'wp-admin/css/ms.css',
  309. 'wp-admin/css/ms.dev.css',
  310. 'wp-admin/css/nav-menu-rtl.css',
  311. 'wp-admin/css/nav-menu-rtl.dev.css',
  312. 'wp-admin/css/nav-menu.css',
  313. 'wp-admin/css/nav-menu.dev.css',
  314. 'wp-admin/css/plugin-install-rtl.css',
  315. 'wp-admin/css/plugin-install-rtl.dev.css',
  316. 'wp-admin/css/plugin-install.css',
  317. 'wp-admin/css/plugin-install.dev.css',
  318. 'wp-admin/css/press-this-rtl.css',
  319. 'wp-admin/css/press-this-rtl.dev.css',
  320. 'wp-admin/css/press-this.css',
  321. 'wp-admin/css/press-this.dev.css',
  322. 'wp-admin/css/theme-editor-rtl.css',
  323. 'wp-admin/css/theme-editor-rtl.dev.css',
  324. 'wp-admin/css/theme-editor.css',
  325. 'wp-admin/css/theme-editor.dev.css',
  326. 'wp-admin/css/theme-install-rtl.css',
  327. 'wp-admin/css/theme-install-rtl.dev.css',
  328. 'wp-admin/css/theme-install.css',
  329. 'wp-admin/css/theme-install.dev.css',
  330. 'wp-admin/css/widgets-rtl.css',
  331. 'wp-admin/css/widgets-rtl.dev.css',
  332. 'wp-admin/css/widgets.css',
  333. 'wp-admin/css/widgets.dev.css',
  334. 'wp-admin/includes/internal-linking.php',
  335. 'wp-includes/images/admin-bar-sprite-rtl.png',
  336. 'wp-includes/js/jquery/ui.button.js',
  337. 'wp-includes/js/jquery/ui.core.js',
  338. 'wp-includes/js/jquery/ui.dialog.js',
  339. 'wp-includes/js/jquery/ui.draggable.js',
  340. 'wp-includes/js/jquery/ui.droppable.js',
  341. 'wp-includes/js/jquery/ui.mouse.js',
  342. 'wp-includes/js/jquery/ui.position.js',
  343. 'wp-includes/js/jquery/ui.resizable.js',
  344. 'wp-includes/js/jquery/ui.selectable.js',
  345. 'wp-includes/js/jquery/ui.sortable.js',
  346. 'wp-includes/js/jquery/ui.tabs.js',
  347. 'wp-includes/js/jquery/ui.widget.js',
  348. 'wp-includes/js/l10n.dev.js',
  349. 'wp-includes/js/l10n.js',
  350. 'wp-includes/js/tinymce/plugins/wplink/css',
  351. 'wp-includes/js/tinymce/plugins/wplink/img',
  352. 'wp-includes/js/tinymce/plugins/wplink/js',
  353. 'wp-includes/js/tinymce/themes/advanced/img/wpicons.png',
  354. 'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png',
  355. 'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/button_bg.png',
  356. 'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif',
  357. 'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png',
  358. 'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/separator.gif',
  359. // Don't delete, yet: 'wp-rss.php',
  360. // Don't delete, yet: 'wp-rdf.php',
  361. // Don't delete, yet: 'wp-rss2.php',
  362. // Don't delete, yet: 'wp-commentsrss2.php',
  363. // Don't delete, yet: 'wp-atom.php',
  364. // Don't delete, yet: 'wp-feed.php',
  365. // 3.4
  366. 'wp-admin/images/gray-star.png',
  367. 'wp-admin/images/logo-login.png',
  368. 'wp-admin/images/star.png',
  369. 'wp-admin/index-extra.php',
  370. 'wp-admin/network/index-extra.php',
  371. 'wp-admin/user/index-extra.php',
  372. 'wp-admin/images/screenshots/admin-flyouts.png',
  373. 'wp-admin/images/screenshots/coediting.png',
  374. 'wp-admin/images/screenshots/drag-and-drop.png',
  375. 'wp-admin/images/screenshots/help-screen.png',
  376. 'wp-admin/images/screenshots/media-icon.png',
  377. 'wp-admin/images/screenshots/new-feature-pointer.png',
  378. 'wp-admin/images/screenshots/welcome-screen.png',
  379. 'wp-includes/css/editor-buttons.css',
  380. 'wp-includes/css/editor-buttons.dev.css',
  381. 'wp-includes/js/tinymce/plugins/paste/blank.htm',
  382. 'wp-includes/js/tinymce/plugins/wordpress/css',
  383. 'wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js',
  384. 'wp-includes/js/tinymce/plugins/wordpress/img/embedded.png',
  385. 'wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif',
  386. 'wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif',
  387. 'wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js',
  388. 'wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css',
  389. 'wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.dev.js',
  390. 'wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin.dev.js',
  391. 'wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.dev.js',
  392. 'wp-includes/js/tinymce/plugins/wpgallery/img/gallery.png',
  393. 'wp-includes/js/tinymce/plugins/wplink/editor_plugin.dev.js',
  394. // Don't delete, yet: 'wp-pass.php',
  395. // Don't delete, yet: 'wp-register.php',
  396. // 3.5
  397. 'wp-admin/gears-manifest.php',
  398. 'wp-admin/includes/manifest.php',
  399. 'wp-admin/images/archive-link.png',
  400. 'wp-admin/images/blue-grad.png',
  401. 'wp-admin/images/button-grad-active.png',
  402. 'wp-admin/images/button-grad.png',
  403. 'wp-admin/images/ed-bg-vs.gif',
  404. 'wp-admin/images/ed-bg.gif',
  405. 'wp-admin/images/fade-butt.png',
  406. 'wp-admin/images/fav-arrow-rtl.gif',
  407. 'wp-admin/images/fav-arrow.gif',
  408. 'wp-admin/images/fav-vs.png',
  409. 'wp-admin/images/fav.png',
  410. 'wp-admin/images/gray-grad.png',
  411. 'wp-admin/images/loading-publish.gif',
  412. 'wp-admin/images/logo-ghost.png',
  413. 'wp-admin/images/logo.gif',
  414. 'wp-admin/images/menu-arrow-frame-rtl.png',
  415. 'wp-admin/images/menu-arrow-frame.png',
  416. 'wp-admin/images/menu-arrows.gif',
  417. 'wp-admin/images/menu-bits-rtl-vs.gif',
  418. 'wp-admin/images/menu-bits-rtl.gif',
  419. 'wp-admin/images/menu-bits-vs.gif',
  420. 'wp-admin/images/menu-bits.gif',
  421. 'wp-admin/images/menu-dark-rtl-vs.gif',
  422. 'wp-admin/images/menu-dark-rtl.gif',
  423. 'wp-admin/images/menu-dark-vs.gif',
  424. 'wp-admin/images/menu-dark.gif',
  425. 'wp-admin/images/required.gif',
  426. 'wp-admin/images/screen-options-toggle-vs.gif',
  427. 'wp-admin/images/screen-options-toggle.gif',
  428. 'wp-admin/images/toggle-arrow-rtl.gif',
  429. 'wp-admin/images/toggle-arrow.gif',
  430. 'wp-admin/images/upload-classic.png',
  431. 'wp-admin/images/upload-fresh.png',
  432. 'wp-admin/images/white-grad-active.png',
  433. 'wp-admin/images/white-grad.png',
  434. 'wp-admin/images/widgets-arrow-vs.gif',
  435. 'wp-admin/images/widgets-arrow.gif',
  436. 'wp-admin/images/wpspin_dark.gif',
  437. 'wp-includes/images/upload.png',
  438. 'wp-includes/js/prototype.js',
  439. 'wp-includes/js/scriptaculous',
  440. );
  441. /**
  442. * Stores new files in wp-content to copy
  443. *
  444. * The contents of this array indicate any new bundled plugins/themes which
  445. * should be installed with the WordPress Upgrade. These items will not be
  446. * re-installed in future upgrades, this behaviour is controlled by the
  447. * introduced version present here being older than the current installed version.
  448. *
  449. * The content of this array should follow the following format:
  450. * Filename (relative to wp-content) => Introduced version
  451. * Directories should be noted by suffixing it with a trailing slash (/)
  452. *
  453. * @since 3.2.0
  454. * @global array $_new_bundled_files
  455. * @var array
  456. * @name $_new_bundled_files
  457. */
  458. global $_new_bundled_files;
  459. $_new_bundled_files = array(
  460. 'plugins/akismet/' => '2.0',
  461. 'themes/twentyten/' => '3.0',
  462. 'themes/twentyeleven/' => '3.2'
  463. );
  464. /**
  465. * Upgrade the core of WordPress.
  466. *
  467. * This will create a .maintenance file at the base of the WordPress directory
  468. * to ensure that people can not access the web site, when the files are being
  469. * copied to their locations.
  470. *
  471. * The files in the {@link $_old_files} list will be removed and the new files
  472. * copied from the zip file after the database is upgraded.
  473. *
  474. * The files in the {@link $_new_bundled_files} list will be added to the installation
  475. * if the version is greater than or equal to the old version being upgraded.
  476. *
  477. * The steps for the upgrader for after the new release is downloaded and
  478. * unzipped is:
  479. * 1. Test unzipped location for select files to ensure that unzipped worked.
  480. * 2. Create the .maintenance file in current WordPress base.
  481. * 3. Copy new WordPress directory over old WordPress files.
  482. * 4. Upgrade WordPress to new version.
  483. * 4.1. Copy all files/folders other than wp-content
  484. * 4.2. Copy any language files to WP_LANG_DIR (which may differ from WP_CONTENT_DIR
  485. * 4.3. Copy any new bundled themes/plugins to their respective locations
  486. * 5. Delete new WordPress directory path.
  487. * 6. Delete .maintenance file.
  488. * 7. Remove old files.
  489. * 8. Delete 'update_core' option.
  490. *
  491. * There are several areas of failure. For instance if PHP times out before step
  492. * 6, then you will not be able to access any portion of your site. Also, since
  493. * the upgrade will not continue where it left off, you will not be able to
  494. * automatically remove old files and remove the 'update_core' option. This
  495. * isn't that bad.
  496. *
  497. * If the copy of the new WordPress over the old fails, then the worse is that
  498. * the new WordPress directory will remain.
  499. *
  500. * If it is assumed that every file will be copied over, including plugins and
  501. * themes, then if you edit the default theme, you should rename it, so that
  502. * your changes remain.
  503. *
  504. * @since 2.7.0
  505. *
  506. * @param string $from New release unzipped path.
  507. * @param string $to Path to old WordPress installation.
  508. * @return WP_Error|null WP_Error on failure, null on success.
  509. */
  510. function update_core($from, $to) {
  511. global $wp_filesystem, $_old_files, $_new_bundled_files, $wpdb;
  512. @set_time_limit( 300 );
  513. $php_version = phpversion();
  514. $mysql_version = $wpdb->db_version();
  515. $required_php_version = '5.2.4';
  516. $required_mysql_version = '5.0';
  517. $wp_version = '3.4';
  518. $php_compat = version_compare( $php_version, $required_php_version, '>=' );
  519. if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
  520. $mysql_compat = true;
  521. else
  522. $mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' );
  523. if ( !$mysql_compat || !$php_compat )
  524. $wp_filesystem->delete($from, true);
  525. if ( !$mysql_compat && !$php_compat )
  526. 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 ) );
  527. elseif ( !$php_compat )
  528. 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 ) );
  529. elseif ( !$mysql_compat )
  530. 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 ) );
  531. // Sanity check the unzipped distribution
  532. apply_filters('update_feedback', __('Verifying the unpacked files&#8230;'));
  533. $distro = '';
  534. $roots = array( '/wordpress/', '/wordpress-mu/' );
  535. foreach( $roots as $root ) {
  536. if ( $wp_filesystem->exists($from . $root . 'readme.html') && $wp_filesystem->exists($from . $root . 'wp-includes/version.php') ) {
  537. $distro = $root;
  538. break;
  539. }
  540. }
  541. if ( !$distro ) {
  542. $wp_filesystem->delete($from, true);
  543. return new WP_Error('insane_distro', __('The update could not be unpacked') );
  544. }
  545. apply_filters('update_feedback', __('Installing the latest version&#8230;'));
  546. // Create maintenance file to signal that we are upgrading
  547. $maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
  548. $maintenance_file = $to . '.maintenance';
  549. $wp_filesystem->delete($maintenance_file);
  550. $wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE);
  551. // Copy new versions of WP files into place.
  552. $result = _copy_dir($from . $distro, $to, array('wp-content') );
  553. // Custom Content Directory needs updating now.
  554. // Copy Languages
  555. if ( !is_wp_error($result) && $wp_filesystem->is_dir($from . $distro . 'wp-content/languages') ) {
  556. if ( WP_LANG_DIR != ABSPATH . WPINC . '/languages' || @is_dir(WP_LANG_DIR) )
  557. $lang_dir = WP_LANG_DIR;
  558. else
  559. $lang_dir = WP_CONTENT_DIR . '/languages';
  560. if ( !@is_dir($lang_dir) && 0 === strpos($lang_dir, ABSPATH) ) { // Check the language directory exists first
  561. $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.
  562. clearstatcache(); // for FTP, Need to clear the stat cache
  563. }
  564. if ( @is_dir($lang_dir) ) {
  565. $wp_lang_dir = $wp_filesystem->find_folder($lang_dir);
  566. if ( $wp_lang_dir )
  567. $result = copy_dir($from . $distro . 'wp-content/languages/', $wp_lang_dir);
  568. }
  569. }
  570. // Copy New bundled plugins & themes
  571. // This gives us the ability to install new plugins & themes bundled with future versions of WordPress whilst avoiding the re-install upon upgrade issue.
  572. if ( !is_wp_error($result) && ( ! defined('CORE_UPGRADE_SKIP_NEW_BUNDLED') || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) {
  573. $old_version = $GLOBALS['wp_version']; // $wp_version in local scope == new version
  574. foreach ( (array) $_new_bundled_files as $file => $introduced_version ) {
  575. // If $introduced version is greater than what the site was previously running
  576. if ( version_compare($introduced_version, $old_version, '>') ) {
  577. $directory = ('/' == $file[ strlen($file)-1 ]);
  578. list($type, $filename) = explode('/', $file, 2);
  579. if ( 'plugins' == $type )
  580. $dest = $wp_filesystem->wp_plugins_dir();
  581. elseif ( 'themes' == $type )
  582. $dest = trailingslashit($wp_filesystem->wp_themes_dir()); // Back-compat, ::wp_themes_dir() did not return trailingslash'd pre-3.2
  583. else
  584. continue;
  585. if ( ! $directory ) {
  586. if ( $wp_filesystem->exists($dest . $filename) )
  587. continue;
  588. if ( ! $wp_filesystem->copy($from . $distro . 'wp-content/' . $file, $dest . $filename, FS_CHMOD_FILE) )
  589. $result = new WP_Error('copy_failed', __('Could not copy file.'), $dest . $filename);
  590. } else {
  591. if ( $wp_filesystem->is_dir($dest . $filename) )
  592. continue;
  593. $wp_filesystem->mkdir($dest . $filename, FS_CHMOD_DIR);
  594. $_result = copy_dir( $from . $distro . 'wp-content/' . $file, $dest . $filename);
  595. if ( is_wp_error($_result) ) //If a error occurs partway through this final step, keep the error flowing through, but keep process going.
  596. $result = $_result;
  597. }
  598. }
  599. } //end foreach
  600. }
  601. // Handle $result error from the above blocks
  602. if ( is_wp_error($result) ) {
  603. $wp_filesystem->delete($maintenance_file);
  604. $wp_filesystem->delete($from, true);
  605. return $result;
  606. }
  607. // Remove old files
  608. foreach ( $_old_files as $old_file ) {
  609. $old_file = $to . $old_file;
  610. if ( !$wp_filesystem->exists($old_file) )
  611. continue;
  612. $wp_filesystem->delete($old_file, true);
  613. }
  614. // Upgrade DB with separate request
  615. apply_filters('update_feedback', __('Upgrading database&#8230;'));
  616. $db_upgrade_url = admin_url('upgrade.php?step=upgrade_db');
  617. wp_remote_post($db_upgrade_url, array('timeout' => 60));
  618. // Remove working directory
  619. $wp_filesystem->delete($from, true);
  620. // Force refresh of update information
  621. if ( function_exists('delete_site_transient') )
  622. delete_site_transient('update_core');
  623. else
  624. delete_option('update_core');
  625. // Remove maintenance file, we're done.
  626. $wp_filesystem->delete($maintenance_file);
  627. // If we made it this far:
  628. do_action( '_core_updated_successfully', $wp_version );
  629. return $wp_version;
  630. }
  631. /**
  632. * Copies a directory from one location to another via the WordPress Filesystem Abstraction.
  633. * Assumes that WP_Filesystem() has already been called and setup.
  634. *
  635. * This is a temporary function for the 3.1 -> 3.2 upgrade only and will be removed in 3.3
  636. *
  637. * @ignore
  638. * @since 3.2.0
  639. * @see copy_dir()
  640. *
  641. * @param string $from source directory
  642. * @param string $to destination directory
  643. * @param array $skip_list a list of files/folders to skip copying
  644. * @return mixed WP_Error on failure, True on success.
  645. */
  646. function _copy_dir($from, $to, $skip_list = array() ) {
  647. global $wp_filesystem;
  648. $dirlist = $wp_filesystem->dirlist($from);
  649. $from = trailingslashit($from);
  650. $to = trailingslashit($to);
  651. $skip_regex = '';
  652. foreach ( (array)$skip_list as $key => $skip_file )
  653. $skip_regex .= preg_quote($skip_file, '!') . '|';
  654. if ( !empty($skip_regex) )
  655. $skip_regex = '!(' . rtrim($skip_regex, '|') . ')$!i';
  656. foreach ( (array) $dirlist as $filename => $fileinfo ) {
  657. if ( !empty($skip_regex) )
  658. if ( preg_match($skip_regex, $from . $filename) )
  659. continue;
  660. if ( 'f' == $fileinfo['type'] ) {
  661. if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) {
  662. // If copy failed, chmod file to 0644 and try again.
  663. $wp_filesystem->chmod($to . $filename, 0644);
  664. if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) )
  665. return new WP_Error('copy_failed', __('Could not copy file.'), $to . $filename);
  666. }
  667. } elseif ( 'd' == $fileinfo['type'] ) {
  668. if ( !$wp_filesystem->is_dir($to . $filename) ) {
  669. if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) )
  670. return new WP_Error('mkdir_failed', __('Could not create directory.'), $to . $filename);
  671. }
  672. $result = _copy_dir($from . $filename, $to . $filename, $skip_list);
  673. if ( is_wp_error($result) )
  674. return $result;
  675. }
  676. }
  677. return true;
  678. }
  679. /**
  680. * Redirect to the About WordPress page after a successful upgrade.
  681. *
  682. * This function is only needed when the existing install is older than 3.4.0.
  683. *
  684. * @since 3.3.0
  685. *
  686. */
  687. function _redirect_to_about_wordpress( $new_version ) {
  688. global $wp_version, $pagenow, $action;
  689. if ( version_compare( $wp_version, '3.4-RC1', '>=' ) )
  690. return;
  691. // Ensure we only run this on the update-core.php page. wp_update_core() could be called in other contexts.
  692. if ( 'update-core.php' != $pagenow )
  693. return;
  694. if ( 'do-core-upgrade' != $action && 'do-core-reinstall' != $action )
  695. return;
  696. // Load the updated default text localization domain for new strings
  697. load_default_textdomain();
  698. // See do_core_upgrade()
  699. show_message( __('WordPress updated successfully') );
  700. 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="%s">here</a>.' ), $new_version, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
  701. show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $new_version, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
  702. echo '</div>';
  703. ?>
  704. <script type="text/javascript">
  705. window.location = '<?php echo self_admin_url( 'about.php?updated' ); ?>';
  706. </script>
  707. <?php
  708. // Include admin-footer.php and exit
  709. include(ABSPATH . 'wp-admin/admin-footer.php');
  710. exit();
  711. }
  712. add_action( '_core_updated_successfully', '_redirect_to_about_wordpress' );