1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14:
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: 19: 20: 21: 22: 23: 24: 25:
26: class cUpgradeJob_0012 extends cUpgradeJobAbstract {
27:
28: public $maxVersion = "4.9.3";
29:
30: public function _execute() {
31: global $cfg;
32:
33: if ($_SESSION['setuptype'] == 'upgrade') {
34:
35:
36: $actionColl = new cApiActionCollection();
37:
38:
39: plugin_include('pim', 'classes/class.pim.plugin.collection.php');
40: plugin_include('pim', 'classes/class.pim.plugin.relations.collection.php');
41:
42:
43: $pluginRelColl = new PimPluginRelationsCollection();
44:
45:
46: $pluginColl = new PimPluginCollection();
47:
48:
49: $pluginColl->select();
50: while ($plugin = $pluginColl->next()) {
51:
52:
53: $pluginXmlPath = $cfg['path']['contenido'] . $cfg['path']['plugins'] . cSecurity::escapeString($plugin->get('folder')) . DIRECTORY_SEPARATOR . "plugin.xml";
54:
55:
56: $xml = simplexml_load_string(file_get_contents($pluginXmlPath));
57:
58:
59: $actionCount = count($xml->contenido->actions->action);
60:
61: for ($i = 0; $i < $actionCount; $i++) {
62:
63:
64: $actionColl->setWhere('name', cSecurity::escapeString($xml->contenido->actions->action[$i]));
65: $actionColl->query();
66:
67:
68: $actionId = $actionColl->next();
69:
70:
71: if ($actionId !== false) {
72: $pluginRelColl->create($actionId->get("idaction"), $plugin->get('idplugin'), 'action');
73: }
74: }
75: }
76: }
77: }
78:
79: }
80: