/
updateRenderedStory
executable file
·76 lines (55 loc) · 1.64 KB
/
updateRenderedStory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/perl -w
# This code is a part of Slash, and is released under the GPL.
# Copyright 1997-2002 by Open Source Development Network. See README
# and COPYING for more information, or see http://slashcode.com/.
# $Id$
use strict;
use File::Basename;
use Getopt::Std;
use Slash;
use Slash::Utility;
use Benchmark;
use vars qw( $slashdb $constants $junk );
(my $VERSION) = ' $Revision$ ' =~ /\$Revision:\s+([^\s]+)/;
my $PROGNAME = basename($0);
my %opts;
# Remember to doublecheck these match usage()!
usage('Options used incorrectly') unless getopts('hu:v', \%opts);
usage() if $opts{'h'};
version() if $opts{'v'};
$opts{'u'} ||= 'slash';
createEnvironment($opts{u});
$slashdb = getCurrentDB();
$constants = getCurrentStatic();
main();
sub main {
my $sids = $slashdb->sqlSelectColArrayref('sid', 'stories');
Slash::Utility::Anchor::getSkinColors();
print "Updating " . scalar(@$sids) ." \n";
for my $sid (@$sids) {
$slashdb->setStory($sid, { rendered => displayStory($sid,'', { get_cacheable => 1})});
}
}
sub usage {
print "*** $_[0]\n" if $_[0];
# Remember to doublecheck these match getopts()!
print <<EOT;
Usage: $PROGNAME [OPTIONS]
This utility rebuilds all of the rendered stories. If you change all of your template designs for your index you will probably want to run this.
Main options:
-h Help (this message)
-v Version
-u Virtual user (default is "slash")
EOT
exit;
}
sub version {
print <<EOT;
$PROGNAME $VERSION
This code is a part of Slash, and is released under the GPL.
Copyright 1997-2002 by Open Source Development Network. See README
and COPYING for more information, or see http://slashcode.com/.
EOT
exit;
}
__END__