Recursively get all of the migration paths.

@return array
436702
protected function getPaths()
    {
        $directory = new RecursiveDirectoryIterator($this->getMigrationPath());
        $iterator = new RecursiveIteratorIterator($directory);
        $paths = [];
        foreach ($iterator as $info) {
            if ($info->isDir()) {
                $paths[] = $info->getPath();
            }
        }

        return array_unique($paths);
    }
156138
public function getMigrationStatus()
    {
        $configuration = $this->getMigrationConfiguration();

        $executedMigrations = $configuration->getMigratedVersions();
        $availableMigrations = $configuration->getAvailableVersions();
        $executedUnavailableMigrations = array_diff($executedMigrations, $availableMigrations);

        $numExecutedUnavailableMigrations = count($executedUnavailableMigrations);
        $numNewMigrations = count(array_diff($availableMigrations, $executedMigrations));

        return [
            'Name' => $configuration->getName() ? $configuration->getName() : 'Doctrine Database Migrations',
            'Database Driver' => $configuration->getConnection()->getDriver()->getName(),
            'Database Name' => $configuration->getConnection()->getDatabase(),
            'Configuration Source' => 'manually configured',
            'Version Table Name' => $configuration->getMigrationsTableName(),
            'Version Column Name' => $configuration->getMigrationsColumnName(),
            'Migrations Namespace' => $configuration->getMigrationsNamespace(),
            'Migrations Target Directory' => $configuration->getMigrationsDirectory(),
            'Previous Version' => $this->getFormattedVersionAlias('prev', $configuration),
            'Current Version' => $this->getFormattedVersionAlias('current', $configuration),
            'Next Version' => $this->getFormattedVersionAlias('next', $configuration),
            'Latest Version' => $this->getFormattedVersionAlias('latest', $configuration),
            'Executed Migrations' => count($executedMigrations),
            'Executed Unavailable Migrations' => $numExecutedUnavailableMigrations,
            'Available Migrations' => count($availableMigrations),
            'New Migrations' => $numNewMigrations,
        ];
    }
1219745
private function fetchMigrations()
    {
        if ( ! isset($this->migrations)) {
            return null;
        }

        if (empty($this->migrations)) {
            return array();
        }

        $migrations = array();
        $connection = $this->entityManager->getConnection();
        $driver     = $connection->getDatabasePlatform()->getName();

        foreach ($this->migrations as $migration) {
            $files = glob($migration . '/*.sql');

            if (empty($files)) {
                $files = glob($migration . '/' . $driver . '/*.sql');

                if (empty($files)) {
                    continue;
                }
            }

            foreach ($files as $file) {
                $version = basename($file, '.sql');

                if (preg_match('~^[vV]([^_]+)_~', $version, $matches)) {
                    $version = $matches[1];
                }

                $migrations[$version] = $file;
            }
        }

        uksort($migrations, 'version_compare');

        return $migrations;
    }
981712
public function getMigrations( )
    {
        $migrations = array();
        
        $dir = opendir( $this->migrationPath );
        
        while ( ( $file = readdir( $dir ) ) !== FALSE )
        {
            if ( '.' !== $file && '..' !== $file )
            {
                $migrations[] = str_replace( '.php', '', $file );
            }
        }
        
        closedir( $dir );
        
        usort( $migrations, array( $this, '_sortMigrations' ) );
        
        return $this->filter( self::ON_GET_MIGRATIONS_FILTER, $migrations );
    }
1346823
public function getPath()
    {
        $config = $this->component->get('migration');

        $path = (is_array($config) && array_key_exists('path', $config)) ? $config['path'] : config('components.paths.generator.migration');

        return $this->component->getExtraPath($path);
    }
856703
public function migrate(): array
    {
        $result = $this->getFactory()->createPropelCommandProvider()->execute('migration:diff');
        return array_merge(
            $result,
            $this->getFactory()->createPropelCommandProvider()->execute('migration:migrate')
        );
    }
828155
public function getMigrationFiles($path)
    {
        $files = $this->files->glob($path .'/*_*.php');

        // Once we have the array of files in the directory we will just remove the
        // extension and take the basename of the file which is all we need when
        // finding the migrations that haven't been run against the databases.
        if ($files === false) return array();

        $files = array_map(function($file)
        {
            return str_replace('.php', '', basename($file));

        }, $files);

        // Once we have all of the formatted file names we will sort them and since
        // they all start with a timestamp this should give us the migrations in
        // the order they were actually created by the application developers.
        sort($files);

        return $files;
    }
