Commit a04e77f9 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add more checks when retrieving latest Mahara version (see bug #638511)


Check that download page was retrieved from launchpad
Suppress warnings & errors when parsing html from the download page
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent e0c34bf7
......@@ -2370,8 +2370,19 @@ function cron_check_for_updates() {
$result = mahara_http_request($request);
if (!empty($result->errno)) {
log_debug('Could not retrieve launchpad download page');
return;
}
$page = new DOMDocument();
$page->loadHTML($result->data);
libxml_use_internal_errors(true);
$success = $page->loadHTML($result->data);
libxml_use_internal_errors(false);
if (!$success) {
log_debug('Error parsing launchpad download page');
return;
}
$xpath = new DOMXPath($page);
$query = '//div[starts-with(@id,"release-information-")]';
$elements = $xpath->query($query);
......
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