Commit d46bd8bc authored by Freddy's avatar Freddy Committed by Luke081515
Browse files

Add getMissingLinks

parent 85de532d
......@@ -830,6 +830,34 @@ class Core extends Password {
}
return serialize($page);
}
/** getMissingLinks
* Returns missing links "redlinks" on a page
* @author Freddy2001
* @param $Site - Page with links that will be checked
* @returns Array with missing pages
*/
public function getMissingLinks ($Site) {
$data = "action=query&format=php&prop=info&generator=links&utf8=1&formatversion=2&gpllimit=max&titles=" . urlencode($Site);
try {
$website = $this->httpRequest($data, $this->job, 'GET');
$website = unserialize($website);
$answer = $website['query']['pages'];
$result = array();
for ($i = 0; $i < count($answer); $i++) {
if (isset($answer[$i]['missing'])) {
$result[] = $answer[$i]['title'];
}
}
if (count($result) < 1) {
return false;
} else {
return $result;
}
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
return false;
}
}
/** getAllPages
* returns all pages of namespace
* @author Luke081515
......@@ -1194,4 +1222,4 @@ class Core extends Password {
return "success";
}
}
?>
\ No newline at end of file
?>
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