MediaWiki
REL1_30
FileSystemFetcher.php
Go to the documentation of this file.
1
<?php
8
namespace
LocalisationUpdate
;
9
13
class
FileSystemFetcher
implements
Fetcher
{
14
public
function
fetchFile
( $url ) {
15
// Remove the protocol prefix
16
$url = preg_replace(
'~^file://~'
,
''
, $url );
17
18
if
( !is_readable( $url ) ) {
19
return
false
;
20
}
21
22
return
file_get_contents( $url );
23
}
24
25
public
function
fetchDirectory
( $pattern ) {
26
// Remove the protocol prefix
27
$pattern = preg_replace(
'~^file://~'
,
''
, $pattern );
28
29
$data = [];
30
foreach
( glob( $pattern ) as $file ) {
31
if
( is_readable( $file ) ) {
32
$data[
"file://$file"
] = file_get_contents( $file );
33
}
34
}
35
return
$data;
36
}
37
}
LocalisationUpdate\FileSystemFetcher
Accesses file system directly.
Definition
FileSystemFetcher.php:13
LocalisationUpdate\FileSystemFetcher\fetchFile
fetchFile( $url)
Fetches a single resource.
Definition
FileSystemFetcher.php:14
LocalisationUpdate\FileSystemFetcher\fetchDirectory
fetchDirectory( $pattern)
Fetch a list of resources.
Definition
FileSystemFetcher.php:25
LocalisationUpdate\Fetcher
Interface for classes which fetch files over different protocols and ways.
Definition
Fetcher.php:13
LocalisationUpdate
Definition
Fetcher.php:8
extensions
LocalisationUpdate
fetcher
FileSystemFetcher.php
Generated on Mon Nov 25 2024 15:41:58 for MediaWiki by
1.10.0