Commit 155a3fef authored by ~rs's avatar ~rs

add getUserContribs

parent d28da283
Pipeline #1995 passed with stages
in 2 minutes and 36 seconds
......@@ -883,6 +883,34 @@ class Core extends Password {
}
return $result['query']['users'][0]['gender'];
}
/** getUserContribs
* returns a contribution-feed of a user
* @author KPFC
* @param $username – The username of the user
* @param $namespace – The namespace to get the contribs from
* @param $date - edits from date YYYY-MM (and earlier)
* @param $toponly – only show living edits
* @param $deletedonly – only show deleted contribs
* @param $newonly – only show page creations
* @param $hideminor – hide minor edits
* @return the contribs of a user as array
*/
public function getUserContribs ($username, $namespace=null, $year=null, $month=null, $toponly=false, $deletedonly=false, $newonly=false, $hideminor=false) {
$request = 'action=feedcontributions&feedformat=rss&user=' . urlencode($username);
if ($namespace) $request .= '&namespace=' . $namespace;
if ($year) $request .= '&year=' . $year;
if ($month) $request .= '&month=' . $month;
if ($toponly) $request .= '&toponly=true';
if ($deletedonly) $request .= '&deletedonly=true';
if ($newonly) $request .= '&newonly=true';
if ($hideminor) $request .= '&hideminor=true';
$result = $this->httpRequest($request, $this->job, 'GET');
$result = json_decode(json_encode(simplexml_load_string($result)), true);
if (!isset($result['channel']['item'])) {
return false;
}
return $result['channel']['item'];
}
/** 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