Get all of the migration files in a given path.

Differs from the original `getMigrationFiles` because
the phar don't support globs.
359628
public function getMigrationFiles($paths): array
    {
        return collect($paths)
            ->flatMap(
                function ($path) {
                    return collect(
                        (new Finder)->in([$path])
                            ->files()
                    )
                        ->map(
                            function (SplFileInfo $file) {
                                return $file->getPathname();
                            }
                        )
                        ->all();
                }
            )
            ->filter()
            ->sortBy(
                function ($file) {
                    return $this->getMigrationName($file);
                }
            )
            ->values()
            ->keyBy(
                function ($file) {
                    return $this->getMigrationName($file);
                }
            )
            ->all();
    }
1274722
def read(*paths):
    ''''''
    with open(os.path.join(os.path.dirname(__file__), *paths)) as fp:
        return fp.read()
717234
function getDirectories(path){
  return fs.readdirSync(path).filter(function (file) {
    return fs.statSync(path + "/" + file).isDirectory();
  });	
}
283074
def _get_schema_file(extension, path):
        
        for file in os.listdir(path):
            if file.endswith(extension):
                return os.path.join(path, file)
796176
def get_migrations_dir(graph):
    
    try:
        migrations_dir = graph.migrations_dir
    except (LockedGraphError, NotBoundError):
        migrations_dir = graph.metadata.get_path("migrations")

    if not isdir(migrations_dir):
        raise Exception("Migrations dir must exist: {}".format(migrations_dir))
    return migrations_dir
417202
public function getMigrations()
    {
        $path = $this['path'];

        $files = Filesystem::files($path);

        $migrations = new DataSet();

        foreach ($files as $file) {
            $ext = File::getExtension($file->getBasename());

            if ($ext !== 'php') {
                continue;
            }

            $name = $file->getBasename();

            list($id, $name) = explode('_', $name, 2);

            $mig = new Data();

            $mig['id']      = $id;
            $mig['version'] = $id;
            $mig['name']    = File::stripExtension($name);
            $mig['class']   = StringNormalise::toCamelCase(File::stripExtension($name));
            $mig['file']    = $file->getBasename();
            $mig['path']    = $file->getPathname();

            $migrations[$id] = $mig;
        }

        return $migrations;
    }
471558
public static File[] getFiles(List<String> paths) {
        File[] files = new File[paths.size()];
        int i = 0;
        for (String file : paths) {
            files[i++] = new File(file);
        }
        return files;
    }
1153383
public function getAllFiles($path){
        $fullpath = $this->getFullPath().$path;
        if(file_exists($fullpath)){
            $file = new \SplFileInfo($fullpath);
            if($file->isDir()){
                $r = array();
                // if($path != "/") $r[] = $this->folderParent($path);
                $finder = new Finder();
                $directories = $finder->notName($this->config['folder_thumb']);
                if (count($this->config['folder_excludes'])>0) {
                    foreach ($this->config['folder_excludes'] as $value) {
                        $directories = $finder->notName($value);
                    }
                }
                //$directories = $directories->notName('web.config')->notName('.htaccess')->depth(0)->sortByType();
                $directories = $directories->notName('web.config')->notName('.htaccess')->depth(0)->sort(
                    function ($a, $b) {return $b->getMTime() - $a->getMTime();}
                    );
                // $directories = $directories->files()->name('*.jpg');
                $directories = $directories->in($fullpath);
                foreach ($directories as $key => $directorie) {
                    $namefile = $directorie->getFilename();
                    if($directorie->isDir() && $this->validNameFile($namefile,false)){
                        $t = $this->dirInfo($directorie,$path);
                        if($t) $r[] = $t;
                    }elseif($directorie->isFile() && $this->validNameFile($namefile)){
                        $t = $this->fileInfo($directorie,$path);
                        if($t) $r[] = $t;
                    }
                }
                return $r;
            }elseif($file->isFile()){
                $t = $this->fileInfo($file,$path);
                if($t){
                    return $t;
                }else{
                    $result = array("query"=>"BE_GETFILEALL_NOT_LEIBLE","params"=>array());
                    $this->setInfo(array("msg"=>$result));
                    if( $this->config['debug'] ) $this->_log(__METHOD__." - Archivo no leible - $fullpath");
                    return;
                }
            }elseif($file->isLink()){
                $result = array("query"=>"BE_GETFILEALL_NOT_PERMITIDO","params"=>array());
                $this->setInfo(array("msg"=>$result));
                if( $this->config['debug'] ) $this->_log(__METHOD__." - path desconocido - $fullpath");
                return ;
            }
        }else{
            $result = array("query"=>"BE_GETFILEALL_NOT_EXISTED","params"=>array());
            $this->setInfo(array("msg"=>$result));
            if( $this->config['debug'] ) $this->_log(__METHOD__." - No existe el archivo - $fullpath");
            return ;
        }
    }
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;
	}
734206
def get_files(path:PathOrStr, extensions:Collection[str]=None, recurse:bool=False,
              include:Optional[Collection[str]]=None)->FilePathList:
    ""
    if recurse:
        res = []
        for i,(p,d,f) in enumerate(os.walk(path)):
            # skip hidden dirs
            if include is not None and i==0:  d[:] = [o for o in d if o in include]
            else:                             d[:] = [o for o in d if not o.startswith('.')]
            res += _get_files(path, p, f, extensions)
        return res
    else:
        f = [o.name for o in os.scandir(path) if o.is_file()]
        return _get_files(path, path, f, extensions)
506373
def find_migrations_directory():
    
    here = os.path.abspath(os.path.dirname(__file__))
    return os.path.join(here, 'sql/migrations')
175822
def get_files(path):
    
    return_files = []
    for root, dirs, files in os.walk(path):

        # Skip hidden files
        files = [f for f in files if not f[0] == '.']
        dirs[:] = [d for d in dirs if not d[0] == '.']

        for filename in files:
            return_files.append(os.path.join(root, filename))
    return return_files
1302572
protected function getMigrationPaths()
    {
        if ($this->input->hasOption('path') && $this->option('path')) {
            return [app()->basePath() . '/' . $this->option('path')];
        }

        // Do not use the migrator paths.
        return [ $this->getMigrationPath() ];
    }
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
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;
    }
472104
def get_pending_migrations(path, databases=None, stop_at=None):
    
    if stop_at is None:
        stop_at = float("inf")
    
    # database: [(number, full_path)]
    possible_migrations = get_all_migrations(path, databases)
    # database: [full_path]
    applied_migrations = get_applied_migrations(databases)
    # database: [full_path]
    to_execute = defaultdict(list)
    
    for database, scripts in possible_migrations.iteritems():
        applied = applied_migrations[database]
        pending = to_execute[database]
        for number, migration in scripts:
            path, script = os.path.split(migration)
            if script not in applied and number <= stop_at:
                pending.append(script)
    
    return dict((k, v) for k, v in to_execute.iteritems() if v)
282687
public static function get_migrations( $path )
	{
		$objects = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator( $path ), \RecursiveIteratorIterator::SELF_FIRST );
		
		$files = array();
		
		foreach( $objects as $name => $object )
		{
			if ( \CCStr::extension( $name ) == 'sql' )
			{
				$files[\CCStr::cut( substr( basename( $name ), strrpos( basename( $name ),  '_' )+1 ), '.' )] = $name;
			}
		}
		
		ksort( $files );
		
		return $files;
	}