67 lines
1.8 KiB
Perl
67 lines
1.8 KiB
Perl
# Selima Website Content Management System
|
|
# Rebuild.pm: The web page rebuild processor.
|
|
|
|
# Copyright (c) 2006-2018 imacat.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# Author: imacat <imacat@mail.imacat.idv.tw>
|
|
# First written: 2006-04-04
|
|
|
|
package Selima::Processor::Rebuild;
|
|
use 5.008;
|
|
use strict;
|
|
use warnings;
|
|
use base qw(Selima::Processor);
|
|
|
|
use Time::HiRes qw();
|
|
|
|
use Selima::DataVars qw(:scptconf);
|
|
use Selima::Guest;
|
|
use Selima::ShortCut;
|
|
|
|
# new: Initialize the processor
|
|
sub new : method {
|
|
local ($_, %_);
|
|
my ($self, $class);
|
|
($class, @_) = @_;
|
|
$self = $class->SUPER::new(@_);
|
|
$self->{"modified"} = 1;
|
|
return $self;
|
|
}
|
|
|
|
# _other_tasks: Perform tasks other than column updates
|
|
sub _other_tasks : method {
|
|
local ($_, %_);
|
|
my $self;
|
|
$self = $_[0];
|
|
# Rebuild the pages
|
|
$self->{"t_start"} = Time::HiRes::time;
|
|
$_ = $MAIN->can("rebuild_" . $self->{"form"}->param("type"));
|
|
&$_();
|
|
$self->{"t_end"} = Time::HiRes::time;
|
|
}
|
|
|
|
# _actlog: Log the activity
|
|
sub _actlog : method {
|
|
return gactlog "Rebuild pages of type \"" . $_[0]->{"form"}->param("type") . "\".";
|
|
}
|
|
|
|
# _ret_status: Return the process status
|
|
sub _ret_status : method {
|
|
return {"msg"=>N_("The specified web pages have been successfully rebuilt. ([sprintf,%0.3f,_1] seconds)"),
|
|
"margs"=>[$_[0]->{"t_end"}-$_[0]->{"t_start"}]};
|
|
}
|
|
|
|
return 1;
|