Ticket #41699: 41699.3.diff
File 41699.3.diff, 12.3 KB (added by , 6 years ago) |
---|
-
src/wp-admin/admin.php
if ( get_option('db_upgraded') ) { 75 75 do_action( 'after_mu_upgrade', $response ); 76 76 unset($response); 77 77 } 78 78 unset($c); 79 79 } 80 80 } 81 81 82 82 require_once(ABSPATH . 'wp-admin/includes/admin.php'); 83 83 84 84 auth_redirect(); 85 85 86 86 // Schedule trash collection 87 87 if ( ! wp_next_scheduled( 'wp_scheduled_delete' ) && ! wp_installing() ) 88 88 wp_schedule_event(time(), 'daily', 'wp_scheduled_delete'); 89 89 90 // Schedule Transient cleanup 91 if ( ! wp_next_scheduled( 'delete_expired_transients' ) && ! wp_installing() ) 92 wp_schedule_event( time(), 'daily', 'delete_expired_transients' ); 93 90 94 set_screen_options(); 91 95 92 96 $date_format = __( 'F j, Y' ); 93 97 $time_format = __( 'g:i a' ); 94 98 95 99 wp_enqueue_script( 'common' ); 96 100 97 98 99 100 101 /** 101 102 * $pagenow is set in vars.php 102 103 * $wp_importers is sometimes set in wp-admin/includes/import.php 103 104 * The remaining variables are imported as globals elsewhere, declared as globals here 104 105 * 105 106 * @global string $pagenow 106 107 * @global array $wp_importers 107 108 * @global string $hook_suffix 108 109 * @global string $plugin_page 109 110 * @global string $typenow 110 111 * @global string $taxnow 111 112 */ 112 113 global $pagenow, $wp_importers, $hook_suffix, $plugin_page, $typenow, $taxnow; 113 114 114 115 $page_hook = null; -
src/wp-admin/includes/schema.php
function populate_options() { 572 572 'links_recently_updated_time', 'links_recently_updated_prepend', 'links_recently_updated_append', 573 573 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 574 574 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', 575 575 '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', 576 576 'can_compress_scripts', 'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', 577 577 'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page', 578 578 'wporg_popular_tags', 'what_to_show', 'rss_language', 'language', 'enable_xmlrpc', 'enable_app', 579 579 'embed_autourls', 'default_post_edit_rows', 'gzipcompression', 'advanced_edit' 580 580 ); 581 581 foreach ( $unusedoptions as $option ) 582 582 delete_option($option); 583 583 584 584 // Delete obsolete magpie stuff. 585 585 $wpdb->query("DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'"); 586 586 587 /* 588 * Deletes all expired transients. The multi-table delete syntax is used 589 * to delete the transient record from table a, and the corresponding 590 * transient_timeout record from table b. 591 */ 592 $time = time(); 593 $sql = "DELETE a, b FROM $wpdb->options a, $wpdb->options b 594 WHERE a.option_name LIKE %s 595 AND a.option_name NOT LIKE %s 596 AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) ) 597 AND b.option_value < %d"; 598 $wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_transient_' ) . '%', $wpdb->esc_like( '_transient_timeout_' ) . '%', $time ) ); 599 600 if ( is_main_site() && is_main_network() ) { 601 $sql = "DELETE a, b FROM $wpdb->options a, $wpdb->options b 602 WHERE a.option_name LIKE %s 603 AND a.option_name NOT LIKE %s 604 AND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) ) 605 AND b.option_value < %d"; 606 $wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_site_transient_' ) . '%', $wpdb->esc_like( '_site_transient_timeout_' ) . '%', $time ) ); 607 } 587 // Clear expired transients 588 delete_expired_transients( true ); 608 589 } 609 590 610 591 /** 611 592 * Execute WordPress role creation for the various WordPress versions. 612 593 * 613 594 * @since 2.0.0 614 595 */ 615 596 function populate_roles() { 616 597 populate_roles_160(); 617 598 populate_roles_210(); 618 599 populate_roles_230(); 619 600 populate_roles_250(); 620 601 populate_roles_260(); 621 602 populate_roles_270(); 622 603 populate_roles_280(); -
src/wp-admin/includes/upgrade.php
function upgrade_460() { 1734 1734 } 1735 1735 } 1736 1736 } 1737 1737 1738 1738 /** 1739 1739 * Executes network-level upgrade routines. 1740 1740 * 1741 1741 * @since 3.0.0 1742 1742 * 1743 1743 * @global int $wp_current_db_version 1744 1744 * @global wpdb $wpdb 1745 1745 */ 1746 1746 function upgrade_network() { 1747 1747 global $wp_current_db_version, $wpdb; 1748 1748 1749 // Always. 1750 if ( is_main_network() ) { 1751 /* 1752 * Deletes all expired transients. The multi-table delete syntax is used 1753 * to delete the transient record from table a, and the corresponding 1754 * transient_timeout record from table b. 1755 */ 1756 $time = time(); 1757 $sql = "DELETE a, b FROM $wpdb->sitemeta a, $wpdb->sitemeta b 1758 WHERE a.meta_key LIKE %s 1759 AND a.meta_key NOT LIKE %s 1760 AND b.meta_key = CONCAT( '_site_transient_timeout_', SUBSTRING( a.meta_key, 17 ) ) 1761 AND b.meta_value < %d"; 1762 $wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_site_transient_' ) . '%', $wpdb->esc_like ( '_site_transient_timeout_' ) . '%', $time ) ); 1763 } 1749 // Always clear expired transients 1750 delete_expired_transients( true ); 1764 1751 1765 1752 // 2.8. 1766 1753 if ( $wp_current_db_version < 11549 ) { 1767 1754 $wpmu_sitewide_plugins = get_site_option( 'wpmu_sitewide_plugins' ); 1768 1755 $active_sitewide_plugins = get_site_option( 'active_sitewide_plugins' ); 1769 1756 if ( $wpmu_sitewide_plugins ) { 1770 1757 if ( !$active_sitewide_plugins ) 1771 1758 $sitewide_plugins = (array) $wpmu_sitewide_plugins; 1772 1759 else 1773 1760 $sitewide_plugins = array_merge( (array) $active_sitewide_plugins, (array) $wpmu_sitewide_plugins ); 1774 1761 1775 1762 update_site_option( 'active_sitewide_plugins', $sitewide_plugins ); 1776 1763 } 1777 1764 delete_site_option( 'wpmu_sitewide_plugins' ); 1778 1765 delete_site_option( 'deactivated_sitewide_plugins' ); -
src/wp-includes/default-filters.php
add_action( 'sanitize_comment_cookies', 305 305 add_action( 'admin_print_scripts', 'print_emoji_detection_script' ); 306 306 add_action( 'admin_print_scripts', 'print_head_scripts', 20 ); 307 307 add_action( 'admin_print_footer_scripts', '_wp_footer_scripts' ); 308 308 add_action( 'admin_print_styles', 'print_emoji_styles' ); 309 309 add_action( 'admin_print_styles', 'print_admin_styles', 20 ); 310 310 add_action( 'init', 'smilies_init', 5 ); 311 311 add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 ); 312 312 add_action( 'plugins_loaded', 'wp_maybe_load_embeds', 0 ); 313 313 add_action( 'shutdown', 'wp_ob_end_flush_all', 1 ); 314 314 // Create a revision whenever a post is updated. 315 315 add_action( 'post_updated', 'wp_save_post_revision', 10, 1 ); 316 316 add_action( 'publish_post', '_publish_post_hook', 5, 1 ); 317 317 add_action( 'transition_post_status', '_transition_post_status', 5, 3 ); 318 318 add_action( 'transition_post_status', '_update_term_count_on_transition_post_status', 10, 3 ); 319 319 add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce' ); 320 add_action( 'wp_scheduled_delete', 'wp_scheduled_delete' );321 add_action( 'wp_scheduled_auto_draft_delete', 'wp_delete_auto_drafts' );322 320 add_action( 'admin_init', 'send_frame_options_header', 10, 0 ); 323 add_action( 'importer_scheduled_cleanup', 'wp_delete_attachment' );324 add_action( 'upgrader_scheduled_cleanup', 'wp_delete_attachment' );325 321 add_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' ); 326 322 add_action( 'welcome_panel', 'wp_welcome_panel' ); 327 323 324 // Cron tasks 325 add_action( 'wp_scheduled_delete', 'wp_scheduled_delete' ); 326 add_action( 'wp_scheduled_auto_draft_delete', 'wp_delete_auto_drafts' ); 327 add_action( 'importer_scheduled_cleanup', 'wp_delete_attachment' ); 328 add_action( 'upgrader_scheduled_cleanup', 'wp_delete_attachment' ); 329 add_action( 'delete_expired_transients', 'delete_expired_transients' ); 330 328 331 // Navigation menu actions 329 332 add_action( 'delete_post', '_wp_delete_post_menu_item' ); 330 333 add_action( 'delete_term', '_wp_delete_tax_menu_item', 10, 3 ); 331 334 add_action( 'transition_post_status', '_wp_auto_add_pages_to_menu', 10, 3 ); 332 335 add_action( 'delete_post', '_wp_delete_customize_changeset_dependent_auto_drafts' ); 333 336 334 337 // Post Thumbnail CSS class filtering 335 338 add_action( 'begin_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_add' ); 336 339 add_action( 'end_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_remove' ); 337 340 338 341 // Redirect Old Slugs 339 342 add_action( 'template_redirect', 'wp_old_slug_redirect' ); 340 343 add_action( 'post_updated', 'wp_check_for_changed_slugs', 12, 3 ); 341 344 add_action( 'attachment_updated', 'wp_check_for_changed_slugs', 12, 3 ); 342 345 -
src/wp-includes/option.php
function set_transient( $transient, $val 805 805 * Fires after the value for a transient has been set. 806 806 * 807 807 * @since 3.0.0 808 808 * @since 3.6.0 The `$value` and `$expiration` parameters were added. 809 809 * 810 810 * @param string $transient The name of the transient. 811 811 * @param mixed $value Transient value. 812 812 * @param int $expiration Time until expiration in seconds. 813 813 */ 814 814 do_action( 'setted_transient', $transient, $value, $expiration ); 815 815 } 816 816 return $result; 817 817 } 818 818 819 819 /** 820 * Deletes all expired transients. 821 * 822 * The multi-table delete syntax is used to delete the transient record 823 * from table a, and the corresponding transient_timeout record from table b. + 824 * 825 * @since 4.9.0 826 * 827 * @param bool $force_db Optional. Force cleanup to run against the database even when an external object cache is used. 828 */ 829 function delete_expired_transients( $force_db = false) { 830 global $wpdb; 831 832 if ( ! $force_db && wp_using_ext_object_cache() ) { 833 return; 834 } 835 836 $wpdb->query( $wpdb->prepare( 837 "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b 838 WHERE a.option_name LIKE %s 839 AND a.option_name NOT LIKE %s 840 AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) ) 841 AND b.option_value < %d", 842 $wpdb->esc_like( '_transient_' ) . '%', 843 $wpdb->esc_like( '_transient_timeout_' ) . '%', 844 time() 845 ) ); 846 847 if ( ! is_multisite() ) { 848 // non-Multisite stores site transients in the options table. 849 $wpdb->query( $wpdb->prepare( 850 "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b 851 WHERE a.option_name LIKE %s 852 AND a.option_name NOT LIKE %s 853 AND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) ) 854 AND b.option_value < %d", 855 $wpdb->esc_like( '_site_transient_' ) . '%', 856 $wpdb->esc_like( '_site_transient_timeout_' ) . '%', 857 time() 858 ) ); 859 } elseif ( is_multisite() && is_main_site() && is_main_network() ) { 860 // Multisite stores site transients in the sitemeta table. 861 $wpdb->query( $wpdb->prepare( 862 "DELETE a, b FROM {$wpdb->sitemeta} a, {$wpdb->sitemeta} b 863 WHERE a.meta_key LIKE %s 864 AND a.meta_key NOT LIKE %s 865 AND b.meta_key = CONCAT( '_site_transient_timeout_', SUBSTRING( a.meta_key, 17 ) ) 866 AND b.meta_value < %d", 867 $wpdb->esc_like( '_site_transient_' ) . '%', 868 $wpdb->esc_like( '_site_transient_timeout_' ) . '%', 869 time() 870 ) ); 871 } 872 } 873 874 /** 820 875 * Saves and restores user interface settings stored in a cookie. 821 876 * 822 877 * Checks if the current user-settings cookie is updated and stores it. When no 823 878 * cookie exists (different browser used), adds the last saved cookie restoring 824 879 * the settings. 825 880 * 826 881 * @since 2.7.0 827 882 */ 828 883 function wp_user_settings() { 829 884 830 885 if ( ! is_admin() || wp_doing_ajax() ) { 831 886 return; 832 887 } 833 888 834 889 if ( ! $user_id = get_current_user_id() ) {