Revision 1538
Added by Luisehahne almost 14 years ago
| upgrade.php | ||
|---|---|---|
| 4 | 4 |
* @category WebsiteBaker |
| 5 | 5 |
* @package modules |
| 6 | 6 |
* @subpackage news |
| 7 |
* @copyright 2004-2009, Ryan Djurovich |
|
| 8 | 7 |
* @copyright 2009-2011, Website Baker Org. e.V. |
| 9 | 8 |
* @link http://www.websitebaker2.org/ |
| 10 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
| ... | ... | |
| 17 | 16 |
*/ |
| 18 | 17 |
|
| 19 | 18 |
// Must include code to stop this file being access directly |
| 20 |
if(!defined('WB_URL')) { throw new Exception('illegal file access!! ['.$_SERVER['PHP_SELF'].']'); }
|
|
| 19 |
/* -------------------------------------------------------- */ |
|
| 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 |
} |
|
| 21 | 25 |
|
| 22 | 26 |
/* **** START UPGRADE ******************************************************* */ |
| 23 | 27 |
if(!function_exists('mod_news_Upgrade'))
|
| 24 | 28 |
{
|
| 25 | 29 |
function mod_news_Upgrade() |
| 26 | 30 |
{
|
| 27 |
global $database, $admin, $MESSAGE; |
|
| 31 |
global $database, $msg, $admin, $MESSAGE;
|
|
| 28 | 32 |
$callingScript = $_SERVER["SCRIPT_NAME"]; |
| 29 | 33 |
$tmp = 'upgrade-script.php'; |
| 30 | 34 |
$globalStarted = substr_compare($callingScript, $tmp,(0-strlen($tmp)),strlen($tmp)) === 0; |
| ... | ... | |
| 37 | 41 |
make_dir(WB_PATH.PAGES_DIRECTORY.'/posts/'); |
| 38 | 42 |
}else {
|
| 39 | 43 |
if(!$globalStarted){
|
| 40 |
$admin->print_error($MESSAGE['PAGES_CANNOT_CREATE_ACCESS_FILE']);
|
|
| 44 |
$msg[] = ($MESSAGE['PAGES_CANNOT_CREATE_ACCESS_FILE']);
|
|
| 41 | 45 |
}else {
|
| 42 |
echo $MESSAGE['PAGES_CANNOT_CREATE_ACCESS_FILE'].'<br />';
|
|
| 46 |
$msg[] = $MESSAGE['PAGES_CANNOT_CREATE_ACCESS_FILE'].'<br />';
|
|
| 43 | 47 |
return; |
| 44 | 48 |
} |
| 45 | 49 |
} |
| ... | ... | |
| 104 | 108 |
} |
| 105 | 109 |
unset($oDir); |
| 106 | 110 |
if($globalStarted && $count > 0) {
|
| 107 |
echo 'save date of creation from '.$count.' old accessfiles and delete these files.<br />';
|
|
| 111 |
$msg[] = 'save date of creation from '.$count.' old accessfiles and delete these files.<br />';
|
|
| 108 | 112 |
} |
| 109 | 113 |
// ************************************************ |
| 110 | 114 |
// Check the validity of 'create-file-timestamp' and balance against 'posted-timestamp' |
| ... | ... | |
| 151 | 155 |
change_mode($file); |
| 152 | 156 |
}else {
|
| 153 | 157 |
if($globalStarted){
|
| 154 |
echo $MESSAGE['PAGES_CANNOT_CREATE_ACCESS_FILE'].'<br />';
|
|
| 158 |
$msg[] = $MESSAGE['PAGES_CANNOT_CREATE_ACCESS_FILE'].'<br />';
|
|
| 155 | 159 |
return; |
| 156 | 160 |
}else {
|
| 157 |
$admin->print_error($MESSAGE['PAGES_CANNOT_CREATE_ACCESS_FILE']);
|
|
| 161 |
$msg[] = ($MESSAGE['PAGES_CANNOT_CREATE_ACCESS_FILE']);
|
|
| 158 | 162 |
} |
| 159 | 163 |
} |
| 160 | 164 |
$count++; |
| 161 | 165 |
} |
| 162 | 166 |
} |
| 163 |
if($globalStarted) { echo 'created '.$count.' new accessfiles.'; }
|
|
| 164 |
if(!$globalStarted) { $admin->print_footer(); }
|
|
| 167 |
if($globalStarted) { $msg[] = 'created '.$count.' new accessfiles.'; }
|
|
| 168 |
// if(!$globalStarted) { $admin->print_footer(); }
|
|
| 165 | 169 |
} |
| 166 | 170 |
} |
| 167 | 171 |
|
| 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(); |
|
| 179 |
} |
|
| 180 |
} |
|
| 181 |
} else {
|
|
| 182 |
$msg[] = $database->get_error(); |
|
| 183 |
} |
|
| 184 |
} |
|
| 185 |
// ------------------------------------ |
|
| 168 | 186 |
mod_news_Upgrade(); |
| 169 | 187 |
/* **** END UPGRADE ********************************************************* */ |
Also available in: Unified diff
! add table db engine in module install scripts
! some small updates in modules