386192
protected function alreadyExistingMigrations()
    {
        $matchingFiles = glob($this->getMigrationPath('*'));

        return array_map(function ($path) {
            return basename($path);
        }, $matchingFiles);
    }
821060
protected function findPackageMigrations(): array
	{
		$migrations = [];

		foreach($this->application->getPackages() as $package)
		{
			foreach($this->fileSystem->glob($package->getPath() . '/src/migrations/*.php') as $migration)
			{
				$migrations[] = (object) ['package' => $package->getName(), 'version' => $this->getBasename($migration)];
			}
		}

		return $migrations;
	}
1277086
public function getMigrations($reverse = false)
    {
        $files = $this->laravel['files']->glob($this->getPath().'/*_*.php');

        // Once we have the array of files in the directory we will just remove the
        // extension and take the basename of the file which is all we need when
        // finding the migrations that haven't been run against the databases.
        if ($files === false) {
            return array();
        }

        $files = array_map(function ($file) {
            return str_replace('.php', '', basename($file));

        }, $files);

        // Once we have all of the formatted file names we will sort them and since
        // they all start with a timestamp this should give us the migrations in
        // the order they were actually created by the application developers.
        sort($files);

        if ($reverse) {
            return array_reverse($files);
        }

        return $files;
    }
236759
public function getLoadedPluginPaths()
    {
        $pluginPaths = [];

        $plugins = Plugin::loaded() ?? [];
        foreach ($plugins as $p) {
            // @TODO load active plugins from plugin manager
            if (in_array($p, ['DebugKit', 'Migrations'])) {
                continue;
            }
            $pluginPaths[$p] = Plugin::path($p);
        }

        return $pluginPaths;
    }
1163743
def _get_all_migrations():
    
    from . import migrations

    package = migrations
    prefix = package.__name__ + '.'
    all_migrations = []
    for importer, modname, ispkg in pkgutil.iter_modules(package.__path__, prefix):
        version = int(modname.split('.')[-1].split('_')[0])
        all_migrations.append((version, modname))

    all_migrations = sorted(all_migrations, key=lambda x: x[0])
    return all_migrations
1269016
protected function getOptions()
    {
        return array_merge(parent::getOptions(), [
            ['migrate', 'm', InputOption::VALUE_NONE, 'Run the migrations'],
            ['seed', 's', InputOption::VALUE_NONE, 'Seed the database after migrating the database'],
            ['no-clear', null, InputOption::VALUE_NONE, "Don't clear the application's cache after the update"],
        ]);
    }
1061946
private function getPaths()
    {
        $paths = array_dot(['path' => $this->getLaravelPaths()]);
        collect(array_keys(get_class_vars(get_class($this))))->filter(function ($propertyName) {
            return ends_with($propertyName, 'Path');
        })->each(function ($propertyName) use (&$paths) {
            $paths[ $propertyName ] = $this->{$propertyName};
        });
        $paths[ 'packagePath' ] = $this->getRootDir();

        return $paths;
    }
953902
public static function get_all() {
		$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);
		}

		return $migrations;
	}
1244309
public function migrateUp()
    {
        $output = [];
        foreach ($this->getMigrations() as $version => $migration) {
            if ($this->isMigrated($version) === false) {
                $paths = $this->_config->getMigrationPaths();
                foreach ($paths as $path) {
                    $migrationFile = glob($path . DS . $version . '*');
                    $filePath      = array_shift($migrationFile);
                    $className     = Util::mapFileNameToClassName(basename($filePath));

                    /** @noinspection PhpIncludeInspection */
                    require_once $filePath;

                    /** @var AbstractMigration $migrate */
                    $migrate  = new $className($version);
                    $versions = $this->_adapter->getVersions();

                    //  Check migrate value version.
                    if ($migrate->getVersion() > $version) {
                        $output[] = __d(
                            'extensions',
                            'The version «{0}» is lower than the current.',
                            sprintf('<strong>%s</strong>', $version)
                        );
                    }

                    if (!Arr::in($version, $versions)) {
                        $migrate->setAdapter($this->_adapter)->up();
                        $output[] = $this->_execute($migrate);
                    }
                }
            }
        }

        return $output;
    }
1210496
protected function getSeedFiles()
    {
        $config = $this->getConfig();
        $paths = $config->getSeedPaths();
        $files = [];

        foreach ($paths as $path) {
            $files = array_merge(
                $files,
                Util::glob($path . DIRECTORY_SEPARATOR . '*.php')
            );
        }
        // glob() can return the same file multiple times
        // This will cause the migration to fail with a
        // false assumption of duplicate migrations
        // http://php.net/manual/en/function.glob.php#110340
        $files = array_unique($files);

        return $files;
    }