diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 9a46bc1b4..63a6a105f 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -19,9 +19,12 @@ - fix: WG user not logged in Apache - Upgraded to TinyMCE 2.0.6.1, which fixes a number of bugs that WebGUI users 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 than it was supposed to and more than it told them it was charging. + 6.99.4 - fix: better checking of selected template type - fix: SQLForm - added missing privilege check diff --git a/sbin/search.pl b/sbin/search.pl index c9c6306dd..c23893b3b 100644 --- a/sbin/search.pl +++ b/sbin/search.pl @@ -24,19 +24,23 @@ my $help = 0; my $indexsite = 0; my $configFile = ""; my $indexAll = ""; +my $updatesite = 0; GetOptions( 'indexall'=>\$indexAll, 'configFile=s'=>\$configFile, 'search=s'=>\$search, 'help'=>\$help, - 'indexsite'=>\$indexsite + 'indexsite'=>\$indexsite, + 'updatesite'=>\$updatesite ); if ($configFile) { my $session = WebGUI::Session->open("..", $configFile); if ($indexsite) { reindexSite($session); + } elsif ($updatesite) { + updateSite($session); } elsif ($search) { searchSite($session, $search); } else { @@ -74,6 +78,11 @@ Options: --search= * Searches the site for a keyword or phrase and 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. STOP @@ -125,4 +134,22 @@ sub searchSite { 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"; +}