Beispiel #1
0
 /**
  * This method will be used to find an extension that determined
  * by name.
  *
  * Return "install"    when extension does not installed
  * Return "update"     when extension is installed and is out of date
  * Return "installed"  when extension is installed and is up to date
  *
  * @param   string  $name     The name of extension
  * @param   string  $version  Version number that used to determine state
  *
  * @return  string
  */
 private function _getExtensionState($name, $version)
 {
     $installedExtensions = JSNTplHelper::findInstalledExtensions();
     if (!isset($installedExtensions[$name])) {
         return 'install';
     }
     if (version_compare($installedExtensions[$name]->version, $version, '<')) {
         return 'update';
     }
     return 'installed';
 }
Beispiel #2
0
 /**
  * This method will be used to find an extension that determined
  * by name.
  *
  * Return "install"    when extension does not installed
  * Return "update"     when extension is installed and is out of date
  * Return "installed"  when extension is installed and is up to date
  *
  * @param   string  $name     The name of extension
  * @param   string  $version  Version number that used to determine state
  *
  * @return  string
  */
 private function _getExtensionState($name, $version, $isThirdParty = false)
 {
     $installedExtensions = JSNTplHelper::findInstalledExtensions();
     if (!isset($installedExtensions[$name])) {
         return 'install';
     }
     if (version_compare($installedExtensions[$name]->version, $version, '<')) {
         return 'update';
     }
     if ($isThirdParty) {
         if (version_compare($installedExtensions[$name]->version, $version, '>')) {
             return 'unsupported';
         }
     }
     return 'installed';
 }
Beispiel #3
0
 /**
  * Get version of installed extension
  *
  * @param   string  $name  The name of extension.
  *
  * @return  string
  */
 private function _getExtensionVersion($name)
 {
     $installedExtensions = JSNTplHelper::findInstalledExtensions();
     if (!isset($installedExtensions[$name])) {
         return null;
     }
     return $installedExtensions[$name]->version;
 }