Changeset 55688
- Timestamp:
- 04/26/2023 03:08:35 PM (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/upgrade.php
r55677 r55688 2743 2743 $for_update = array(); 2744 2744 2745 // Create a tablename index for an array ($cqueries) of queries.2745 // Create a tablename index for an array ($cqueries) of recognized query types. 2746 2746 foreach ( $queries as $qry ) { 2747 2747 if ( preg_match( '|CREATE TABLE ([^ ]*)|', $qry, $matches ) ) { 2748 2748 $cqueries[ trim( $matches[1], '`' ) ] = $qry; 2749 2749 $for_update[ $matches[1] ] = 'Created table ' . $matches[1]; 2750 } elseif ( preg_match( '|CREATE DATABASE ([^ ]*)|', $qry, $matches ) ) { 2750 continue; 2751 } 2752 2753 if ( preg_match( '|CREATE DATABASE ([^ ]*)|', $qry, $matches ) ) { 2751 2754 array_unshift( $cqueries, $qry ); 2752 } elseif ( preg_match( '|INSERT INTO ([^ ]*)|', $qry, $matches ) ) { 2755 continue; 2756 } 2757 2758 if ( preg_match( '|INSERT INTO ([^ ]*)|', $qry, $matches ) ) { 2753 2759 $iqueries[] = $qry; 2754 } elseif ( preg_match( '|UPDATE ([^ ]*)|', $qry, $matches ) ) { 2760 continue; 2761 } 2762 2763 if ( preg_match( '|UPDATE ([^ ]*)|', $qry, $matches ) ) { 2755 2764 $iqueries[] = $qry; 2756 } else { 2757 // Unrecognized query type. 2765 continue; 2758 2766 } 2759 2767 } … … 3074 3082 $index_string .= 'UNIQUE '; 3075 3083 } 3084 3076 3085 if ( 'FULLTEXT' === strtoupper( $index_data['index_type'] ) ) { 3077 3086 $index_string .= 'FULLTEXT '; 3078 3087 } 3088 3079 3089 if ( 'SPATIAL' === strtoupper( $index_data['index_type'] ) ) { 3080 3090 $index_string .= 'SPATIAL '; 3081 3091 } 3092 3082 3093 $index_string .= 'KEY '; 3083 3094 if ( 'primary' !== $index_name ) { 3084 3095 $index_string .= '`' . $index_name . '`'; 3085 3096 } 3097 3086 3098 $index_columns = ''; 3087 3099 … … 3180 3192 */ 3181 3193 function make_site_theme_from_oldschool( $theme_name, $template ) { 3182 $home_path = get_home_path(); 3183 $site_dir = WP_CONTENT_DIR . "/themes/$template"; 3194 $home_path = get_home_path(); 3195 $site_dir = WP_CONTENT_DIR . "/themes/$template"; 3196 $default_dir = WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME; 3184 3197 3185 3198 if ( ! file_exists( "$home_path/index.php" ) ) { … … 3209 3222 $index = implode( '', file( "$oldpath/$oldfile" ) ); 3210 3223 if ( strpos( $index, 'WP_USE_THEMES' ) !== false ) { 3211 if ( ! copy( WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME . '/index.php', "$site_dir/$newfile" ) ) {3224 if ( ! copy( "$default_dir/$oldfile", "$site_dir/$newfile" ) ) { 3212 3225 return false; 3213 3226 } … … 3235 3248 3236 3249 // Update stylesheet references. 3237 $line = str_replace( "<?php echo __get_option('siteurl'); ?>/wp-layout.css", "<?php bloginfo('stylesheet_url'); ?>", $line ); 3250 $line = str_replace( 3251 "<?php echo __get_option('siteurl'); ?>/wp-layout.css", 3252 "<?php bloginfo('stylesheet_url'); ?>", 3253 $line 3254 ); 3238 3255 3239 3256 // Update comments template inclusion. 3240 $line = str_replace( "<?php include(ABSPATH . 'wp-comments.php'); ?>", '<?php comments_template(); ?>', $line ); 3257 $line = str_replace( 3258 "<?php include(ABSPATH . 'wp-comments.php'); ?>", 3259 '<?php comments_template(); ?>', 3260 $line 3261 ); 3241 3262 3242 3263 fwrite( $f, "{$line}\n" ); … … 3247 3268 3248 3269 // Add a theme header. 3249 $header = "/*\nTheme Name: $theme_name\nTheme URI: " . __get_option( 'siteurl' ) . "\nDescription: A theme automatically created by the update.\nVersion: 1.0\nAuthor: Moi\n*/\n"; 3270 $header = "/*\n" . 3271 "Theme Name: $theme_name\n" . 3272 'Theme URI: ' . __get_option( 'siteurl' ) . "\n" . 3273 "Description: A theme automatically created by the update.\n" . 3274 "Version: 1.0\n" . 3275 "Author: Moi\n" . 3276 "*/\n"; 3250 3277 3251 3278 $stylelines = file_get_contents( "$site_dir/style.css" ); … … 3285 3312 continue; 3286 3313 } 3314 3287 3315 if ( ! copy( "$default_dir/$theme_file", "$site_dir/$theme_file" ) ) { 3288 3316 return; 3289 3317 } 3318 3290 3319 chmod( "$site_dir/$theme_file", 0777 ); 3291 3320 } … … 3299 3328 $f = fopen( "$site_dir/style.css", 'w' ); 3300 3329 3330 $headers = array( 3331 'Theme Name:' => $theme_name, 3332 'Theme URI:' => __get_option( 'url' ), 3333 'Description:' => 'Your theme.', 3334 'Version:' => '1', 3335 'Author:' => 'You', 3336 ); 3337 3301 3338 foreach ( $stylelines as $line ) { 3302 if ( strpos( $line, 'Theme Name:' ) !== false ) { 3303 $line = 'Theme Name: ' . $theme_name; 3304 } elseif ( strpos( $line, 'Theme URI:' ) !== false ) { 3305 $line = 'Theme URI: ' . __get_option( 'url' ); 3306 } elseif ( strpos( $line, 'Description:' ) !== false ) { 3307 $line = 'Description: Your theme.'; 3308 } elseif ( strpos( $line, 'Version:' ) !== false ) { 3309 $line = 'Version: 1'; 3310 } elseif ( strpos( $line, 'Author:' ) !== false ) { 3311 $line = 'Author: You'; 3312 } 3339 foreach ( $headers as $header => $value ) { 3340 if ( strpos( $line, $header ) !== false ) { 3341 $line = $header . ' ' . $value; 3342 } 3343 } 3344 3313 3345 fwrite( $f, $line . "\n" ); 3314 3346 } 3347 3315 3348 fclose( $f ); 3316 3349 } … … 3328 3361 continue; 3329 3362 } 3363 3330 3364 if ( ! copy( "$default_dir/images/$image", "$site_dir/images/$image" ) ) { 3331 3365 return; 3332 3366 } 3367 3333 3368 chmod( "$site_dir/images/$image", 0777 ); 3334 3369 }
Note: See TracChangeset
for help on using the changeset viewer.