/** * put your comment there... * */ public function finalize() { // Upgrade database internal version number using // installer class. cssJSToolbox::import('includes:installer:installer:installer.class.php'); CJTInstaller::getInstance()->finalize(); // Chaining. return $this; }
/** * Allow executing of a single installation operation! * Both Install and Upgrade operations can be executed throught here * * * @return void */ public function install() { // Initialize. $result = FALSE; // Read input! $rOperation = $this->input['operation']; $type = $rOperation['type']; // Get allowed operations with their state! $operations = (array) get_option(self::INSTALLATION_STATE); $vOperations =& $operations[CJTPlugin::DB_VERSION]; // Invalid operation! if (!isset($vOperations['operations'][$type][$rOperation['name']])) { throw new Exception('Invalid operation'); } else { // Install only if not installed! $operation =& $vOperations['operations'][$type][$rOperation['name']]; if (!isset($operation['state']) || $operation['state'] != self::OPERATION_STATE_INSTALLED) { // Import installer and get installer object! switch ($type) { case 'install': cssJSToolbox::import('includes:installer:installer:installer.class.php'); $installer = CJTInstaller::getInstance(); break; case 'upgrade': $upgrader = $vOperations['upgrader']; cssJSToolbox::import($upgrader['file']); $installer = new $upgrader['class'](); break; } // Execute the requested operation, save state only when succesed! if ($installer->{$rOperation['name']}()) { $operation['state'] = self::OPERATION_STATE_INSTALLED; // Update operations cache to reflect the new state! update_option(self::INSTALLATION_STATE, $operations); // Say OK! $result = array('state' => self::OPERATION_STATE_INSTALLED); } } } return $result; }