Skip to content

Commit

Permalink
Merge branch 'release-10.1' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
demiankatz committed Nov 4, 2024
2 parents cea1420 + df5b6d9 commit cee5b37
Show file tree
Hide file tree
Showing 47 changed files with 87 additions and 2,809 deletions.
10 changes: 0 additions & 10 deletions config/vufind/RecordTabs.ini
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,6 @@ tabs[Preview] = preview
tabs[Details] = StaffViewArray
defaultTab = null

[VuFind\RecordDriver\WorldCat]
tabs[Holdings] = HoldingsWorldCat
tabs[Description] = Description
tabs[TOC] = TOC
tabs[UserComments] = UserComments
tabs[Reviews] = Reviews
tabs[Excerpt] = Excerpt
tabs[Details] = StaffViewMARC
defaultTab = null

[VuFind\RecordDriver\WorldCat2]
tabs[Holdings] = HoldingsWorldCat2
tabs[Description] = Description
Expand Down
89 changes: 0 additions & 89 deletions config/vufind/WorldCat.ini

This file was deleted.

2 changes: 1 addition & 1 deletion config/vufind/combined.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; This file controls the "combined search" module. Each section is named for a
; search backend (e.g. "Solr", "Summon", "WorldCat", etc.). If you want to create
; search backend (e.g. "Solr", "Summon", "WorldCat2", etc.). If you want to create
; multiple columns using the same backend but different settings, you may add a
; colon and a suffix (e.g. "Solr:filter1", "Solr:filter2") to differentiate the
; sections.
Expand Down
12 changes: 1 addition & 11 deletions config/vufind/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1377,15 +1377,6 @@ url = "https://api.booksite.com"
;apiId = myAccessId
;apiKey = mySecretKey

; This section must be filled in if you plan to use the optional WorldCat
; search module. Otherwise, it may be ignored.
;[WorldCat]
;Your WorldCat search API key
;apiKey = "long-search-api-key-goes-here"
;Your holdings symbol (usually a three-letter code) - used for excluding your
; institution's holdings from the search results.
;OCLCCode = MYCODE

; This section must be filled in to use Relais functionality. When
; activated, this function will allow users to place ILL requests on unavailable
; items through the record holdings tab.
Expand Down Expand Up @@ -2127,7 +2118,6 @@ hide_holdings[] = "World Wide Web"
; MoreByAuthorSolr - Display books from the Solr index matching the current
; record's primary author.
; Similar - Similarity based on Solr lookup
; WorldCatSimilar - Similarity based on WorldCat lookup
; WorldCat2Similar - Similarity based on WorldCat v2 lookup
related[] = "Similar"
;related[] = "MoreByAuthorSolr"
Expand Down Expand Up @@ -2590,7 +2580,7 @@ max_tag_length = 64
case_sensitive_tags = false
; If this setting is set to false, users will not be presented with a search
; drop-down or advanced search link when searching/viewing tags. This is recommended
; when using a multi-backend system (e.g. Solr + Summon + WorldCat). If set to
; when using a multi-backend system (e.g. Solr + Summon + WorldCat2). If set to
; true, the standard Solr search options and advanced search link will be shown
; in the tag screens; this is recommended when using a Solr-only configuration.
show_solr_options_in_tag_search = false
Expand Down
2 changes: 1 addition & 1 deletion languages/ILSMessages/es.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ available_for_pickup_notification = "Tiene material disponible para recoger"
checkout_block = "No puedes retirar más tems"
electronic_resources_block = "No puede acceder a recursos electrónicos"
hold_wrong_user_institution = "No puede reservar material de la biblioteca solicitada."
ill_item_renewal_limit = "Devolución en la fecha de vencimiento."
ill_item_renewal_limit = "Devolución en la fecha de vencimiento (máx. de renovaciones alcanzado)."
ill_renewal_too_soon = "El ítem se renovará automáticamente (a menos que otros lo soliciten)"
lost_card = "Su tarjeta ha sido reportada como perdida"
message_from_library = "Tiene un mensaje de su biblioteca"
Expand Down
6 changes: 3 additions & 3 deletions module/VuFind/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@
'VuFind\Controller\UpgradeController' => 'VuFind\Controller\UpgradeControllerFactory',
'VuFind\Controller\WebController' => 'VuFind\Controller\AbstractBaseFactory',
'VuFind\Controller\WorldcatController' => 'VuFind\Controller\AbstractBaseFactory',
'VuFind\Controller\WorldcatrecordController' => 'VuFind\Controller\AbstractBaseFactory',
'VuFind\Controller\Worldcat2Controller' => 'VuFind\Controller\AbstractBaseFactory',
'VuFind\Controller\Worldcat2recordController' => 'VuFind\Controller\AbstractBaseFactory',
],
Expand Down Expand Up @@ -353,8 +352,9 @@
'web' => 'VuFind\Controller\WebController',
'Worldcat' => 'VuFind\Controller\WorldcatController',
'worldcat' => 'VuFind\Controller\WorldcatController',
'WorldcatRecord' => 'VuFind\Controller\WorldcatrecordController',
'worldcatrecord' => 'VuFind\Controller\WorldcatrecordController',
// Remap legacy WorldcatRecord action to point to Worldcat2recordController
'WorldcatRecord' => 'VuFind\Controller\Worldcat2recordController',
'worldcatrecord' => 'VuFind\Controller\Worldcat2recordController',
'Worldcat2' => 'VuFind\Controller\Worldcat2Controller',
'worldcat2' => 'VuFind\Controller\Worldcat2Controller',
'Worldcat2Record' => 'VuFind\Controller\Worldcat2recordController',
Expand Down
5 changes: 2 additions & 3 deletions module/VuFind/src/VuFind/Config/Feature/IniReaderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ trait IniReaderTrait
protected function getIniReader()
{
if (null == $this->iniReader) {
// Use ASCII 0 as a nest separator; otherwise some of the unusual key names
// we have (i.e. in WorldCat.ini search options) will get parsed in
// unexpected ways.
// Use ASCII 0 as a nest separator; otherwise some of our unusual key names
// (e.g. strings containing . characters) will get parsed in unexpected ways.
$this->iniReader = new IniReader();
$this->iniReader->setNestSeparator(chr(0));
}
Expand Down
73 changes: 4 additions & 69 deletions module/VuFind/src/VuFind/Config/Upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ public function run()
$this->upgradeSms();
$this->upgradeSummon();
$this->upgradePrimo();
$this->upgradeWorldCat();

// The previous upgrade routines may have added values to permissions.ini,
// so we should save it last. It doesn't have its own upgrade routine.
Expand Down Expand Up @@ -621,24 +620,13 @@ protected function upgradeConfig()
}

// Warn the user about deprecated WorldCat settings:
if (isset($newConfig['WorldCat']['LimitCodes'])) {
unset($newConfig['WorldCat']['LimitCodes']);
if (isset($newConfig['WorldCat'])) {
unset($newConfig['WorldCat']);
$this->addWarning(
'The [WorldCat] LimitCodes setting never had any effect and has been'
. ' removed.'
'The [WorldCat] section of config.ini has been removed following'
. ' the shutdown of the v1 WorldCat search API; use WorldCat2.ini instead.'
);
}
$badKeys
= ['id', 'xISBN_token', 'xISBN_secret', 'xISSN_token', 'xISSN_secret'];
foreach ($badKeys as $key) {
if (isset($newConfig['WorldCat'][$key])) {
unset($newConfig['WorldCat'][$key]);
$this->addWarning(
'The [WorldCat] ' . $key . ' setting is no longer used and'
. ' has been removed.'
);
}
}
if (
isset($newConfig['Record']['related'])
&& in_array('Editions', $newConfig['Record']['related'])
Expand Down Expand Up @@ -1232,59 +1220,6 @@ protected function upgradePrimoServerSettings()
}
}

/**
* Upgrade WorldCat.ini.
*
* @throws FileAccessException
* @return void
*/
protected function upgradeWorldCat()
{
// If WorldCat is disabled in our current configuration, we don't need to
// load any WorldCat-specific settings:
if (!isset($this->newConfigs['config.ini']['WorldCat']['apiKey'])) {
return;
}

// we want to retain the old installation's search settings exactly as-is
$groups = [
'Basic_Searches', 'Advanced_Searches', 'Sorting',
];
$this->applyOldSettings('WorldCat.ini', $groups);

// we need to fix an obsolete search setting for authors
foreach (['Basic_Searches', 'Advanced_Searches'] as $section) {
$new = [];
foreach ($this->newConfigs['WorldCat.ini'][$section] as $k => $v) {
if ($k == 'srw.au:srw.pn:srw.cn') {
$k = 'srw.au';
}
$new[$k] = $v;
}
$this->newConfigs['WorldCat.ini'][$section] = $new;
}

// Deal with deprecated related record module.
$newConfig = & $this->newConfigs['WorldCat.ini'];
if (
isset($newConfig['Record']['related'])
&& in_array('WorldCatEditions', $newConfig['Record']['related'])
) {
$newConfig['Record']['related'] = array_diff(
$newConfig['Record']['related'],
['WorldCatEditions']
);
$this->addWarning(
'The WorldCatEditions related record module is no longer '
. 'supported due to OCLC\'s xID API shutdown.'
. ' It has been removed from your settings.'
);
}

// save the file
$this->saveModifiedConfig('WorldCat.ini');
}

/**
* Does the specified properties file contain any meaningful
* (non-empty/non-comment) lines?
Expand Down
39 changes: 21 additions & 18 deletions module/VuFind/src/VuFind/Controller/WorldcatController.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

/**
* WorldCat Controller
* WorldCat Controller (legacy -- redirects to WorldCat v2 controller)
*
* PHP version 8
*
* Copyright (C) Villanova University 2010.
* Copyright (C) Villanova University 2024.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
Expand All @@ -29,48 +29,51 @@

namespace VuFind\Controller;

use Laminas\ServiceManager\ServiceLocatorInterface;

/**
* WorldCat Controller
* WorldCat Controller (legacy -- redirects to WorldCat v2 controller)
*
* @category VuFind
* @package Controller
* @author Demian Katz <[email protected]>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org Main Site
*/
class WorldcatController extends AbstractSearch
class WorldcatController extends AbstractBase
{
/**
* Constructor
* Home action -- redirect to WorldCat v2.
*
* @param ServiceLocatorInterface $sm Service locator
* @return mixed
*/
public function __construct(ServiceLocatorInterface $sm)
public function homeAction()
{
$this->searchClassId = 'WorldCat';
parent::__construct($sm);
return $this->redirect()->toRoute('worldcat2-home');
}

/**
* Is the result scroller active?
* Advanced search action -- redirect to WorldCat v2.
*
* @return bool
* @return mixed
*/
protected function resultScrollerActive()
public function advancedAction()
{
$config = $this->getService(\VuFind\Config\PluginManager::class)->get('WorldCat');
return $config->Record->next_prev_navigation ?? false;
return $this->redirect()->toRoute('worldcat2-advanced');
}

/**
* Search action -- call standard results action
* Search action -- transform search and redirect to WorldCat v2.
*
* @return mixed
*/
public function searchAction()
{
return $this->resultsAction();
$params = $this->params()->fromQuery();
// v1 types are prefixed with "srw." but v2 types are not; convert!
foreach ($params as $key => $value) {
if (str_starts_with($key, 'type')) {
$params[$key] = str_replace('srw.', '', $value);
}
}
return $this->redirect()->toRoute('worldcat2-search', options: ['query' => $params]);
}
}
Loading

0 comments on commit cee5b37

Please sign in to comment.