MediaWiki REL1_34
FileSystemFetcher.php
Go to the documentation of this file.
1<?php
8namespace LocalisationUpdate;
9
13class FileSystemFetcher implements Fetcher {
19 public function fetchFile( $url ) {
20 // Remove the protocol prefix
21 $url = preg_replace( '~^file://~', '', $url );
22
23 if ( !is_readable( $url ) ) {
24 return false;
25 }
26
27 return file_get_contents( $url );
28 }
29
35 public function fetchDirectory( $pattern ) {
36 // Remove the protocol prefix
37 $pattern = preg_replace( '~^file://~', '', $pattern );
38
39 $data = [];
40 foreach ( glob( $pattern ) as $file ) {
41 if ( is_readable( $file ) ) {
42 $data["file://$file"] = file_get_contents( $file );
43 }
44 }
45 return $data;
46 }
47}
Accesses file system directly.
Interface for classes which fetch files over different protocols and ways.
Definition Fetcher.php:13
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
Definition router.php:42