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,19 +340,25 @@ 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();
foreach ($options as $option) { if (!$options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'")) {
// "When trying to design a foolproof system, include_once(ABSPATH . '/wp-admin/upgrade-functions.php');
// never underestimate the ingenuity of the fools :)" -- Dougal make_db_current_silent();
if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value); $options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options");
if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value); }
if ('category_base' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value); $wpdb->show_errors();
if (@ $value = unserialize($option->option_value) )
$all_options->{$option->option_name} = $value; foreach ($options as $option) {
else $value = $option->option_value; // "When trying to design a foolproof system,
$all_options->{$option->option_name} = $value; // never underestimate the ingenuity of the fools :)" -- Dougal
} if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
if ('category_base' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
if (@ $value = unserialize($option->option_value) )
$all_options->{$option->option_name} = $value;
else $value = $option->option_value;
$all_options->{$option->option_name} = $value;
} }
return $all_options; return $all_options;
} }