private function installModule(\Model_Extension $ext) { $mod = $this->di['mod']($ext->name); if ($mod->isCore()) { throw new \Fuse_Exception("BillingFuse core modules can not be installed or removed"); } $info = $mod->getManifest(); if (isset($info['minimum_billingfuse_version']) && Fuse_Version::compareVersion($info['minimum_billingfuse_version']) > 0) { throw new \Fuse_Exception('Module can not be installed. It requires at least :min version of BillingFuse. You are using :v', array(':min' => $info['minimum_billingfuse_version'], ':v' => Fuse_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 (\Fuse_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 BillingFuse version * @return bool */ public function getCanUpdate() { $version = $this->getLatestVersion(); $result = Fuse_Version::compareVersion($version); return $result > 0; }