Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         wysiwyg
6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2012, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.3
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version      	$Id: upgrade.php 1754 2012-09-15 16:00:56Z Luisehahne $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/wysiwyg/upgrade.php $
14
 * @lastmodified    $Date: 2012-09-15 18:00:56 +0200 (Sat, 15 Sep 2012) $
15
 *
16
 */
17
/* -------------------------------------------------------- */
18
// Must include code to stop this file being accessed directly
19
if(!defined('WB_PATH')) {
20
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
21
	throw new IllegalFileException();
22
}
23
/* -------------------------------------------------------- */
24
$msg = '';
25
$sTable = TABLE_PREFIX.'mod_wysiwyg';
26
if(($sOldType = $database->getTableEngine($sTable))) {
27
	if(('myisam' != strtolower($sOldType))) {
28
		if(!$database->query('ALTER TABLE `'.$sTable.'` Engine = \'MyISAM\' ')) {
29
			$msg = $database->get_error();
30
		}
31
	}
32
} else {
33
	$msg .= $database->get_error().'<br />';
34
}
35

    
36
$sql = 'ALTER TABLE `'.DB_NAME.'`.`'.$sTable.'` DROP PRIMARY KEY';
37
if(!$database->query($sql)) {
38
	$msg .= $database->get_error().'<br />';
39
}
40

    
41
$sql = 'ALTER TABLE `'.$sTable.'`  ADD `wysiwyg_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST';
42
if(!$database->query($sql)) {
43
	$msg .= $database->get_error().'<br />';
44
}
45

    
46
// change internal absolute links into relative links
47
$sTable = TABLE_PREFIX.'mod_wysiwyg';
48
$sql  = 'UPDATE `'.$sTable.'` ';
49
$sql .= 'SET `content` = REPLACE(`content`, \'"'.WB_URL.MEDIA_DIRECTORY.'\', \'"{SYSVAR:MEDIA_REL}\')';
50
if (!$database->query($sql)) {
51
	$msg .= $database->get_error().'<br />';
52
}
53

    
54
// ------------------------------------
(9-9/10)