79 |
79 |
}
|
80 |
80 |
}
|
81 |
81 |
}
|
|
82 |
function db_add_field($field, $table, $desc) {
|
|
83 |
global $database; global $OK; global $FAIL;
|
|
84 |
echo "<br /><u>Adding field '$field' to table '$table'</u><br />";
|
|
85 |
$table = TABLE_PREFIX.$table;
|
|
86 |
$query = $database->query("DESCRIBE $table '$field'");
|
|
87 |
if($query->numRows() == 0) { // add field
|
|
88 |
$query = $database->query("ALTER TABLE $table ADD $field $desc");
|
|
89 |
echo mysql_error()?mysql_error().'<br />':'';
|
|
90 |
$query = $database->query("DESCRIBE $table '$field'");
|
|
91 |
echo mysql_error()?mysql_error().'<br />':'';
|
|
92 |
if($query->numRows() > 0) {
|
|
93 |
echo "'$field' added. $OK.<br />";
|
|
94 |
} else {
|
|
95 |
echo "adding '$field' $FAIL!<br />";
|
|
96 |
}
|
|
97 |
} else {
|
|
98 |
echo "'$field' allready there. $OK.<br />";
|
|
99 |
}
|
|
100 |
}
|
82 |
101 |
|
83 |
102 |
|
84 |
103 |
echo "<br /><u>Adding module_order and max_excerpt to search-table</u><br />";
|
... | ... | |
93 |
112 |
db_add_search_key_value($key, $value);
|
94 |
113 |
}
|
95 |
114 |
|
|
115 |
echo "<br /><u>Adding some internal config-elements to search-table</u><br />";
|
|
116 |
// These are global config-elements which don't appear in settings-page. Change them in the database if needed.
|
|
117 |
// cfg_show_description - whether to show page-description on the results page (true/false), def: true
|
|
118 |
// cfg_search_description - whether to search in page-description (true/false), def: true [only used while searching title/link/description/keywords]
|
|
119 |
// cfg_search_keywords - whether to search in page-keywords (true/false), def: true [only used while searching title/link/description/keywords]
|
|
120 |
// cfg_enable_old_search - use old search-method, too (true/false), def: true [use old method as fallback]
|
|
121 |
$cfg = array(
|
|
122 |
'cfg_show_description' => 'true',
|
|
123 |
'cfg_search_description' => 'true',
|
|
124 |
'cfg_search_keywords' => 'true',
|
|
125 |
'cfg_enable_old_search' => 'true'
|
|
126 |
);
|
|
127 |
foreach($cfg as $key=>$value) {
|
|
128 |
db_add_search_key_value($key, $value);
|
|
129 |
}
|
96 |
130 |
|
97 |
131 |
echo "<br /><u>Changing results_loop in search-table</u><br />";
|
98 |
132 |
// adding [EXCERPT]
|
... | ... | |
149 |
183 |
}
|
150 |
184 |
}
|
151 |
185 |
|
152 |
|
echo "<br /><u>Adding some internal config-elements to search-table</u><br />";
|
153 |
|
// These are global config-elements which don't appear in settings-page. Change them in the database if needed.
|
154 |
|
// cfg_show_description - whether to show page-description on the results page (true/false), def: true
|
155 |
|
// cfg_search_description - whether to search in page-description (true/false), def: true [only used while searching title/link/description/keywords]
|
156 |
|
// cfg_search_keywords - whether to search in page-keywords (true/false), def: true [only used while searching title/link/description/keywords]
|
157 |
|
// cfg_enable_old_search - use old search-method, too (true/false), def: true [use old method as fallback]
|
158 |
|
$cfg = array(
|
159 |
|
'cfg_show_description' => 'true',
|
160 |
|
'cfg_search_description' => 'true',
|
161 |
|
'cfg_search_keywords' => 'true',
|
162 |
|
'cfg_enable_old_search' => 'true'
|
163 |
|
);
|
164 |
|
foreach($cfg as $key=>$value) {
|
165 |
|
db_add_search_key_value($key, $value);
|
166 |
|
}
|
167 |
|
|
168 |
|
|
169 |
186 |
/**********************************************************
|
170 |
187 |
* - publish-by-date
|
171 |
188 |
*/
|
172 |
|
echo "<br /><u>Adding fields 'publ_start' and 'publ_end' to table 'sections'</u><br />";
|
173 |
189 |
// Add fields "publ_start" and "publ_end" to table "sections"
|
174 |
190 |
// check if fields are present
|
175 |
|
$table = TABLE_PREFIX."sections";
|
176 |
|
$query = $database->query("DESCRIBE $table 'publ_start'");
|
177 |
|
if($query->numRows() == 0) { // add field
|
178 |
|
$query = $database->query("ALTER TABLE $table ADD publ_start INT NOT NULL DEFAULT '0'");
|
179 |
|
echo mysql_error()?mysql_error().'<br />':'';
|
180 |
|
$query = $database->query("DESCRIBE $table 'publ_start'");
|
181 |
|
echo mysql_error()?mysql_error().'<br />':'';
|
182 |
|
if($query->numRows() > 0) {
|
183 |
|
echo "'publ_start' added. $OK.<br />";
|
184 |
|
} else {
|
185 |
|
echo "adding 'publ_start' $FAIL!<br />";
|
186 |
|
}
|
187 |
|
} else {
|
188 |
|
echo "'publ_start' allready there. $OK.<br />";
|
189 |
|
}
|
190 |
|
$query = $database->query("DESCRIBE $table 'publ_end'");
|
191 |
|
if($query->numRows() == 0) { // add field
|
192 |
|
$query = $database->query("ALTER TABLE $table ADD publ_end INT NOT NULL DEFAULT '0'");
|
193 |
|
echo mysql_error()?mysql_error().'<br />':'';
|
194 |
|
$query = $database->query("DESCRIBE $table 'publ_end'");
|
195 |
|
if($query->numRows() > 0) {
|
196 |
|
echo "'publ_end' added. $OK.<br />";
|
197 |
|
} else {
|
198 |
|
echo "adding 'publ_end' $FAIL!<br />";
|
199 |
|
}
|
200 |
|
} else {
|
201 |
|
echo "'publ_end' allready there. $OK<br />";
|
202 |
|
}
|
|
191 |
db_add_field('publ_start', 'sections', "INT NOT NULL DEFAULT '0'");
|
|
192 |
db_add_field('publ_end', 'sections', "INT NOT NULL DEFAULT '0'");
|
203 |
193 |
|
204 |
194 |
|
205 |
195 |
/**********************************************************
|
... | ... | |
386 |
376 |
//Start of upgrade script for the form modul
|
387 |
377 |
//******************************************************************************
|
388 |
378 |
|
389 |
|
echo "<BR><B>Adding new field to database table mod_form_settings</B><BR>";
|
|
379 |
db_add_field('success_email_subject', 'mod_form_settings', "VARCHAR(255) NOT NULL AFTER `success_message`");
|
|
380 |
db_add_field('success_email_text', 'mod_form_settings', "TEXT NOT NULL AFTER `success_message`");
|
|
381 |
db_add_field('success_email_from', 'mod_form_settings', "VARCHAR(255) NOT NULL AFTER `success_message`");
|
|
382 |
db_add_field('success_email_to', 'mod_form_settings', "TEXT NOT NULL AFTER `success_message`");
|
|
383 |
db_add_field('success_page', 'mod_form_settings', "TEXT NOT NULL AFTER `success_message`");
|
|
384 |
db_add_field('email_fromname', 'mod_form_settings', "VARCHAR( 255 ) NOT NULL AFTER email_from");
|
|
385 |
db_add_field('success_email_fromname', 'mod_form_settings', "VARCHAR( 255 ) NOT NULL AFTER success_email_from");
|
390 |
386 |
|
391 |
|
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_form_settings` ADD `success_email_subject` VARCHAR(255) NOT NULL AFTER `success_message`")) {
|
392 |
|
echo 'Database Field success_email_subject added successfully<br />';
|
393 |
|
}
|
394 |
|
echo mysql_error().'<br />';
|
395 |
|
|
396 |
|
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_form_settings` ADD `success_email_text` TEXT NOT NULL AFTER `success_message`")) {
|
397 |
|
echo 'Database Field success_email_text added successfully<br />';
|
398 |
|
}
|
399 |
|
echo mysql_error().'<br />';
|
400 |
|
|
401 |
|
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_form_settings` ADD `success_email_from` VARCHAR(255) NOT NULL AFTER `success_message`")) {
|
402 |
|
echo 'Database Field success_email_from added successfully<br />';
|
403 |
|
}
|
404 |
|
echo mysql_error().'<br />';
|
405 |
|
|
406 |
|
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_form_settings` ADD `success_email_to` TEXT NOT NULL AFTER `success_message`")) {
|
407 |
|
echo 'Database Field success_email_to added successfully<br />';
|
408 |
|
}
|
409 |
|
echo mysql_error().'<br />';
|
410 |
|
|
411 |
|
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_form_settings` ADD `success_page` TEXT NOT NULL AFTER `success_message`")) {
|
412 |
|
echo 'Database Field success_page added successfully<br />';
|
413 |
|
}
|
414 |
|
echo mysql_error().'<br />';
|
415 |
|
|
416 |
387 |
echo "<BR><B>Deleting field success_message from table mod_form_settings</B><BR>";
|
417 |
388 |
|
418 |
389 |
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_form_settings` DROP `success_message`")) {
|
... | ... | |
482 |
453 |
//Start of upgrade script for the news modul
|
483 |
454 |
//******************************************************************************
|
484 |
455 |
|
485 |
|
echo "<BR><B>Adding new fields to database table mod_news_posts</B><BR>";
|
486 |
|
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_news_posts` ADD `published_when` INT NOT NULL AFTER `commenting`")) {
|
487 |
|
echo 'Database Field published_when added successfully<br />';
|
488 |
|
}
|
489 |
|
echo mysql_error().'<br />';
|
490 |
|
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_news_posts` ADD `published_until` INT NOT NULL AFTER `published_when`")) {
|
491 |
|
echo 'Database Field published_until added successfully<br />';
|
492 |
|
}
|
493 |
|
echo mysql_error().'<br />';
|
|
456 |
db_add_field('published_when', 'mod_news_posts', "INT NOT NULL AFTER `commenting`");
|
|
457 |
db_add_field('published_until', 'mod_news_posts', "INT NOT NULL AFTER `published_when`");
|
494 |
458 |
|
495 |
459 |
// UPDATING DATA INTO FIELDS
|
496 |
460 |
echo "<BR>";
|
... | ... | |
577 |
541 |
//End of upgrade script for the news modul
|
578 |
542 |
//******************************************************************************
|
579 |
543 |
|
|
544 |
|
|
545 |
|
|
546 |
|
580 |
547 |
echo "<br /><br />Done<br />";
|
581 |
548 |
|
582 |
549 |
?>
|
Updated upgrade-script.