Revision 883
Added by thorn almost 17 years ago
| upgrade-script.php | ||
|---|---|---|
| 102 | 102 |
$OK = '<span class="ok">OK</span>'; |
| 103 | 103 |
$FAIL = '<span class="error">FAILED</span>'; |
| 104 | 104 |
|
| 105 |
/********************************************************** |
|
| 106 |
* - Adding field sec_anchor to settings table |
|
| 107 |
*/ |
|
| 105 |
// function to add a var/value-pair into settings-table |
|
| 108 | 106 |
function db_add_key_value($key, $value) {
|
| 109 | 107 |
global $database; global $OK; global $FAIL; |
| 110 | 108 |
$table = TABLE_PREFIX.'settings'; |
| ... | ... | |
| 126 | 124 |
} |
| 127 | 125 |
} |
| 128 | 126 |
|
| 129 |
echo "<br />Adding field sec_anchor to settings table<br />"; |
|
| 127 |
// function to add a new field into a table |
|
| 128 |
function db_add_field($field, $table, $desc) {
|
|
| 129 |
global $database; global $OK; global $FAIL; |
|
| 130 |
echo "<u>Adding field '$field' to table '$table'</u><br />"; |
|
| 131 |
$table = TABLE_PREFIX.$table; |
|
| 132 |
$query = $database->query("DESCRIBE $table '$field'");
|
|
| 133 |
if($query->numRows() == 0) { // add field
|
|
| 134 |
$query = $database->query("ALTER TABLE $table ADD $field $desc");
|
|
| 135 |
echo (mysql_error()?mysql_error().'<br />':''); |
|
| 136 |
$query = $database->query("DESCRIBE $table '$field'");
|
|
| 137 |
echo (mysql_error()?mysql_error().'<br />':''); |
|
| 138 |
if($query->numRows() > 0) {
|
|
| 139 |
echo "'$field' added. $OK.<br />"; |
|
| 140 |
} else {
|
|
| 141 |
echo "adding '$field' $FAIL!<br />"; |
|
| 142 |
} |
|
| 143 |
} else {
|
|
| 144 |
echo "'$field' allready there. $OK.<br />"; |
|
| 145 |
} |
|
| 146 |
} |
|
| 147 |
|
|
| 148 |
|
|
| 149 |
/********************************************************** |
|
| 150 |
* - Adding field sec_anchor to settings table |
|
| 151 |
*/ |
|
| 152 |
echo "<br />Adding key sec_anchor to settings table<br />"; |
|
| 130 | 153 |
$cfg = array( |
| 131 | 154 |
'sec_anchor' => 'wb_' |
| 132 |
|
|
| 133 | 155 |
); |
| 134 | 156 |
foreach($cfg as $key=>$value) {
|
| 135 | 157 |
db_add_key_value($key, $value); |
| 136 | 158 |
} |
| 137 | 159 |
|
| 160 |
|
|
| 138 | 161 |
/********************************************************** |
| 162 |
* - Add field "redirect_type" to table "mod_menu_link" |
|
| 163 |
*/ |
|
| 164 |
echo "<br />Adding field redirect_type to mod_menu_link table<br />"; |
|
| 165 |
db_add_field('redirect_type', 'mod_menu_link', "INT NOT NULL DEFAULT '302' AFTER `target_page_id`");
|
|
| 166 |
|
|
| 167 |
|
|
| 168 |
/********************************************************** |
|
| 139 | 169 |
* - End of upgrade script |
| 140 | 170 |
*/ |
| 141 | 171 |
echo '<p style="font-size:120%;"><strong>Congratulations: The upgrade script is finished ...</strong></p>'; |
Also available in: Unified diff
added redirect-type (301/302) to menu_link