author | ymh <ymh.work@gmail.com> |
Fri, 05 Sep 2025 18:52:52 +0200 | |
changeset 22 | 8c2e4d02f4ef |
parent 21 | 48c4eec2b7e6 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* Update Core administration panel. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
||
9 |
/** WordPress Administration Bootstrap */ |
|
16 | 10 |
require_once __DIR__ . '/admin.php'; |
0 | 11 |
|
12 |
wp_enqueue_style( 'plugin-install' ); |
|
13 |
wp_enqueue_script( 'plugin-install' ); |
|
5 | 14 |
wp_enqueue_script( 'updates' ); |
0 | 15 |
add_thickbox(); |
16 |
||
17 |
if ( is_multisite() && ! is_network_admin() ) { |
|
18 |
wp_redirect( network_admin_url( 'update-core.php' ) ); |
|
16 | 19 |
exit; |
0 | 20 |
} |
21 |
||
9 | 22 |
if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_languages' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
23 |
wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); |
9 | 24 |
} |
0 | 25 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
26 |
/** |
16 | 27 |
* Lists available core updates. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
28 |
* |
16 | 29 |
* @since 2.7.0 |
30 |
* |
|
31 |
* @global string $wp_local_package Locale code of the package. |
|
32 |
* @global wpdb $wpdb WordPress database abstraction object. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
33 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
34 |
* @param object $update |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
35 |
*/ |
0 | 36 |
function list_core_update( $update ) { |
9 | 37 |
global $wp_local_package, $wpdb; |
38 |
static $first_pass = true; |
|
0 | 39 |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
40 |
$wp_version = wp_get_wp_version(); |
18 | 41 |
$version_string = sprintf( '%s–%s', $update->current, get_locale() ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
42 |
|
16 | 43 |
if ( 'en_US' === $update->locale && 'en_US' === get_locale() ) { |
9 | 44 |
$version_string = $update->current; |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
45 |
} elseif ( 'en_US' === $update->locale && $update->packages->partial && $wp_version === $update->partial_version ) { |
16 | 46 |
$updates = get_core_updates(); |
47 |
if ( $updates && 1 === count( $updates ) ) { |
|
48 |
// If the only available update is a partial builds, it doesn't need a language-specific version string. |
|
49 |
$version_string = $update->current; |
|
50 |
} |
|
19 | 51 |
} elseif ( 'en_US' === $update->locale && 'en_US' !== get_locale() ) { |
52 |
$version_string = sprintf( '%s–%s', $update->current, $update->locale ); |
|
9 | 53 |
} |
0 | 54 |
|
55 |
$current = false; |
|
16 | 56 |
if ( ! isset( $update->response ) || 'latest' === $update->response ) { |
0 | 57 |
$current = true; |
9 | 58 |
} |
18 | 59 |
|
60 |
$message = ''; |
|
9 | 61 |
$form_action = 'update-core.php?action=do-core-upgrade'; |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
62 |
$php_version = PHP_VERSION; |
9 | 63 |
$mysql_version = $wpdb->db_version(); |
64 |
$show_buttons = true; |
|
18 | 65 |
|
66 |
// Nightly build versions have two hyphens and a commit number. |
|
67 |
if ( preg_match( '/-\w+-\d+/', $update->current ) ) { |
|
68 |
// Retrieve the major version number. |
|
69 |
preg_match( '/^\d+.\d+/', $update->current, $update_major ); |
|
70 |
/* translators: %s: WordPress version. */ |
|
71 |
$submit = sprintf( __( 'Update to latest %s nightly' ), $update_major[0] ); |
|
72 |
} else { |
|
73 |
/* translators: %s: WordPress version. */ |
|
74 |
$submit = sprintf( __( 'Update to version %s' ), $version_string ); |
|
75 |
} |
|
76 |
||
16 | 77 |
if ( 'development' === $update->response ) { |
18 | 78 |
$message = __( 'You can update to the latest nightly build manually:' ); |
0 | 79 |
} else { |
80 |
if ( $current ) { |
|
16 | 81 |
/* translators: %s: WordPress version. */ |
18 | 82 |
$submit = sprintf( __( 'Re-install version %s' ), $version_string ); |
0 | 83 |
$form_action = 'update-core.php?action=do-core-reinstall'; |
84 |
} else { |
|
9 | 85 |
$php_compat = version_compare( $php_version, $update->php_version, '>=' ); |
86 |
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) { |
|
0 | 87 |
$mysql_compat = true; |
9 | 88 |
} else { |
0 | 89 |
$mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' ); |
9 | 90 |
} |
91 |
||
92 |
$version_url = sprintf( |
|
16 | 93 |
/* translators: %s: WordPress version. */ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
94 |
esc_url( __( 'https://wordpress.org/documentation/wordpress-version/version-%s/' ) ), |
9 | 95 |
sanitize_title( $update->current ) |
96 |
); |
|
97 |
||
16 | 98 |
$php_update_message = '</p><p>' . sprintf( |
99 |
/* translators: %s: URL to Update PHP page. */ |
|
100 |
__( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
101 |
esc_url( wp_get_update_php_url() ) |
|
102 |
); |
|
0 | 103 |
|
9 | 104 |
$annotation = wp_get_update_php_annotation(); |
16 | 105 |
|
9 | 106 |
if ( $annotation ) { |
107 |
$php_update_message .= '</p><p><em>' . $annotation . '</em>'; |
|
108 |
} |
|
109 |
||
110 |
if ( ! $mysql_compat && ! $php_compat ) { |
|
16 | 111 |
$message = sprintf( |
112 |
/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Minimum required MySQL version number, 5: Current PHP version number, 6: Current MySQL version number. */ |
|
113 |
__( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher and MySQL version %4$s or higher. You are running PHP version %5$s and MySQL version %6$s.' ), |
|
114 |
$version_url, |
|
115 |
$update->current, |
|
116 |
$update->php_version, |
|
117 |
$update->mysql_version, |
|
118 |
$php_version, |
|
119 |
$mysql_version |
|
120 |
) . $php_update_message; |
|
9 | 121 |
} elseif ( ! $php_compat ) { |
16 | 122 |
$message = sprintf( |
123 |
/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Current PHP version number. */ |
|
124 |
__( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher. You are running version %4$s.' ), |
|
125 |
$version_url, |
|
126 |
$update->current, |
|
127 |
$update->php_version, |
|
128 |
$php_version |
|
129 |
) . $php_update_message; |
|
9 | 130 |
} elseif ( ! $mysql_compat ) { |
16 | 131 |
$message = sprintf( |
132 |
/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required MySQL version number, 4: Current MySQL version number. */ |
|
133 |
__( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires MySQL version %3$s or higher. You are running version %4$s.' ), |
|
134 |
$version_url, |
|
135 |
$update->current, |
|
136 |
$update->mysql_version, |
|
137 |
$mysql_version |
|
138 |
); |
|
9 | 139 |
} else { |
16 | 140 |
$message = sprintf( |
18 | 141 |
/* translators: 1: Installed WordPress version number, 2: URL to WordPress release notes, 3: New WordPress version number, including locale if necessary. */ |
142 |
__( 'You can update from WordPress %1$s to <a href="%2$s">WordPress %3$s</a> manually:' ), |
|
143 |
$wp_version, |
|
16 | 144 |
$version_url, |
145 |
$version_string |
|
146 |
); |
|
9 | 147 |
} |
18 | 148 |
|
9 | 149 |
if ( ! $mysql_compat || ! $php_compat ) { |
0 | 150 |
$show_buttons = false; |
9 | 151 |
} |
0 | 152 |
} |
153 |
} |
|
154 |
||
155 |
echo '<p>'; |
|
156 |
echo $message; |
|
157 |
echo '</p>'; |
|
18 | 158 |
|
19 | 159 |
echo '<form method="post" action="' . esc_url( $form_action ) . '" name="upgrade" class="upgrade">'; |
9 | 160 |
wp_nonce_field( 'upgrade-core' ); |
18 | 161 |
|
0 | 162 |
echo '<p>'; |
18 | 163 |
echo '<input name="version" value="' . esc_attr( $update->current ) . '" type="hidden" />'; |
164 |
echo '<input name="locale" value="' . esc_attr( $update->locale ) . '" type="hidden" />'; |
|
0 | 165 |
if ( $show_buttons ) { |
166 |
if ( $first_pass ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
167 |
submit_button( $submit, $current ? '' : 'primary regular', 'upgrade', false ); |
0 | 168 |
$first_pass = false; |
169 |
} else { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
170 |
submit_button( $submit, '', 'upgrade', false ); |
0 | 171 |
} |
172 |
} |
|
16 | 173 |
if ( 'en_US' !== $update->locale ) { |
9 | 174 |
if ( ! isset( $update->dismissed ) || ! $update->dismissed ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
175 |
submit_button( __( 'Hide this update' ), '', 'dismiss', false ); |
9 | 176 |
} else { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
177 |
submit_button( __( 'Bring back this update' ), '', 'undismiss', false ); |
9 | 178 |
} |
179 |
} |
|
0 | 180 |
echo '</p>'; |
18 | 181 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
182 |
if ( 'en_US' !== $update->locale && ( ! isset( $wp_local_package ) || $wp_local_package !== $update->locale ) ) { |
16 | 183 |
echo '<p class="hint">' . __( 'This localized version contains both the translation and various other localization fixes.' ) . '</p>'; |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
184 |
} elseif ( 'en_US' === $update->locale && 'en_US' !== get_locale() && ( ! $update->packages->partial && $wp_version === $update->partial_version ) ) { |
9 | 185 |
// Partial builds don't need language-specific warnings. |
16 | 186 |
echo '<p class="hint">' . sprintf( |
187 |
/* translators: %s: WordPress version. */ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
188 |
__( 'You are about to install WordPress %s <strong>in English (US)</strong>. There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.' ), |
16 | 189 |
'development' !== $update->response ? $update->current : '' |
190 |
) . '</p>'; |
|
0 | 191 |
} |
18 | 192 |
|
0 | 193 |
echo '</form>'; |
194 |
} |
|
195 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
196 |
/** |
16 | 197 |
* Display dismissed updates. |
198 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
199 |
* @since 2.7.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
200 |
*/ |
0 | 201 |
function dismissed_updates() { |
9 | 202 |
$dismissed = get_core_updates( |
203 |
array( |
|
204 |
'dismissed' => true, |
|
205 |
'available' => false, |
|
206 |
) |
|
207 |
); |
|
19 | 208 |
|
0 | 209 |
if ( $dismissed ) { |
9 | 210 |
$show_text = esc_js( __( 'Show hidden updates' ) ); |
211 |
$hide_text = esc_js( __( 'Hide hidden updates' ) ); |
|
212 |
?> |
|
19 | 213 |
<script type="text/javascript"> |
214 |
jQuery( function( $ ) { |
|
215 |
$( '#show-dismissed' ).on( 'click', function() { |
|
216 |
var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) ); |
|
217 |
||
218 |
if ( isExpanded ) { |
|
219 |
$( this ).text( '<?php echo $show_text; ?>' ).attr( 'aria-expanded', 'false' ); |
|
220 |
} else { |
|
221 |
$( this ).text( '<?php echo $hide_text; ?>' ).attr( 'aria-expanded', 'true' ); |
|
222 |
} |
|
223 |
||
224 |
$( '#dismissed-updates' ).toggle( 'fast' ); |
|
225 |
}); |
|
226 |
}); |
|
227 |
</script> |
|
9 | 228 |
<?php |
229 |
echo '<p class="hide-if-no-js"><button type="button" class="button" id="show-dismissed" aria-expanded="false">' . __( 'Show hidden updates' ) . '</button></p>'; |
|
0 | 230 |
echo '<ul id="dismissed-updates" class="core-updates dismissed">'; |
9 | 231 |
foreach ( (array) $dismissed as $update ) { |
0 | 232 |
echo '<li>'; |
233 |
list_core_update( $update ); |
|
234 |
echo '</li>'; |
|
235 |
} |
|
236 |
echo '</ul>'; |
|
237 |
} |
|
238 |
} |
|
239 |
||
240 |
/** |
|
241 |
* Display upgrade WordPress for downloading latest or upgrading automatically form. |
|
242 |
* |
|
5 | 243 |
* @since 2.7.0 |
0 | 244 |
*/ |
245 |
function core_upgrade_preamble() { |
|
18 | 246 |
$updates = get_core_updates(); |
0 | 247 |
|
18 | 248 |
// Include an unmodified $wp_version. |
249 |
require ABSPATH . WPINC . '/version.php'; |
|
250 |
||
251 |
$is_development_version = preg_match( '/alpha|beta|RC/', $wp_version ); |
|
16 | 252 |
|
253 |
if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) { |
|
18 | 254 |
echo '<h2 class="response">'; |
255 |
_e( 'An updated version of WordPress is available.' ); |
|
256 |
echo '</h2>'; |
|
257 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
258 |
$message = sprintf( |
16 | 259 |
/* translators: 1: Documentation on WordPress backups, 2: Documentation on updating WordPress. */ |
260 |
__( '<strong>Important:</strong> Before updating, please <a href="%1$s">back up your database and files</a>. For help with updates, visit the <a href="%2$s">Updating WordPress</a> documentation page.' ), |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
261 |
__( 'https://developer.wordpress.org/advanced-administration/security/backup/' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
262 |
__( 'https://wordpress.org/documentation/article/updating-wordpress/' ) |
16 | 263 |
); |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
264 |
wp_admin_notice( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
265 |
$message, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
266 |
array( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
267 |
'type' => 'warning', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
268 |
'additional_classes' => array( 'inline' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
269 |
) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
270 |
); |
18 | 271 |
} elseif ( $is_development_version ) { |
272 |
echo '<h2 class="response">' . __( 'You are using a development version of WordPress.' ) . '</h2>'; |
|
273 |
} else { |
|
274 |
echo '<h2 class="response">' . __( 'You have the latest version of WordPress.' ) . '</h2>'; |
|
0 | 275 |
} |
276 |
||
277 |
echo '<ul class="core-updates">'; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
278 |
foreach ( (array) $updates as $update ) { |
0 | 279 |
echo '<li>'; |
280 |
list_core_update( $update ); |
|
281 |
echo '</li>'; |
|
282 |
} |
|
283 |
echo '</ul>'; |
|
18 | 284 |
|
0 | 285 |
// Don't show the maintenance mode notice when we are only showing a single re-install option. |
16 | 286 |
if ( $updates && ( count( $updates ) > 1 || 'latest' !== $updates[0]->response ) ) { |
287 |
echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, this mode will be deactivated.' ) . '</p>'; |
|
0 | 288 |
} elseif ( ! $updates ) { |
289 |
list( $normalized_version ) = explode( '-', $wp_version ); |
|
16 | 290 |
echo '<p>' . sprintf( |
291 |
/* translators: 1: URL to About screen, 2: WordPress version. */ |
|
292 |
__( '<a href="%1$s">Learn more about WordPress %2$s</a>.' ), |
|
293 |
esc_url( self_admin_url( 'about.php' ) ), |
|
294 |
$normalized_version |
|
295 |
) . '</p>'; |
|
0 | 296 |
} |
18 | 297 |
|
0 | 298 |
dismissed_updates(); |
299 |
} |
|
300 |
||
16 | 301 |
/** |
18 | 302 |
* Display WordPress auto-updates settings. |
303 |
* |
|
304 |
* @since 5.6.0 |
|
305 |
*/ |
|
306 |
function core_auto_updates_settings() { |
|
307 |
if ( isset( $_GET['core-major-auto-updates-saved'] ) ) { |
|
308 |
if ( 'enabled' === $_GET['core-major-auto-updates-saved'] ) { |
|
309 |
$notice_text = __( 'Automatic updates for all WordPress versions have been enabled. Thank you!' ); |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
310 |
wp_admin_notice( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
311 |
$notice_text, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
312 |
array( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
313 |
'type' => 'success', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
314 |
'dismissible' => true, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
315 |
) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
316 |
); |
18 | 317 |
} elseif ( 'disabled' === $_GET['core-major-auto-updates-saved'] ) { |
318 |
$notice_text = __( 'WordPress will only receive automatic security and maintenance releases from now on.' ); |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
319 |
wp_admin_notice( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
320 |
$notice_text, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
321 |
array( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
322 |
'type' => 'success', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
323 |
'dismissible' => true, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
324 |
) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
325 |
); |
18 | 326 |
} |
327 |
} |
|
328 |
||
329 |
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
330 |
$updater = new WP_Automatic_Updater(); |
|
331 |
||
332 |
// Defaults: |
|
333 |
$upgrade_dev = get_site_option( 'auto_update_core_dev', 'enabled' ) === 'enabled'; |
|
334 |
$upgrade_minor = get_site_option( 'auto_update_core_minor', 'enabled' ) === 'enabled'; |
|
335 |
$upgrade_major = get_site_option( 'auto_update_core_major', 'unset' ) === 'enabled'; |
|
336 |
||
337 |
$can_set_update_option = true; |
|
338 |
// WP_AUTO_UPDATE_CORE = true (all), 'beta', 'rc', 'development', 'branch-development', 'minor', false. |
|
339 |
if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) { |
|
340 |
if ( false === WP_AUTO_UPDATE_CORE ) { |
|
341 |
// Defaults to turned off, unless a filter allows it. |
|
342 |
$upgrade_dev = false; |
|
343 |
$upgrade_minor = false; |
|
344 |
$upgrade_major = false; |
|
345 |
} elseif ( true === WP_AUTO_UPDATE_CORE |
|
346 |
|| in_array( WP_AUTO_UPDATE_CORE, array( 'beta', 'rc', 'development', 'branch-development' ), true ) |
|
347 |
) { |
|
348 |
// ALL updates for core. |
|
349 |
$upgrade_dev = true; |
|
350 |
$upgrade_minor = true; |
|
351 |
$upgrade_major = true; |
|
352 |
} elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) { |
|
353 |
// Only minor updates for core. |
|
354 |
$upgrade_dev = false; |
|
355 |
$upgrade_minor = true; |
|
356 |
$upgrade_major = false; |
|
357 |
} |
|
358 |
||
359 |
// The UI is overridden by the `WP_AUTO_UPDATE_CORE` constant. |
|
360 |
$can_set_update_option = false; |
|
361 |
} |
|
362 |
||
363 |
if ( $updater->is_disabled() ) { |
|
364 |
$upgrade_dev = false; |
|
365 |
$upgrade_minor = false; |
|
366 |
$upgrade_major = false; |
|
367 |
||
368 |
/* |
|
369 |
* The UI is overridden by the `AUTOMATIC_UPDATER_DISABLED` constant |
|
370 |
* or the `automatic_updater_disabled` filter, |
|
371 |
* or by `wp_is_file_mod_allowed( 'automatic_updater' )`. |
|
372 |
* See `WP_Automatic_Updater::is_disabled()`. |
|
373 |
*/ |
|
374 |
$can_set_update_option = false; |
|
375 |
} |
|
376 |
||
377 |
// Is the UI overridden by a plugin using the `allow_major_auto_core_updates` filter? |
|
378 |
if ( has_filter( 'allow_major_auto_core_updates' ) ) { |
|
379 |
$can_set_update_option = false; |
|
380 |
} |
|
381 |
||
382 |
/** This filter is documented in wp-admin/includes/class-core-upgrader.php */ |
|
383 |
$upgrade_dev = apply_filters( 'allow_dev_auto_core_updates', $upgrade_dev ); |
|
384 |
/** This filter is documented in wp-admin/includes/class-core-upgrader.php */ |
|
385 |
$upgrade_minor = apply_filters( 'allow_minor_auto_core_updates', $upgrade_minor ); |
|
386 |
/** This filter is documented in wp-admin/includes/class-core-upgrader.php */ |
|
387 |
$upgrade_major = apply_filters( 'allow_major_auto_core_updates', $upgrade_major ); |
|
388 |
||
389 |
$auto_update_settings = array( |
|
390 |
'dev' => $upgrade_dev, |
|
391 |
'minor' => $upgrade_minor, |
|
392 |
'major' => $upgrade_major, |
|
393 |
); |
|
394 |
||
395 |
if ( $upgrade_major ) { |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
396 |
$wp_version = wp_get_wp_version(); |
18 | 397 |
$updates = get_core_updates(); |
398 |
||
399 |
if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) { |
|
400 |
echo '<p>' . wp_get_auto_update_message() . '</p>'; |
|
401 |
} |
|
402 |
} |
|
403 |
||
404 |
$action_url = self_admin_url( 'update-core.php?action=core-major-auto-updates-settings' ); |
|
405 |
?> |
|
406 |
||
407 |
<p class="auto-update-status"> |
|
408 |
<?php |
|
409 |
||
410 |
if ( $updater->is_vcs_checkout( ABSPATH ) ) { |
|
411 |
_e( 'This site appears to be under version control. Automatic updates are disabled.' ); |
|
412 |
} elseif ( $upgrade_major ) { |
|
413 |
_e( 'This site is automatically kept up to date with each new version of WordPress.' ); |
|
414 |
||
415 |
if ( $can_set_update_option ) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
416 |
echo '<br />'; |
18 | 417 |
printf( |
418 |
'<a href="%s" class="core-auto-update-settings-link core-auto-update-settings-link-disable">%s</a>', |
|
419 |
wp_nonce_url( add_query_arg( 'value', 'disable', $action_url ), 'core-major-auto-updates-nonce' ), |
|
420 |
__( 'Switch to automatic updates for maintenance and security releases only.' ) |
|
421 |
); |
|
422 |
} |
|
423 |
} elseif ( $upgrade_minor ) { |
|
424 |
_e( 'This site is automatically kept up to date with maintenance and security releases of WordPress only.' ); |
|
425 |
||
426 |
if ( $can_set_update_option ) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
427 |
echo '<br />'; |
18 | 428 |
printf( |
429 |
'<a href="%s" class="core-auto-update-settings-link core-auto-update-settings-link-enable">%s</a>', |
|
430 |
wp_nonce_url( add_query_arg( 'value', 'enable', $action_url ), 'core-major-auto-updates-nonce' ), |
|
431 |
__( 'Enable automatic updates for all new versions of WordPress.' ) |
|
432 |
); |
|
433 |
} |
|
434 |
} else { |
|
435 |
_e( 'This site will not receive automatic updates for new versions of WordPress.' ); |
|
436 |
} |
|
437 |
?> |
|
438 |
</p> |
|
439 |
||
440 |
<?php |
|
441 |
/** |
|
442 |
* Fires after the major core auto-update settings. |
|
443 |
* |
|
444 |
* @since 5.6.0 |
|
445 |
* |
|
446 |
* @param array $auto_update_settings { |
|
447 |
* Array of core auto-update settings. |
|
448 |
* |
|
449 |
* @type bool $dev Whether to enable automatic updates for development versions. |
|
450 |
* @type bool $minor Whether to enable minor automatic core updates. |
|
451 |
* @type bool $major Whether to enable major automatic core updates. |
|
452 |
* } |
|
453 |
*/ |
|
454 |
do_action( 'after_core_auto_updates_settings', $auto_update_settings ); |
|
455 |
} |
|
456 |
||
457 |
/** |
|
16 | 458 |
* Display the upgrade plugins form. |
459 |
* |
|
460 |
* @since 2.9.0 |
|
461 |
*/ |
|
0 | 462 |
function list_plugin_updates() { |
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
463 |
$wp_version = wp_get_wp_version(); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
464 |
$cur_wp_version = preg_replace( '/-.*$/', '', $wp_version ); |
0 | 465 |
|
16 | 466 |
require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
0 | 467 |
$plugins = get_plugin_updates(); |
468 |
if ( empty( $plugins ) ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
469 |
echo '<h2>' . __( 'Plugins' ) . '</h2>'; |
0 | 470 |
echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>'; |
471 |
return; |
|
472 |
} |
|
473 |
$form_action = 'update-core.php?action=do-plugin-upgrade'; |
|
474 |
||
475 |
$core_updates = get_core_updates(); |
|
16 | 476 |
if ( ! isset( $core_updates[0]->response ) || 'latest' === $core_updates[0]->response || 'development' === $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=' ) ) { |
0 | 477 |
$core_update_version = false; |
9 | 478 |
} else { |
0 | 479 |
$core_update_version = $core_updates[0]->current; |
9 | 480 |
} |
18 | 481 |
|
482 |
$plugins_count = count( $plugins ); |
|
0 | 483 |
?> |
18 | 484 |
<h2> |
485 |
<?php |
|
486 |
printf( |
|
487 |
'%s <span class="count">(%d)</span>', |
|
488 |
__( 'Plugins' ), |
|
489 |
number_format_i18n( $plugins_count ) |
|
490 |
); |
|
491 |
?> |
|
492 |
</h2> |
|
0 | 493 |
<p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.' ); ?></p> |
494 |
<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade"> |
|
9 | 495 |
<?php wp_nonce_field( 'upgrade-core' ); ?> |
496 |
<p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e( 'Update Plugins' ); ?>" name="upgrade" /></p> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
497 |
<table class="widefat updates-table" id="update-plugins-table"> |
0 | 498 |
<thead> |
499 |
<tr> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
500 |
<td class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></td> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
501 |
<td class="manage-column"><label for="plugins-select-all"><?php _e( 'Select All' ); ?></label></td> |
0 | 502 |
</tr> |
503 |
</thead> |
|
504 |
||
505 |
<tbody class="plugins"> |
|
9 | 506 |
<?php |
16 | 507 |
|
508 |
$auto_updates = array(); |
|
509 |
if ( wp_is_auto_update_enabled_for_type( 'plugin' ) ) { |
|
510 |
$auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); |
|
511 |
$auto_update_notice = ' | ' . wp_get_auto_update_message(); |
|
512 |
} |
|
513 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
514 |
foreach ( (array) $plugins as $plugin_file => $plugin_data ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
515 |
$plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
516 |
|
9 | 517 |
$icon = '<span class="dashicons dashicons-admin-plugins"></span>'; |
518 |
$preferred_icons = array( 'svg', '2x', '1x', 'default' ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
519 |
foreach ( $preferred_icons as $preferred_icon ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
520 |
if ( ! empty( $plugin_data->update->icons[ $preferred_icon ] ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
521 |
$icon = '<img src="' . esc_url( $plugin_data->update->icons[ $preferred_icon ] ) . '" alt="" />'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
522 |
break; |
9 | 523 |
} |
5 | 524 |
} |
525 |
||
0 | 526 |
// Get plugin compat for running version of WordPress. |
9 | 527 |
if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $cur_wp_version, '>=' ) ) { |
16 | 528 |
/* translators: %s: WordPress version. */ |
529 |
$compat = '<br />' . sprintf( __( 'Compatibility with WordPress %s: 100%% (according to its author)' ), $cur_wp_version ); |
|
0 | 530 |
} else { |
16 | 531 |
/* translators: %s: WordPress version. */ |
532 |
$compat = '<br />' . sprintf( __( 'Compatibility with WordPress %s: Unknown' ), $cur_wp_version ); |
|
0 | 533 |
} |
534 |
// Get plugin compat for updated version of WordPress. |
|
535 |
if ( $core_update_version ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
536 |
if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) { |
16 | 537 |
/* translators: %s: WordPress version. */ |
538 |
$compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %s: 100%% (according to its author)' ), $core_update_version ); |
|
0 | 539 |
} else { |
16 | 540 |
/* translators: %s: WordPress version. */ |
541 |
$compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %s: Unknown' ), $core_update_version ); |
|
0 | 542 |
} |
543 |
} |
|
9 | 544 |
|
545 |
$requires_php = isset( $plugin_data->update->requires_php ) ? $plugin_data->update->requires_php : null; |
|
546 |
$compatible_php = is_php_version_compatible( $requires_php ); |
|
547 |
||
548 |
if ( ! $compatible_php && current_user_can( 'update_php' ) ) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
549 |
$compat .= '<br />' . __( 'This update does not work with your version of PHP.' ) . ' '; |
9 | 550 |
$compat .= sprintf( |
16 | 551 |
/* translators: %s: URL to Update PHP page. */ |
9 | 552 |
__( '<a href="%s">Learn more about updating PHP</a>.' ), |
553 |
esc_url( wp_get_update_php_url() ) |
|
554 |
); |
|
555 |
||
556 |
$annotation = wp_get_update_php_annotation(); |
|
557 |
||
558 |
if ( $annotation ) { |
|
559 |
$compat .= '</p><p><em>' . $annotation . '</em>'; |
|
560 |
} |
|
561 |
} |
|
562 |
||
0 | 563 |
// Get the upgrade notice for the new plugin version. |
9 | 564 |
if ( isset( $plugin_data->update->upgrade_notice ) ) { |
565 |
$upgrade_notice = '<br />' . strip_tags( $plugin_data->update->upgrade_notice ); |
|
0 | 566 |
} else { |
567 |
$upgrade_notice = ''; |
|
568 |
} |
|
569 |
||
9 | 570 |
$details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '§ion=changelog&TB_iframe=true&width=640&height=662' ); |
571 |
$details = sprintf( |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
572 |
'<a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
573 |
esc_url( $details_url ), |
16 | 574 |
/* translators: 1: Plugin name, 2: Version number. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
575 |
esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_data->Name, $plugin_data->update->new_version ) ), |
16 | 576 |
/* translators: %s: Plugin version. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
577 |
sprintf( __( 'View version %s details.' ), $plugin_data->update->new_version ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
578 |
); |
0 | 579 |
|
18 | 580 |
$checkbox_id = 'checkbox_' . md5( $plugin_file ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
581 |
?> |
9 | 582 |
<tr> |
583 |
<td class="check-column"> |
|
16 | 584 |
<?php if ( $compatible_php ) : ?> |
585 |
<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" /> |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
586 |
<label for="<?php echo $checkbox_id; ?>"> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
587 |
<span class="screen-reader-text"> |
16 | 588 |
<?php |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
589 |
/* translators: Hidden accessibility text. %s: Plugin name. */ |
16 | 590 |
printf( __( 'Select %s' ), $plugin_data->Name ); |
591 |
?> |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
592 |
</span> |
16 | 593 |
</label> |
594 |
<?php endif; ?> |
|
9 | 595 |
</td> |
596 |
<td class="plugin-title"><p> |
|
597 |
<?php echo $icon; ?> |
|
598 |
<strong><?php echo $plugin_data->Name; ?></strong> |
|
599 |
<?php |
|
600 |
printf( |
|
16 | 601 |
/* translators: 1: Plugin version, 2: New version. */ |
9 | 602 |
__( 'You have version %1$s installed. Update to %2$s.' ), |
603 |
$plugin_data->Version, |
|
604 |
$plugin_data->update->new_version |
|
605 |
); |
|
16 | 606 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
607 |
echo ' ' . $details . $compat; |
16 | 608 |
|
609 |
if ( in_array( $plugin_file, $auto_updates, true ) ) { |
|
610 |
echo $auto_update_notice; |
|
611 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
612 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
613 |
echo $upgrade_notice; |
9 | 614 |
?> |
615 |
</p></td> |
|
616 |
</tr> |
|
16 | 617 |
<?php |
0 | 618 |
} |
9 | 619 |
?> |
0 | 620 |
</tbody> |
5 | 621 |
|
622 |
<tfoot> |
|
623 |
<tr> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
624 |
<td class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></td> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
625 |
<td class="manage-column"><label for="plugins-select-all-2"><?php _e( 'Select All' ); ?></label></td> |
5 | 626 |
</tr> |
627 |
</tfoot> |
|
0 | 628 |
</table> |
9 | 629 |
<p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e( 'Update Plugins' ); ?>" name="upgrade" /></p> |
0 | 630 |
</form> |
9 | 631 |
<?php |
0 | 632 |
} |
633 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
634 |
/** |
16 | 635 |
* Display the upgrade themes form. |
636 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
637 |
* @since 2.9.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
638 |
*/ |
0 | 639 |
function list_theme_updates() { |
640 |
$themes = get_theme_updates(); |
|
641 |
if ( empty( $themes ) ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
642 |
echo '<h2>' . __( 'Themes' ) . '</h2>'; |
0 | 643 |
echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>'; |
644 |
return; |
|
645 |
} |
|
646 |
||
647 |
$form_action = 'update-core.php?action=do-theme-upgrade'; |
|
18 | 648 |
|
649 |
$themes_count = count( $themes ); |
|
9 | 650 |
?> |
18 | 651 |
<h2> |
652 |
<?php |
|
653 |
printf( |
|
654 |
'%s <span class="count">(%d)</span>', |
|
655 |
__( 'Themes' ), |
|
656 |
number_format_i18n( $themes_count ) |
|
657 |
); |
|
658 |
?> |
|
659 |
</h2> |
|
0 | 660 |
<p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click “Update Themes”.' ); ?></p> |
9 | 661 |
<p> |
662 |
<?php |
|
663 |
printf( |
|
16 | 664 |
/* translators: %s: Link to documentation on child themes. */ |
9 | 665 |
__( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ), |
666 |
__( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ) |
|
667 |
); |
|
668 |
?> |
|
669 |
</p> |
|
0 | 670 |
<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade"> |
9 | 671 |
<?php wp_nonce_field( 'upgrade-core' ); ?> |
672 |
<p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e( 'Update Themes' ); ?>" name="upgrade" /></p> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
673 |
<table class="widefat updates-table" id="update-themes-table"> |
0 | 674 |
<thead> |
675 |
<tr> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
676 |
<td class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></td> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
677 |
<td class="manage-column"><label for="themes-select-all"><?php _e( 'Select All' ); ?></label></td> |
0 | 678 |
</tr> |
679 |
</thead> |
|
680 |
||
681 |
<tbody class="plugins"> |
|
9 | 682 |
<?php |
16 | 683 |
$auto_updates = array(); |
684 |
if ( wp_is_auto_update_enabled_for_type( 'theme' ) ) { |
|
685 |
$auto_updates = (array) get_site_option( 'auto_update_themes', array() ); |
|
686 |
$auto_update_notice = ' | ' . wp_get_auto_update_message(); |
|
687 |
} |
|
688 |
||
0 | 689 |
foreach ( $themes as $stylesheet => $theme ) { |
16 | 690 |
$requires_wp = isset( $theme->update['requires'] ) ? $theme->update['requires'] : null; |
691 |
$requires_php = isset( $theme->update['requires_php'] ) ? $theme->update['requires_php'] : null; |
|
692 |
||
693 |
$compatible_wp = is_wp_version_compatible( $requires_wp ); |
|
694 |
$compatible_php = is_php_version_compatible( $requires_php ); |
|
695 |
||
696 |
$compat = ''; |
|
697 |
||
698 |
if ( ! $compatible_wp && ! $compatible_php ) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
699 |
$compat .= '<br />' . __( 'This update does not work with your versions of WordPress and PHP.' ) . ' '; |
16 | 700 |
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { |
701 |
$compat .= sprintf( |
|
702 |
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ |
|
703 |
__( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
704 |
esc_url( self_admin_url( 'update-core.php' ) ), |
16 | 705 |
esc_url( wp_get_update_php_url() ) |
706 |
); |
|
707 |
||
708 |
$annotation = wp_get_update_php_annotation(); |
|
709 |
||
710 |
if ( $annotation ) { |
|
711 |
$compat .= '</p><p><em>' . $annotation . '</em>'; |
|
712 |
} |
|
713 |
} elseif ( current_user_can( 'update_core' ) ) { |
|
714 |
$compat .= sprintf( |
|
715 |
/* translators: %s: URL to WordPress Updates screen. */ |
|
716 |
__( '<a href="%s">Please update WordPress</a>.' ), |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
717 |
esc_url( self_admin_url( 'update-core.php' ) ) |
16 | 718 |
); |
719 |
} elseif ( current_user_can( 'update_php' ) ) { |
|
720 |
$compat .= sprintf( |
|
721 |
/* translators: %s: URL to Update PHP page. */ |
|
722 |
__( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
723 |
esc_url( wp_get_update_php_url() ) |
|
724 |
); |
|
725 |
||
726 |
$annotation = wp_get_update_php_annotation(); |
|
727 |
||
728 |
if ( $annotation ) { |
|
729 |
$compat .= '</p><p><em>' . $annotation . '</em>'; |
|
730 |
} |
|
731 |
} |
|
732 |
} elseif ( ! $compatible_wp ) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
733 |
$compat .= '<br />' . __( 'This update does not work with your version of WordPress.' ) . ' '; |
16 | 734 |
if ( current_user_can( 'update_core' ) ) { |
735 |
$compat .= sprintf( |
|
736 |
/* translators: %s: URL to WordPress Updates screen. */ |
|
737 |
__( '<a href="%s">Please update WordPress</a>.' ), |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
738 |
esc_url( self_admin_url( 'update-core.php' ) ) |
16 | 739 |
); |
740 |
} |
|
741 |
} elseif ( ! $compatible_php ) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
742 |
$compat .= '<br />' . __( 'This update does not work with your version of PHP.' ) . ' '; |
16 | 743 |
if ( current_user_can( 'update_php' ) ) { |
744 |
$compat .= sprintf( |
|
745 |
/* translators: %s: URL to Update PHP page. */ |
|
746 |
__( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
747 |
esc_url( wp_get_update_php_url() ) |
|
748 |
); |
|
749 |
||
750 |
$annotation = wp_get_update_php_annotation(); |
|
751 |
||
752 |
if ( $annotation ) { |
|
753 |
$compat .= '</p><p><em>' . $annotation . '</em>'; |
|
754 |
} |
|
755 |
} |
|
756 |
} |
|
757 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
758 |
$checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
759 |
?> |
9 | 760 |
<tr> |
761 |
<td class="check-column"> |
|
16 | 762 |
<?php if ( $compatible_wp && $compatible_php ) : ?> |
763 |
<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" /> |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
764 |
<label for="<?php echo $checkbox_id; ?>"> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
765 |
<span class="screen-reader-text"> |
16 | 766 |
<?php |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
767 |
/* translators: Hidden accessibility text. %s: Theme name. */ |
16 | 768 |
printf( __( 'Select %s' ), $theme->display( 'Name' ) ); |
769 |
?> |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
770 |
</span> |
16 | 771 |
</label> |
772 |
<?php endif; ?> |
|
9 | 773 |
</td> |
774 |
<td class="plugin-title"><p> |
|
19 | 775 |
<img src="<?php echo esc_url( $theme->get_screenshot() . '?ver=' . $theme->version ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" /> |
9 | 776 |
<strong><?php echo $theme->display( 'Name' ); ?></strong> |
777 |
<?php |
|
778 |
printf( |
|
16 | 779 |
/* translators: 1: Theme version, 2: New version. */ |
9 | 780 |
__( 'You have version %1$s installed. Update to %2$s.' ), |
781 |
$theme->display( 'Version' ), |
|
782 |
$theme->update['new_version'] |
|
783 |
); |
|
16 | 784 |
|
785 |
echo ' ' . $compat; |
|
786 |
||
787 |
if ( in_array( $stylesheet, $auto_updates, true ) ) { |
|
788 |
echo $auto_update_notice; |
|
789 |
} |
|
9 | 790 |
?> |
791 |
</p></td> |
|
792 |
</tr> |
|
793 |
<?php |
|
0 | 794 |
} |
9 | 795 |
?> |
0 | 796 |
</tbody> |
5 | 797 |
|
798 |
<tfoot> |
|
799 |
<tr> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
800 |
<td class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></td> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
801 |
<td class="manage-column"><label for="themes-select-all-2"><?php _e( 'Select All' ); ?></label></td> |
5 | 802 |
</tr> |
803 |
</tfoot> |
|
0 | 804 |
</table> |
9 | 805 |
<p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e( 'Update Themes' ); ?>" name="upgrade" /></p> |
0 | 806 |
</form> |
9 | 807 |
<?php |
0 | 808 |
} |
809 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
810 |
/** |
16 | 811 |
* Display the update translations form. |
812 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
813 |
* @since 3.7.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
814 |
*/ |
0 | 815 |
function list_translation_updates() { |
816 |
$updates = wp_get_translation_updates(); |
|
817 |
if ( ! $updates ) { |
|
16 | 818 |
if ( 'en_US' !== get_locale() ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
819 |
echo '<h2>' . __( 'Translations' ) . '</h2>'; |
0 | 820 |
echo '<p>' . __( 'Your translations are all up to date.' ) . '</p>'; |
821 |
} |
|
822 |
return; |
|
823 |
} |
|
824 |
||
825 |
$form_action = 'update-core.php?action=do-translation-upgrade'; |
|
826 |
?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
827 |
<h2><?php _e( 'Translations' ); ?></h2> |
5 | 828 |
<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-translations" class="upgrade"> |
829 |
<p><?php _e( 'New translations are available.' ); ?></p> |
|
830 |
<?php wp_nonce_field( 'upgrade-translations' ); ?> |
|
0 | 831 |
<p><input class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p> |
832 |
</form> |
|
833 |
<?php |
|
834 |
} |
|
835 |
||
836 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
837 |
* Upgrades WordPress core display. |
0 | 838 |
* |
5 | 839 |
* @since 2.7.0 |
0 | 840 |
* |
9 | 841 |
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
842 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
843 |
* @param bool $reinstall |
0 | 844 |
*/ |
845 |
function do_core_upgrade( $reinstall = false ) { |
|
846 |
global $wp_filesystem; |
|
847 |
||
16 | 848 |
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
0 | 849 |
|
9 | 850 |
if ( $reinstall ) { |
0 | 851 |
$url = 'update-core.php?action=do-core-reinstall'; |
9 | 852 |
} else { |
0 | 853 |
$url = 'update-core.php?action=do-core-upgrade'; |
9 | 854 |
} |
855 |
$url = wp_nonce_url( $url, 'upgrade-core' ); |
|
0 | 856 |
|
9 | 857 |
$version = isset( $_POST['version'] ) ? $_POST['version'] : false; |
858 |
$locale = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US'; |
|
859 |
$update = find_core_update( $version, $locale ); |
|
860 |
if ( ! $update ) { |
|
0 | 861 |
return; |
9 | 862 |
} |
0 | 863 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
864 |
/* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
865 |
* Allow relaxed file ownership writes for User-initiated upgrades when the API specifies |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
866 |
* that it's safe to do so. This only happens when there are no new files to create. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
867 |
*/ |
5 | 868 |
$allow_relaxed_file_ownership = ! $reinstall && isset( $update->new_files ) && ! $update->new_files; |
869 |
||
9 | 870 |
?> |
0 | 871 |
<div class="wrap"> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
872 |
<h1><?php _e( 'Update WordPress' ); ?></h1> |
9 | 873 |
<?php |
0 | 874 |
|
16 | 875 |
$credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ); |
876 |
if ( false === $credentials ) { |
|
0 | 877 |
echo '</div>'; |
878 |
return; |
|
879 |
} |
|
880 |
||
5 | 881 |
if ( ! WP_Filesystem( $credentials, ABSPATH, $allow_relaxed_file_ownership ) ) { |
16 | 882 |
// Failed to connect. Error and request again. |
5 | 883 |
request_filesystem_credentials( $url, '', true, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ); |
0 | 884 |
echo '</div>'; |
885 |
return; |
|
886 |
} |
|
887 |
||
9 | 888 |
if ( $wp_filesystem->errors->has_errors() ) { |
889 |
foreach ( $wp_filesystem->errors->get_error_messages() as $message ) { |
|
890 |
show_message( $message ); |
|
891 |
} |
|
0 | 892 |
echo '</div>'; |
893 |
return; |
|
894 |
} |
|
895 |
||
9 | 896 |
if ( $reinstall ) { |
0 | 897 |
$update->response = 'reinstall'; |
9 | 898 |
} |
0 | 899 |
|
900 |
add_filter( 'update_feedback', 'show_message' ); |
|
901 |
||
902 |
$upgrader = new Core_Upgrader(); |
|
9 | 903 |
$result = $upgrader->upgrade( |
904 |
$update, |
|
905 |
array( |
|
906 |
'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership, |
|
907 |
) |
|
908 |
); |
|
0 | 909 |
|
9 | 910 |
if ( is_wp_error( $result ) ) { |
911 |
show_message( $result ); |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
912 |
if ( 'up_to_date' !== $result->get_error_code() && 'locked' !== $result->get_error_code() ) { |
16 | 913 |
show_message( __( 'Installation failed.' ) ); |
9 | 914 |
} |
0 | 915 |
echo '</div>'; |
916 |
return; |
|
917 |
} |
|
918 |
||
16 | 919 |
show_message( __( 'WordPress updated successfully.' ) ); |
920 |
show_message( |
|
921 |
'<span class="hide-if-no-js">' . sprintf( |
|
922 |
/* translators: 1: WordPress version, 2: URL to About screen. */ |
|
923 |
__( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ), |
|
924 |
$result, |
|
925 |
esc_url( self_admin_url( 'about.php?updated' ) ) |
|
926 |
) . '</span>' |
|
927 |
); |
|
928 |
show_message( |
|
929 |
'<span class="hide-if-js">' . sprintf( |
|
930 |
/* translators: 1: WordPress version, 2: URL to About screen. */ |
|
931 |
__( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), |
|
932 |
$result, |
|
933 |
esc_url( self_admin_url( 'about.php?updated' ) ) |
|
934 |
) . '</span>' |
|
935 |
); |
|
0 | 936 |
?> |
937 |
</div> |
|
938 |
<script type="text/javascript"> |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
939 |
window.location = '<?php echo esc_url( self_admin_url( 'about.php?updated' ) ); ?>'; |
0 | 940 |
</script> |
941 |
<?php |
|
942 |
} |
|
943 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
944 |
/** |
16 | 945 |
* Dismiss a core update. |
946 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
947 |
* @since 2.7.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
948 |
*/ |
0 | 949 |
function do_dismiss_core_update() { |
9 | 950 |
$version = isset( $_POST['version'] ) ? $_POST['version'] : false; |
951 |
$locale = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US'; |
|
952 |
$update = find_core_update( $version, $locale ); |
|
953 |
if ( ! $update ) { |
|
0 | 954 |
return; |
9 | 955 |
} |
0 | 956 |
dismiss_core_update( $update ); |
9 | 957 |
wp_redirect( wp_nonce_url( 'update-core.php?action=upgrade-core', 'upgrade-core' ) ); |
0 | 958 |
exit; |
959 |
} |
|
960 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
961 |
/** |
16 | 962 |
* Undismiss a core update. |
963 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
964 |
* @since 2.7.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
965 |
*/ |
0 | 966 |
function do_undismiss_core_update() { |
9 | 967 |
$version = isset( $_POST['version'] ) ? $_POST['version'] : false; |
968 |
$locale = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US'; |
|
969 |
$update = find_core_update( $version, $locale ); |
|
970 |
if ( ! $update ) { |
|
0 | 971 |
return; |
9 | 972 |
} |
0 | 973 |
undismiss_core_update( $version, $locale ); |
9 | 974 |
wp_redirect( wp_nonce_url( 'update-core.php?action=upgrade-core', 'upgrade-core' ) ); |
0 | 975 |
exit; |
976 |
} |
|
977 |
||
9 | 978 |
$action = isset( $_GET['action'] ) ? $_GET['action'] : 'upgrade-core'; |
0 | 979 |
|
980 |
$upgrade_error = false; |
|
16 | 981 |
if ( ( 'do-theme-upgrade' === $action || ( 'do-plugin-upgrade' === $action && ! isset( $_GET['plugins'] ) ) ) |
0 | 982 |
&& ! isset( $_POST['checked'] ) ) { |
16 | 983 |
$upgrade_error = ( 'do-theme-upgrade' === $action ) ? 'themes' : 'plugins'; |
9 | 984 |
$action = 'upgrade-core'; |
0 | 985 |
} |
986 |
||
9 | 987 |
$title = __( 'WordPress Updates' ); |
5 | 988 |
$parent_file = 'index.php'; |
989 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
990 |
$updates_overview = '<p>' . __( 'On this screen, you can update to the latest version of WordPress, as well as update your themes, plugins, and translations from the WordPress.org repositories.' ) . '</p>'; |
5 | 991 |
$updates_overview .= '<p>' . __( 'If an update is available, you᾿ll see a notification appear in the Toolbar and navigation menu.' ) . ' ' . __( 'Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.' ) . '</p>'; |
0 | 992 |
|
9 | 993 |
get_current_screen()->add_help_tab( |
994 |
array( |
|
995 |
'id' => 'overview', |
|
996 |
'title' => __( 'Overview' ), |
|
997 |
'content' => $updates_overview, |
|
998 |
) |
|
999 |
); |
|
0 | 1000 |
|
18 | 1001 |
$updates_howto = '<p>' . __( '<strong>WordPress</strong> — Updating your WordPress installation is a simple one-click procedure: just <strong>click on the “Update now” button</strong> when you are notified that a new version is available.' ) . ' ' . __( 'In most cases, WordPress will automatically apply maintenance and security updates in the background for you.' ) . '</p>'; |
5 | 1002 |
$updates_howto .= '<p>' . __( '<strong>Themes and Plugins</strong> — To update individual themes or plugins from this screen, use the checkboxes to make your selection, then <strong>click on the appropriate “Update” button</strong>. To update all of your themes or plugins at once, you can check the box at the top of the section to select all before clicking the update button.' ) . '</p>'; |
1003 |
||
16 | 1004 |
if ( 'en_US' !== get_locale() ) { |
5 | 1005 |
$updates_howto .= '<p>' . __( '<strong>Translations</strong> — The files translating WordPress into your language are updated for you whenever any other updates occur. But if these files are out of date, you can <strong>click the “Update Translations”</strong> button.' ) . '</p>'; |
1006 |
} |
|
1007 |
||
9 | 1008 |
get_current_screen()->add_help_tab( |
1009 |
array( |
|
1010 |
'id' => 'how-to-update', |
|
1011 |
'title' => __( 'How to Update' ), |
|
1012 |
'content' => $updates_howto, |
|
1013 |
) |
|
1014 |
); |
|
0 | 1015 |
|
16 | 1016 |
$help_sidebar_autoupdates = ''; |
1017 |
||
1018 |
if ( ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) || ( current_user_can( 'update_plugins' ) && wp_is_auto_update_enabled_for_type( 'plugin' ) ) ) { |
|
18 | 1019 |
$help_tab_autoupdates = '<p>' . __( 'Auto-updates can be enabled or disabled for WordPress major versions and for each individual theme or plugin. Themes or plugins with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates depends on the WP-Cron task scheduling system.' ) . '</p>'; |
16 | 1020 |
$help_tab_autoupdates .= '<p>' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '</p>'; |
1021 |
||
1022 |
get_current_screen()->add_help_tab( |
|
1023 |
array( |
|
1024 |
'id' => 'plugins-themes-auto-updates', |
|
1025 |
'title' => __( 'Auto-updates' ), |
|
1026 |
'content' => $help_tab_autoupdates, |
|
1027 |
) |
|
1028 |
); |
|
1029 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1030 |
$help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/documentation/article/plugins-themes-auto-updates/">Documentation on Auto-updates</a>' ) . '</p>'; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1031 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1032 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1033 |
$help_sidebar_rollback = ''; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1034 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1035 |
if ( current_user_can( 'update_themes' ) || current_user_can( 'update_plugins' ) ) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1036 |
$rollback_help = '<p>' . __( 'This feature will create a temporary backup of a plugin or theme before it is upgraded. This backup is used to restore the plugin or theme back to its previous state if there is an error during the update process.' ) . '</p>'; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1037 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1038 |
$rollback_help .= '<p>' . __( 'On systems with fewer resources, this may lead to server timeouts or resource limits being reached. If you encounter an issue during the update process, please create a support forum topic and reference <strong>Rollback</strong> in the issue title.' ) . '</p>'; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1039 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1040 |
get_current_screen()->add_help_tab( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1041 |
array( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1042 |
'id' => 'rollback-plugins-themes', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1043 |
'title' => __( 'Restore Plugin or Theme' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1044 |
'content' => $rollback_help, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1045 |
) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1046 |
); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1047 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1048 |
$help_sidebar_rollback = '<p>' . __( '<a href="https://developer.wordpress.org/advanced-administration/wordpress/common-errors/">Common Errors</a>' ) . '</p>'; |
16 | 1049 |
} |
1050 |
||
0 | 1051 |
get_current_screen()->set_help_sidebar( |
9 | 1052 |
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1053 |
'<p>' . __( '<a href="https://wordpress.org/documentation/article/dashboard-updates-screen/">Documentation on Updating WordPress</a>' ) . '</p>' . |
16 | 1054 |
$help_sidebar_autoupdates . |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1055 |
'<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>' . |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1056 |
$help_sidebar_rollback |
0 | 1057 |
); |
1058 |
||
16 | 1059 |
if ( 'upgrade-core' === $action ) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1060 |
// Force an update check when requested. |
5 | 1061 |
$force_check = ! empty( $_GET['force-check'] ); |
1062 |
wp_version_check( array(), $force_check ); |
|
0 | 1063 |
|
16 | 1064 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
0 | 1065 |
?> |
1066 |
<div class="wrap"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1067 |
<h1><?php _e( 'WordPress Updates' ); ?></h1> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1068 |
<p><?php _e( 'Updates may take several minutes to complete. If there is no feedback after 5 minutes, or if there are errors please refer to the Help section above.' ); ?></p> |
18 | 1069 |
|
0 | 1070 |
<?php |
1071 |
if ( $upgrade_error ) { |
|
16 | 1072 |
if ( 'themes' === $upgrade_error ) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1073 |
$theme_updates = get_theme_updates(); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1074 |
if ( ! empty( $theme_updates ) ) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1075 |
wp_admin_notice( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1076 |
__( 'Please select one or more themes to update.' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1077 |
array( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1078 |
'additional_classes' => array( 'error' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1079 |
) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1080 |
); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1081 |
} |
9 | 1082 |
} else { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1083 |
$plugin_updates = get_plugin_updates(); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1084 |
if ( ! empty( $plugin_updates ) ) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1085 |
wp_admin_notice( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1086 |
__( 'Please select one or more plugins to update.' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1087 |
array( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1088 |
'additional_classes' => array( 'error' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1089 |
) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1090 |
); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1091 |
} |
9 | 1092 |
} |
0 | 1093 |
} |
1094 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1095 |
$last_update_check = false; |
9 | 1096 |
$current = get_site_transient( 'update_core' ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1097 |
|
9 | 1098 |
if ( $current && isset( $current->last_checked ) ) { |
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1099 |
$last_update_check = $current->last_checked + (int) ( (float) get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1100 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1101 |
|
18 | 1102 |
echo '<h2 class="wp-current-version">'; |
1103 |
/* translators: Current version of WordPress. */ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
1104 |
printf( __( 'Current version: %s' ), esc_html( wp_get_wp_version() ) ); |
18 | 1105 |
echo '</h2>'; |
1106 |
||
1107 |
echo '<p class="update-last-checked">'; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1108 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1109 |
printf( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1110 |
/* translators: 1: Date, 2: Time. */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1111 |
__( 'Last checked on %1$s at %2$s.' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1112 |
/* translators: Last update date format. See https://www.php.net/manual/datetime.format.php */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1113 |
date_i18n( __( 'F j, Y' ), $last_update_check ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1114 |
/* translators: Last update time format. See https://www.php.net/manual/datetime.format.php */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1115 |
date_i18n( __( 'g:i a T' ), $last_update_check ) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1116 |
); |
18 | 1117 |
echo ' <a href="' . esc_url( self_admin_url( 'update-core.php?force-check=1' ) ) . '">' . __( 'Check again.' ) . '</a>'; |
0 | 1118 |
echo '</p>'; |
1119 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1120 |
if ( current_user_can( 'update_core' ) ) { |
18 | 1121 |
core_auto_updates_settings(); |
0 | 1122 |
core_upgrade_preamble(); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1123 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1124 |
if ( current_user_can( 'update_plugins' ) ) { |
0 | 1125 |
list_plugin_updates(); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1126 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1127 |
if ( current_user_can( 'update_themes' ) ) { |
0 | 1128 |
list_theme_updates(); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1129 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1130 |
if ( current_user_can( 'update_languages' ) ) { |
0 | 1131 |
list_translation_updates(); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1132 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1133 |
|
5 | 1134 |
/** |
1135 |
* Fires after the core, plugin, and theme update tables. |
|
1136 |
* |
|
1137 |
* @since 2.9.0 |
|
1138 |
*/ |
|
1139 |
do_action( 'core_upgrade_preamble' ); |
|
0 | 1140 |
echo '</div>'; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1141 |
|
9 | 1142 |
wp_localize_script( |
1143 |
'updates', |
|
1144 |
'_wpUpdatesItemCounts', |
|
1145 |
array( |
|
1146 |
'totals' => wp_get_update_data(), |
|
1147 |
) |
|
1148 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1149 |
|
16 | 1150 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |
0 | 1151 |
|
16 | 1152 |
} elseif ( 'do-core-upgrade' === $action || 'do-core-reinstall' === $action ) { |
0 | 1153 |
|
9 | 1154 |
if ( ! current_user_can( 'update_core' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1155 |
wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); |
9 | 1156 |
} |
0 | 1157 |
|
9 | 1158 |
check_admin_referer( 'upgrade-core' ); |
0 | 1159 |
|
5 | 1160 |
// Do the (un)dismiss actions before headers, so that they can redirect. |
9 | 1161 |
if ( isset( $_POST['dismiss'] ) ) { |
0 | 1162 |
do_dismiss_core_update(); |
9 | 1163 |
} elseif ( isset( $_POST['undismiss'] ) ) { |
0 | 1164 |
do_undismiss_core_update(); |
9 | 1165 |
} |
0 | 1166 |
|
16 | 1167 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
1168 |
if ( 'do-core-reinstall' === $action ) { |
|
0 | 1169 |
$reinstall = true; |
9 | 1170 |
} else { |
0 | 1171 |
$reinstall = false; |
9 | 1172 |
} |
0 | 1173 |
|
9 | 1174 |
if ( isset( $_POST['upgrade'] ) ) { |
1175 |
do_core_upgrade( $reinstall ); |
|
1176 |
} |
|
0 | 1177 |
|
9 | 1178 |
wp_localize_script( |
1179 |
'updates', |
|
1180 |
'_wpUpdatesItemCounts', |
|
1181 |
array( |
|
1182 |
'totals' => wp_get_update_data(), |
|
1183 |
) |
|
1184 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1185 |
|
16 | 1186 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |
0 | 1187 |
|
16 | 1188 |
} elseif ( 'do-plugin-upgrade' === $action ) { |
0 | 1189 |
|
9 | 1190 |
if ( ! current_user_can( 'update_plugins' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1191 |
wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); |
9 | 1192 |
} |
0 | 1193 |
|
9 | 1194 |
check_admin_referer( 'upgrade-core' ); |
0 | 1195 |
|
1196 |
if ( isset( $_GET['plugins'] ) ) { |
|
1197 |
$plugins = explode( ',', $_GET['plugins'] ); |
|
1198 |
} elseif ( isset( $_POST['checked'] ) ) { |
|
1199 |
$plugins = (array) $_POST['checked']; |
|
1200 |
} else { |
|
9 | 1201 |
wp_redirect( admin_url( 'update-core.php' ) ); |
0 | 1202 |
exit; |
1203 |
} |
|
1204 |
||
9 | 1205 |
$url = 'update.php?action=update-selected&plugins=' . urlencode( implode( ',', $plugins ) ); |
1206 |
$url = wp_nonce_url( $url, 'bulk-update-plugins' ); |
|
0 | 1207 |
|
19 | 1208 |
// Used in the HTML title tag. |
9 | 1209 |
$title = __( 'Update Plugins' ); |
0 | 1210 |
|
16 | 1211 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
18 | 1212 |
?> |
1213 |
<div class="wrap"> |
|
1214 |
<h1><?php _e( 'Update Plugins' ); ?></h1> |
|
1215 |
<iframe src="<?php echo $url; ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="<?php esc_attr_e( 'Update progress' ); ?>"></iframe> |
|
1216 |
</div> |
|
1217 |
<?php |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1218 |
|
9 | 1219 |
wp_localize_script( |
1220 |
'updates', |
|
1221 |
'_wpUpdatesItemCounts', |
|
1222 |
array( |
|
1223 |
'totals' => wp_get_update_data(), |
|
1224 |
) |
|
1225 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1226 |
|
16 | 1227 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |
0 | 1228 |
|
16 | 1229 |
} elseif ( 'do-theme-upgrade' === $action ) { |
0 | 1230 |
|
9 | 1231 |
if ( ! current_user_can( 'update_themes' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1232 |
wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); |
9 | 1233 |
} |
0 | 1234 |
|
9 | 1235 |
check_admin_referer( 'upgrade-core' ); |
0 | 1236 |
|
1237 |
if ( isset( $_GET['themes'] ) ) { |
|
1238 |
$themes = explode( ',', $_GET['themes'] ); |
|
1239 |
} elseif ( isset( $_POST['checked'] ) ) { |
|
1240 |
$themes = (array) $_POST['checked']; |
|
1241 |
} else { |
|
9 | 1242 |
wp_redirect( admin_url( 'update-core.php' ) ); |
0 | 1243 |
exit; |
1244 |
} |
|
1245 |
||
9 | 1246 |
$url = 'update.php?action=update-selected-themes&themes=' . urlencode( implode( ',', $themes ) ); |
1247 |
$url = wp_nonce_url( $url, 'bulk-update-themes' ); |
|
0 | 1248 |
|
19 | 1249 |
// Used in the HTML title tag. |
9 | 1250 |
$title = __( 'Update Themes' ); |
0 | 1251 |
|
16 | 1252 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
5 | 1253 |
?> |
1254 |
<div class="wrap"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1255 |
<h1><?php _e( 'Update Themes' ); ?></h1> |
9 | 1256 |
<iframe src="<?php echo $url; ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="<?php esc_attr_e( 'Update progress' ); ?>"></iframe> |
5 | 1257 |
</div> |
1258 |
<?php |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1259 |
|
9 | 1260 |
wp_localize_script( |
1261 |
'updates', |
|
1262 |
'_wpUpdatesItemCounts', |
|
1263 |
array( |
|
1264 |
'totals' => wp_get_update_data(), |
|
1265 |
) |
|
1266 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1267 |
|
16 | 1268 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |
0 | 1269 |
|
16 | 1270 |
} elseif ( 'do-translation-upgrade' === $action ) { |
0 | 1271 |
|
9 | 1272 |
if ( ! current_user_can( 'update_languages' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1273 |
wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); |
9 | 1274 |
} |
0 | 1275 |
|
1276 |
check_admin_referer( 'upgrade-translations' ); |
|
1277 |
||
16 | 1278 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
1279 |
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
0 | 1280 |
|
9 | 1281 |
$url = 'update-core.php?action=do-translation-upgrade'; |
1282 |
$nonce = 'upgrade-translations'; |
|
1283 |
$title = __( 'Update Translations' ); |
|
0 | 1284 |
$context = WP_LANG_DIR; |
1285 |
||
1286 |
$upgrader = new Language_Pack_Upgrader( new Language_Pack_Upgrader_Skin( compact( 'url', 'nonce', 'title', 'context' ) ) ); |
|
9 | 1287 |
$result = $upgrader->bulk_upgrade(); |
0 | 1288 |
|
9 | 1289 |
wp_localize_script( |
1290 |
'updates', |
|
1291 |
'_wpUpdatesItemCounts', |
|
1292 |
array( |
|
1293 |
'totals' => wp_get_update_data(), |
|
1294 |
) |
|
1295 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1296 |
|
16 | 1297 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |
0 | 1298 |
|
18 | 1299 |
} elseif ( 'core-major-auto-updates-settings' === $action ) { |
1300 |
||
1301 |
if ( ! current_user_can( 'update_core' ) ) { |
|
1302 |
wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); |
|
1303 |
} |
|
1304 |
||
1305 |
$redirect_url = self_admin_url( 'update-core.php' ); |
|
1306 |
||
1307 |
if ( isset( $_GET['value'] ) ) { |
|
1308 |
check_admin_referer( 'core-major-auto-updates-nonce' ); |
|
1309 |
||
1310 |
if ( 'enable' === $_GET['value'] ) { |
|
1311 |
update_site_option( 'auto_update_core_major', 'enabled' ); |
|
1312 |
$redirect_url = add_query_arg( 'core-major-auto-updates-saved', 'enabled', $redirect_url ); |
|
1313 |
} elseif ( 'disable' === $_GET['value'] ) { |
|
1314 |
update_site_option( 'auto_update_core_major', 'disabled' ); |
|
1315 |
$redirect_url = add_query_arg( 'core-major-auto-updates-saved', 'disabled', $redirect_url ); |
|
1316 |
} |
|
1317 |
} |
|
1318 |
||
1319 |
wp_redirect( $redirect_url ); |
|
1320 |
exit; |
|
0 | 1321 |
} else { |
5 | 1322 |
/** |
1323 |
* Fires for each custom update action on the WordPress Updates screen. |
|
1324 |
* |
|
1325 |
* The dynamic portion of the hook name, `$action`, refers to the |
|
1326 |
* passed update action. The hook fires in lieu of all available |
|
1327 |
* default update actions. |
|
1328 |
* |
|
1329 |
* @since 3.2.0 |
|
1330 |
*/ |
|
16 | 1331 |
do_action( "update-core-custom_{$action}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
0 | 1332 |
} |