forked from commons-app/apps-android-commons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinclude-stubs.php
68 lines (58 loc) · 1.16 KB
/
include-stubs.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
// Stubs for enough of the MediaWiki environment to run UploadWizard.config.php
global $wgFileExtensions, $wgServer, $wgScriptPath, $wgAPIModules, $wgMaxUploadSize, $wgLang, $wgMemc, $wgUploadWizardConfig;
class FakeLang {
function getCode() {
return 'en';
}
}
$wgLang = new FakeLang();
function wfMemcKey() {
return 'fake-key';
}
class FakeMemc {
function get() {
return array( 'en' => 'English' );
}
}
$wgMemc = new FakeMemc();
class FakeMessage {
function plain() {
return 'stub-message-plain';
}
function parse() {
return 'stub-message-parsed';
}
}
function wfMessage() {
return new FakeMessage();
}
/**
* Converts shorthand byte notation to integer form
*
* @param $string String
* @return Integer
*/
function wfShorthandToInteger( $string = '' ) {
$string = trim( $string );
if ( $string === '' ) {
return -1;
}
$last = $string[strlen( $string ) - 1];
$val = intval( $string );
switch ( $last ) {
case 'g':
case 'G':
$val *= 1024;
// break intentionally missing
case 'm':
case 'M':
$val *= 1024;
// break intentionally missing
case 'k':
case 'K':
$val *= 1024;
}
return $val;
}
$wgAPIModules = array();