Changeset 29676

Show
Ignore:
Timestamp:
09.01.2015 13:10:56 (4 years ago)
Author:
jts21
Message:

Added gs-siteinfo.pl. Lists current sites. Updated site listing code to ignore anything which isn't a site.

Location:
main/trunk/package-kits/scripts
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/package-kits/scripts/perllib/Greenstone/Site.pm

    r29675 r29676  
    1010 
    1111our $VERSION = 1.00; 
    12 our @EXPORT = ( 'new', 'get_sites' ); 
     12our @EXPORT = ( ); 
    1313my $configTemplate; 
    1414 
     
    2929} 
    3030 
    31 sub get { 
     31sub list { 
    3232    ref shift and die "Static method called on object\n"; 
    3333    my $sites = {}; 
     
    3535    opendir DH, $dir or die "Could not open sites directory '$dir'\n"; 
    3636    while (my $site = readdir DH) { 
     37        # skip hidden files and current/parent directory 
     38        $site =~ /^\./ and next; 
     39        # skip non-directories 
     40        -d "$dir/$site" or next; 
    3741        # We don't really need to store anything more than the fact that the site exists 
    3842        # So we just store nothing, which is enough to put the key in the hash 
     
    4650sub exists { 
    4751    my $self = shift; 
    48     my $sites = get; 
     52    my $sites = list; 
    4953    return exists $sites->{$self->{name}}; 
    5054}