Commit e2df82bd authored by Keith Jolley's avatar Keith Jolley
Browse files

Rename refdb config attribute to ref_db for consistency with other dbs.

refdb will still work.
Allow ref_db, auth_db and prefs_db settings to be overridden for single
db.
parent d04c1e25
......@@ -79,7 +79,7 @@ splitstree_path=/usr/bin/splitstree4
#You will need to run the accompaning getrefs.pl script regularly to
#keep this updated (unless you're mirroring another system)
refdb=refs
ref_db=refs
#CHARTDIRECTOR####
#Set to 1 if the chartdirector library is installed
......
......@@ -214,9 +214,9 @@ sub _process_flags {
sub _get_reference {
my ( $self, $pmid, $td ) = @_;
my $buffer;
if ( $self->{'config'}->{'refdb'} ) {
if ( $self->{'config'}->{'ref_db'} ) {
my %att = (
dbase_name => $self->{'config'}->{'refdb'},
dbase_name => $self->{'config'}->{'ref_db'},
host => $self->{'system'}->{'host'},
port => $self->{'system'}->{'port'},
user => $self->{'system'}->{'user'},
......@@ -253,7 +253,7 @@ sub _get_reference {
$sqlr->finish;
$sqlr2->finish;
} else {
$logger->error("No connection to reference database '$self->{'config'}->{'refdb'}' - check configuration.\n");
$logger->error("No connection to reference database '$self->{'config'}->{'ref_db'}' - check configuration.\n");
$buffer .=
"<tr class=\"td$td\"><th>reference</th><td align=\"left\"><a href='http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&amp;db=PubMed&amp;list_uids=$pmid&amp;dopt=Abstract'>$pmid</a></td><td colspan=\"3\" style=\"text-align:left; width:75%\">No details available.";
$buffer .= "</td></tr>\n";
......
......@@ -126,7 +126,7 @@ sub _initiate {
$self->{'error'} = 'invalidXML';
return;
}
$self->{'system'} = $self->{'xmlHandler'}->get_system_hash();
$self->{'system'} = $self->{'xmlHandler'}->get_system_hash;
if ( $self->{'system'}->{'dbtype'} ne 'sequences' && $self->{'system'}->{'dbtype'} ne 'isolates' ) {
$self->{'error'} = 'invalidDbType';
}
......@@ -160,11 +160,18 @@ sub _initiate {
$self->{'system'}->{'view'} ||= 'isolates';
$self->{'system'}->{'labelfield'} ||= 'isolate';
if ( !$self->{'xmlHandler'}->is_field( $self->{'system'}->{'labelfield'} ) ) {
$logger->error(
"The defined labelfield '$self->{'system'}->{'labelfield'}' does not exist in the database. Please set the labelfield attribute in the system tag of the database XML file."
);
$logger->error( "The defined labelfield '$self->{'system'}->{'labelfield'}' does not exist in the database. "
. "Please set the labelfield attribute in the system tag of the database XML file." );
}
}
#Allow individual database configs to override system auth and pref databases
$self->{'config'}->{'prefs_db'} = $self->{'system'}->{'prefs_db'} if defined $self->{'system'}->{'prefs_db'};
$self->{'config'}->{'auth_db'} = $self->{'system'}->{'auth_db'} if defined $self->{'system'}->{'auth_db'};
#refdb attribute has been renamed ref_db for consistency with other databases (refdb still works)
$self->{'config'}->{'ref_db'} //= $self->{'config'}->{'refdb'};
$self->{'config'}->{'ref_db'} = $self->{'system'}->{'ref_db'} if defined $self->{'system'}->{'ref_db'};
return;
}
......@@ -197,6 +204,7 @@ sub initiate_view {
my $username = $attributes->{'username'};
my $status_ref = $self->{'datastore'}->run_simple_query( "SELECT status FROM users WHERE user_name=?", $username );
return if ref $status_ref ne 'ARRAY' || $status_ref->[0] eq 'admin';
#You need to be able to read and write to a record to view it in the curator's interface
my $write_clause = $attributes->{'curate'} ? ' AND write=true' : '';
my $view_clause = << "SQL";
......@@ -259,7 +267,7 @@ sub read_config_file {
$config = Config::Tiny->read("$config_dir/bigsdb.conf");
foreach (
qw ( prefs_db auth_db jobs_db max_load emboss_path tmp_dir secure_tmp_dir blast_path blast+_path blast_threads
muscle_path mogrify_path ipcress_path splitstree_path reference refdb chartdirector
muscle_path mogrify_path ipcress_path splitstree_path reference refdb ref_db chartdirector
disable_updates disable_update_message intranet debug results_deleted_days)
)
{
......
......@@ -352,9 +352,9 @@ sub _get_user_info {
sub _print_maintable_reference {
my ( $self, $fieldname, $pmid, $td ) = @_;
my $q = $self->{'cgi'};
if ( $self->{'config'}->{'refdb'} ) {
if ( $self->{'config'}->{'ref_db'} ) {
my %att = (
dbase_name => $self->{'config'}->{'refdb'},
dbase_name => $self->{'config'}->{'ref_db'},
host => $self->{'system'}->{'host'},
port => $self->{'system'}->{'port'},
user => $self->{'system'}->{'user'},
......
......@@ -1098,7 +1098,7 @@ sub get_citation_hash {
my ( $self, $pmid_ref, $options ) = @_;
my $citation_ref;
my %att = (
'dbase_name' => $self->{'config'}->{'refdb'},
'dbase_name' => $self->{'config'}->{'ref_db'},
'host' => $self->{'system'}->{'host'},
'port' => $self->{'system'}->{'port'},
'user' => $self->{'system'}->{'user'},
......@@ -1111,7 +1111,7 @@ sub get_citation_hash {
catch BIGSdb::DatabaseConnectionException with {
$logger->error("Can't connect to reference database");
};
return $citation_ref if !$self->{'config'}->{'refdb'} || !$dbr;
return $citation_ref if !$self->{'config'}->{'ref_db'} || !$dbr;
my $sqlr = $dbr->prepare("SELECT year,journal,title,volume,pages FROM refs WHERE pmid=?");
my $sqlr2 = $dbr->prepare("SELECT surname,initials FROM authors WHERE id=?");
my $sqlr3 = $dbr->prepare("SELECT author FROM refauthors WHERE pmid=? ORDER BY position");
......@@ -1182,7 +1182,7 @@ sub get_citation_hash {
sub create_temp_ref_table {
my ( $self, $list, $qry_ref ) = @_;
my %att = (
'dbase_name' => $self->{'config'}->{'refdb'},
'dbase_name' => $self->{'config'}->{'ref_db'},
'host' => $self->{'system'}->{'host'},
'port' => $self->{'system'}->{'port'},
'user' => $self->{'system'}->{'user'},
......@@ -1321,7 +1321,7 @@ sub run_simple_ref_query {
#runs simple query (single row returned) against ref database
my ( $self, $qry, @values ) = @_;
my %att = (
'dbase_name' => $self->{'config'}->{'refdb'},
'dbase_name' => $self->{'config'}->{'ref_db'},
'host' => $self->{'system'}->{'host'},
'port' => $self->{'system'}->{'port'},
'user' => $self->{'system'}->{'user'},
......
......@@ -123,8 +123,8 @@ sub get_appropriate_plugin_names {
if !$self->{'config'}->{'chartdirector'}
&& $attr->{'requires'} =~ /chartdirector/;
next
if !$self->{'config'}->{'refdb'}
&& $attr->{'requires'} =~ /refdb/;
if !$self->{'config'}->{'ref_db'}
&& $attr->{'requires'} =~ /ref_?db/;
next
if !$self->{'config'}->{'emboss_path'}
&& $attr->{'requires'} =~ /emboss/;
......
......@@ -43,7 +43,7 @@ sub get_attributes {
section => 'export,postquery',
url => 'http://pubmlst.org/software/database/bigsdb/userguide/isolates/export_isolates.shtml',
input => 'query',
requires => 'refdb,js_tree',
requires => 'ref_db,js_tree',
help => 'tooltips',
order => 15
);
......
......@@ -42,7 +42,7 @@ sub get_attributes {
section => 'breakdown,postquery',
url => 'http://pubmlst.org/software/database/bigsdb/userguide/isolates/publications.shtml',
input => 'query',
requires => 'refdb',
requires => 'ref_db',
order => 30,
);
return \%att;
......@@ -59,7 +59,7 @@ sub run {
my $q = $self->{'cgi'};
my $query_file = $q->param('query_file');
print "<h1>Publication breakdown of dataset</h1>\n";
if ( !$self->{'config'}->{'refdb'} ) {
if ( !$self->{'config'}->{'ref_db'} ) {
print "<div class=\"box\" id=\"statusbad\">No reference database has been defined.</p></div>\n";
return;
}
......
......@@ -30,7 +30,7 @@ sub print_content {
my $q = $self->{'cgi'};
my $scheme_id = $q->param('scheme_id');
my %att = (
'dbase_name' => $self->{'config'}->{'refdb'},
'dbase_name' => $self->{'config'}->{'ref_db'},
'host' => $system->{'host'},
'port' => $system->{'port'},
'user' => $system->{'user'},
......
......@@ -429,7 +429,7 @@ sub _print_isolate_filter_fieldset {
}
}
}
if ( $self->{'config'}->{'refdb'} ) {
if ( $self->{'config'}->{'ref_db'} ) {
my $pmid = $self->{'datastore'}->run_list_query("SELECT DISTINCT(pubmed_id) FROM refs");
my $buffer;
if (@$pmid) {
......@@ -684,7 +684,7 @@ sub _print_profile_query_interface {
print "</ul>\n";
print "</fieldset>\n";
my @filters;
if ( $self->{'config'}->{'refdb'} ) {
if ( $self->{'config'}->{'ref_db'} ) {
my $pmid = $self->{'datastore'}->run_list_query( "SELECT DISTINCT(pubmed_id) FROM profile_refs WHERE scheme_id=?", $scheme_id );
if (@$pmid) {
my $labels = $self->{'datastore'}->get_citation_hash($pmid);
......
......@@ -86,8 +86,8 @@ sub _print_plugins {
if !$self->{'config'}->{'chartdirector'}
&& $attr->{'requires'} =~ /chartdirector/;
$disabled_reason{$_} = 'Reference database not configured.'
if !$self->{'config'}->{'refdb'}
&& $attr->{'requires'} =~ /refdb/;
if !$self->{'config'}->{'ref_db'}
&& $attr->{'requires'} =~ /ref_?db/;
$disabled_reason{$_} = 'EMBOSS not installed.'
if !$self->{'config'}->{'emboss_path'}
&& $attr->{'requires'} =~ /emboss/;
......
Supports Markdown
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