Revision 1896
Added by Dietmar over 11 years ago
upgrade.php | ||
---|---|---|
4 | 4 |
* @category modules |
5 | 5 |
* @package wrapper |
6 | 6 |
* @author WebsiteBaker Project |
7 |
* @copyright 2009-2011, Website Baker Org. e.V.
|
|
8 |
* @link http://www.websitebaker2.org/
|
|
7 |
* @copyright 2009-2013, WebsiteBaker Org. e.V.
|
|
8 |
* @link http://www.websitebaker2.org/
|
|
9 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
10 | 10 |
* @platform WebsiteBaker 2.8.x |
11 | 11 |
* @requirements PHP 5.2.2 and higher |
12 |
* @version $Id$
|
|
13 |
* @filesource $HeadURL$
|
|
12 |
* @version $Id$
|
|
13 |
* @filesource $HeadURL$
|
|
14 | 14 |
* @lastmodified $Date$ |
15 | 15 |
* |
16 | 16 |
*/ |
17 |
// Must include code to stop this file being access directly |
|
18 | 17 |
/* -------------------------------------------------------- */ |
19 |
if(defined('WB_PATH') == false)
|
|
20 |
{ |
|
21 |
// Stop this file being access directly
|
|
22 |
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>');
|
|
18 |
// Must include code to stop this file being accessed directly
|
|
19 |
if(!defined('WB_URL')) {
|
|
20 |
require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
|
|
21 |
throw new IllegalFileException();
|
|
23 | 22 |
} |
24 | 23 |
/* -------------------------------------------------------- */ |
25 | 24 |
|
26 |
$msg = ''; |
|
27 |
$sTable = TABLE_PREFIX.'mod_wrapper'; |
|
28 |
if(($sOldType = $database->getTableEngine($sTable))) { |
|
29 |
if(('myisam' != strtolower($sOldType))) { |
|
30 |
if(!$database->query('ALTER TABLE `'.$sTable.'` Engine = \'MyISAM\' ')) { |
|
31 |
$msg = $database->get_error(); |
|
25 |
function mod_wrapper_upgrade($bDebug=false) { |
|
26 |
global $OK ,$FAIL; |
|
27 |
$database=WbDatabase::getInstance(); |
|
28 |
$msg = array(); |
|
29 |
$callingScript = $_SERVER["SCRIPT_NAME"]; |
|
30 |
// check if upgrade startet by upgrade-script to echo a message |
|
31 |
$tmp = 'upgrade-script.php'; |
|
32 |
$globalStarted = substr_compare($callingScript, $tmp,(0-strlen($tmp)),strlen($tmp)) === 0; |
|
33 |
// check for missing tables, if true stop the upgrade |
|
34 |
$aTable = array('mod_wrapper'); |
|
35 |
$aPackage = UpgradeHelper::existsAllTables($aTable); |
|
36 |
if( sizeof($aPackage) > 0){ |
|
37 |
$msg[] = 'TABLE '.implode(' missing! '.$FAIL.'<br />TABLE ',$aPackage).' missing! '.$FAIL; |
|
38 |
$msg[] = 'Mod_Wrapper upgrade failed'." $FAIL"; |
|
39 |
if($globalStarted) { |
|
40 |
echo '<strong>'.implode('<br />',$msg).'</strong><br />'; |
|
41 |
} |
|
42 |
return ( ($globalStarted==true ) ? $globalStarted : $msg); |
|
43 |
} else { |
|
44 |
for($x=0; $x<sizeof($aTable);$x++) { |
|
45 |
if(($sOldType = $database->getTableEngine($database->TablePrefix.$aTable[$x]))) { |
|
46 |
if(('myisam' != strtolower($sOldType))) { |
|
47 |
if(!$database->query('ALTER TABLE `'.$database->TablePrefix.$aTable[$x].'` Engine = \'MyISAM\' ')) { |
|
48 |
$msg[] = $database->get_error(); |
|
49 |
} else{ |
|
50 |
$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` changed to Engine = \'MyISAM\''." $OK"; |
|
51 |
} |
|
52 |
} else { |
|
53 |
$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` has Engine = \'MyISAM\''." $OK"; |
|
54 |
} |
|
55 |
} else { |
|
56 |
$msg[] = $database->get_error(); |
|
57 |
} |
|
58 |
} |
|
59 |
// only for upgrade-script |
|
60 |
if($globalStarted) { |
|
61 |
if($bDebug) { |
|
62 |
echo '<strong>'.implode('<br />',$msg).'</strong><br />'; |
|
63 |
} |
|
64 |
} |
|
32 | 65 |
} |
66 |
$msg[] = 'Mod_Wrapper upgrade successfull finished '." $OK"; |
|
67 |
if($globalStarted) { |
|
68 |
echo "<strong>Mod_Wrapper upgrade successfull finished $OK</strong><br />"; |
|
69 |
} |
|
70 |
return ( ($globalStarted==true ) ? $globalStarted : $msg); |
|
33 | 71 |
} |
34 |
} else { |
|
35 |
$msg = $database->get_error(); |
|
72 |
// ------------------------------------ |
|
73 |
|
|
74 |
$bDebugModus = ((isset($bDebugModus)) ? $bDebugModus : false); |
|
75 |
// Don't show the messages twice |
|
76 |
if( is_array($msg = mod_wrapper_upgrade($bDebugModus)) ) { |
|
77 |
echo '<strong>'.implode('<br />',$msg).'</strong><br />'; |
|
36 | 78 |
} |
37 |
// ------------------------------------ |
Also available in: Unified diff
! update wrapper module and set version to 2.8.4
! update wysiwyg install.php, info.php