Merge branch 'master' of git@github.com:plainblack/webgui

This commit is contained in:
daviddelikat 2009-10-14 10:42:41 -05:00
commit fa40b99182
52 changed files with 3081 additions and 3155 deletions

View file

@ -1,3 +1,23 @@
7.8.2
- fixed #11098: Leaving a version tag makes everyone leave
- fixed #11096: Error on deleting FAQ(CS)-item
- fixed #11060: Some tables have latin1 as the default character set
- fixed #11089: No message body in Notification
- fixed #2569: robots.txt issues
- fixed #11104: Wrong name for request tracker post form template
- fixed #11077: Untested result in WebGUI::Storage->getFiles
- fixed #11080: Asset Manage Crumb Trail flyout menu
- fixed #10874: EMS Schedule displaying incorrectly
- fixed #10956: Account, Profile system bad rendering with lots of
- fixed #11112: story archive RSS feed
- added Insurance estimator for the USPS shipping driver
- fixed #11121: Syndicated Content search terms require both title and description match
- fixed #11057: Deleting wiki attachments
- fixed #11122: Survey icon is missing from admin console
- fixed #11107: linked image with caption
- fixed #10914: Shop: No email notifications sent when the cart has net value 0
- fixed #11126: WebGUI database has varchar fields
7.8.1
- mark $session->datetime->time as deprecated and remove its use from core code
- fixed: Wikis broken by 7.8.0 upgrade
@ -41,6 +61,8 @@
- fixed #11049: form caching incorrectly
- fixed #11088: i18n Survey Section Information
- fixed #11087: SC asset repeats its own description in feeds
- fixed #10916: png icon
- fixed #11100: syncToCdn's help is not proper POD
7.8.0
- upgraded YUI to 2.8.0r4

File diff suppressed because one or more lines are too long

View file

@ -11,10 +11,26 @@ save you many hours of grief.
--------------------------------------------------------------------
* The EventManagementSystem schedule template was accidently given
the same namespace as the main EMS template. This allowed the
wrong template to be chosen for the main EMS template and the
schedule template. The upgrade from 7.8.0 to 7.8.1 will attempt
to fix this when default templates have been used.
the same namespace as the main EMS template. This allowed the
wrong template to be chosen for the main EMS template and the
schedule template. The upgrade from 7.8.0 to 7.8.1 will attempt
to fix this when default templates have been used.
* In the past, it was possible to leave WebguiRoot undefined
or incorrectly specified, and WebGUI would still function. It
must now be properly specified, which means it must be configured
in the global Apache section (outside any VirtualHost or
Directory sections) and point to the correct WebGUI root
directory. For example:
PerlSetVar WebguiRoot /data/WebGUI
* WebGUI creates thumbnails for uploaded images. The name for
those thumbnail files is created by prepending "thumb-" to the
name of the file. If a file that start with "thumb-" is created
then WebGUI would throw an error. Starting with 7.8.1, files
that start with "thumb-" will be renamed by removing that
prefix from the filename.
7.8.0
--------------------------------------------------------------------

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View file

