1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
16:
17: 18: 19: 20: 21: 22: 23:
24: class cUpgradeJob_0009 extends cUpgradeJobAbstract {
25:
26: private $_tableMapping = array('%s_news' => '%s_pi_news',
27: '%s_news_groupmembers' => '%s_pi_news_groupmembers',
28: '%s_news_groups' => '%s_pi_news_groups',
29: '%s_news_jobs' => '%s_pi_news_jobs',
30: '%s_news_log' => '%s_pi_news_log',
31: '%s_news_rcp' => '%s_pi_news_rcp');
32:
33: public function _execute() {
34: global $cfg;
35:
36: if ($this->_setupType != 'upgrade') {
37: return;
38: }
39:
40: $updateDB = getSetupMySQLDBConnection(false);
41: foreach ($this->_tableMapping as $oldName => $newName) {
42: $this->_oDb->query('SHOW TABLES LIKE "%s"', sprintf($oldName, $cfg['sql']['sqlprefix']));
43: $oldTable = $this->_oDb->nextRecord();
44:
45: $this->_oDb->query('SHOW TABLES LIKE "%s"', sprintf($newName, $cfg['sql']['sqlprefix']));
46: $newTable = $this->_oDb->nextRecord();
47:
48: if ($newTable === false && $oldTable === true) {
49: $this->_oDb->query('RENAME TABLE ' . sprintf($oldName, $cfg['sql']['sqlprefix']) . ' TO ' . sprintf($newName, $cfg['sql']['sqlprefix']));
50:
51: alterTableHandling(sprintf($newName, $cfg['sql']['sqlprefix']));
52: urlDecodeTable($updateDB, sprintf($newName, $cfg['sql']['sqlprefix']));
53: }
54: }
55: }
56:
57: }
58:
59: ?>