author | ymh <ymh.work@gmail.com> |
Fri, 05 Sep 2025 18:40:08 +0200 | |
changeset 21 | 48c4eec2b7e6 |
parent 19 | 3d72ae0968f4 |
child 22 | 8c2e4d02f4ef |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* WordPress Installer |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
9 |
// Confidence check. |
0 | 10 |
if ( false ) { |
9 | 11 |
?> |
0 | 12 |
<!DOCTYPE html> |
16 | 13 |
<html> |
0 | 14 |
<head> |
15 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|
16 |
<title>Error: PHP is not running</title> |
|
17 |
</head> |
|
18 |
<body class="wp-core-ui"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
19 |
<p id="logo"><a href="https://wordpress.org/">WordPress</a></p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
20 |
<h1>Error: PHP is not running</h1> |
0 | 21 |
<p>WordPress requires that your web server is running PHP. Your server does not have PHP installed, or PHP is turned off.</p> |
22 |
</body> |
|
23 |
</html> |
|
9 | 24 |
<?php |
0 | 25 |
} |
26 |
||
27 |
/** |
|
28 |
* We are installing WordPress. |
|
29 |
* |
|
30 |
* @since 1.5.1 |
|
31 |
* @var bool |
|
32 |
*/ |
|
33 |
define( 'WP_INSTALLING', true ); |
|
34 |
||
35 |
/** Load WordPress Bootstrap */ |
|
16 | 36 |
require_once dirname( __DIR__ ) . '/wp-load.php'; |
0 | 37 |
|
38 |
/** Load WordPress Administration Upgrade API */ |
|
16 | 39 |
require_once ABSPATH . 'wp-admin/includes/upgrade.php'; |
0 | 40 |
|
5 | 41 |
/** Load WordPress Translation Install API */ |
16 | 42 |
require_once ABSPATH . 'wp-admin/includes/translation-install.php'; |
5 | 43 |
|
0 | 44 |
/** Load wpdb */ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
45 |
require_once ABSPATH . WPINC . '/class-wpdb.php'; |
5 | 46 |
|
47 |
nocache_headers(); |
|
0 | 48 |
|
49 |
$step = isset( $_GET['step'] ) ? (int) $_GET['step'] : 0; |
|
50 |
||
51 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
52 |
* Display installation header. |
0 | 53 |
* |
54 |
* @since 2.5.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
55 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
56 |
* @param string $body_classes |
0 | 57 |
*/ |
5 | 58 |
function display_header( $body_classes = '' ) { |
0 | 59 |
header( 'Content-Type: text/html; charset=utf-8' ); |
5 | 60 |
if ( is_rtl() ) { |
61 |
$body_classes .= 'rtl'; |
|
62 |
} |
|
63 |
if ( $body_classes ) { |
|
64 |
$body_classes = ' ' . $body_classes; |
|
65 |
} |
|
9 | 66 |
?> |
0 | 67 |
<!DOCTYPE html> |
16 | 68 |
<html <?php language_attributes(); ?>> |
0 | 69 |
<head> |
5 | 70 |
<meta name="viewport" content="width=device-width" /> |
0 | 71 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
72 |
<meta name="robots" content="noindex,nofollow" /> |
0 | 73 |
<title><?php _e( 'WordPress › Installation' ); ?></title> |
9 | 74 |
<?php wp_admin_css( 'install', true ); ?> |
0 | 75 |
</head> |
9 | 76 |
<body class="wp-core-ui<?php echo $body_classes; ?>"> |
16 | 77 |
<p id="logo"><?php _e( 'WordPress' ); ?></p> |
0 | 78 |
|
9 | 79 |
<?php |
16 | 80 |
} // End display_header(). |
0 | 81 |
|
82 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
83 |
* Displays installer setup form. |
0 | 84 |
* |
85 |
* @since 2.8.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
86 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
87 |
* @global wpdb $wpdb WordPress database abstraction object. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
88 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
89 |
* @param string|null $error |
0 | 90 |
*/ |
91 |
function display_setup_form( $error = null ) { |
|
92 |
global $wpdb; |
|
5 | 93 |
|
16 | 94 |
$user_table = ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->users ) ) ) !== null ); |
0 | 95 |
|
16 | 96 |
// Ensure that sites appear in search engines by default. |
0 | 97 |
$blog_public = 1; |
5 | 98 |
if ( isset( $_POST['weblog_title'] ) ) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
99 |
$blog_public = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : $blog_public; |
5 | 100 |
} |
0 | 101 |
|
102 |
$weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : ''; |
|
9 | 103 |
$user_name = isset( $_POST['user_name'] ) ? trim( wp_unslash( $_POST['user_name'] ) ) : ''; |
104 |
$admin_email = isset( $_POST['admin_email'] ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : ''; |
|
0 | 105 |
|
106 |
if ( ! is_null( $error ) ) { |
|
9 | 107 |
?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
108 |
<h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1> |
0 | 109 |
<p class="message"><?php echo $error; ?></p> |
110 |
<?php } ?> |
|
5 | 111 |
<form id="setup" method="post" action="install.php?step=2" novalidate="novalidate"> |
9 | 112 |
<table class="form-table" role="presentation"> |
0 | 113 |
<tr> |
114 |
<th scope="row"><label for="weblog_title"><?php _e( 'Site Title' ); ?></label></th> |
|
115 |
<td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo esc_attr( $weblog_title ); ?>" /></td> |
|
116 |
</tr> |
|
117 |
<tr> |
|
9 | 118 |
<th scope="row"><label for="user_login"><?php _e( 'Username' ); ?></label></th> |
0 | 119 |
<td> |
120 |
<?php |
|
121 |
if ( $user_table ) { |
|
9 | 122 |
_e( 'User(s) already exists.' ); |
5 | 123 |
echo '<input name="user_name" type="hidden" value="admin" />'; |
0 | 124 |
} else { |
9 | 125 |
?> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
126 |
<input name="user_name" type="text" id="user_login" size="25" aria-describedby="user-name-desc" value="<?php echo esc_attr( sanitize_user( $user_name, true ) ); ?>" /> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
127 |
<p id="user-name-desc"><?php _e( 'Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods, and the @ symbol.' ); ?></p> |
9 | 128 |
<?php |
129 |
} |
|
130 |
?> |
|
0 | 131 |
</td> |
132 |
</tr> |
|
133 |
<?php if ( ! $user_table ) : ?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
134 |
<tr class="form-field form-required user-pass1-wrap"> |
0 | 135 |
<th scope="row"> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
136 |
<label for="pass1"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
137 |
<?php _e( 'Password' ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
138 |
</label> |
0 | 139 |
</th> |
140 |
<td> |
|
9 | 141 |
<div class="wp-pwd"> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
142 |
<?php $initial_password = isset( $_POST['admin_password'] ) ? stripslashes( $_POST['admin_password'] ) : wp_generate_password( 18 ); ?> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
143 |
<div class="password-input-wrapper"> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
144 |
<input type="password" name="admin_password" id="pass1" class="regular-text" autocomplete="new-password" spellcheck="false" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result admin-password-desc" /> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
145 |
<div id="pass-strength-result" aria-live="polite"></div> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
146 |
</div> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
147 |
<button type="button" class="button wp-hide-pw hide-if-no-js" data-start-masked="<?php echo (int) isset( $_POST['admin_password'] ); ?>" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
148 |
<span class="dashicons dashicons-hidden"></span> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
149 |
<span class="text"><?php _e( 'Hide' ); ?></span> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
150 |
</button> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
151 |
</div> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
152 |
<p id="admin-password-desc"><span class="description important hide-if-no-js"> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
153 |
<strong><?php _e( 'Important:' ); ?></strong> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
154 |
<?php /* translators: The non-breaking space prevents 1Password from thinking the text "log in" should trigger a password save prompt. */ ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
155 |
<?php _e( 'You will need this password to log in. Please store it in a secure location.' ); ?></span></p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
156 |
</td> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
157 |
</tr> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
158 |
<tr class="form-field form-required user-pass2-wrap hide-if-js"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
159 |
<th scope="row"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
160 |
<label for="pass2"><?php _e( 'Repeat Password' ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
161 |
<span class="description"><?php _e( '(required)' ); ?></span> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
162 |
</label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
163 |
</th> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
164 |
<td> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
165 |
<input type="password" name="admin_password2" id="pass2" autocomplete="new-password" spellcheck="false" /> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
166 |
</td> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
167 |
</tr> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
168 |
<tr class="pw-weak"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
169 |
<th scope="row"><?php _e( 'Confirm Password' ); ?></th> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
170 |
<td> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
171 |
<label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
172 |
<input type="checkbox" name="pw_weak" class="pw-checkbox" /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
173 |
<?php _e( 'Confirm use of weak password' ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
174 |
</label> |
0 | 175 |
</td> |
176 |
</tr> |
|
177 |
<?php endif; ?> |
|
178 |
<tr> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
179 |
<th scope="row"><label for="admin_email"><?php _e( 'Your Email' ); ?></label></th> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
180 |
<td><input name="admin_email" type="email" id="admin_email" size="25" aria-describedby="admin-email-desc" value="<?php echo esc_attr( $admin_email ); ?>" /> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
181 |
<p id="admin-email-desc"><?php _e( 'Double-check your email address before continuing.' ); ?></p></td> |
0 | 182 |
</tr> |
183 |
<tr> |
|
16 | 184 |
<th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site visibility' ) : _e( 'Search engine visibility' ); ?></th> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
185 |
<td> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
186 |
<fieldset> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
187 |
<legend class="screen-reader-text"><span> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
188 |
<?php |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
189 |
has_action( 'blog_privacy_selector' ) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
190 |
/* translators: Hidden accessibility text. */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
191 |
? _e( 'Site visibility' ) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
192 |
/* translators: Hidden accessibility text. */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
193 |
: _e( 'Search engine visibility' ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
194 |
?> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
195 |
</span></legend> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
196 |
<?php |
9 | 197 |
if ( has_action( 'blog_privacy_selector' ) ) { |
198 |
?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
199 |
<input id="blog-public" type="radio" name="blog_public" value="1" <?php checked( 1, $blog_public ); ?> /> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
200 |
<label for="blog-public"><?php _e( 'Allow search engines to index this site' ); ?></label><br /> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
201 |
<input id="blog-norobots" type="radio" name="blog_public" aria-describedby="public-desc" value="0" <?php checked( 0, $blog_public ); ?> /> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
202 |
<label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
203 |
<p id="public-desc" class="description"><?php _e( 'Note: Discouraging search engines does not block access to your site — it is up to search engines to honor your request.' ); ?></p> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
204 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
205 |
/** This action is documented in wp-admin/options-reading.php */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
206 |
do_action( 'blog_privacy_selector' ); |
9 | 207 |
} else { |
208 |
?> |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
209 |
<label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" aria-describedby="privacy-desc" value="0" <?php checked( 0, $blog_public ); ?> /> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
210 |
<?php _e( 'Discourage search engines from indexing this site' ); ?></label> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
211 |
<p id="privacy-desc" class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
212 |
<?php } ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
213 |
</fieldset> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
214 |
</td> |
0 | 215 |
</tr> |
216 |
</table> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
217 |
<p class="step"><?php submit_button( __( 'Install WordPress' ), 'large', 'Submit', false, array( 'id' => 'submit' ) ); ?></p> |
5 | 218 |
<input type="hidden" name="language" value="<?php echo isset( $_REQUEST['language'] ) ? esc_attr( $_REQUEST['language'] ) : ''; ?>" /> |
0 | 219 |
</form> |
9 | 220 |
<?php |
16 | 221 |
} // End display_setup_form(). |
0 | 222 |
|
223 |
// Let's check to make sure WP isn't already installed. |
|
224 |
if ( is_blog_installed() ) { |
|
225 |
display_header(); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
226 |
die( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
227 |
'<h1>' . __( 'Already Installed' ) . '</h1>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
228 |
'<p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p>' . |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
229 |
'<p class="step"><a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log In' ) . '</a></p>' . |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
230 |
'</body></html>' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
231 |
); |
0 | 232 |
} |
233 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
234 |
/** |
16 | 235 |
* @global string $wp_version The WordPress version string. |
236 |
* @global string $required_php_version The required PHP version string. |
|
237 |
* @global string $required_mysql_version The required MySQL version string. |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
238 |
* @global wpdb $wpdb WordPress database abstraction object. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
239 |
*/ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
240 |
global $wp_version, $required_php_version, $required_mysql_version, $wpdb; |
5 | 241 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
242 |
$php_version = PHP_VERSION; |
9 | 243 |
$mysql_version = $wpdb->db_version(); |
244 |
$php_compat = version_compare( $php_version, $required_php_version, '>=' ); |
|
245 |
$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' ); |
|
0 | 246 |
|
9 | 247 |
$version_url = sprintf( |
16 | 248 |
/* translators: %s: WordPress version. */ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
249 |
esc_url( __( 'https://wordpress.org/documentation/wordpress-version/version-%s/' ) ), |
9 | 250 |
sanitize_title( $wp_version ) |
251 |
); |
|
252 |
||
16 | 253 |
$php_update_message = '</p><p>' . sprintf( |
18 | 254 |
/* translators: %s: URL to Update PHP page. */ |
16 | 255 |
__( '<a href="%s">Learn more about updating PHP</a>.' ), |
256 |
esc_url( wp_get_update_php_url() ) |
|
257 |
); |
|
9 | 258 |
|
259 |
$annotation = wp_get_update_php_annotation(); |
|
16 | 260 |
|
9 | 261 |
if ( $annotation ) { |
262 |
$php_update_message .= '</p><p><em>' . $annotation . '</em>'; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
263 |
} |
0 | 264 |
|
9 | 265 |
if ( ! $mysql_compat && ! $php_compat ) { |
16 | 266 |
$compat = sprintf( |
267 |
/* 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. */ |
|
268 |
__( 'You cannot install 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.' ), |
|
269 |
$version_url, |
|
270 |
$wp_version, |
|
271 |
$required_php_version, |
|
272 |
$required_mysql_version, |
|
273 |
$php_version, |
|
274 |
$mysql_version |
|
275 |
) . $php_update_message; |
|
9 | 276 |
} elseif ( ! $php_compat ) { |
16 | 277 |
$compat = sprintf( |
278 |
/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Current PHP version number. */ |
|
279 |
__( 'You cannot install because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher. You are running version %4$s.' ), |
|
280 |
$version_url, |
|
281 |
$wp_version, |
|
282 |
$required_php_version, |
|
283 |
$php_version |
|
284 |
) . $php_update_message; |
|
9 | 285 |
} elseif ( ! $mysql_compat ) { |
16 | 286 |
$compat = sprintf( |
287 |
/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required MySQL version number, 4: Current MySQL version number. */ |
|
288 |
__( 'You cannot install because <a href="%1$s">WordPress %2$s</a> requires MySQL version %3$s or higher. You are running version %4$s.' ), |
|
289 |
$version_url, |
|
290 |
$wp_version, |
|
291 |
$required_mysql_version, |
|
292 |
$mysql_version |
|
293 |
); |
|
9 | 294 |
} |
295 |
||
296 |
if ( ! $mysql_compat || ! $php_compat ) { |
|
0 | 297 |
display_header(); |
16 | 298 |
die( '<h1>' . __( 'Requirements Not Met' ) . '</h1><p>' . $compat . '</p></body></html>' ); |
0 | 299 |
} |
300 |
||
301 |
if ( ! is_string( $wpdb->base_prefix ) || '' === $wpdb->base_prefix ) { |
|
302 |
display_header(); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
303 |
die( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
304 |
'<h1>' . __( 'Configuration Error' ) . '</h1>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
305 |
'<p>' . sprintf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
306 |
/* translators: %s: wp-config.php */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
307 |
__( 'Your %s file has an empty database table prefix, which is not supported.' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
308 |
'<code>wp-config.php</code>' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
309 |
) . '</p></body></html>' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
310 |
); |
0 | 311 |
} |
312 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
313 |
// Set error message if DO_NOT_UPGRADE_GLOBAL_TABLES isn't set as it will break install. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
314 |
if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
315 |
display_header(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
316 |
die( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
317 |
'<h1>' . __( 'Configuration Error' ) . '</h1>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
318 |
'<p>' . sprintf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
319 |
/* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
320 |
__( 'The constant %s cannot be defined when installing WordPress.' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
321 |
'<code>DO_NOT_UPGRADE_GLOBAL_TABLES</code>' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
322 |
) . '</p></body></html>' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
323 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
324 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
325 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
326 |
/** |
16 | 327 |
* @global string $wp_local_package Locale code of the package. |
328 |
* @global WP_Locale $wp_locale WordPress date and time locale object. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
329 |
*/ |
5 | 330 |
$language = ''; |
331 |
if ( ! empty( $_REQUEST['language'] ) ) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
332 |
$language = sanitize_locale_name( $_REQUEST['language'] ); |
5 | 333 |
} elseif ( isset( $GLOBALS['wp_local_package'] ) ) { |
334 |
$language = $GLOBALS['wp_local_package']; |
|
335 |
} |
|
336 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
337 |
$scripts_to_print = array( 'jquery' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
338 |
|
9 | 339 |
switch ( $step ) { |
16 | 340 |
case 0: // Step 0. |
341 |
if ( wp_can_install_language_pack() && empty( $language ) ) { |
|
342 |
$languages = wp_get_available_translations(); |
|
343 |
if ( $languages ) { |
|
344 |
$scripts_to_print[] = 'language-chooser'; |
|
345 |
display_header( 'language-chooser' ); |
|
346 |
echo '<form id="setup" method="post" action="?step=1">'; |
|
347 |
wp_install_language_form( $languages ); |
|
348 |
echo '</form>'; |
|
349 |
break; |
|
350 |
} |
|
5 | 351 |
} |
352 |
||
353 |
// Deliberately fall through if we can't reach the translations API. |
|
354 |
||
355 |
case 1: // Step 1, direct link or from language chooser. |
|
356 |
if ( ! empty( $language ) ) { |
|
357 |
$loaded_language = wp_download_language_pack( $language ); |
|
358 |
if ( $loaded_language ) { |
|
359 |
load_default_textdomain( $loaded_language ); |
|
360 |
$GLOBALS['wp_locale'] = new WP_Locale(); |
|
361 |
} |
|
362 |
} |
|
363 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
364 |
$scripts_to_print[] = 'user-profile'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
365 |
|
5 | 366 |
display_header(); |
9 | 367 |
?> |
0 | 368 |
<h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1> |
5 | 369 |
<p><?php _e( 'Welcome to the famous five-minute WordPress installation process! Just fill in the information below and you’ll be on your way to using the most extendable and powerful personal publishing platform in the world.' ); ?></p> |
0 | 370 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
371 |
<h2><?php _e( 'Information needed' ); ?></h2> |
19 | 372 |
<p><?php _e( 'Please provide the following information. Do not worry, you can always change these settings later.' ); ?></p> |
0 | 373 |
|
9 | 374 |
<?php |
0 | 375 |
display_setup_form(); |
376 |
break; |
|
377 |
case 2: |
|
5 | 378 |
if ( ! empty( $language ) && load_default_textdomain( $language ) ) { |
9 | 379 |
$loaded_language = $language; |
5 | 380 |
$GLOBALS['wp_locale'] = new WP_Locale(); |
381 |
} else { |
|
382 |
$loaded_language = 'en_US'; |
|
383 |
} |
|
384 |
||
9 | 385 |
if ( ! empty( $wpdb->error ) ) { |
0 | 386 |
wp_die( $wpdb->error->get_error_message() ); |
9 | 387 |
} |
0 | 388 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
389 |
$scripts_to_print[] = 'user-profile'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
390 |
|
0 | 391 |
display_header(); |
16 | 392 |
// Fill in the data we gathered. |
9 | 393 |
$weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : ''; |
394 |
$user_name = isset( $_POST['user_name'] ) ? trim( wp_unslash( $_POST['user_name'] ) ) : ''; |
|
395 |
$admin_password = isset( $_POST['admin_password'] ) ? wp_unslash( $_POST['admin_password'] ) : ''; |
|
396 |
$admin_password_check = isset( $_POST['admin_password2'] ) ? wp_unslash( $_POST['admin_password2'] ) : ''; |
|
397 |
$admin_email = isset( $_POST['admin_email'] ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : ''; |
|
398 |
$public = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : 1; |
|
5 | 399 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
400 |
// Check email address. |
0 | 401 |
$error = false; |
402 |
if ( empty( $user_name ) ) { |
|
16 | 403 |
// TODO: Poka-yoke. |
0 | 404 |
display_setup_form( __( 'Please provide a valid username.' ) ); |
405 |
$error = true; |
|
16 | 406 |
} elseif ( sanitize_user( $user_name, true ) !== $user_name ) { |
0 | 407 |
display_setup_form( __( 'The username you provided has invalid characters.' ) ); |
408 |
$error = true; |
|
16 | 409 |
} elseif ( $admin_password !== $admin_password_check ) { |
410 |
// TODO: Poka-yoke. |
|
0 | 411 |
display_setup_form( __( 'Your passwords do not match. Please try again.' ) ); |
412 |
$error = true; |
|
5 | 413 |
} elseif ( empty( $admin_email ) ) { |
16 | 414 |
// TODO: Poka-yoke. |
0 | 415 |
display_setup_form( __( 'You must provide an email address.' ) ); |
416 |
$error = true; |
|
417 |
} elseif ( ! is_email( $admin_email ) ) { |
|
16 | 418 |
// TODO: Poka-yoke. |
19 | 419 |
display_setup_form( __( 'Sorry, that is not a valid email address. Email addresses look like <code>username@example.com</code>.' ) ); |
0 | 420 |
$error = true; |
421 |
} |
|
422 |
||
16 | 423 |
if ( false === $error ) { |
0 | 424 |
$wpdb->show_errors(); |
5 | 425 |
$result = wp_install( $weblog_title, $user_name, $admin_email, $public, '', wp_slash( $admin_password ), $loaded_language ); |
9 | 426 |
?> |
0 | 427 |
|
428 |
<h1><?php _e( 'Success!' ); ?></h1> |
|
429 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
430 |
<p><?php _e( 'WordPress has been installed. Thank you, and enjoy!' ); ?></p> |
0 | 431 |
|
432 |
<table class="form-table install-success"> |
|
433 |
<tr> |
|
434 |
<th><?php _e( 'Username' ); ?></th> |
|
435 |
<td><?php echo esc_html( sanitize_user( $user_name, true ) ); ?></td> |
|
436 |
</tr> |
|
437 |
<tr> |
|
438 |
<th><?php _e( 'Password' ); ?></th> |
|
9 | 439 |
<td> |
18 | 440 |
<?php if ( ! empty( $result['password'] ) && empty( $admin_password_check ) ) : ?> |
441 |
<code><?php echo esc_html( $result['password'] ); ?></code><br /> |
|
442 |
<?php endif; ?> |
|
9 | 443 |
<p><?php echo $result['password_message']; ?></p> |
0 | 444 |
</td> |
445 |
</tr> |
|
446 |
</table> |
|
447 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
448 |
<p class="step"><a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log In' ); ?></a></p> |
0 | 449 |
|
9 | 450 |
<?php |
0 | 451 |
} |
452 |
break; |
|
453 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
454 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
455 |
if ( ! wp_is_mobile() ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
456 |
?> |
0 | 457 |
<script type="text/javascript">var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
458 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
459 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
460 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
461 |
wp_print_scripts( $scripts_to_print ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
462 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
463 |
<script type="text/javascript"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
464 |
jQuery( function( $ ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
465 |
$( '.hide-if-no-js' ).removeClass( 'hide-if-no-js' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
466 |
} ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
467 |
</script> |
0 | 468 |
</body> |
469 |
</html> |