Skip to content
Snippets Groups Projects
Commit 2f11d9af authored by Sebastian Kehr's avatar Sebastian Kehr :rowboat_tone2:
Browse files

refs #12050, #11810

* enables a configurable item id for ILS connection health checks
parent 09033209
No related merge requests found
......@@ -217,6 +217,9 @@ driver = Sample
;loadNoILSOnFailure - Whether or not to load the NoILS driver if the main driver fails
loadNoILSOnFailure = false
; default item id to look up when performing health checks
healthCheckItemId = 1
; This setting determines how and when hold / recall links are displayed.
; Legal values:
; - all (Show links for all items - Place Hold for Available Items and Place Recall
......
......@@ -165,6 +165,9 @@ driver = Sample
;loadNoILSOnFailure - Whether or not to load the NoILS driver if the main driver fails
loadNoILSOnFailure = true
; finc specific item id to look up when performing health checks
healthCheckItemId = 0000000001
; This setting determines how and when hold / recall links are displayed.
; Legal values:
; - all (Show links for all items - Place Hold for Available Items and Place Recall
......
......@@ -90,4 +90,32 @@ class Connection extends \VuFind\ILS\Connection implements TranslatorAwareInterf
}
return $response;
}
/*
* Overrides super method to look up a configurable item for health checks.
* TODO: Adjust super method and create pull request to community repo.
*
* */
public function getOfflineMode($healthCheck = false)
{
// If we have NoILS failover configured, force driver initialization so
// we can know we are checking the offline mode against the correct driver.
if ($this->hasNoILSFailover()) {
$this->getDriver();
}
// If we need to perform a health check, try to do a random item lookup
// before proceeding.
if ($healthCheck) {
$this->getStatus($this->config['healthCheckItemId']);
}
// If we're encountering failures, let's go into ils-offline mode if
// the ILS driver does not natively support getOfflineMode().
$default = $this->failing ? 'ils-offline' : false;
// Graceful degradation -- return false if no method supported.
return $this->checkCapability('getOfflineMode')
? $this->getDriver()->getOfflineMode() : $default;
}
}
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