Skip to content

Commit

Permalink
Merge branch 'dev-10.0' into dev-10.0-ajax-results
Browse files Browse the repository at this point in the history
  • Loading branch information
EreMaijala committed Aug 18, 2023
2 parents b3d3984 + fc9040b commit 0e447b1
Show file tree
Hide file tree
Showing 386 changed files with 3,437 additions and 3,435 deletions.
7 changes: 6 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -758,8 +758,13 @@ ${git_status}
<fileset dir="${localdir}/config/vufind">
<patternset>
<include name="*.ini" />
<include name="*.yaml" />
<include name="*.ini.bak" />
<include name="*.json" />
<include name="*.json.bak" />
<include name="*.key" />
<include name="*.key.bak" />
<include name="*.yaml" />
<include name="*.yaml.bak" />
</patternset>
</fileset>
</delete>
Expand Down
2 changes: 1 addition & 1 deletion module/VuFind/functions/codecoverage.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function setupVuFindRemoteCodeCoverage(array $modules): void
$filter
);
} catch (\Exception $e) {
$error("Failed to create collector: " . (string)$e);
$error('Failed to create collector: ' . (string)$e);
}

$outputDir .= '/' . urlencode($testName);
Expand Down
2 changes: 1 addition & 1 deletion module/VuFind/src/VuFind/AjaxHandler/GetRecordDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function handleRequest(Params $params)
);

