Check installed version.

@param string $installed_version
@param array  $definition_versions

@return bool
349350
protected function checkInstalledVersion($installed_version, array $definition_versions)
    {
        if ($installed_version === null) {
            $this->error('Nothing installed version.');
            $this->line('Please run <comment>database:upgrade<comment>.');

            return false;
        }

        $index = array_search($installed_version, array_keys($definition_versions));

        if ($index === false) {
            $versions = json_encode(array_keys($definition_versions));
            $this->error("Installed version '{$installed_version}' was not found in definition {$versions}.");

            return false;
        }

        if ($index >= 2) {
            $this->error("Installed version '$installed_version' was older.");
            $this->line('Please run <comment>database:upgrade<comment>.');

            return false;
        }

        return true;
    }
301875
public static boolean checkVersionDirName(File versionDir) {
        return (versionDir.isDirectory() && versionDir.getName().contains("version-") && !versionDir.getName()
                                                                                                    .endsWith(".bak"));
    }
184597
public boolean isInstalled()
      throws ManagedSdkVerificationException, ManagedSdkVersionMismatchException {
    if (getSdkHome() == null) {
      return false;
    }
    if (!Files.isDirectory(getSdkHome())) {
      return false;
    }
    if (!Files.isRegularFile(getGcloudPath())) {
      return false;
    }
    // Verify the versions match up for fixed version installs
    if (version != Version.LATEST) {
      try {
        String versionFileContents =
            new String(Files.readAllBytes(getSdkHome().resolve("VERSION")), StandardCharsets.UTF_8)
                .trim();
        if (!versionFileContents.equals(version.getVersion())) {
          throw new ManagedSdkVersionMismatchException(
              "Installed sdk version: "
                  + versionFileContents
                  + " does not match expected version: "
                  + version.getVersion()
                  + ".");
        }
      } catch (IOException ex) {
        throw new ManagedSdkVerificationException(ex);
      }
    }
    return true;
  }
421413
protected static function checkVersion()
    {
        if (self::$checked === true) {
            return true;
        }

        $process = new \SystemProcess\SystemProcess('bzr');
        $process->nonZeroExitCodeException = true;
        $process->argument('--version')->execute();

        if (!preg_match('/\Bazaar \(bzr\) ([0-9.]*)/', $process->stdoutOutput, $match)) {
            throw new \RuntimeException('Could not determine Bazaar version.');
        }

        if (version_compare($match[1], '1.1', '<')) {
            throw new \RuntimeException('Bazaar is required in a minimum version of 1.1.');
        }

        $process = new \SystemProcess\SystemProcess('bzr');
        $process->nonZeroExitCodeException = true;
        $process->argument('plugins')->execute();

        if (strpos($process->stdoutOutput, 'xmloutput') === false) {
            throw new \RuntimeException('Missing required bazaar pluging "xmloutput".');
        }

        return self::$checked = true;
    }
613632
public function isDrupalInstalled() {
    $this->logger->debug("Verifying that Drupal is installed...");
    $result = $this->executor->drush("sqlq \"SHOW TABLES LIKE 'config'\"")->run();
    $output = trim($result->getMessage());
    $installed = $result->wasSuccessful() && $output == 'config';

    return $installed;
  }
787932
public function processUpgradeScript(Plugin $plugin, &$log, $installedVersion)
    {
        $script = $plugin->Path .'/upgrade.php';

        if(file_exists($script))
            include_once $script;

    }
407627
public function validateNoUnmaintainedPhpVersionsInTravis($travisYml, $maintainedVersions)
    {
        if (empty($travisYml['php'])) {
            return true;
        }

        $failedTravis = array();
        // First pass - check the .travis.yml constraints against the maintained versions.
        foreach ($travisYml['php'] as $travisVersion) {
            if (!in_array($travisVersion, $maintainedVersions)) {
                $failedTravis[] = $travisVersion;
            }
        }

        if (!empty($failedTravis)) {
            $this->output->writeln(
                sprintf(
                    '<error>travis.yml specifies PHP version "%s" but only "%s" are actively maintained.</error>',
                    implode(', ', $failedTravis),
                    implode(', ', $maintainedVersions)
                )
            );

            return false;
        }

        return true;
    }
704169
public function isSatisfiedBy($versionInfo): bool
    {
        $versions = $this->contentService->loadVersions($versionInfo->getContentInfo());

        foreach ($versions as $checkedVersionInfo) {
            if ($checkedVersionInfo->versionNo > $versionInfo->versionNo
                && $checkedVersionInfo->isPublished()
                && $checkedVersionInfo->initialLanguageCode === $this->languageCode
            ) {
                return true;
            }
        }

        return false;
    }
96828
public static function getMigrationVersion()
    {
        if (self::isInstallerAvailable()) {
            $migrations = scandir(DOCROOT . '/install/migrations');
            $migration_file = end($migrations);
            $migration_class = 'migration_' . str_replace('.', '', substr($migration_file, 0, -4));
            return call_user_func(array($migration_class, 'getVersion'));
        }

        return false;
    }
963608
def version
      return @detected_version if defined? @detected_version
      version = installed_versions.find { |p, _v| p == path }
      @detected_version = version.nil? ? nil : version[1]
    end
1002329
public boolean isModifiedOnVersion(String version) {
		if (version == null || version.isEmpty()) {
			return true;
		}
		if (this.history != null && this.history.isModifiedOnVersion(version)) {
			return true;
		}
		if (this.fields != null) {
			for (APIParameter param : this.fields) {
				if (param.isModifiedOnVersion(version)) {
					return true;
				}
			}
		}
		return false;
	}
862686
protected function getInstalledSymfonyVersion()
    {
        $symfonyVersion = $this->composerManager->getPackageVersion('symfony/symfony');

        if (!empty($symfonyVersion) && 'v' === substr($symfonyVersion, 0, 1)) {
            return substr($symfonyVersion, 1);
        }

        return $symfonyVersion;
    }
1169269
public function matchPackageVersions($availableVersions, $wantedVersion)
    {
        $m = null;
        if (preg_match('/^(\d+(?:\.\d+)*)(?:dev|alpha|a|beta|b|rc)/i', $wantedVersion, $m)) {
            $wantedVersionBase = $m[1];
        } else {
            $wantedVersionBase = $wantedVersion;
        }
        $wantedVersionComparable = preg_replace('/^(.*?\d)(\.0+)+$/', '\1', $wantedVersionBase);
        $result = null;
        $availableVersions = $this->sortPackageVersions($availableVersions, false);
        foreach ($availableVersions as $availableVersion) {
            if ($result === null) {
                $result = $availableVersion;
            }
            if (strpos($availableVersion, PackageVersionEntity::DEV_PREFIX) === 0) {
                $availableVersionBase = substr($availableVersion, strlen(PackageVersionEntity::DEV_PREFIX));
                $availableVersionIsDev = true;
            } else {
                $availableVersionBase = $availableVersion;
                $availableVersionIsDev = false;
            }
            $availableVersionComparable = preg_replace('/^(.*?\d)(\.0+)+$/', '\1', $availableVersionBase);
            if ($availableVersionIsDev) {
                $availableVersionIsDev .= str_repeat('.' . PHP_INT_MAX, 6);
            }
            $cmp = version_compare($availableVersionComparable, $wantedVersionComparable);
            if ($cmp > 0) {
                if ($availableVersionIsDev && strpos($availableVersionBase . '.', $wantedVersionBase . '.') === 0) {
                    $result = $availableVersion;
                }
                break;
            }
            $result = $availableVersion;
            if ($cmp === 0) {
                break;
            }
        }

        return $result;
    }
797864
public function checkPhpVersion()
    {
        $requirementFits = null;

        $minimalRequiredVersion = '7.0.0';
        $minimalRecommendedVersion = '7.0.0';
        $maximalRecommendedVersion = '7.1.9999';

        $installedPhpVersion = $this->getPhpVersion();

        if (version_compare($installedPhpVersion, $minimalRequiredVersion, '<')) {
            $requirementFits = static::MODULE_STATUS_BLOCKS_SETUP;
        }

        if (is_null($requirementFits) &&
            version_compare($installedPhpVersion, $minimalRecommendedVersion, '>=')
            && version_compare($installedPhpVersion, $maximalRecommendedVersion, '<=')) {
            $requirementFits = static::MODULE_STATUS_OK;
        }

        if (is_null($requirementFits)) {
            $requirementFits = static::MODULE_STATUS_FITS_MINIMUM_REQUIREMENTS;
        }

        return $requirementFits;
    }
1023277
protected function hasLocalizedVersion()
    {
        if ((bool)$this->getConfig("use_localized_views") && Strata::i18n()->hasActiveLocales()) {
            $localizedFilename =  $this->generateLocalizedViewPath();
            return file_exists($localizedFilename . $this->getConfig('file_extention'));
        }

        return false;
    }
1332788
public static function isCurrentVersionNewerThanDatabaseVersion()
    {
        $app = Application::getFacadeApplication();
        $db = $app->make(Connection::class);
        $config = $app->make('config');
        $database = $db->fetchColumn('select max(version) from SystemDatabaseMigrations');
        $code = $config->get('concrete.version_db');

        return $database < $code;
    }
415685
public function isVersionedService()
    {
        if ($this->def->getService() === null || !$this->def->getService()->getVersioning()) {
            return false;
        }

        return (boolean) $this->def->getService()->getVersioning();
    }