@ -137,18 +137,38 @@ sub moveCalendarFeedsToJSON {
sub removeOrphanedVersionTags {
my $session = shift;
print "\tRemoving orphan version tags (this may take a while)... " unless $quiet;
# Get all Version Tag ids
my %tags = map { $_ => 1 } @{$session->db->buildArrayRef("SELECT tagId FROM assetVersionTag")};
#print "\nSite has " . keys(%tags) . " Version Tags in total\n" unless $quiet;
# Get all Version Tags with associated assetData
my %tags_with_data = map { $_ => 1 } @{$session->db->buildArrayRef("SELECT tagId FROM assetData")};
#print "* " . keys(%tags_with_data) . " with associated assetData\n" unless $quiet;
# Figure out the set of ophans
my @orphans = grep { !$tags_with_data{$_} } keys %tags;
#print "* " . scalar(@orphans) . " orphans\n" unless $quiet;
# Sanity check
if (keys(%tags) - keys(%tags_with_data) != scalar(@orphans)) { die "Something is broken in your Version Tag table" }
my $sth = $session->db->read(
"SELECT tagId FROM assetVersionTag",
);
while ( my ($tagId) = $sth->array ) {
if ( !$session->db->quickScalar(
"SELECT COUNT(*) FROM assetData WHERE tagId=?",
[ $tagId ]
) ) {
my $tag = WebGUI::VersionTag->new( $session, $tagId );
$tag->rollback;
# Remove the orphans
my $count = 0;
for my $tagId (@orphans) {
# Progress
if ($count % 100 == 0) { print '*' unless $quiet; }
# Double-check on reduced set (remove to speed up even further)
if ( $session->db->quickScalar("SELECT COUNT(*) FROM assetData WHERE tagId=?", [ $tagId ]) ) {
die "Version Tag was supposed to be an orphan, but had assetData: $tagId";
}
my $tag = WebGUI::VersionTag->new( $session, $tagId );
$tag->rollback;
$count++;
}
print "DONE!\n" unless $quiet;

View file

@ -0,0 +1,256 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
our ($webguiRoot);
BEGIN {
$webguiRoot = "../..";
unshift (@INC, $webguiRoot."/lib");
}
use strict;
use Getopt::Long;
use WebGUI::Session;
use WebGUI::Storage;
use WebGUI::Asset;
use WebGUI::Shop::Pay;
use WebGUI::Shop::PayDriver;
my $toVersion = '7.8.2';
my $quiet; # this line required
my $session = start(); # this line required
fixTableDefaultCharsets($session);
correctWikiAttachmentPermissions( $session );
transactionsNotifications( $session );
fixBadVarCharColumns ( $session );
finish($session); # this line required
#----------------------------------------------------------------------------
# Describe what our function does
#sub exampleFunction {
# my $session = shift;
# print "\tWe're doing some stuff here that you should know about... " unless $quiet;
# # and here's our code
# print "DONE!\n" unless $quiet;
#}
#----------------------------------------------------------------------------
sub fixTableDefaultCharsets {
my $session = shift;
my $db = $session->db;
print "\tFixing default character set on tables... " unless $quiet;
my @tables = qw(
Carousel Collaboration DataTable Map MapPoint MatrixListing
MatrixListing_attribute Story StoryArchive StoryTopic
Survey_questionTypes Survey_test ThingyRecord ThingyRecord_record
adSkuPurchase assetAspectComments assetAspectRssFeed
filePumpBundle inbox_messageState taxDriver tax_eu_vatNumbers
template_attachments
);
for my $table (@tables) {
$db->write(
sprintf('ALTER TABLE %s DEFAULT CHARACTER SET = ?', $db->dbh->quote_identifier($table)),
['utf8'],
);
}
my $db_name = $db->dbh->{Name};
my $database = (split /[;:]/, $db_name)[0];
while ( $db_name =~ /([^=;:]+)=([^;:]+)/msxg ) {
if ( $1 eq 'db' || $1 eq 'database' || $1 eq 'dbname' ) {
$database = $2;
last;
}
}
$session->db->write(sprintf 'ALTER DATABASE %s DEFAULT CHARACTER SET utf8', $db->dbh->quote_identifier($database));
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub correctWikiAttachmentPermissions {
my $session = shift;
print "\tCorrect group edit permission on wiki page attachments... " unless $quiet;
my $root = WebGUI::Asset->getRoot($session);
my $pageIterator = $root->getLineageIterator(
['descendants'],
{
includeOnlyClasses => ['WebGUI::Asset::WikiPage'],
}
);
PAGE: while (my $wikiPage = $pageIterator->()) {
my $wiki = $wikiPage->getWiki;
next PAGE unless $wiki && $wiki->get('allowAttachments') && $wikiPage->getChildCount;
foreach my $attachment (@{ $wikiPage->getLineage(['children'])}) {
$attachment->update({ groupIdEdit => $wiki->get('groupToEditPages') });
}
}
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub transactionsNotifications {
my $session = shift;
print "\tMove Shop notifications from PayDriver to Transactions... " unless $quiet;
my $pay = WebGUI::Shop::Pay->new($session);
my $gateways = $pay->getPaymentGateways;
my $defaultNotificationGroup = '3';
my $defaultTemplate = 'bPz1yk6Y9uwMDMBcmMsSCg';
if (@{ $gateways }) {
my $firstGateway = $gateways->[0];
$defaultNotificationGroup = $firstGateway->get('saleNotificationGroupId');
$defaultTemplate = $firstGateway->get('receiptEmailTemplateId' );
foreach my $gateway (@{ $gateways }) {
my $properties = $gateway->get();
delete $properties->{ saleNotificationGroupId };
delete $properties->{ receiptEmailTemplateId };
$gateway->update($properties);
}
}
$session->setting->add('shopSaleNotificationGroupId', $defaultNotificationGroup);
$session->setting->add('shopReceiptEmailTemplateId', $defaultTemplate);
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub fixBadVarCharColumns {
my $session = shift;
print "\tGive all revisionDate columns the correct definition... " unless $quiet;
my @dataSets = (
[ 'AdSku', 'assetId', "CHAR(22) BINARY NOT NULL" ],
[ 'AdSku', 'purchaseTemplate', "CHAR(22) BINARY NOT NULL" ],
[ 'AdSku', 'manageTemplate', "CHAR(22) BINARY NOT NULL" ],
[ 'AdSku', 'adSpace', "CHAR(22) BINARY NOT NULL" ],
[ 'AdSku', 'clickDiscounts', "CHAR(22) DEFAULT NULL" ],
[ 'AdSku', 'impressionDiscounts', "CHAR(22) DEFAULT NULL" ],
[ 'Collaboration', 'replyRichEditor', "CHAR(22) BINARY DEFAULT 'PBrichedit000000000002'" ],
[ 'Collaboration', 'replyFilterCode', "CHAR(30) BINARY DEFAULT 'javascript'" ],
[ 'DataForm', 'htmlAreaRichEditor', "CHAR(22) BINARY DEFAULT '**Use_Default_Editor**'" ],
[ 'MapPoint', 'website', "CHAR(22) BINARY DEFAULT NULL" ],
[ 'MapPoint', 'address1', "CHAR(22) BINARY DEFAULT NULL" ],
[ 'MapPoint', 'address2', "CHAR(22) BINARY DEFAULT NULL" ],
[ 'MapPoint', 'city', "CHAR(22) BINARY DEFAULT NULL" ],
[ 'MapPoint', 'state', "CHAR(22) BINARY DEFAULT NULL" ],
[ 'MapPoint', 'zipCode', "CHAR(22) BINARY DEFAULT NULL" ],
[ 'MapPoint', 'country', "CHAR(22) BINARY DEFAULT NULL" ],
[ 'MapPoint', 'phone', "CHAR(22) BINARY DEFAULT NULL" ],
[ 'MapPoint', 'fax', "CHAR(22) BINARY DEFAULT NULL" ],
[ 'MapPoint', 'email', "CHAR(22) BINARY DEFAULT NULL" ],
[ 'Survey', 'onSurveyEndWorkflowId',"CHAR(22) BINARY DEFAULT NULL" ],
[ 'Survey_questionTypes', 'questionType', "CHAR(56) NOT NULL" ],
[ 'bucketLog', 'userId', "CHAR(22) BINARY NOT NULL" ],
[ 'bucketLog', 'Bucket', "CHAR(22) BINARY NOT NULL" ],
[ 'deltaLog', 'userId', "CHAR(22) BINARY NOT NULL" ],
[ 'deltaLog', 'assetId', "CHAR(22) BINARY NOT NULL" ],
[ 'deltaLog', 'url', "CHAR(255) NOT NULL" ],
[ 'passiveAnalyticsStatus', 'userId', "CHAR(255) NOT NULL" ],
[ 'passiveLog', 'url', "CHAR(255) NOT NULL" ],
[ 'passiveLog', 'userId', "CHAR(22) BINARY NOT NULL" ],
[ 'passiveLog', 'assetId', "CHAR(22) BINARY NOT NULL" ],
[ 'passiveLog', 'sessionId', "CHAR(22) BINARY NOT NULL" ],
);
foreach my $dataSet (@dataSets) {
$session->db->write(sprintf "ALTER TABLE `%s` MODIFY COLUMN `%s` %s", @{ $dataSet });
}
print "Done.\n" unless $quiet;
}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------
# Add a package to the import node
sub addPackage {
my $session = shift;
my $file = shift;
# Make a storage location for the package
my $storage = WebGUI::Storage->createTemp( $session );
$storage->addFileFromFilesystem( $file );
# Import the package into the import node
my $package = eval { WebGUI::Asset->getImportNode($session)->importPackage( $storage, { overwriteLatest => 1 } ); };
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
# Turn off the package flag, and set the default flag for templates added
my $assetIds = $package->getLineage( ['self','descendants'] );
for my $assetId ( @{ $assetIds } ) {
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
if ( !$asset ) {
print "Couldn't instantiate asset with ID '$assetId'. Please check package '$file' for corruption.\n";
next;
}
my $properties = { isPackage => 0 };
if ($asset->isa('WebGUI::Asset::Template')) {
$properties->{isDefault} = 1;
}
$asset->update( $properties );
}
return;
}
#-------------------------------------------------
sub start {
my $configFile;
$|=1; #disable output buffering
GetOptions(
'configFile=s'=>\$configFile,
'quiet'=>\$quiet
);
my $session = WebGUI::Session->open($webguiRoot,$configFile);
$session->user({userId=>3});
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Upgrade to ".$toVersion});
return $session;
}
#-------------------------------------------------
sub finish {
my $session = shift;
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}
#-------------------------------------------------
sub updateTemplates {
my $session = shift;
return undef unless (-d "packages-".$toVersion);
print "\tUpdating packages.\n" unless ($quiet);
opendir(DIR,"packages-".$toVersion);
my @files = readdir(DIR);
closedir(DIR);
my $newFolder = undef;
foreach my $file (@files) {
next unless ($file =~ /\.wgpkg$/);
# Fix the filename to include a path
$file = "packages-" . $toVersion . "/" . $file;
addPackage( $session, $file );
}
}
#vim:ft=perl