Commit 06d17296 authored by remy's avatar remy
Browse files

fix: R/Bioconductor was not working anymore

parent fd129d2b
Pipeline #317 failed with stage
in 1 minute and 3 seconds
......@@ -51,6 +51,8 @@ if(isset($_GET['limit'])) {
}
$result = array();
$version_num = "";
$version_name = "";
if(strpos($distrib, ':') !== false) {
$os = explode (":", $distrib);
......@@ -146,4 +148,4 @@ foreach ($result as $t) {
echo '</tr>
</tbody>
</table>
';
\ No newline at end of file
';
......@@ -41,8 +41,10 @@ function getDocument($url) {
$context = stream_context_create($opts);
$content = file_get_contents($url, false, $context);
$doc = new DOMDocument();
$doc = new \DOMDocument('1.0', 'UTF-8');
$internalErrors = libxml_use_internal_errors(true);
$doc->loadHtml($content);
libxml_use_internal_errors($internalErrors);
return $doc;
}
......@@ -406,7 +408,7 @@ function findRPackage($os_name, $version_num, $version_name, $keyword, $limit, $
$url_packages = "https://www.bioconductor.org/packages/release/bioc/";
$doc = getDocument($url_packages);
$trs = $doc->getElementsByTagName('tr');
$size = $trs->length - 1;
......@@ -414,21 +416,15 @@ function findRPackage($os_name, $version_num, $version_name, $keyword, $limit, $
$index = 0;
for ($i = 1; $i <= $size; $i++) {
$name = $trs[$i]->childNodes[1]->nodeValue;
$name = $trs[$i]->getElementsByTagName('td')[0]->nodeValue;
if(strpos($name, $keyword) !== false) {
$description = $trs[$i]->childNodes[5]->nodeValue;
$description = $trs[$i]->getElementsByTagName('td')[2]->nodeValue;
$version = "";
$link = "https://www.bioconductor.org/packages/release/bioc/html/".$name.".html";
$other = $trs[$i]->childNodes[3]->nodeValue;
$other = $trs[$i]->getElementsByTagName('td')[1]->nodeValue;
$package = new Package($name, $version, $description, $link, $other);
$results[] = $package;
$index++;
}
......
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