Project

General

Profile

« Previous | Next » 

Revision 1894

Added by Dietmar over 11 years ago

  1. bugfix form intall form284db.sql
  2. bugfix wb_search_data.sql layout for table settings
    ! update menu_link module and set Version to 2.8.1

View differences:

upgrade.php
4 4
 * @category        modules
5 5
 * @package         menu_link
6 6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8 8
 * @link            http://www.websitebaker2.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10 10
 * @platform        WebsiteBaker 2.8.x
......
14 14
 * @lastmodified    $Date$
15 15
 *
16 16
 */
17
// Must include code to stop this file being access directly
17

  
18 18
/* -------------------------------------------------------- */
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>');
19
// Must include code to stop this file being accessed directly
20
if(!defined('WB_URL')) {
21
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
22
	throw new IllegalFileException();
23 23
}
24 24
/* -------------------------------------------------------- */
25 25

  
26
$msg = '';
27
$sTable = TABLE_PREFIX.'mod_menu_link';
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();
26
	function mod_menu_link_upgrade($bDebug=false) {
27
		global $OK ,$FAIL;
28
		$database=WbDatabase::getInstance();
29
		$msg = array();
30
		$callingScript = $_SERVER["SCRIPT_NAME"];
31
		// check if upgrade startet by upgrade-script to echo a message
32
		$tmp = 'upgrade-script.php';
33
		$globalStarted = substr_compare($callingScript, $tmp,(0-strlen($tmp)),strlen($tmp)) === 0;
34
// check for missing tables, if true stop the upgrade
35
		$aTable = array('mod_menu_link');
36
		$aPackage = UpgradeHelper::existsAllTables($aTable);
37
		if( sizeof($aPackage) > 0){
38
			$msg[] =  'TABLE '.implode(' missing! '.$FAIL.'<br />TABLE ',$aPackage).' missing! '.$FAIL;
39
			$msg[] = 'Menu_Link upgrade failed'." $FAIL";
40
			if($globalStarted) {
41
				echo '<strong>'.implode('<br />',$msg).'</strong><br />';
42
			}
43
			return ( ($globalStarted==true ) ? $globalStarted : $msg);
44
		} else {
45
			for($x=0; $x<sizeof($aTable);$x++) {
46
				if(($sOldType = $database->getTableEngine($database->TablePrefix.$aTable[$x]))) {
47
					if(('myisam' != strtolower($sOldType))) {
48
						if(!$database->query('ALTER TABLE `'.$database->TablePrefix.$aTable[$x].'` Engine = \'MyISAM\' ')) {
49
							$msg[] = $database->get_error();
50
						} else{
51
							$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` changed to Engine = \'MyISAM\''." $OK";
52
						}
53
					} else {
54
						$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` has Engine = \'MyISAM\''." $OK";
55
					}
56
				} else {
57
					$msg[] = $database->get_error();
58
				}
59
			}
60
// change table structure
61
			$sTable = $database->TablePrefix.'mod_menu_link';
62
			$sFieldName = 'redirect_type';
63
			$sDescription = "INT NOT NULL DEFAULT '301' AFTER `target_page_id`";
64
			if(!$database->field_modify($sTable,$sFieldName,$sDescription)) {
65
				$msg[] = ''.$database->get_error();
66
			} else {
67
				$msg[] = 'Field ( `redirect_type` ) description has been changed successfully'." $OK";
68
			}
69
// only for upgrade-script
70
			if($globalStarted) {
71
				if($bDebug) {
72
					echo '<strong>'.implode('<br />',$msg).'</strong><br />';
73
				}
74
			}
32 75
		}
76
		$msg[] = 'Menu_Link upgrade successfull finished ';
77
		if($globalStarted) {
78
			echo "<strong>Menu_Link upgrade successfull finished $OK</strong><br />";
79
		}
80
		return ( ($globalStarted==true ) ? $globalStarted : $msg);
33 81
	}
34
} else {
35
	$msg = $database->get_error();
82
// ------------------------------------
83

  
84
$bDebugModus = ((isset($bDebugModus)) ? $bDebugModus : false);
85
// Don't show the messages twice
86
if( is_array($msg = mod_menu_link_upgrade($bDebugModus))) {
87
	echo '<strong>'.implode('<br />',$msg).'</strong><br />';
36 88
}
89

  
37 90
// ------------------------------------

Also available in: Unified diff