fix 11985 Search.pl should warn on bad asset
This commit is contained in:
parent
f78fb51b13
commit
ad8f1231fc
2 changed files with 30 additions and 1 deletions
|
|
@ -22,6 +22,7 @@
|
|||
- fixed #11960: Billing address mandatory fields not specified
|
||||
- fixed #11975: Cannot paste threads: "Cannot call method isa()"
|
||||
- fixed #11976: Use Container URL in search gives user Permission Denied
|
||||
- fixed #11985: Search.pl should warn on bad assets
|
||||
|
||||
7.10.6
|
||||
- fixed #11974: Toolbar icons unclickable in Webkit using HTML5
|
||||
|
|
|
|||
|
|
@ -19,6 +19,13 @@ BEGIN {
|
|||
$webguiRoot = File::Spec->rel2abs(File::Spec->catdir(File::Basename::dirname(__FILE__), File::Spec->updir));
|
||||
unshift @INC, File::Spec->catdir($webguiRoot, 'lib');
|
||||
}
|
||||
foreach my $libDir ( readLines( "preload.custom" ) ) {
|
||||
if ( !-d $libDir ) {
|
||||
warn "WARNING: Not adding lib directory '$libDir' from preload.custom: Directory does not exist.\n";
|
||||
next;
|
||||
}
|
||||
unshift @INC, $libDir;
|
||||
}
|
||||
|
||||
use Getopt::Long;
|
||||
use WebGUI::Asset;
|
||||
|
|
@ -89,7 +96,11 @@ sub reindexSite {
|
|||
my @searchableAssetIds;
|
||||
while (my ($id, $class) = $rs->array) {
|
||||
my $asset = WebGUI::Asset->new($session,$id,$class);
|
||||
if (defined $asset && $asset->get("state") eq "published" && ($asset->get("status") eq "approved" || $asset->get("status") eq "archived")) {
|
||||
if ( !$asset ) {
|
||||
warn sprintf "- Asset %s (%s) could not be instantiated\n", $id, $class;
|
||||
next;
|
||||
}
|
||||
if ($asset->get("state") eq "published" && ($asset->get("status") eq "approved" || $asset->get("status") eq "archived")) {
|
||||
print $asset->getId."\t".$asset->getTitle."\t";
|
||||
my $t = [Time::HiRes::gettimeofday()];
|
||||
$asset->indexContent;
|
||||
|
|
@ -143,6 +154,23 @@ sub updateSite {
|
|||
print "\nSite indexing took ".Time::HiRes::tv_interval($siteTime)." seconds.\n";
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub readLines {
|
||||
my $file = shift;
|
||||
my @lines;
|
||||
if (open(my $fh, '<', $file)) {
|
||||
while (my $line = <$fh>) {
|
||||
$line =~ s/#.*//;
|
||||
$line =~ s/^\s+//;
|
||||
$line =~ s/\s+$//;
|
||||
next if !$line;
|
||||
push @lines, $line;
|
||||
}
|
||||
close $fh;
|
||||
}
|
||||
return @lines;
|
||||
}
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue