From 40fc216aa7855ab97d3915b56ee02154f4d0d09e Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Mon, 15 Dec 2003 09:55:47 +0000 Subject: [PATCH] Hacks file option and include. git-svn-id: https://develop.svn.wordpress.org/trunk@614 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/upgrade-072-to-080.php | 46 ++++++++++++++++++++------------- wp-includes/functions.php | 7 ++++- wp-settings.php | 21 +++++++-------- 3 files changed, 44 insertions(+), 30 deletions(-) diff --git a/wp-admin/upgrade-072-to-080.php b/wp-admin/upgrade-072-to-080.php index cac347b698..501b6aca18 100644 --- a/wp-admin/upgrade-072-to-080.php +++ b/wp-admin/upgrade-072-to-080.php @@ -4,7 +4,6 @@ require('install-helper.php'); $step = $HTTP_GET_VARS['step']; if (!$step) $step = 0; -//update_option('blogdescription', 'hahahah'); ?> @@ -123,23 +122,34 @@ if (!$wpdb->get_var("SELECT option_name FROM $tableoptions WHERE option_name = '

Working hide_errors(); // Turn this off for dev and we should probably just fix the queries anyway - // fix timezone diff range - $wpdb->query("UPDATE $tableoptionvalues SET optionvalue_max = 23 , optionvalue_min = -23 WHERE option_id = 51"); - echo ' .'; - flush(); - // fix upload users description - $wpdb->query("UPDATE $tableoptions SET option_description = '...or you may authorize only some users. enter their logins here, separated by spaces. if you leave this variable blank, all users who have the minimum level are authorized to upload. example: \'barbara anne george\'' WHERE option_id = 37"); - echo ' .'; - flush(); - // and file types - $wpdb->query("UPDATE $tableoptions SET option_description = 'accepted file types, separated by spaces. example: \'jpg gif png\'' WHERE option_id = 34"); - echo ' .'; - flush(); - // add link to php date format. this could be to a wordpress.org page in the future - $wpdb->query("UPDATE $tableoptions SET option_description = 'see help for format characters' WHERE option_id = 52"); - $wpdb->query("UPDATE $tableoptions SET option_description = 'see help for format characters' WHERE option_id = 53"); - echo ' .'; - flush(); +// fix timezone diff range +$wpdb->query("UPDATE $tableoptionvalues SET optionvalue_max = 23 , optionvalue_min = -23 WHERE option_id = 51"); +echo ' .'; +flush(); +// fix upload users description +$wpdb->query("UPDATE $tableoptions SET option_description = '...or you may authorize only some users. enter their logins here, separated by spaces. if you leave this variable blank, all users who have the minimum level are authorized to upload. example: \'barbara anne george\'' WHERE option_id = 37"); +echo ' .'; +flush(); +// and file types +$wpdb->query("UPDATE $tableoptions SET option_description = 'accepted file types, separated by spaces. example: \'jpg gif png\'' WHERE option_id = 34"); +echo ' .'; +flush(); +// add link to php date format. this could be to a wordpress.org page in the future +$wpdb->query("UPDATE $tableoptions SET option_description = 'see help for format characters' WHERE option_id = 52"); +$wpdb->query("UPDATE $tableoptions SET option_description = 'see help for format characters' WHERE option_id = 53"); +echo ' .'; +flush(); +if (!$wpdb->get_var("SELECT option_id FROM $tableoptinos WHERE option_name = 'hack_file'")) { + $wpdb->query("INSERT INTO `$tableoptions` + ( `option_id` , `blog_id` , `option_name` , `option_can_override` , `option_type` , `option_value` , `option_width` , `option_height` , `option_description` , `option_admin_level` ) + VALUES + ('', '0', 'hack_file', 'Y', '2', '0', '20', '8', 'Set this to true if you plan to use a hacks file. This is a place for you to store code hacks that won’t be overwritten when you upgrade. The file must be in your wordpress root and called my-hacks.php', '8')"); + $optionid = $wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = 'hack_file'"); + $wpdb->query("INSERT INTO $tableoptiongroup_options + (group_id, option_id, seq) + VALUES + (2, $optionid, 5)"); +} ?> Done with the options updates. Now for a bit of comment action

+// Check for hacks file if the option is enabled +if (get_settings('hack_file')) { + if (file_exists($abspath . '/my-hacks.php')) + require($abspath . '/my-hacks.php'); +} +?> \ No newline at end of file diff --git a/wp-settings.php b/wp-settings.php index ab21a9fb23..3a2360cdbe 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -1,15 +1,4 @@