$html = $this->renderer->render(
"record/ajaxview-" . $viewtype . ".phtml",
'record/ajaxview-' . $viewtype . '.phtml',
[
'defaultTab' => $details['default'],
'driver' => $driver,
Expand Down
2 changes: 1 addition & 1 deletion module/VuFind/src/VuFind/AjaxHandler/GetVisData.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected function processFacetValues($filters, $fields)
];
foreach ($values['data']['list'] as $current) {
// Only retain numeric values!
if (preg_match("/^[0-9]+$/", $current['value'])) {
if (preg_match('/^[0-9]+$/', $current['value'])) {
$newValues['data'][]
= [$current['value'], $current['count']];
}
Expand Down
8 changes: 4 additions & 4 deletions module/VuFind/src/VuFind/Auth/CAS.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ public function authenticate($request)

// Has the user configured attributes to use for populating the user table?
$attribsToCheck = [
"cat_username", "cat_password", "email", "lastname", "firstname",
"college", "major", "home_library",
'cat_username', 'cat_password', 'email', 'lastname', 'firstname',
'college', 'major', 'home_library',
];
$catPassword = null;
foreach ($attribsToCheck as $attribute) {
Expand Down Expand Up @@ -255,14 +255,14 @@ protected function getRequiredAttributes()
// Now extract user attribute values:
$cas = $this->getConfig()->CAS;
foreach ($cas as $key => $value) {
if (preg_match("/userattribute_[0-9]{1,}/", $key)) {
if (preg_match('/userattribute_[0-9]{1,}/', $key)) {
$valueKey = 'userattribute_value_' . substr($key, 14);
$sortedUserAttributes[$value] = $cas->$valueKey ?? null;

// Throw an exception if attributes are missing/empty.
if (empty($sortedUserAttributes[$value])) {
throw new AuthException(
"User attribute value of " . $value . " is missing!"
'User attribute value of ' . $value . ' is missing!'
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions module/VuFind/src/VuFind/Auth/ChoiceAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ protected function validateConfig()
|| !strlen($this->config->ChoiceAuth->choice_order)
) {
throw new AuthException(
"One or more ChoiceAuth parameters are missing. " .
"Check your config.ini!"
'One or more ChoiceAuth parameters are missing. ' .
'Check your config.ini!'
);
}
}
Expand Down
10 changes: 5 additions & 5 deletions module/VuFind/src/VuFind/Auth/LDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function validateConfig()
|| empty($this->config->LDAP->$param)
) {
throw new AuthException(
"One or more LDAP parameters are missing. Check your config.ini!"
'One or more LDAP parameters are missing. Check your config.ini!'
);
}
}
Expand Down Expand Up @@ -278,8 +278,8 @@ protected function processLDAPUser($username, $data)

// Loop through LDAP response and map fields to database object based
// on configuration settings:
for ($i = 0; $i < $data["count"]; $i++) {
for ($j = 0; $j < $data[$i]["count"]; $j++) {
for ($i = 0; $i < $data['count']; $i++) {
for ($j = 0; $j < $data[$i]['count']; $j++) {
foreach ($fields as $field) {
$configValue = $this->getSetting($field);
if ($data[$i][$j] == $configValue && !empty($configValue)) {
Expand All @@ -288,15 +288,15 @@ protected function processLDAPUser($username, $data)
// if no separator is given map only the first value
if (isset($separator)) {
$tmp = [];
for ($k = 0; $k < $value["count"]; $k++) {
for ($k = 0; $k < $value['count']; $k++) {
$tmp[] = $value[$k];
}
$value = implode($separator, $tmp);
} else {
$value = $value[0];
}

if ($field != "cat_password") {
if ($field != 'cat_password') {
$user->$field = $value ?? '';
} else {
$catPassword = $value;
Expand Down
4 changes: 2 additions & 2 deletions module/VuFind/src/VuFind/Auth/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ public function login($request)
) {
if (!$this->csrf->isValid($request->getPost()->get('csrf'))) {
$this->getAuth()->resetState();
$this->logWarning("Invalid CSRF token passed to login");
$this->logWarning('Invalid CSRF token passed to login');
throw new AuthException('authentication_error_technical');
} else {
// After successful token verification, clear list to shrink session:
Expand Down Expand Up @@ -793,7 +793,7 @@ public function connectLibraryCard($request, $user)
{
$auth = $this->getAuth();
if (!$auth->supportsConnectingLibraryCard()) {
throw new \Exception("Connecting of library cards is not supported");
throw new \Exception('Connecting of library cards is not supported');
}
$auth->connectLibraryCard($request, $user);
}
Expand Down
4 changes: 2 additions & 2 deletions module/VuFind/src/VuFind/Auth/MultiAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ protected function validateConfig()
{
if (empty($this->config->MultiAuth->method_order)) {
throw new AuthException(
"One or more MultiAuth parameters are missing. " .
"Check your config.ini!"
'One or more MultiAuth parameters are missing. ' .
'Check your config.ini!'
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions module/VuFind/src/VuFind/Auth/SIP2.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function authenticate($request)
$msg_result = $mysip->get_message($in);

// Make sure the response is 98 as expected
if (!preg_match("/^98/", $msg_result)) {
if (!preg_match('/^98/', $msg_result)) {
$mysip->disconnect();
throw new AuthException('authentication_error_technical');
}
Expand All @@ -95,7 +95,7 @@ public function authenticate($request)
$msg_result = $mysip->get_message($in);

// Make sure the response is 24 as expected
if (!preg_match("/^24/", $msg_result)) {
if (!preg_match('/^24/', $msg_result)) {
$mysip->disconnect();
throw new AuthException('authentication_error_technical');
}
Expand Down
6 changes: 3 additions & 3 deletions module/VuFind/src/VuFind/Auth/Shibboleth.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ protected function validateConfig()
$shib = $this->config->Shibboleth;
if (!isset($shib->username) || empty($shib->username)) {
throw new AuthException(
"Shibboleth username is missing in your configuration file."
'Shibboleth username is missing in your configuration file.'
);
}

Expand Down Expand Up @@ -387,14 +387,14 @@ protected function getRequiredAttributes($config)

// Now extract user attribute values:
foreach ($config as $key => $value) {
if (preg_match("/userattribute_[0-9]{1,}/", $key)) {
if (preg_match('/userattribute_[0-9]{1,}/', $key)) {
$valueKey = 'userattribute_value_' . substr($key, 14);
$sortedUserAttributes[$value] = $config[$valueKey] ?? null;

// Throw an exception if attributes are missing/empty.
if (empty($sortedUserAttributes[$value])) {
throw new AuthException(
"User attribute value of " . $value . " is missing!"
'User attribute value of ' . $value . ' is missing!'
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion module/VuFind/src/VuFind/Auth/ShibbolethFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
*/
class ShibbolethFactory implements \Laminas\ServiceManager\Factory\FactoryInterface
{
public const SHIBBOLETH_CONFIG_FILE_NAME = "Shibboleth";
public const SHIBBOLETH_CONFIG_FILE_NAME = 'Shibboleth';

/**
* Create an object
Expand Down
6 changes: 3 additions & 3 deletions module/VuFind/src/VuFind/Autocomplete/Solr.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ protected function mungeQuery($query)
{
// Modify the query so it makes a nice, truncated autocomplete query:
$forbidden = [':', '(', ')', '*', '+', '"', "'"];
$query = str_replace($forbidden, " ", $query);
if (substr($query, -1) != " ") {
$query .= "*";
$query = str_replace($forbidden, ' ', $query);
if (substr($query, -1) != ' ') {
$query .= '*';
}
return $query;
}
Expand Down
6 changes: 3 additions & 3 deletions module/VuFind/src/VuFind/Autocomplete/SolrCN.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ protected function mungeQuery($query)
{
// Modify the query so it makes a nice, truncated autocomplete query:
$forbidden = [':', '(', ')', '*', '+', '"'];
$query = str_replace($forbidden, " ", $query);
$query = str_replace($forbidden, ' ', $query);

// Assign display fields and sort order based on the query -- if the
// first character is a number, give Dewey priority; otherwise, give
// LC priority:
if (is_numeric(substr(trim($query), 0, 1))) {
$this->setDisplayField(['dewey-full', 'callnumber-raw']);
$this->setSortField("dewey-sort,callnumber-sort");
$this->setSortField('dewey-sort,callnumber-sort');
} else {
$this->setDisplayField(['callnumber-raw', 'dewey-full']);
$this->setSortField("callnumber-sort,dewey-sort");
$this->setSortField('callnumber-sort,dewey-sort');
}

return $query;
Expand Down
2 changes: 1 addition & 1 deletion module/VuFind/src/VuFind/Autocomplete/SolrPrefix.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function getSuggestions($query)
protected function mungeQuery($query)
{
$forbidden = [':', '(', ')', '*', '+', '"'];
return str_replace($forbidden, " ", $query);
return str_replace($forbidden, ' ', $query);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion module/VuFind/src/VuFind/Cache/KeyGeneratorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected function getCacheKey($suffix = null)
// transformed key should match the custom pattern.
$key = preg_replace(
"/([^a-z0-9_\+\-])+/Di",
"",
'',
$key
);
}
Expand Down
2 changes: 1 addition & 1 deletion module/VuFind/src/VuFind/ChannelProvider/Random.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function getFromRecord(RecordDriver $driver, $channelToken = null)
public function getFromSearch(Results $results, $channelToken = null)
{
$params = $results->getParams();
if ("retain" !== $this->mode) {
if ('retain' !== $this->mode) {
$randomParams = $this->paramManager->get($params->getSearchClassId());
} else {
$randomParams = clone $params;
Expand Down
4 changes: 2 additions & 2 deletions module/VuFind/src/VuFind/Config/PathResolverFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ public function __invoke(
while (!empty($currentDir)) {
// check if the directory exists
if (!($canonicalizedCurrentDir = realpath($currentDir))) {
trigger_error("Configured local directory does not exist: " . $currentDir, E_USER_WARNING);
trigger_error('Configured local directory does not exist: ' . $currentDir, E_USER_WARNING);
break;
}
$currentDir = $canonicalizedCurrentDir;

// check if the current directory was already included in the stack to avoid infinite loops
if (in_array($currentDir, array_column($localDirs, 'directory'))) {
trigger_error("Current directory was already included in the stack: " . $currentDir, E_USER_WARNING);
trigger_error('Current directory was already included in the stack: ' . $currentDir, E_USER_WARNING);
break;
}

Expand Down
8 changes: 4 additions & 4 deletions module/VuFind/src/VuFind/Config/Upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,10 @@ protected function checkTheme($setting, $default = null)
unset($this->newConfigs['config.ini']['Site'][$setting]);
} else {
$this->addWarning(
"WARNING: This version of VuFind does not support "
'WARNING: This version of VuFind does not support '
. "the {$theme} theme. Your config.ini [Site] {$setting} setting"
. " has been reset to the default: {$default}. You may need to "
. "reimplement your custom theme."
. 'reimplement your custom theme.'
);
$this->newConfigs['config.ini']['Site'][$setting] = $default;
}
Expand Down Expand Up @@ -1351,13 +1351,13 @@ protected function upgradeILS()
{
$driver = $this->newConfigs['config.ini']['Catalog']['driver'] ?? '';
if (empty($driver)) {
$this->addWarning("WARNING: Could not find ILS driver setting.");
$this->addWarning('WARNING: Could not find ILS driver setting.');
} elseif ('Sample' == $driver) {
// No configuration file for Sample driver
} elseif (!file_exists($this->oldDir . '/' . $driver . '.ini')) {
$this->addWarning(
"WARNING: Could not find {$driver}.ini file; "
. "check your ILS driver configuration."
. 'check your ILS driver configuration.'
);
} else {
$this->saveUnmodifiedConfig($driver . '.ini');
Expand Down
14 changes: 7 additions & 7 deletions module/VuFind/src/VuFind/Config/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ public function set($section, $setting, $value)

// Reset some flags and prepare to rewrite the content:
$settingSet = false;
$currentSection = "";
$this->content = "";
$currentSection = '';
$this->content = '';

// Process one line at a time...
foreach ($lines as $line) {
Expand Down Expand Up @@ -217,7 +217,7 @@ protected function buildContentValue($e)
return 'true';
} elseif ($e === false) {
return 'false';
} elseif ($e == "") {
} elseif ($e == '') {
return '';
} else {
return '"' . str_replace('"', '\"', $e) . '"';
Expand Down Expand Up @@ -253,15 +253,15 @@ protected function buildContentLine($key, $value, $tab = 17)
// omit them from the key names; any other index should be
// explicitly set:
$currentIndex = ($i === $autoIndex) ? '' : $i;
$retVal .= $key . '[' . $currentIndex . ']' . $tabStr . " = "
$retVal .= $key . '[' . $currentIndex . ']' . $tabStr . ' = '
. $this->buildContentValue($current) . "\n";
$autoIndex++;
}
return rtrim($retVal);
}

// Standard case: value is not an array:
return $key . $tabStr . " = " . $this->buildContentValue($value);
return $key . $tabStr . ' = ' . $this->buildContentValue($value);
}

/**
Expand Down Expand Up @@ -301,12 +301,12 @@ protected function buildContentArrayLines($key, $value)
*/
protected function buildContent($assoc_arr, $comments)
{
$content = "";
$content = '';
foreach ($assoc_arr as $key => $elem) {
if (isset($comments['sections'][$key]['before'])) {
$content .= $comments['sections'][$key]['before'];
}
$content .= "[" . $key . "]";
$content .= '[' . $key . ']';
if (!empty($comments['sections'][$key]['inline'])) {
$content .= "\t" . $comments['sections'][$key]['inline'];
}
Expand Down
Loading

0 comments on commit 0e447b1

Please sign in to comment.