Change the showing of hidden pages by the SiteIndex to be configurable. Fixes RFE #11044.
Also, change the SiteIndex to use an iterator.
This commit is contained in:
parent
e59ccc5dd3
commit
ca86f3d84b
5 changed files with 38 additions and 4 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
- fixed #11372: All Search Forms should use GET
|
- fixed #11372: All Search Forms should use GET
|
||||||
- fixed #11373: Problem creating FilePump bundles
|
- fixed #11373: Problem creating FilePump bundles
|
||||||
- fixed #11374: USPS shipping drivers take 3 minutes to timeout
|
- fixed #11374: USPS shipping drivers take 3 minutes to timeout
|
||||||
|
- fixed #11044: Optionally include hidden pages in sitemap.xml
|
||||||
|
|
||||||
7.8.10
|
7.8.10
|
||||||
- fixed #11332: Pagination in webgui.org forum urls
|
- fixed #11332: Pagination in webgui.org forum urls
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,11 @@ save you many hours of grief.
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
* WebGUI now requires DateTime::Format::HTTP, to handle parsing HTTP dates.
|
* WebGUI now requires DateTime::Format::HTTP, to handle parsing HTTP dates.
|
||||||
|
|
||||||
|
* The Google sitemap generator in WebGUI was including hidden pages in the list of
|
||||||
|
pages. This is now configurable, with the default being to NOT show hidden pages.
|
||||||
|
If you wish hidden pages to be shown, then in the config file set showHiddenPages
|
||||||
|
to 1.
|
||||||
|
|
||||||
7.8.6
|
7.8.6
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
* WebGUI now requires LWP 5.833 or higher, to fix a bug in that module.
|
* WebGUI now requires LWP 5.833 or higher, to fix a bug in that module.
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ my $quiet; # this line required
|
||||||
my $session = start(); # this line required
|
my $session = start(); # this line required
|
||||||
|
|
||||||
# upgrade functions go here
|
# upgrade functions go here
|
||||||
|
addSiteIndexToConfig($session);
|
||||||
|
|
||||||
finish($session); # this line required
|
finish($session); # this line required
|
||||||
|
|
||||||
|
|
@ -44,6 +45,16 @@ finish($session); # this line required
|
||||||
# print "DONE!\n" unless $quiet;
|
# print "DONE!\n" unless $quiet;
|
||||||
#}
|
#}
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# Describe what our function does
|
||||||
|
sub addSiteIndexToConfig {
|
||||||
|
my $session = shift;
|
||||||
|
print "\tAdd Site Config indexing section to config file... " unless $quiet;
|
||||||
|
$session->config->set('siteIndex', { showHiddenPages => 0 });
|
||||||
|
# and here's our code
|
||||||
|
print "DONE!\n" unless $quiet;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1071,4 +1071,10 @@
|
||||||
"Opera Mini"
|
"Opera Mini"
|
||||||
],
|
],
|
||||||
|
|
||||||
|
#A list of UserAgents of recognized mobile platforms. If useMobileStyle is set in the
|
||||||
|
#Admin settings, then the mobile style will be used for these browsers.
|
||||||
|
"siteIndex" : {
|
||||||
|
"showHiddenPages" : 0
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ package WebGUI::Content::SiteIndex;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use WebGUI::Asset;
|
use WebGUI::Asset;
|
||||||
|
use WebGUI::Exception;
|
||||||
use XML::Simple;
|
use XML::Simple;
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
@ -53,17 +54,28 @@ sub handler {
|
||||||
unless ($p =~ m/sitemap\.xml$/i) {
|
unless ($p =~ m/sitemap\.xml$/i) {
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $whereClause = "assetData.groupIdView = 7";
|
||||||
|
if (! $session->config->get("siteIndex")->{showHiddenPages}) {
|
||||||
|
$whereClause .= ' AND assetData.isHidden=0';
|
||||||
|
}
|
||||||
|
|
||||||
my $pages = WebGUI::Asset->getRoot($session)->getLineage(["self","descendants"],{
|
my $pages = WebGUI::Asset->getRoot($session)->getLineageIterator(["self","descendants"],{
|
||||||
returnObjects => 1,
|
returnObjects => 1,
|
||||||
includeOnlyClasses => ["WebGUI::Asset::Wobject::Layout"],
|
includeOnlyClasses => ["WebGUI::Asset::Wobject::Layout"],
|
||||||
whereClause => "assetData.groupIdView = 7",
|
whereClause => $whereClause,
|
||||||
limit => 20000
|
limit => 20000
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
my $url = [];
|
my $url = [];
|
||||||
foreach my $page (@{$pages}) {
|
ASSET: while (1) {
|
||||||
|
my $page = eval { $pages->() };
|
||||||
|
if (my $e = Exception::Class->caught()) {
|
||||||
|
$session->log->error($@);
|
||||||
|
next ASSET;
|
||||||
|
}
|
||||||
|
last ASSET unless $page;
|
||||||
push(@{$url},{
|
push(@{$url},{
|
||||||
loc => $session->url->getSiteURL().formatXML($page->getUrl),
|
loc => $session->url->getSiteURL().formatXML($page->getUrl),
|
||||||
lastmod => $session->datetime->epochToSet($page->get("revisionDate")),
|
lastmod => $session->datetime->epochToSet($page->get("revisionDate")),
|
||||||
|
|
@ -112,4 +124,3 @@ sub formatXML {
|
||||||
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue