Airship\Engine\Continuum\Version::isUpgrade PHP Méthode

isUpgrade() public méthode

Is $nextVersion newer than $this->currentVersion?
public isUpgrade ( string $nextVersion ) : boolean
$nextVersion string
Résultat boolean
    public function isUpgrade(string $nextVersion) : bool
    {
        $curr = \Airship\expand_version($this->currentVersion);
        $next = \Airship\expand_version($nextVersion);
        return $next > $curr;
    }

Usage Example

Exemple #1
0
 /**
  * Should this automatic update be permitted?
  *
  * @param UpdateInfo $info
  * @param string $currentVersion
  * @return bool
  */
 protected function checkVersionSettings(UpdateInfo $info, string $currentVersion) : bool
 {
     $state = State::instance();
     $nextVersion = $info->getVersion();
     $version = new Version($currentVersion);
     // If this isn't an upgrade at all, don't apply it.
     if (!$version->isUpgrade($nextVersion)) {
         return false;
     }
     if ($version->isMajorUpgrade($nextVersion)) {
         return !empty($state->universal['auto-update']['major']);
     }
     if ($version->isMinorUpgrade($nextVersion)) {
         return !empty($state->universal['auto-update']['minor']);
     }
     if ($version->isPatchUpgrade($nextVersion)) {
         return !empty($state->universal['auto-update']['patch']);
     }
     return false;
 }