- Added support for database name different from archive name.
1 parent 2488a0b commit 33101a4aeaa61f371b535545a5a0b166b9f8f078
nstanger authored on 16 Jul 2008
Showing 1 changed file
View
20
Repositories/statistics/scripts/eprints-usage_src.php
have, add an entry to this array in the following format:
 
'archive_name' => array(
'sqlserver' => 'db_host',
'username' => 'archive_name',
'dbname' => 'database_name',
'username' => 'user_name',
'password' => 'password',
),
 
NJS 2007-07-16: Added support for different database name.
Usually, archive_name, database_name and user_name are the same, but they
don't have to be.
*/
$eprintsdbs = array(
'otago_eprints_v3' => array(
'otago_eprints' => array(
'sqlserver' => 'localhost',
'dbname' => 'otago_eprints_v3',
'username' => 'otago_eprints',
'password' => 'DrSyntaxRidesAgain',
),
'cardrona' => array(
'sqlserver' => 'localhost',
'dbname' => 'cardona_v3',
'username' => 'cardrona',
'password' => 'chautquau',
'password' => 'DrSyntaxRidesAgain',
),
);
 
/* NJS 2005-12-16
}
if(isset($eprintname[$archive_name . $eprint_id])) {
$eprint_name = $eprintname[$archive_name . $eprint_id];
} else {
$eprint_name = getePrintName($eprints_connections[$archive_name],$archive_name,$eprint_id,$eprints_version);
$eprint_name = getePrintName($eprints_connections[$archive_name],$eprintsdbs[$archive_name]['dbname'],$eprint_id,$eprints_version);
$eprintname[$archive_name . $eprint_id] = $eprint_name;
}
if($eprint_name=='') {
// Do nothing.
}
mysql_close($connect);
 
// Look up the title corresponding to the specified eprint id.
function getePrintName($connection,$archive,$eprintid,$eprints_version) {
function getePrintName($connection,$dbname,$eprintid,$eprints_version) {
// NJS 2006-06-14: DB connection now passed as an argument.
$db = mysql_select_db($archive,$connection);
$db = mysql_select_db($dbname,$connection);
// NJS 2007-07-24: Added check for EPrints version, as the
// database structure changed between versions 2 and 3.
if ( $eprints_version > 2 )
{