[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/extensions/LocalisationUpdate/fetcher/ -> FileSystemFetcher.php (source)

   1  <?php
   2  /**
   3   * @file
   4   * @author Niklas Laxström
   5   * @license GPL-2.0+
   6   */
   7  
   8  /**
   9   * Accesses file system directly.
  10   */
  11  class LU_FileSystemFetcher implements LU_Fetcher {
  12  	public function fetchFile( $url ) {
  13          // Remove the protocol prefix
  14          $url = preg_replace( '~^file://~', '', $url );
  15  
  16          if ( !is_readable( $url ) ) {
  17              return false;
  18          }
  19  
  20          return file_get_contents( $url );
  21      }
  22  
  23  	public function fetchDirectory( $pattern ) {
  24          // Remove the protocol prefix
  25          $pattern = preg_replace( '~^file://~', '', $pattern );
  26  
  27          $data = array();
  28          foreach ( glob( $pattern ) as $file ) {
  29              if ( is_readable( $file ) ) {
  30                  $data["file://$file"] = file_get_contents( $file );
  31              }
  32          }
  33          return $data;
  34      }
  35  }


Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1