added redirect and migrated site map to article
This commit is contained in:
parent
0ffe4c87ce
commit
8a3e872238
8 changed files with 203 additions and 24 deletions
|
|
@ -22,6 +22,12 @@ save you many hours of grief.
|
|||
need to download and upgrade to 5.5.x before you can upgrade
|
||||
to 6.3 or higher.
|
||||
|
||||
* All Site Map wobjects will be migrated to Navigation macros in
|
||||
Articles during the upgrade. All the site map templates will
|
||||
be lost. If you want them, save them before the upgrade. Also
|
||||
check your site after the upgrade for all site maps to make
|
||||
sure that they look the way you want them to look.
|
||||
|
||||
|
||||
6.2.8
|
||||
--------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ sub walkTree {
|
|||
while (my $page = $a->hashRef) {
|
||||
my $pageId = WebGUI::Id::generate();
|
||||
my $pageLineage = $parentLineage.sprintf("%06d",$myRank);
|
||||
my $pageUrl = $page->{urlizedTitle};
|
||||
my $pageUrl = fixUrl($page->{urlizedTitle});
|
||||
my $className = 'WebGUI::Asset::Layout';
|
||||
if ($page->{redirectURL} ne "") {
|
||||
$className = 'WebGUI::Asset::Redirect';
|
||||
|
|
@ -95,7 +95,7 @@ sub walkTree {
|
|||
my ($namespace) = WebGUI::SQL->quickHashRef("select * from ".$wobject->{namespace}." where wobjectId=".quote($wobject->{wobjectId}));
|
||||
my $wobjectId = WebGUI::Id::generate();
|
||||
my $wobjectLineage = $pageLineage.sprintf("%06d",$rank);
|
||||
my $wobjectUrl = $pageUrl."/".$wobject->{title};
|
||||
my $wobjectUrl = fixUrl($pageUrl."/".$wobject->{title});
|
||||
my $groupIdView = $page->{groupIdView};
|
||||
my $groupIdEdit = $page->{groupIdEdit};
|
||||
my $ownerId = $page->{ownerId};
|
||||
|
|
@ -117,7 +117,16 @@ sub walkTree {
|
|||
# migrate image to image asset
|
||||
# migrate forums
|
||||
} elsif ($namespace eq "SiteMap") {
|
||||
# we're dumping sitemaps so do that here
|
||||
my $navident = 'SiteMap_'.$namespace->{wobjectId};
|
||||
my ($starturl) = WebGUI::SQL->quickArray("select urlizedTitle from page
|
||||
where pageId=".quote($namespace->{startAtThisLevel}));
|
||||
WebGUI::SQL->write("insert into Navigation (navigationId, identifier, depth, startAt,
|
||||
templateId) values (".quote(WebGUI::Id::generate()).", ".quote($navident).",
|
||||
".quote($namespace->{depth}).", ".quote($starturl).", '1')");
|
||||
my $navmacro = $wobject->{description}.'<p>^Navigation('.$navident.');</p>';
|
||||
WebGUI::SQL->write("update wobject set className='WebGUI::Asset::Wobject::Article', description=".quote($navmacro)."
|
||||
where assetId=".quote($wobjectId));
|
||||
WebGUI::SQL->write("insert into Article (assetId) values (".quote($wobjectId).")");
|
||||
} elsif ($namespace eq "FileManager") {
|
||||
# we're dumping file manager's so do that here
|
||||
} elsif ($namespace eq "Product") {
|
||||
|
|
@ -135,6 +144,7 @@ sub walkTree {
|
|||
}
|
||||
$b->finish;
|
||||
walkTree($page->{pageId},$pageId,$pageLineage,$rank+1);
|
||||
$myRank++;
|
||||
}
|
||||
$a->finish;
|
||||
my $sth = WebGUI::SQL->read("select distinct(namespace) from wobject");
|
||||
|
|
@ -172,9 +182,25 @@ sub walkTree {
|
|||
WebGUI::SQL->write("drop table page");
|
||||
WebGUI::SQL->write("alter table Article drop column image");
|
||||
WebGUI::SQL->write("alter table Article drop column attachment");
|
||||
WebGUI::SQL->write("delete from template where namespace in ('SiteMap')");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sub fixUrl {
|
||||
my $id = shift;
|
||||
my $url = WebGUI::URL::urlize(shift);
|
||||
my ($test) = WebGUI::SQL->quickArray("select url from asset where assetId<>".quote($id)." and url=".quote($url));
|
||||
if ($test) {
|
||||
my @parts = split(/\./,$url);
|
||||
if ($parts[0] =~ /(.*)(\d+$)/) {
|
||||
$parts[0] = $1.($2+1);
|
||||
} elsif ($test ne "") {
|
||||
$parts[0] .= "2";
|
||||
}
|
||||
$url = join(".",@parts);
|
||||
$url = fixUrl($url);
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue