private function installModule(\Model_Extension $ext) { $mod = $this->di['mod']($ext->name); if ($mod->isCore()) { throw new \Box_Exception("BoxBilling core modules can not be installed or removed"); } $info = $mod->getManifest(); if (isset($info['minimum_boxbilling_version']) && Box_Version::compareVersion($info['minimum_boxbilling_version']) > 0) { throw new \Box_Exception('Module can not be installed. It requires at least :min version of BoxBilling. You are using :v', array(':min' => $info['minimum_boxbilling_version'], ':v' => Box_Version::VERSION)); } // Allow install module even if no installer exists // as it can be simple module // perform install script if available try { $mod->install(); } catch (\Box_Exception $e) { if ($e->getCode() != 408) { throw $e; } } $ext->version = $info['version']; $this->di['db']->store($ext); return true; }
/** * Check if we need to update current BoxBilling version * @return bool */ public function getCanUpdate() { $version = $this->getLatestVersion(); $result = Box_Version::compareVersion($version); return $result > 0; }