15 'wgEnableUploads' =>
true,
16 'wgAllowCopyUploads' =>
true,
19 if (
wfLocalFile(
'UploadFromUrlTest.png' )->exists() ) {
25 $appendModule =
false,
User $user =
null, $tokenType =
null
34 $module->getResult()->getResultData(
null, [
'Strip' =>
'all' ] ),
43 $job = JobQueueGroup::singleton()->pop();
45 $job = JobQueueGroup::singleton()->pop();
54 $token = $this->user->getEditToken();
63 $this->
assertEquals(
"The token parameter must be set", $e->getMessage() );
65 $this->
assertTrue( $exception,
"Got exception" );
75 $this->
assertEquals(
"One of the parameters sessionkey, file, url is required",
78 $this->
assertTrue( $exception,
"Got exception" );
84 'url' =>
'http://www.example.com/test.png',
89 $this->
assertEquals(
"The filename parameter must be set", $e->getMessage() );
91 $this->
assertTrue( $exception,
"Got exception" );
93 $this->user->removeGroup(
'sysop' );
98 'url' =>
'http://www.example.com/test.png',
99 'filename' =>
'UploadFromUrlTest.png',
104 $this->
assertEquals(
"Permission denied", $e->getMessage() );
106 $this->
assertTrue( $exception,
"Got exception" );
113 $token = $this->user->getEditToken();
115 $job = JobQueueGroup::singleton()->pop();
118 $this->user->addGroup(
'users' );
120 'action' =>
'upload',
121 'filename' =>
'UploadFromUrlTest.png',
122 'url' =>
'http://upload.wikimedia.org/wikipedia/mediawiki/b/bc/Wiki.png',
123 'ignorewarnings' =>
true,
127 $job = JobQueueGroup::singleton()->pop();
137 $t = Title::newFromText( $name,
NS_FILE );
138 $this->
assertTrue(
$t->exists(),
"File '$name' exists" );
140 if (
$t->exists() ) {
141 $file =
wfFindFile( $name, [
'ignoreRedirect' =>
true ] );
144 $page = WikiPage::factory(
$t );
145 $page->doDeleteArticle(
"testing" );
147 $t = Title::newFromText( $name,
NS_FILE );
149 $this->
assertFalse(
$t->exists(),
"File '$name' was deleted" );
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
wfLocalFile( $title)
Get an object referring to a locally registered file.
wfFindFile( $title, $options=[])
Find a file.
if(! $wgDBerrorLogTZ) $wgRequest
This is the main API class, used for both external and internal processing.
Exception used to abort API execution with an error.
WebRequest clone which takes values from a provided array.
testClearQueue()
Ensure that the job queue is empty before continuing.
testSetupUrlDownload( $data)
@depends testClearQueue
doApiRequest(array $params, array $unused=null, $appendModule=false, User $user=null, $tokenType=null)
Does the API request and returns the result.
testSyncDownload( $data)
@depends testClearQueue
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
this hook is for auditing only $req
returning false will NOT prevent logging $e
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
if(count( $args)< 1) $job