1: <?php
2: /**
3: * This file contains the upgrade job 7.
4: *
5: * @package Setup
6: * @subpackage UpgradeJob
7: * @author Simon Sprankel
8: * @copyright four for business AG <www.4fb.de>
9: * @license http://www.contenido.org/license/LIZENZ.txt
10: * @link http://www.4fb.de
11: * @link http://www.contenido.org
12: */
13:
14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
15:
16: /**
17: * Upgrade job 7.
18: * Copies the content of the con_plugins."path" column to the "folder" column
19: * and deletes the "path" column afterwards.
20: *
21: * @package Setup
22: * @subpackage UpgradeJob
23: */
24: class cUpgradeJob_0007 extends cUpgradeJobAbstract {
25:
26: public $maxVersion = "4.9.0-beta1";
27:
28: public function _execute() {
29: global $cfg, $db;
30:
31: if ($this->_setupType == 'upgrade') {
32: // check if the column "path" still exists
33: $db->query('SHOW COLUMNS FROM `%s`;', $cfg['tab']['plugins']);
34:
35: $columns = array();
36: while ($db->nextRecord()) {
37: $columns[] = $db->f('Field');
38: }
39:
40: if (in_array('path', $columns)) {
41: // copy path to folder
42: $db->query('UPDATE `%s` SET folder = path;', $cfg['tab']['plugins']);
43: // drop column "path"
44: $db->query('ALTER TABLE `%s` DROP path;', $cfg['tab']['plugins']);
45: }
46: }
47: }
48:
49: }
50: