Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DIS-397 Add logging to INN-Reach results fetch method #2250

Open
wants to merge 1 commit into
base: 25.03.00
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/web/release_notes/25.03.00.MD
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
### Other Updates
- Remove unused AspenLiDASettings class. (DIS-393) (*MDN*)
- Added check to make sure `$catalog` is not null before calling `hasIlsConsentSupport()` in `Library.php`. (DIS-394) (*LS*)
- Add logging to INN-Reach contents fetching (DIS-397) (*TC*)

// kirstien

Expand Down Expand Up @@ -81,6 +82,7 @@

### Theke Solutions
- Lucas Montoya (LM)
- Tomás Cohen Arazi (TC)

## Special Testing thanks to
- Myranda Fuentes (Grove)
Expand Down
8 changes: 8 additions & 0 deletions code/web/sys/InterLibraryLoan/InnReach.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@
*/

require_once ROOT_DIR . '/sys/CurlWrapper.php';
require_once ROOT_DIR . '/sys/SystemLogging/ExternalRequestLogEntry.php';

class InnReach {
/**
* Load search results from INN-Reach using the encore interface.
**/
function getTopSearchResults($searchTerms, $maxResults) {
global $logger;
$innReachUrl = $this->getSearchLink($searchTerms);
//Load the HTML from INN-Reach
$req = new CurlWrapper();
$innReachInfo = $req->curlGetPage($innReachUrl);
$responseCode = $req->getResponseCode();
//Logging
ExternalRequestLogEntry::logRequest('innreach.getTopSearchResults', 'GET', $innReachUrl, $req->getHeaders(), '', $responseCode, $innReachInfo, []);
if ($responseCode != 200) {
$logger->log('Unable to search for titles on INN-Reach. Response code was ' . $responseCode, Logger::LOG_ERROR);
}

//Get the total number of results
if (preg_match('/<span class="noResultsHideMessage">.*?(\d+) - (\d+) of (\d+).*?<\/span>/s', $innReachInfo, $summaryInfo)) {
Expand Down
Loading