Commit 5a5ee597 authored by Luke081515's avatar Luke081515

Add getCreatedPages

* Adds a function to get pages created by a user
* Depends on !67
* Fixes #84
parent ff6e41ef
Pipeline #1390 passed with stages
in 2 minutes and 31 seconds
......@@ -889,6 +889,24 @@ class Core extends Password {
}
return $result['query']['users'][0]['gender'];
}
/** getCreatedPages
* returns all created pages of a user
* @author Luke081515
* @param $username – The username of the user
* @return an array with the pagetitles, or false if no pages got created yet
*/
public function getCreatedPages($user) {
$result = $this->httpRequest("action=query&format=json&list=usercontribs&uclimit=max&ucuser=" . urlencode($user)
. "&ucdir=older&ucshow=new", $this->job, "GET");
$result = $this->decode($result);
for ($a = 0; isset($result["query"]["usercontribs"][$a]["title"]); $a++) {
$createResults[$a] = $result["query"]["usercontribs"][$a]["title"];
}
if (!isset($createResults[0])) {
return false;
}
return $createResults;
}
/** checkTemplate
* checks if a template is used at a page (transcluded)
* @author Luke081515
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment