Changeset 1401
- Timestamp:
- 06/10/2004 08:42:25 AM (21 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/upgrade-functions.php
r1370 r1401 842 842 $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_description, option_admin_level) VALUES('default_email_category', 1, '1', 'by default posts by email will have this category', 8)"); 843 843 } 844 845 if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'recently_edited'")) { 846 $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('recently_edited', 3, '', 8)"); 847 } 848 849 maybe_add_column($wpdb->options, 'autoload', "ALTER TABLE `$wpdb->options` ADD `autoload` ENUM( 'yes', 'no' ) NOT NULL ;"); 850 851 // Set up a few options not to load by default 852 $fatoptions = array( 'moderation_keys', 'recently_edited' ); 853 foreach ($fatoptions as $fatoption) : 854 $wpdb->query("UPDATE $wpdb->options SET `autoload` = 'no' WHERE option_name = '$fatoption'"); 855 endforeach; 844 856 } 845 857 -
trunk/wp-blog-header.php
r1381 r1401 149 149 150 150 // Update some caches. 151 update_user_cache();152 151 update_category_cache(); 153 152 -
trunk/wp-includes/functions.php
r1394 r1401 189 189 function get_userdatabylogin($user_login) { 190 190 global $cache_userdata, $wpdb; 191 if ( empty($cache_userdata["$user_login"]) ) {191 if ( !empty($user_login) && empty($cache_userdata["$user_login"]) ) { 192 192 $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$user_login'"); 193 193 $cache_userdata["$user_login"] = $user; … … 200 200 function get_userid($user_login) { 201 201 global $cache_userdata, $wpdb; 202 if ( empty($cache_userdata["$user_login"]) ) {202 if ( !empty($user_login) && empty($cache_userdata["$user_login"]) ) { 203 203 $user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$user_login'"); 204 204 … … 301 301 function get_settings($setting) { 302 302 global $wpdb, $cache_settings; 303 if ( strstr($_SERVER['REQUEST_URI'], 'install.php')) {303 if ( strstr($_SERVER['REQUEST_URI'], 'install.php') || strstr($_SERVER['REQUEST_URI'], 'upgrade.php') ) { 304 304 return false; 305 305 } 306 306 307 if ( (empty($cache_settings)) ) { 308 $settings = get_alloptions(); 309 $cache_settings = $settings; 307 if ( empty($cache_settings) ) { 308 $cache_settings = get_alloptions(); 309 } 310 311 if ('home' == $setting && '' == $cache_settings->home) return $cache_settings->siteurl; 312 313 if (!isset($cache_settings->$setting)) { 314 return $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'"); 310 315 } else { 311 $settings = $cache_settings; 312 } 313 314 if ('home' == $setting && '' == $settings->home) return $settings->siteurl; 315 316 if (!isset($settings->$setting)) { 317 return false; 318 } else { 319 return stripslashes($settings->$setting); 316 return $cache_settings->$setting; 320 317 } 321 318 } … … 323 320 function get_alloptions() { 324 321 global $wpdb; 325 $options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options"); 326 if ($options) { 322 if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'")) { 327 323 foreach ($options as $option) { 328 324 // "When trying to design a foolproof system, 329 // never underestimate the ingenuity of the fools :)" 325 // never underestimate the ingenuity of the fools :)" -- Dougal 330 326 if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value); 331 327 if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value); 332 328 if ('category_base' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value); 333 329 334 $all_options->{$option->option_name} = $option->option_value;330 $all_options->{$option->option_name} = stripslashes($option->option_value); 335 331 } 336 332 } … … 1812 1808 global $cache_userdata, $wpdb; 1813 1809 1814 $users = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE user_level > 0"); 1815 foreach ($users as $user) { 1816 $cache_userdata[$user->ID] = $user; 1817 } 1810 if ( $users = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE user_level > 0") ) : 1811 foreach ($users as $user) : 1812 $cache_userdata[$user->ID] = $user; 1813 endforeach; 1814 return true; 1815 else: 1816 return false; 1817 endif; 1818 1818 } 1819 1819 -
trunk/wp-settings.php
r1377 r1401 48 48 49 49 50 $wpdb->hide_errors();51 $users = $wpdb->get_results("SELECT * FROM $wpdb->users");52 if ( !$users && !strstr($_SERVER['PHP_SELF'], 'install.php') )53 die("It doesn't look like you've installed WP yet. Try running <a href='wp-admin/install.php'>install.php</a>.");54 $wpdb->show_errors();55 56 50 require (ABSPATH . WPINC . '/functions.php'); 57 51 require (ABSPATH . WPINC . '/functions-formatting.php'); … … 60 54 require (ABSPATH . WPINC . '/kses.php'); 61 55 require_once (ABSPATH . WPINC . '/wp-l10n.php'); 56 57 $wpdb->hide_errors(); 58 if ( !update_user_cache() && !strstr($_SERVER['PHP_SELF'], 'install.php') ) 59 die("It doesn't look like you've installed WP yet. Try running <a href='wp-admin/install.php'>install.php</a>."); 60 $wpdb->show_errors(); 62 61 63 62 if (!strstr($_SERVER['PHP_SELF'], 'install.php') && !strstr($_SERVER['PHP_SELF'], 'wp-admin/import')) {
Note: See TracChangeset
for help on using the changeset viewer.