source: gsdl/trunk/perllib/cgiactions/indexaction.pm@ 19293

Last change on this file since 19293 was 19293, checked in by davidb, 15 years ago

Introduction of Perl-based CGI 'actions' plus supporting modules

File size: 2.3 KB
Line 
1###########################################################################
2#
3# indexaction.pm --
4# A component of the Greenstone digital library software
5# from the New Zealand Digital Library Project at the
6# University of Waikato, New Zealand.
7#
8# Copyright (C) 2009 New Zealand Digital Library Project
9#
10# This program is free software; you can redistr te it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23#
24###########################################################################
25
26
27package indexaction;
28
29
30use strict;
31
32use cgiactions::baseaction;
33
34
35
36@indexaction::ISA = ('baseaction');
37
38
39
40my $action_table = {
41 "incremental-rebuild" =>
42 { 'compulsory-args' => [ "un", "metaname" ],
43 'optional-args' => []
44 },
45 };
46
47
48sub new
49{
50 my $class = shift (@_);
51 my ($gsdl_cgi,$iis6_mode) = @_;
52
53 my $self = new baseaction($action_table,$gsdl_cgi,$iis6_mode);
54
55 return bless $self, $class;
56}
57
58
59
60
61sub incremental_rebuild
62{
63 my $self = shift @_;
64
65 my $username = $self->{'username'};
66 my $collect = $self->{'collect'};
67 my $timestamp = $self->{'timestamp'};
68 my $site = $self->{'site'};
69
70 my $gsdl_cgi = $self->{'gsdl_cgi'};
71
72 # timestamp could turn out to be useful, but not used just now
73
74 # don't user authenticate for now
75 if ($baseaction::authentication_enabled) {
76 # Ensure the user is allowed to edit this collection
77 $self->authenticate_user($username, $collect);
78 }
79
80 # Make sure the collection isn't locked by someone else
81 $self->lock_collection($username, $collect, $site);
82
83 $self->run_script($collect,$site,"incremental-rebuild.pl");
84
85
86 if ($baseaction::mail_enabled) {
87 $self->send_mail("Remote Greenstone building event", "Build of collection '$collect' complete.");
88 }
89
90}
91
92
931;
Note: See TracBrowser for help on using the repository browser.