MediaWiki
REL1_32
FileSystemFetcher.php
Go to the documentation of this file.
1
<?php
8
namespace
LocalisationUpdate
;
9
13
class
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
}
LocalisationUpdate\FileSystemFetcher
Accesses file system directly.
Definition
FileSystemFetcher.php:13
LocalisationUpdate\FileSystemFetcher\fetchFile
fetchFile( $url)
Definition
FileSystemFetcher.php:19
LocalisationUpdate\FileSystemFetcher\fetchDirectory
fetchDirectory( $pattern)
Definition
FileSystemFetcher.php:35
LocalisationUpdate\Fetcher
Interface for classes which fetch files over different protocols and ways.
Definition
Fetcher.php:13
LocalisationUpdate
Definition
Fetcher.php:8
extensions
LocalisationUpdate
includes
fetcher
FileSystemFetcher.php
Generated on Mon Nov 25 2024 15:56:36 for MediaWiki by
1.10.0