Skip to content
Snippets Groups Projects
Commit 624980fd authored by Demian Katz's avatar Demian Katz
Browse files

Merge branch 'release-5.0'

parents ead18c4a e53def7f
No related merge requests found
......@@ -60,17 +60,20 @@ set EXTRA_SOLRMARC_SETTINGS=%EXTRA_SOLRMARC_SETTINGS% -Dsolr.core.name=%SOLRCOR
rem ##################################################
rem # Set VUFIND_HOME
rem ##################################################
if not "!%VUFIND_HOME%!"=="!!" goto vufindhomefound
if not (!%VUFIND_HOME%!)==(!!) goto vufindhomefound
rem VUFIND_HOME not set -- try to call env.bat to
rem fix the problem before we give up completely
if exist env.bat goto useenvbat
rem If env.bat doesn't exist, the user hasn't run the installer yet.
echo ERROR: env.bat does not exist -- could not set up environment.
echo WARNING: env.bat does not exist -- trying default environment settings.
echo Please run "php install.php" to correct this problem.
goto end
rem Extract path from current batch file and trim trailing slash:
set VUFIND_HOME=%~dp0%
set VUFIND_HOME=%VUFIND_HOME:~0,-1%
goto vufindhomefound
:useenvbat
call env > nul
if not "!%VUFIND_HOME%!"=="!!" goto vufindhomefound
if not (!%VUFIND_HOME%!)==(!!) goto vufindhomefound
echo You need to set the VUFIND_HOME environmental variable before running this script.
goto end
:vufindhomefound
......@@ -78,11 +81,11 @@ goto end
rem #####################################################
rem # Build java command
rem #####################################################
if not "!%JAVA_HOME%!"=="!!" goto javahomefound
if not (!%JAVA_HOME%!)==(!!) goto javahomefound
set JAVA=java
goto javaset
:javahomefound
set JAVA="%JAVA_HOME%\bin\java"
set JAVA=%JAVA_HOME%\bin\java
:javaset
rem ##################################################
......@@ -93,6 +96,7 @@ if not exist %VUFIND_LOCAL_DIR%\import\import.properties goto nolocalproperties
set PROPERTIES_FILE=%VUFIND_LOCAL_DIR%\import\import.properties
goto propertiesfound
:nolocalproperties
echo WARNING: VUFIND_LOCAL_DIR environment variable is not set. Is this intentional?
set PROPERTIES_FILE=%VUFIND_HOME%\import\import.properties
:propertiesfound
......@@ -112,4 +116,4 @@ echo %RUN_CMD%
:end
rem We're all done -- close down the local environment.
endlocal
\ No newline at end of file
endlocal
......@@ -52,7 +52,6 @@ then
INDEX_OPTIONS='-Xms512m -Xmx512m -DentityExpansionLimit=0'
fi
##################################################
# Set SOLRCORE
##################################################
......@@ -61,15 +60,20 @@ then
EXTRA_SOLRMARC_SETTINGS="$EXTRA_SOLRMARC_SETTINGS -Dsolr.core.name=$SOLRCORE"
fi
##################################################
# Set VUFIND_HOME
##################################################
if [ -z "$VUFIND_HOME" ]
then
VUFIND_HOME="/usr/local/vufind"
# set VUFIND_HOME to the absolute path of the directory containing this script
# https://stackoverflow.com/questions/4774054/reliable-way-for-a-bash-script-to-get-the-full-path-to-itself
export VUFIND_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
fi
if [ -z "$VUFIND_LOCAL_DIR" ]
then
echo "WARNING: VUFIND_LOCAL_DIR environment variable is not set. Is this intentional?"
fi
#####################################################
# Build java command
......
......@@ -66,14 +66,15 @@ public class ConfigManager
* Given the base name of a configuration file, locate the full path.
* @param filename base name of a configuration file
*/
private File findConfigFile(String filename)
private File findConfigFile(String filename) throws IllegalStateException
{
// Find VuFind's home directory in the environment; if it's not available,
// try using a relative path on the assumption that we are currently in
// VuFind's import subdirectory:
String vufindHome = System.getenv("VUFIND_HOME");
if (vufindHome == null) {
vufindHome = "..";
// this shouldn't happen since import-marc.sh and .bat always set VUFIND_HOME
throw new IllegalStateException("VUFIND_HOME must be set");
}
// Check for VuFind 2.0's local directory environment variable:
......@@ -133,11 +134,21 @@ public class ConfigManager
// Retrieve the file if it is not already cached.
if (!configCache.containsKey(filename)) {
Ini ini = new Ini();
File configFile = null;
try {
ini.load(new FileReader(findConfigFile(filename)));
configCache.putIfAbsent(filename, ini);
configFile = findConfigFile(filename);
} catch (IllegalStateException e) {
dieWithError("Illegal State: " + e.getMessage());
} catch (Throwable e) {
dieWithError("Unable to access " + filename);
dieWithError("Unable to locate " + filename);
}
try {
if (configFile != null) {
ini.load(new FileReader(configFile));
configCache.putIfAbsent(filename, ini);
}
} catch (Throwable e) {
dieWithError("Unable to access " + configFile.getAbsolutePath());
}
}
return configCache.get(filename);
......@@ -231,4 +242,4 @@ public class ConfigManager
logger.error(msg);
throw new SolrMarcIndexerException(SolrMarcIndexerException.EXIT, msg);
}
}
\ No newline at end of file
}
......@@ -12,32 +12,35 @@ goto end
rem ##################################################
rem # Set SOLR_HOME
rem ##################################################
if not "!%VUFIND_HOME%!"=="!!" goto vufindhomefound
if not (!%VUFIND_HOME%!)==(!!) goto vufindhomefound
rem VUFIND_HOME not set -- try to call env.bat to
rem fix the problem before we give up completely
if exist env.bat goto useenvbat
rem If env.bat doesn't exist, the user hasn't run the installer yet.
echo ERROR: env.bat does not exist -- could not set up environment.
echo Please run install.php to correct this problem.
goto end
echo WARNING: env.bat does not exist -- trying default environment settings.
echo Please run "php install.php" to correct this problem.
rem Extract path from current batch file and trim trailing slash:
set VUFIND_HOME=%~dp0%
set VUFIND_HOME=%VUFIND_HOME:~0,-1%
goto vufindhomefound
:useenvbat
call env > nul
if not "!%VUFIND_HOME%!"=="!!" goto vufindhomefound
if not (!%VUFIND_HOME%!)==(!!) goto vufindhomefound
echo You need to set the VUFIND_HOME environmental variable before running this script.
goto end
:vufindhomefound
if not "!%SOLR_HOME%!"=="!!" goto solrhomefound
if not (!%SOLR_HOME%!)==(!!) goto solrhomefound
set SOLR_HOME=%VUFIND_HOME%\solr\vufind
:solrhomefound
rem #####################################################
rem # Build java command
rem #####################################################
if not "!%JAVA_HOME%!"=="!!" goto javahomefound
if not (!%JAVA_HOME%!)==(!!) goto javahomefound
set JAVA=java
goto javaset
:javahomefound
set JAVA="%JAVA_HOME%\bin\java"
set JAVA=%JAVA_HOME%\bin\java
:javaset
cd %VUFIND_HOME%\import
......
......@@ -1453,7 +1453,7 @@ class DefaultRecord extends AbstractBase
$xml->addChild('title', htmlspecialchars($this->getTitle()), $dc);
$authors = $this->getDeduplicatedAuthors();
foreach ($authors as $list) {
foreach ((array)$list as $author) {
foreach (array_keys($list) as $author) {
$xml->addChild('creator', htmlspecialchars($author), $dc);
}
}
......
......@@ -101,6 +101,22 @@ class SolrDefaultTest extends \VuFindTest\Unit\TestCase
$this->assertEquals('url_ver=Z39.88-2004&ctx_ver=Z39.88-2004&ctx_enc=info%3Aofi%2Fenc%3AUTF-8&rfr_id=info%3Asid%2Fvufind.svn.sourceforge.net%3Agenerator&rft.title=La+congiura+dei+Principi+Napoletani+1701+%3A+%28prima+e+seconda+stesura%29+%2F&rft.date=1992&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&rft.creator=Vico%2C+Giambattista%2C+1668-1744.&rft.pub=Centro+di+Studi+Vichiani%2C&rft.format=Thingie&rft.language=Italian', $driver->getOpenUrl());
}
/**
* Test Dublin Core conversion.
*
* @return void
*/
public function testDublinCore()
{
$expected = <<<XML
<?xml version="1.0"?>
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd"><dc:title>La congiura dei Principi Napoletani 1701 : (prima e seconda stesura) /</dc:title><dc:creator>Vico, Giambattista, 1668-1744.</dc:creator><dc:creator>Pandolfi, Claudia.</dc:creator><dc:language>Italian</dc:language><dc:language>Latin</dc:language><dc:publisher>Centro di Studi Vichiani,</dc:publisher><dc:date>1992</dc:date><dc:subject>Naples (Kingdom) History Spanish rule, 1442-1707 Sources</dc:subject></oai_dc:dc>
XML;
$xml = $this->getDriver()->getXML('oai_dc');
$this->assertEquals($expected, $xml);
}
/**
* Get a record driver with fake data.
*
......
......@@ -40,17 +40,20 @@ rem Unrecognized action -- display help text
if "!%1!"=="!!" goto usage
rem Set VUFIND_HOME (if not already set)
if not "!%VUFIND_HOME%!"=="!!" goto vufindhomefound
rem VUFIND_HOME not set -- try to call env.bat to
if not (!%VUFIND_HOME%!)==(!!) goto vufindhomefound
rem VUFIND_HOME not set -- try to call env.bat to
rem fix the problem before we give up completely
if exist env.bat goto useenvbat
rem If env.bat doesn't exist, the user hasn't run the installer yet.
echo ERROR: env.bat does not exist -- could not set up environment.
echo WARNING: env.bat does not exist -- trying default environment settings.
echo Please run "php install.php" to correct this problem.
goto end
rem Extract path from current batch file and trim trailing slash:
set VUFIND_HOME=%~dp0%
set VUFIND_HOME=%VUFIND_HOME:~0,-1%
goto vufindhomefound
:useenvbat
call env > nul
if not "!%VUFIND_HOME%!"=="!!" goto vufindhomefound
if not (!%VUFIND_HOME%!)==(!!) goto vufindhomefound
echo You need to set the VUFIND_HOME environmental variable before running this script.
goto end
:vufindhomefound
......
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