ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ComponentInstaller\Util\Filesystem Class Reference

Provides basic file system operations. More...

+ Inheritance diagram for ComponentInstaller\Util\Filesystem:
+ Collaboration diagram for ComponentInstaller\Util\Filesystem:

Public Member Functions

 recursiveGlob ($pattern, $flags=0)
 Performs a recursive-enabled glob search with the given pattern. More...
 
 recursiveGlobFiles ($pattern, $flags=0)
 Performs a recursive glob search for files with the given pattern. More...
 

Detailed Description

Provides basic file system operations.

Definition at line 19 of file Filesystem.php.

Member Function Documentation

◆ recursiveGlob()

ComponentInstaller\Util\Filesystem::recursiveGlob (   $pattern,
  $flags = 0 
)

Performs a recursive-enabled glob search with the given pattern.

Parameters
string$patternThe pattern passed to glob(). If the pattern contains "**", then it a recursive search will be used.
int$flagsFlags to pass into glob().
Returns
mixed An array of files that match the recursive pattern given.

Definition at line 33 of file Filesystem.php.

34 {
35 // Perform the glob search.
36 $files = glob($pattern, $flags);
37
38 // Check if this is to be recursive.
39 if (strpos($pattern, '**') !== FALSE) {
40 $dirs = glob(dirname($pattern).DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR|GLOB_NOSORT);
41 if ($dirs) {
42 foreach ($dirs as $dir) {
43 $files = array_merge($files, $this->recursiveGlob($dir.DIRECTORY_SEPARATOR.basename($pattern), $flags));
44 }
45 }
46 }
47
48 return $files;
49 }
$files
Definition: add-vimline.php:18
recursiveGlob($pattern, $flags=0)
Performs a recursive-enabled glob search with the given pattern.
Definition: Filesystem.php:33

References $files, and ComponentInstaller\Util\Filesystem\recursiveGlob().

Referenced by ComponentInstaller\Util\Filesystem\recursiveGlob(), and ComponentInstaller\Util\Filesystem\recursiveGlobFiles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ recursiveGlobFiles()

ComponentInstaller\Util\Filesystem::recursiveGlobFiles (   $pattern,
  $flags = 0 
)

Performs a recursive glob search for files with the given pattern.

Parameters
string$patternThe pattern passed to glob().
int$flagsFlags to pass into glob().
Returns
mixed An array of files that match the recursive pattern given.

Definition at line 62 of file Filesystem.php.

63 {
64 $files = $this->recursiveGlob($pattern, $flags);
65
66 return array_filter($files, 'is_file');
67 }

References $files, and ComponentInstaller\Util\Filesystem\recursiveGlob().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: