PluginProbe
CSS & JavaScript Toolbox / 6.0.9
CSS & JavaScript Toolbox v6.0.9
trunk 0.3 0.8 10 10.1 11 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.9.1 12 12.0 12.0.1 12.0.3 12.0.4 12.0.5 12.0.6 12.0.7 6.0 6.0.11 All 60 releases
← All changes | models/installer.php +26 -17 6.06.0.9 View file →
@@ -75,35 +75,43 @@
75 75 * put your comment there...
76 76 *
77 77 */
78 78 public function getInternalVersionName() {
79 - return str_replace('.', '', $this->installedDbVersion);
79 + return str_replace(array('.', '-'), '', $this->installedDbVersion);
80 80 }
81 -
81 +
82 82 /**
83 - * put your comment there...
83 + * Get installer operations for current CJT version!
84 84 *
85 + * @return array Operations list metadata.
85 86 */
86 87 public function getOperations() {
87 - // If installation is didn't never run before thise would be unset!
88 - if (!($operations = get_option(self::INSTALLATION_STATE))) {
88 + // Read all install/upgrade operations for all versions!
89 + $operations = get_option(self::INSTALLATION_STATE);
90 + $operations = is_array($operations) ? $operations : array();
91 + // Check if cached: Use only installer cache for 'current' CJT version.
92 + if (!isset($operations[CJTPlugin::DB_VERSION])) {
89 93 // Import installer reflection!
90 94 cssJSToolbox::import('framework:installer:reflection.class.php');
91 95 // Get Installer operations.
92 96 cssJSToolbox::import('includes:installer:installer:installer.class.php');
93 - $operations['operations']['install'] = CJTInstallerReflection::getInstance('CJTInstaller', 'CJTInstaller')->getOperations();
97 + $operations[CJTPlugin::DB_VERSION]['operations']['install'] = CJTInstallerReflection::getInstance('CJTInstaller', 'CJTInstaller')->getOperations();
94 98 if ($this->isUpgrade()) {
95 99 // Get upgrade operations , Also cache upgrader info for later use!
96 - $operations['upgrader'] = $upgrader = $this->getUpgrader();
100 + $operations[CJTPlugin::DB_VERSION]['upgrader'] = $upgrader = $this->getUpgrader();
101 + // Check if upgrader exists!
102 + if (!file_exists(cssJSToolbox::resolvePath($upgrader['file']))) {
103 + throw new Exception("Could not find upgrade/downgrade agent for installer '{$this->installedDbVersion}'! Incompatible version numbers! Upgrader/Downgrwader is no being supported by current versions!!");
104 + }
105 + // Import upgrader + reflect its operations!
97 106 cssJSToolbox::import($upgrader['file']);
98 - $operations['operations']['upgrade'] = CJTInstallerReflection::getInstance($upgrader['class'], 'CJTUpgradeNonTabledVersions')->getOperations();
107 + $operations[CJTPlugin::DB_VERSION]['operations']['upgrade'] = CJTInstallerReflection::getInstance($upgrader['class'], 'CJTUpgradeNonTabledVersions')->getOperations();
99 108 }
100 - // Cache operations!
101 - update_option(self::INSTALLATION_STATE, $operations);
109 + update_option(self::INSTALLATION_STATE, $operations);
102 110 }
103 - return $operations;
111 + return $operations[CJTPlugin::DB_VERSION];
104 112 }
105 -
113 +
106 114 /**
107 115 * put your comment there...
108 116 *
109 117 */
@@ -125,18 +133,19 @@
125 133 public function install() {
126 134 // Read input!
127 135 $rOperation = $this->input['operation'];
128 136 $type = $rOperation['type'];
129 - // Get allowed operations with thier state!
137 + // Get allowed operations with their state!
130 138 $operations = (array) get_option(self::INSTALLATION_STATE);
139 + $vOperations =& $operations[CJTPlugin::DB_VERSION];
131 140 // Invalid operation!
132 - if (!isset($operations['operations'][$type][$rOperation['name']])) {
141 + if (!isset($vOperations['operations'][$type][$rOperation['name']])) {
133 142 throw new Exception('Invalid operation');
134 143 }
135 144 else {
136 145 // Install only if not installed!
137 - $operation =& $operations['operations'][$type][$rOperation['name']];
138 - if ($operation['state'] != self::OPERATION_STATE_INSTALLED) {
146 + $operation =& $vOperations['operations'][$type][$rOperation['name']];
147 + if ((!isset($operation['state'])) || ($operation['state'] != self::OPERATION_STATE_INSTALLED)) {
139 148 // Import installer and get installer object!
140 149 switch ($type) {
141 150 case 'install':
142 151 cssJSToolbox::import('includes:installer:installer:installer.class.php');
@@ -142,9 +151,9 @@
142 151 cssJSToolbox::import('includes:installer:installer:installer.class.php');
143 152 $installer = CJTInstaller::getInstance();
144 153 break;
145 154 case 'upgrade':
146 - $upgrader = $operations['upgrader'];
155 + $upgrader = $vOperations['upgrader'];
147 156 cssJSToolbox::import($upgrader['file']);
148 157 $installer = new $upgrader['class']();
149 158 break;
150 159 }