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