1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category module
|
5
|
* @package Form
|
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.x
|
11
|
* @requirements PHP 5.2.2 and higher
|
12
|
* @version $Id: upgrade.php 1765 2012-09-22 20:06:49Z Luisehahne $
|
13
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/form/upgrade.php $
|
14
|
* @lastmodified $Date: 2012-09-22 22:06:49 +0200 (Sat, 22 Sep 2012) $
|
15
|
* @description
|
16
|
*/
|
17
|
|
18
|
/* -------------------------------------------------------- */
|
19
|
// Must include code to stop this file being accessed directly
|
20
|
if(!defined('WB_PATH')) {
|
21
|
require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
|
22
|
throw new IllegalFileException();
|
23
|
}
|
24
|
/* -------------------------------------------------------- */
|
25
|
|
26
|
if(!function_exists('mod_form_upgrade'))
|
27
|
{
|
28
|
function mod_form_upgrade() {
|
29
|
$msg = array();
|
30
|
global $database,$bDebugModus;
|
31
|
$callingScript = $_SERVER["SCRIPT_NAME"];
|
32
|
// check if upgrade startet by upgrade-script to echo a message
|
33
|
$tmp = 'upgrade-script.php';
|
34
|
$globalStarted = substr_compare($callingScript, $tmp,(0-strlen($tmp)),strlen($tmp)) === 0;
|
35
|
$aTable = array('mod_form_fields','mod_form_settings','mod_form_submissions');
|
36
|
for($x=0; $x<sizeof($aTable);$x++) {
|
37
|
if(($sOldType = $database->getTableEngine(TABLE_PREFIX.$aTable[$x]))) {
|
38
|
if(('myisam' != strtolower($sOldType))) {
|
39
|
if(!$database->query('ALTER TABLE `'.TABLE_PREFIX.$aTable[$x].'` Engine = \'MyISAM\' ')) {
|
40
|
$msg[] = $database->get_error();
|
41
|
} else{
|
42
|
$msg[] = 'TABLE `'.TABLE_PREFIX.$aTable[$x].'` changed to Engine = \'MyISAM\'';
|
43
|
}
|
44
|
} else {
|
45
|
$msg[] = 'TABLE `'.TABLE_PREFIX.$aTable[$x].'` has Engine = \'MyISAM\'';
|
46
|
}
|
47
|
} else {
|
48
|
$msg[] = $database->get_error();
|
49
|
}
|
50
|
}
|
51
|
|
52
|
$table_name = TABLE_PREFIX.'mod_form_settings';
|
53
|
$field_name = 'perpage_submissions';
|
54
|
$description = "INT NOT NULL DEFAULT '10' AFTER `max_submissions`";
|
55
|
if(!$database->field_exists($table_name,$field_name)) {
|
56
|
$database->field_add($table_name, $field_name, $description);
|
57
|
$msg[] = 'Add field `perpage_submissions` AFTER `max_submissions`';
|
58
|
} else {
|
59
|
$msg[] = 'Field `perpage_submissions` already exists';
|
60
|
}
|
61
|
|
62
|
// only for upgrade-script
|
63
|
if($globalStarted) {
|
64
|
if($bDebugModus) {
|
65
|
foreach($msg as $title) {
|
66
|
echo '<strong>'.$title.'</strong><br />';
|
67
|
}
|
68
|
}
|
69
|
}
|
70
|
return $msg;
|
71
|
}
|
72
|
}
|
73
|
// ------------------------------------
|
74
|
|
75
|
$msg = mod_form_upgrade();
|