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
require_once('./upgrade-schema.php');
require_once(dirname(__FILE__) . '/upgrade-schema.php');
// Functions to be called in install and upgrade scripts
function upgrade_all() {
populate_options();

View File

@ -340,8 +340,15 @@ function form_option($option) {
}
function get_alloptions() {
global $wpdb;
if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'")) {
global $wpdb, $wp_queries;
$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) {
// "When trying to design a foolproof system,
// never underestimate the ingenuity of the fools :)" -- Dougal
@ -353,7 +360,6 @@ function get_alloptions() {
else $value = $option->option_value;
$all_options->{$option->option_name} = $value;
}
}
return $all_options;
}