Automatically trigger DB upgrade.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2004-10-08 19:49:58 +00:00
parent e2f52aedec
commit e72de79fa2
2 changed files with 21 additions and 14 deletions

View File

@ -1,5 +1,6 @@
<?php <?php
require_once('./upgrade-schema.php');
require_once(dirname(__FILE__) . '/upgrade-schema.php');
// Functions to be called in install and upgrade scripts // Functions to be called in install and upgrade scripts
function upgrade_all() { function upgrade_all() {
populate_options(); populate_options();

View File

@ -340,8 +340,15 @@ function form_option($option) {
} }
function get_alloptions() { function get_alloptions() {
global $wpdb; global $wpdb, $wp_queries;
if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'")) { $wpdb->hide_errors();
if (!$options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'")) {
include_once(ABSPATH . '/wp-admin/upgrade-functions.php');
make_db_current_silent();
$options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options");
}
$wpdb->show_errors();
foreach ($options as $option) { foreach ($options as $option) {
// "When trying to design a foolproof system, // "When trying to design a foolproof system,
// never underestimate the ingenuity of the fools :)" -- Dougal // never underestimate the ingenuity of the fools :)" -- Dougal
@ -353,7 +360,6 @@ function get_alloptions() {
else $value = $option->option_value; else $value = $option->option_value;
$all_options->{$option->option_name} = $value; $all_options->{$option->option_name} = $value;
} }
}
return $all_options; return $all_options;
} }