- Added an option to update a half indexed site, without the need to start

over from scratch.
This commit is contained in:
JT Smith 2006-06-23 19:16:41 +00:00
parent 6ac999738f
commit fa89e57bb6
2 changed files with 31 additions and 1 deletions

View file

@ -19,9 +19,12 @@
- fix: WG user not logged in Apache - fix: WG user not logged in Apache
- Upgraded to TinyMCE 2.0.6.1, which fixes a number of bugs that WebGUI users - Upgraded to TinyMCE 2.0.6.1, which fixes a number of bugs that WebGUI users
have been experiencing with the Rich Editor. have been experiencing with the Rich Editor.
- Added an option to update a half indexed site, without the need to start
over from scratch.
- fix: Very very bad commerce bug that caused ITransact to charge the user more - fix: Very very bad commerce bug that caused ITransact to charge the user more
than it was supposed to and more than it told them it was charging. than it was supposed to and more than it told them it was charging.
6.99.4 6.99.4
- fix: better checking of selected template type - fix: better checking of selected template type
- fix: SQLForm - added missing privilege check - fix: SQLForm - added missing privilege check

View file

@ -24,19 +24,23 @@ my $help = 0;
my $indexsite = 0; my $indexsite = 0;
my $configFile = ""; my $configFile = "";
my $indexAll = ""; my $indexAll = "";
my $updatesite = 0;
GetOptions( GetOptions(
'indexall'=>\$indexAll, 'indexall'=>\$indexAll,
'configFile=s'=>\$configFile, 'configFile=s'=>\$configFile,
'search=s'=>\$search, 'search=s'=>\$search,
'help'=>\$help, 'help'=>\$help,
'indexsite'=>\$indexsite 'indexsite'=>\$indexsite,
'updatesite'=>\$updatesite
); );
if ($configFile) { if ($configFile) {
my $session = WebGUI::Session->open("..", $configFile); my $session = WebGUI::Session->open("..", $configFile);
if ($indexsite) { if ($indexsite) {
reindexSite($session); reindexSite($session);
} elsif ($updatesite) {
updateSite($session);
} elsif ($search) { } elsif ($search) {
searchSite($session, $search); searchSite($session, $search);
} else { } else {
@ -74,6 +78,11 @@ Options:
--search= * Searches the site for a keyword or phrase and --search= * Searches the site for a keyword or phrase and
returns the results. returns the results.
--updatesite * Indexes content that has not be indexed, but does not
index content that has been indexed. This is useful
if the --indexsite option had to be stopped part way
through.
* This option requires the --configFile option. * This option requires the --configFile option.
STOP STOP
@ -125,4 +134,22 @@ sub searchSite {
print "\nSearch took ".Time::HiRes::tv_interval($t)." seconds.\n"; print "\nSearch took ".Time::HiRes::tv_interval($t)." seconds.\n";
} }
#-------------------------------------------------------------------
sub updateSite {
my $session = shift;
my $siteTime = [Time::HiRes::gettimeofday()];
my $rs = $session->db->read("select assetId, className from asset where state='published'");
while (my ($id, $class) = $rs->array) {
my ($done) = $session->db->quickArray("select count(*) from assetIndex where assetId=?",[$id]);
next if $done;
my $asset = WebGUI::Asset->new($session,$id,$class);
if (defined $asset && $asset->get("status") eq "approved" || defined $asset && $asset->get("status") eq "archived") {
print $asset->getId."\t".$asset->getTitle."\t";
my $t = [Time::HiRes::gettimeofday()];
$asset->indexContent;
print "(".Time::HiRes::tv_interval($t).")\n";
}
}
print "\nSite indexing took ".Time::HiRes::tv_interval($siteTime)." seconds.\n";
}