Revision 1587
Added by darkviper almost 14 years ago
| upgrade.php | ||
|---|---|---|
| 15 | 15 |
* |
| 16 | 16 |
*/ |
| 17 | 17 |
|
| 18 |
// Must include code to stop this file being access directly |
|
| 19 | 18 |
/* -------------------------------------------------------- */ |
| 20 |
if(defined('WB_PATH') == false)
|
|
| 21 |
{
|
|
| 22 |
// Stop this file being access directly |
|
| 23 |
die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
|
|
| 24 |
} |
|
| 25 |
|
|
| 19 |
// Must include code to stop this file being accessed directly |
|
| 20 |
require_once( dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php'); |
|
| 21 |
if(!defined('WB_PATH')) { throw new IllegalFileException(); }
|
|
| 22 |
/* -------------------------------------------------------- */ |
|
| 26 | 23 |
/* **** START UPGRADE ******************************************************* */ |
| 27 | 24 |
if(!function_exists('mod_news_Upgrade'))
|
| 28 | 25 |
{
|
| ... | ... | |
| 124 | 121 |
|
| 125 | 122 |
// rebuild all access-files |
| 126 | 123 |
$count = 0; |
| 127 |
// $backSteps = preg_replace('/^'.preg_quote(WB_PATH).'/', '', $sPostsPath);
|
|
| 128 | 124 |
$backSteps = preg_replace('@^'.preg_quote(WB_PATH).'@', '', $sPostsPath);
|
| 129 | 125 |
$backSteps = str_repeat( '../', substr_count($backSteps, '/')); |
| 130 | 126 |
$sql = 'SELECT `page_id`,`post_id`,`section_id`,`link` '; |
| ... | ... | |
| 146 | 142 |
"\t".'$section_id = '.$recPost['section_id'].';'."\n". |
| 147 | 143 |
"\t".'$post_id = '.$recPost['post_id'].';'."\n". |
| 148 | 144 |
"\t".'$post_section = '.$recPost['section_id'].';'."\n". |
| 149 |
// "\t".'define(\'POST_SECTION\', '.$recPost['section_id'].');'."\n". |
|
| 150 |
// "\t".'define(\'POST_ID\', '.$recPost['post_id'].');'."\n". |
|
| 151 | 145 |
"\t".'require(\''.$backSteps.'index.php\');'."\n". |
| 152 | 146 |
'// *************************************************'."\n"; |
| 153 | 147 |
if( file_put_contents($file, $content) !== false ) {
|
| ... | ... | |
| 165 | 159 |
} |
| 166 | 160 |
} |
| 167 | 161 |
if($globalStarted) { $msg[] = 'created '.$count.' new accessfiles.'; }
|
| 168 |
// if(!$globalStarted) { $admin->print_footer(); }
|
|
| 169 | 162 |
} |
| 170 | 163 |
} |
| 171 | 164 |
|
| 172 |
$msg = array(); |
|
| 173 |
$aTable = array('mod_news_posts','mod_news_groups','mod_news_comments','mod_news_settings');
|
|
| 174 |
for($x=0; $x<sizeof($aTable);$x++) {
|
|
| 175 |
if(($sOldType = $database->getTableEngine(TABLE_PREFIX.$aTable[$x]))) {
|
|
| 176 |
if(('myisam' != strtolower($sOldType))) {
|
|
| 177 |
if(!$database->query('ALTER TABLE `'.TABLE_PREFIX.$aTable[$x].'` Engine = \'MyISAM\' ')) {
|
|
| 178 |
$msg[] = $database->get_error(); |
|
| 165 |
$msg = array(); |
|
| 166 |
$aTable = array('mod_news_posts','mod_news_groups','mod_news_comments','mod_news_settings');
|
|
| 167 |
for($x=0; $x<sizeof($aTable);$x++) {
|
|
| 168 |
if(($sOldType = $database->getTableEngine(TABLE_PREFIX.$aTable[$x]))) {
|
|
| 169 |
if(('myisam' != strtolower($sOldType))) {
|
|
| 170 |
if(!$database->query('ALTER TABLE `'.TABLE_PREFIX.$aTable[$x].'` Engine = \'MyISAM\' ')) {
|
|
| 171 |
$msg[] = $database->get_error(); |
|
| 172 |
} |
|
| 179 | 173 |
} |
| 174 |
} else {
|
|
| 175 |
$msg[] = $database->get_error(); |
|
| 180 | 176 |
} |
| 181 |
} else {
|
|
| 182 |
$msg[] = $database->get_error(); |
|
| 183 | 177 |
} |
| 184 |
} |
|
| 185 | 178 |
// ------------------------------------ |
| 186 | 179 |
mod_news_Upgrade(); |
| 187 |
/* **** END UPGRADE ********************************************************* */ |
|
| 180 |
/* **** END UPGRADE ********************************************************* */ |
|
Also available in: Unified diff
news: added sql-dump to create database tables, some little fixes in install/upgrade