Loads a list of available versions into an array.

@return array
@throws MigrationException
160127
protected function registerAvailableVersions()
    {
        $this->availableVersions = [];
        foreach ($this->packageManager->getAvailablePackages() as $package) {
            $this->registerVersionInDirectory($package, 'TYPO3CR');
            $this->registerVersionInDirectory($package, 'ContentRepository');
        }
        ksort($this->availableVersions);
    }
923084
protected function getNewMigrations()
    {
        $applied = [];

        foreach ($this->getMigrationHistory(null) as $version => $time) {
            $applied[substr($version, 1, 13)] = true;
        }

        $migrations = [];
        $handle = opendir($this->migrationPath);

        while (($file = readdir($handle)) !== false) {
            if ($file === '.' || $file === '..') {
                continue;
            }

            $path = $this->migrationPath . DIRECTORY_SEPARATOR . $file;

            if (preg_match('/^(m(\d{6}_\d{6})_.*?)\.php$/', $file, $matches)
                && !isset($applied[$matches[2]]) && is_file($path)) {
                $migrations[] = $matches[1];
            }
        }

        closedir($handle);
        sort($migrations);

        return $migrations;
    }
495594
public function VersionsList()
    {
        $id = $this->owner->ID ?: $this->owner->OldID;
        $class = get_class($this->owner);
        return Versioned::get_all_versions($class, $id);
    }
1277999
protected function loadCache(): array
    {
        if ($this->_cache === null)
            $this->_cache = Cacher::getInstance()->get($this->getCacheName());

        return $this->_cache;
    }
1342319
protected function getOutstanding(): array
	{
		$migrations = $this->getMigrationsFilteredByConnection();

		if(!empty($migrations))
		{
			foreach($this->getMigrated() as $migrated)
			{
				foreach($migrations as $key => $migration)
				{
					if($migrated->package === $migration->package && $migrated->version === $migration->version)
					{
						unset($migrations[$key]);
					}
				}
			}

			usort($migrations, function($a, $b)
			{
				return strcmp($a->version, $b->version);
			});
		}

		return $migrations;
	}
214473
def _parse_migrations(self):
        """"""
        migration = self.parsed['migration']
        options = self._parse_options(migration)
        versions = self._parse_versions(migration, options)
        return Migration(versions, options)
709451
private function getMigrationsFiles()
    {
        $migrationPath = $this->migrateManager->storagePath;
        $files = array();
        if ($handle = opendir($migrationPath)) {

            while (false !== ($entry = readdir($handle))) {

                if ($entry != "." && $entry != ".." && is_file($migrationPath . '/' . $entry)) {
                    $segments = explode('_', $entry);
                    $files[$segments[0]] = $entry;
                }
            }

            closedir($handle);

            return $files;
        }

        die (Utils::colorize("Error to open migrations storage", "FAILURE"));
    }
1100248
public function getMigrationVersion($version)
    {
        if ($this->isVersionAvailable($version)) {
            if ($this->isVersionLoaded($version)) {
                $configuration = $this->loadedVersions[$version];
            } else {
                $configuration = $this->loadConfiguration($version);
                $this->loadedVersions[$version] = $configuration;
            }
            return $configuration;
        }
        throw new MigrationException('Specified version is not available.', 1345821746);
    }
1236513
public static function get_runnable() {
		$packages = [];
		$packages[] = 'project';
		foreach (\Skeleton\Core\Skeleton::get_all() as $package) {
			$packages[] = $package->name;
		}
		$migrations = [];
		foreach ($packages as $package) {
			$migrations[$package] = \Skeleton\Database\Migration::get_between_versions($package, self::get_version($package), null);
		}

		$sorted_migrations = [];

		foreach ($migrations as $package_migrations) {
			foreach ($package_migrations as $migration) {
				$sorted_migrations[$migration->get_version()->format('YmdHis')] = $migration;
			}
		}
		ksort($sorted_migrations);

		return $sorted_migrations;
	}
400145
protected function getAllMigrations()
	{
		$migrations = array();
		$file_extensions = $this->getMigrationFileExtensions();

		// Use "DirectoryIterator" instead of "glob", because it works within PHAR files as well.
		$directory_iterator = new \DirectoryIterator($this->_migrationsDirectory);

		foreach ( $directory_iterator as $file ) {
			if ( $file->isFile() && in_array($file->getExtension(), $file_extensions) ) {
				$migrations[] = $file->getBasename();
			}
		}

		sort($migrations);

		return $migrations;
	}
1057151
protected function getExcludedTables()
	{
		$excludes = ['migrations'];
		$ignore = $this->option('ignore');
		if ( ! empty($ignore)) {
			return array_merge($excludes, explode(',', $ignore));
		}

		return $excludes;
	}
176754
protected static function cacheMigrations()
	{
		//check if already cached
		if (static::$MIGRATION_CACHE !== null) return true;

		//check if there is a connection
		if (!static::hasDbConnection() || Yii::$app->db->schema->getTableSchema('{{%migration}}') === null) {
			return false;
		}

		//load the data
		static::$MIGRATION_CACHE = [];
		$migrationData = (new Query())
			->select(['version','apply_time'])
			->from('{{%migration}}')
			->orderBy(['apply_time'=>SORT_ASC])
			->all();

		//fill the cache
		foreach ($migrationData as $migration) {
			static::$MIGRATION_CACHE[$migration['version']] = $migration['apply_time'];
		}

		return true;
	}
123955
protected function loadConfiguration($version)
    {
        if (!$this->isVersionAvailable($version)) {
            throw new MigrationException('The requested YamlConfiguration was not available.', 1345822283);
        }

        $configuration = $this->yamlSourceImporter->load(substr($this->availableVersions[$version]['filePathAndName'], 0, -5));
        return $configuration;
    }
67125
public function getAppliedMigrations( )
    {
        $query = "SELECT * FROM $this->migrationTable";
        
        $applied = $this->db->query( $query );
        
        $list = array();
        
        foreach( $applied as $mig )
        {
            $list[] = $mig[ 'migration_name' ];
        }
        
        $list = array_reverse( $list );
        
        return $this->filter( self::ON_GET_APPLIED_MIGRATIONS_FILTER, $list );
    }
1131470
public function getVersions()
    {
        $versions = [];

        $file = $this->getFile();

        /** @var FileVersion $fileVersion */
        foreach ($file->getFileVersions() as $fileVersion) {
            $versionData = [];
            if (isset($this->additionalVersionData[$fileVersion->getVersion()])) {
                $versionData = $this->additionalVersionData[$fileVersion->getVersion()];
            }

            $versionData['version'] = $fileVersion->getVersion();
            $versionData['name'] = $fileVersion->getName();
            $versionData['created'] = $fileVersion->getCreated();
            $versionData['changed'] = $fileVersion->getChanged();
            $versionData['active'] = $fileVersion->isActive();
            $versions[$fileVersion->getVersion()] = $versionData;
        }

        return $versions;
    }
1360494
private function loadResourceFiles()
    {
        return $this->replaceExecutableCode(
            $this->loadResourcesFiles()
        )->mapWithKeys(function ($value, $key) {
            return [$this->removeExtension($key) => $value];
        });
    }
115773
public function getRemotelyUpgradeablePackages()
    {
        $packages = $this->getInstalledList();
        $upgradeables = [];
        foreach ($packages as $p) {
            if (version_compare($p->getPackageVersion(), $p->getPackageVersionUpdateAvailable(), '<')) {
                $upgradeables[] = $p;
            }
        }

        return $upgradeables;
    }