-
+ 1462E3DDB5D228615F9BE8C50CF36A803CC5F89E161B3672D06226C443F54828FB821A01DCC7C8C295D40BD1157779481CDC4946DF975A90992A9123B2440ED6
mp-wp/wp-admin/includes/update-core-fuckit.php
(0 . 0)(1 . 263)
44479 <?php
44480 /**
44481 * WordPress core upgrade functionality.
44482 *
44483 * @package WordPress
44484 * @subpackage Administration
44485 * @since 2.7.0
44486 */
44487
44488 /**
44489 * Stores files to be deleted.
44490 *
44491 * @since 2.7.0
44492 * @global array $_old_files
44493 * @var array
44494 * @name $_old_files
44495 */
44496 global $_old_files;
44497
44498 $_old_files = array(
44499 'wp-admin/bookmarklet.php',
44500 'wp-admin/css/upload.css',
44501 'wp-admin/css/upload-rtl.css',
44502 'wp-admin/css/press-this-ie.css',
44503 'wp-admin/css/press-this-ie-rtl.css',
44504 'wp-admin/edit-form.php',
44505 'wp-admin/link-import.php',
44506 'wp-admin/images/box-bg-left.gif',
44507 'wp-admin/images/box-bg-right.gif',
44508 'wp-admin/images/box-bg.gif',
44509 'wp-admin/images/box-butt-left.gif',
44510 'wp-admin/images/box-butt-right.gif',
44511 'wp-admin/images/box-butt.gif',
44512 'wp-admin/images/box-head-left.gif',
44513 'wp-admin/images/box-head-right.gif',
44514 'wp-admin/images/box-head.gif',
44515 'wp-admin/images/heading-bg.gif',
44516 'wp-admin/images/login-bkg-bottom.gif',
44517 'wp-admin/images/login-bkg-tile.gif',
44518 'wp-admin/images/notice.gif',
44519 'wp-admin/images/toggle.gif',
44520 'wp-admin/images/comment-stalk-classic.gif',
44521 'wp-admin/images/comment-stalk-fresh.gif',
44522 'wp-admin/images/comment-stalk-rtl.gif',
44523 'wp-admin/images/comment-pill.gif',
44524 'wp-admin/images/del.png',
44525 'wp-admin/images/media-button-gallery.gif',
44526 'wp-admin/images/media-buttons.gif',
44527 'wp-admin/images/tail.gif',
44528 'wp-admin/images/gear.png',
44529 'wp-admin/images/tab.png',
44530 'wp-admin/images/postbox-bg.gif',
44531 'wp-admin/includes/upload.php',
44532 'wp-admin/js/dbx-admin-key.js',
44533 'wp-admin/js/link-cat.js',
44534 'wp-admin/js/forms.js',
44535 'wp-admin/js/upload.js',
44536 'wp-admin/profile-update.php',
44537 'wp-admin/templates.php',
44538 'wp-includes/images/audio.png',
44539 'wp-includes/images/css.png',
44540 'wp-includes/images/default.png',
44541 'wp-includes/images/doc.png',
44542 'wp-includes/images/exe.png',
44543 'wp-includes/images/html.png',
44544 'wp-includes/images/js.png',
44545 'wp-includes/images/pdf.png',
44546 'wp-includes/images/swf.png',
44547 'wp-includes/images/tar.png',
44548 'wp-includes/images/text.png',
44549 'wp-includes/images/video.png',
44550 'wp-includes/images/zip.png',
44551 'wp-includes/js/dbx.js',
44552 'wp-includes/js/fat.js',
44553 'wp-includes/js/list-manipulation.js',
44554 'wp-includes/js/jquery/jquery.dimensions.min.js',
44555 'wp-includes/js/tinymce/langs/en.js',
44556 'wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js',
44557 'wp-includes/js/tinymce/plugins/autosave/langs',
44558 'wp-includes/js/tinymce/plugins/directionality/images',
44559 'wp-includes/js/tinymce/plugins/directionality/langs',
44560 'wp-includes/js/tinymce/plugins/inlinepopups/css',
44561 'wp-includes/js/tinymce/plugins/inlinepopups/images',
44562 'wp-includes/js/tinymce/plugins/inlinepopups/jscripts',
44563 'wp-includes/js/tinymce/plugins/paste/images',
44564 'wp-includes/js/tinymce/plugins/paste/jscripts',
44565 'wp-includes/js/tinymce/plugins/paste/langs',
44566 'wp-includes/js/tinymce/plugins/spellchecker/classes/HttpClient.class.php',
44567 'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php',
44568 'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php',
44569 'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php',
44570 'wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css',
44571 'wp-includes/js/tinymce/plugins/spellchecker/images',
44572 'wp-includes/js/tinymce/plugins/spellchecker/langs',
44573 'wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php',
44574 'wp-includes/js/tinymce/plugins/wordpress/images',
44575 'wp-includes/js/tinymce/plugins/wordpress/langs',
44576 'wp-includes/js/tinymce/plugins/wordpress/popups.css',
44577 'wp-includes/js/tinymce/plugins/wordpress/wordpress.css',
44578 'wp-includes/js/tinymce/plugins/wphelp',
44579 'wp-includes/js/tinymce/themes/advanced/css',
44580 'wp-includes/js/tinymce/themes/advanced/images',
44581 'wp-includes/js/tinymce/themes/advanced/jscripts',
44582 'wp-includes/js/tinymce/themes/advanced/langs',
44583 'wp-includes/js/tinymce/tiny_mce_gzip.php',
44584 'wp-includes/js/wp-ajax.js',
44585 'wp-admin/admin-db.php',
44586 'wp-admin/cat.js',
44587 'wp-admin/categories.js',
44588 'wp-admin/custom-fields.js',
44589 'wp-admin/dbx-admin-key.js',
44590 'wp-admin/edit-comments.js',
44591 'wp-admin/install-rtl.css',
44592 'wp-admin/install.css',
44593 'wp-admin/upgrade-schema.php',
44594 'wp-admin/upload-functions.php',
44595 'wp-admin/upload-rtl.css',
44596 'wp-admin/upload.css',
44597 'wp-admin/upload.js',
44598 'wp-admin/users.js',
44599 'wp-admin/widgets-rtl.css',
44600 'wp-admin/widgets.css',
44601 'wp-admin/xfn.js',
44602 'wp-includes/js/tinymce/license.html',
44603 'wp-admin/cat-js.php',
44604 'wp-admin/edit-form-ajax-cat.php',
44605 'wp-admin/execute-pings.php',
44606 'wp-admin/import/b2.php',
44607 'wp-admin/inline-uploading.php',
44608 'wp-admin/link-categories.php',
44609 'wp-admin/list-manipulation.js',
44610 'wp-admin/list-manipulation.php',
44611 'wp-includes/comment-functions.php',
44612 'wp-includes/feed-functions.php',
44613 'wp-includes/functions-compat.php',
44614 'wp-includes/functions-formatting.php',
44615 'wp-includes/functions-post.php',
44616 'wp-includes/js/dbx-key.js',
44617 'wp-includes/js/tinymce/plugins/autosave/langs/cs.js',
44618 'wp-includes/js/tinymce/plugins/autosave/langs/sv.js',
44619 'wp-includes/js/tinymce/themes/advanced/editor_template_src.js',
44620 'wp-includes/links.php',
44621 'wp-includes/pluggable-functions.php',
44622 'wp-includes/template-functions-author.php',
44623 'wp-includes/template-functions-category.php',
44624 'wp-includes/template-functions-general.php',
44625 'wp-includes/template-functions-links.php',
44626 'wp-includes/template-functions-post.php',
44627 'wp-includes/wp-l10n.php',
44628 'wp-admin/import-b2.php',
44629 'wp-admin/import-blogger.php',
44630 'wp-admin/import-greymatter.php',
44631 'wp-admin/import-livejournal.php',
44632 'wp-admin/import-mt.php',
44633 'wp-admin/import-rss.php',
44634 'wp-admin/import-textpattern.php',
44635 'wp-admin/quicktags.js',
44636 'wp-images/fade-butt.png',
44637 'wp-images/get-firefox.png',
44638 'wp-images/header-shadow.png',
44639 'wp-images/smilies',
44640 'wp-images/wp-small.png',
44641 'wp-images/wpminilogo.png',
44642 'wp.php',
44643 'wp-content/themes/default/attachment.php',
44644 'wp-content/themes/default/images/kubrickbg.jpg',
44645 'wp-content/plugins/markdown.php',
44646 'wp-content/plugins/textile1.php',
44647 );
44648
44649 /**
44650 * Upgrade the core of WordPress.
44651 *
44652 * This will create a .maintenance file at the base of the WordPress directory
44653 * to ensure that people can not access the web site, when the files are being
44654 * copied to their locations.
44655 *
44656 * The files in the {@link $_old_files} list will be removed and the new files
44657 * copied from the zip file after the database is upgraded.
44658 *
44659 * The steps for the upgrader for after the new release is downloaded and
44660 * unzipped is:
44661 * 1. Test unzipped location for select files to ensure that unzipped worked.
44662 * 2. Create the .maintenance file in current WordPress base.
44663 * 3. Copy new WordPress directory over old WordPress files.
44664 * 4. Upgrade WordPress to new version.
44665 * 5. Delete new WordPress directory path.
44666 * 6. Delete .maintenance file.
44667 * 7. Remove old files.
44668 * 8. Delete 'update_core' option.
44669 *
44670 * There are several areas of failure. For instance if PHP times out before step
44671 * 6, then you will not be able to access any portion of your site. Also, since
44672 * the upgrade will not continue where it left off, you will not be able to
44673 * automatically remove old files and remove the 'update_core' option. This
44674 * isn't that bad.
44675 *
44676 * If the copy of the new WordPress over the old fails, then the worse is that
44677 * the new WordPress directory will remain.
44678 *
44679 * If it is assumed that every file will be copied over, including plugins and
44680 * themes, then if you edit the default theme, you should rename it, so that
44681 * your changes remain.
44682 *
44683 * @since 2.7.0
44684 *
44685 * @param string $from New release unzipped path.
44686 * @param string $to Path to old WordPress installation.
44687 * @return WP_Error|null WP_Error on failure, null on success.
44688 */
44689 function update_core($from, $to) {
44690 global $wp_filesystem, $_old_files;
44691
44692 @set_time_limit( 300 );
44693
44694 // Sanity check the unzipped distribution
44695 apply_filters('update_feedback', __('Verifying the unpacked files'));
44696 if ( !$wp_filesystem->exists($from . '/wordpress/wp-settings.php') || !$wp_filesystem->exists($from . '/wordpress/wp-admin/admin.php') ||
44697 !$wp_filesystem->exists($from . '/wordpress/wp-includes/functions.php') ) {
44698 $wp_filesystem->delete($from, true);
44699 return new WP_Error('insane_distro', __('The update could not be unpacked') );
44700 }
44701
44702 apply_filters('update_feedback', __('Installing the latest version'));
44703
44704 // Create maintenance file to signal that we are upgrading
44705 $maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
44706 $maintenance_file = $to . '.maintenance';
44707 $wp_filesystem->delete($maintenance_file);
44708 $wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE);
44709
44710 // Copy new versions of WP files into place.
44711 $result = copy_dir($from . '/wordpress', $to);
44712 if ( is_wp_error($result) ) {
44713 $wp_filesystem->delete($maintenance_file);
44714 //$wp_filesystem->delete($working_dir, true); //TODO: Uncomment? This DOES mean that the new files are available in the upgrade folder if it fails.
44715 return $result;
44716 }
44717
44718 // Remove old files
44719 foreach ( $_old_files as $old_file ) {
44720 $old_file = $to . $old_file;
44721 if ( !$wp_filesystem->exists($old_file) )
44722 continue;
44723 $wp_filesystem->delete($old_file, true);
44724 }
44725
44726 // Upgrade DB with separate request
44727 apply_filters('update_feedback', __('Upgrading database'));
44728 $db_upgrade_url = admin_url('upgrade.php?step=upgrade_db');
44729 wp_remote_post($db_upgrade_url, array('timeout' => 60));
44730
44731 // Remove working directory
44732 $wp_filesystem->delete($from, true);
44733
44734 // Force refresh of update information
44735 delete_option('update_core');
44736
44737 // Remove maintenance file, we're done.
44738 $wp_filesystem->delete($maintenance_file);
44739 }
44740
44741 ?>