MediaWiki REL1_33
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}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Accesses file system directly.
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
Interface for classes which fetch files over different protocols and ways.
Definition Fetcher.php:13