rather ugly fix to prevent the querying of unknown/removed options, feel free to replace it with a better alternative someday
git-svn-id: http://svn.automattic.com/wordpress/trunk@1723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
67a8328356
commit
e8a1744ac0
|
@ -299,20 +299,33 @@ function url_to_postid($url = '') {
|
||||||
/* Options functions */
|
/* Options functions */
|
||||||
|
|
||||||
function get_settings($setting) {
|
function get_settings($setting) {
|
||||||
global $wpdb, $cache_settings;
|
global $wpdb, $cache_settings, $cache_nonexistantoptions;
|
||||||
if ( strstr($_SERVER['REQUEST_URI'], 'wp-admin/install.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/upgrade.php') )
|
if ( strstr($_SERVER['REQUEST_URI'], 'wp-admin/install.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/upgrade.php') )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( empty($cache_settings) )
|
if ( empty($cache_settings) )
|
||||||
$cache_settings = get_alloptions();
|
$cache_settings = get_alloptions();
|
||||||
|
|
||||||
|
if ( empty($cache_nonexistantoptions) )
|
||||||
|
$cache_nonexistantoptions = array();
|
||||||
|
|
||||||
if ('home' == $setting && '' == $cache_settings->home)
|
if ('home' == $setting && '' == $cache_settings->home)
|
||||||
return $cache_settings->siteurl;
|
return $cache_settings->siteurl;
|
||||||
|
|
||||||
if ( isset($cache_settings->$setting) ) :
|
if ( isset($cache_settings->$setting) ) :
|
||||||
return $cache_settings->$setting;
|
return $cache_settings->$setting;
|
||||||
else :
|
else :
|
||||||
|
// for these cases when we're asking for an unknown option
|
||||||
|
if ( isset($cache_nonexistantoptions[$setting]) )
|
||||||
|
return false;
|
||||||
|
|
||||||
$option = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
|
$option = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
|
||||||
|
|
||||||
|
if (!$option) :
|
||||||
|
$cache_nonexistantoptions[] = $setting;
|
||||||
|
return false;
|
||||||
|
endif;
|
||||||
|
|
||||||
if (@ $kellogs = unserialize($option) ) return $kellogs;
|
if (@ $kellogs = unserialize($option) ) return $kellogs;
|
||||||
else return $option;
|
else return $option;
|
||||||
endif;
|
endif;
|
||||||
|
|
Loading…
Reference in New Issue