Skip to content

Commit

Permalink
Update OIDplusRDAP.class.php
Browse files Browse the repository at this point in the history
Fix incompatibility with OIDplus system SVN Rev 696 (OIDplusObject::findFitting() does NOT throw an Exception anymore if the object type is unknown)
  • Loading branch information
danielmarschall authored Sep 30, 2022
1 parent af4d951 commit 2d4c2b0
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions plugins/frdl/publicPages/1276945_rdap/OIDplusRDAP.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,31 +63,23 @@ public function rdapQuery($query) {

$out = [];

try {
$obj = OIDplusObject::findFitting($query);
if (!$obj) $obj = OIDplusObject::parse($query);
$query = $obj->nodeId();
} catch (Exception $e) {
$obj = null;
}

$obj = OIDplusObject::findFitting($query);
if (!$obj) $obj = OIDplusObject::parse($query);
if ($obj) $query = $obj->nodeId();

// If object was not found, try if it is an alternative identifier of another object
if(null === $obj) {
if(!$obj){
$alts = OIDplusPagePublicObjects::getAlternativesForQuery($query);
foreach ($alts as $alt) {
$res = OIDplus::db()->query("select * from ###objects where id = ?", array($alt));
if ($res->any()) {
$query = $alt;
$obj = OIDplusObject::findFitting($query);
if (!$obj) $obj = OIDplusObject::parse($query);
if ($obj = OIDplusObject::findFitting($alt)) {
$query = $obj->nodeId();
break;
}
}
}

// Still nothing found?
if(null === $obj){
if(!$obj){
$out['error'] = 'Not found';
if(true === $this->useCache){
$this->rdap_write_cache($out, $cacheFile);
Expand Down

0 comments on commit 2d4c2b0

Please sign in to comment.