author | Anthony Ly <anthonyly.com@gmail.com> |
Wed, 19 Dec 2012 17:46:52 -0800 | |
changeset 204 | 09a1c134465b |
parent 194 | 32102edaa81b |
permissions | -rw-r--r-- |
136 | 1 |
<?php |
2 |
/** |
|
3 |
* Upgrade WordPress Page. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
||
9 |
/** |
|
10 |
* We are upgrading WordPress. |
|
11 |
* |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
12 |
* @since 1.5.1 |
136 | 13 |
* @var bool |
14 |
*/ |
|
15 |
define( 'WP_INSTALLING', true ); |
|
16 |
||
17 |
/** Load WordPress Bootstrap */ |
|
18 |
require( '../wp-load.php' ); |
|
19 |
||
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
20 |
nocache_headers(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
21 |
|
136 | 22 |
timer_start(); |
23 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
24 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
25 |
delete_site_transient('update_core'); |
136 | 26 |
|
27 |
if ( isset( $_GET['step'] ) ) |
|
28 |
$step = $_GET['step']; |
|
29 |
else |
|
30 |
$step = 0; |
|
31 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
32 |
// Do it. No output. |
136 | 33 |
if ( 'upgrade_db' === $step ) { |
34 |
wp_upgrade(); |
|
35 |
die( '0' ); |
|
36 |
} |
|
37 |
||
38 |
$step = (int) $step; |
|
39 |
||
40 |
$php_version = phpversion(); |
|
41 |
$mysql_version = $wpdb->db_version(); |
|
42 |
$php_compat = version_compare( $php_version, $required_php_version, '>=' ); |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
43 |
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
44 |
$mysql_compat = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
45 |
else |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
46 |
$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ); |
136 | 47 |
|
48 |
@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); |
|
49 |
?> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
50 |
<!DOCTYPE html> |
136 | 51 |
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> |
52 |
<head> |
|
53 |
<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" /> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
54 |
<title><?php _e( 'WordPress › Update' ); ?></title> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
55 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
56 |
wp_admin_css( 'install', true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
57 |
wp_admin_css( 'ie', true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
58 |
?> |
136 | 59 |
</head> |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
60 |
<body class="wp-core-ui"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
61 |
<h1 id="logo"><a href="<?php esc_attr_e( 'http://wordpress.org/' ); ?>"><?php _e( 'WordPress' ); ?></a></h1> |
136 | 62 |
|
63 |
<?php if ( get_option( 'db_version' ) == $wp_db_version || !is_blog_installed() ) : ?> |
|
64 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
65 |
<h2><?php _e( 'No Update Required' ); ?></h2> |
136 | 66 |
<p><?php _e( 'Your WordPress database is already up-to-date!' ); ?></p> |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
67 |
<p class="step"><a class="button button-large" href="<?php echo get_option( 'home' ); ?>/"><?php _e( 'Continue' ); ?></a></p> |
136 | 68 |
|
69 |
<?php elseif ( !$php_compat || !$mysql_compat ) : |
|
70 |
if ( !$mysql_compat && !$php_compat ) |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
71 |
printf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> 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 ); |
136 | 72 |
elseif ( !$php_compat ) |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
73 |
printf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ); |
136 | 74 |
elseif ( !$mysql_compat ) |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
75 |
printf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ); |
136 | 76 |
?> |
77 |
<?php else : |
|
78 |
switch ( $step ) : |
|
79 |
case 0: |
|
80 |
$goback = stripslashes( wp_get_referer() ); |
|
81 |
$goback = esc_url_raw( $goback ); |
|
82 |
$goback = urlencode( $goback ); |
|
83 |
?> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
84 |
<h2><?php _e( 'Database Update Required' ); ?></h2> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
85 |
<p><?php _e( 'WordPress has been updated! Before we send you on your way, we have to update your database to the newest version.' ); ?></p> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
86 |
<p><?php _e( 'The update process may take a little while, so please be patient.' ); ?></p> |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
87 |
<p class="step"><a class="button button-large" href="upgrade.php?step=1&backto=<?php echo $goback; ?>"><?php _e( 'Update WordPress Database' ); ?></a></p> |
136 | 88 |
<?php |
89 |
break; |
|
90 |
case 1: |
|
91 |
wp_upgrade(); |
|
92 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
93 |
$backto = !empty($_GET['backto']) ? stripslashes( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
94 |
$backto = esc_url( $backto ); |
136 | 95 |
$backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/'); |
96 |
?> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
97 |
<h2><?php _e( 'Update Complete' ); ?></h2> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
98 |
<p><?php _e( 'Your WordPress database has been successfully updated!' ); ?></p> |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
99 |
<p class="step"><a class="button button-large" href="<?php echo $backto; ?>"><?php _e( 'Continue' ); ?></a></p> |
136 | 100 |
|
101 |
<!-- |
|
102 |
<pre> |
|
103 |
<?php printf( __( '%s queries' ), $wpdb->num_queries ); ?> |
|
104 |
||
105 |
<?php printf( __( '%s seconds' ), timer_stop( 0 ) ); ?> |
|
106 |
</pre> |
|
107 |
--> |
|
108 |
||
109 |
<?php |
|
110 |
break; |
|
111 |
endswitch; |
|
112 |
endif; |
|
113 |
?> |
|
114 |
</body> |
|
115 |
</html> |