diff --git a/docs/upgrades/upgrade_7.8.0-7.8.1.pl b/docs/upgrades/upgrade_7.8.0-7.8.1.pl deleted file mode 100644 index 184a1d5df..000000000 --- a/docs/upgrades/upgrade_7.8.0-7.8.1.pl +++ /dev/null @@ -1,225 +0,0 @@ -#!/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; - - -my $toVersion = '7.8.1'; -my $quiet; # this line required - - -my $session = start(); # this line required - -fixWikis( $session ); -fixEMSTemplates( $session ); -removeOldSubscriptionTables( $session ); -removeOldITransactTables( $session ); -removeSQLFormTables( $session ); -fixBadRevisionDateColumns( $session ); -removeImportCruft( $session ); -removeAdminFromVisitorGroup( $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; -#} - -#---------------------------------------------------------------------------- -# Describe what our function does -sub fixBadRevisionDateColumns { - my $session = shift; - print "\tGive all revisionDate columns the correct definition... " unless $quiet; - $session->db->write("ALTER TABLE Event MODIFY COLUMN revisionDate BIGINT NOT NULL DEFAULT 0"); - $session->db->write("ALTER TABLE Calendar MODIFY COLUMN revisionDate BIGINT NOT NULL DEFAULT 0"); - $session->db->write("ALTER TABLE MultiSearch MODIFY COLUMN revisionDate BIGINT NOT NULL DEFAULT 0"); - $session->db->write("ALTER TABLE Dashboard MODIFY COLUMN revisionDate BIGINT NOT NULL DEFAULT 0"); - $session->db->write("ALTER TABLE StockData MODIFY COLUMN revisionDate BIGINT NOT NULL DEFAULT 0"); - print "Done.\n" unless $quiet; -} - -#---------------------------------------------------------------------------- -# Describe what our function does -sub removeSQLFormTables { - my $session = shift; - print "\tRemoving leftover SQL Form tables if not used... " unless $quiet; - my $tablesUsed = $session->db->quickScalar("select count(*) from asset where className='WebGUI::Asset::Wobject::SQLForm'"); - if (!$tablesUsed) { - $session->db->write('DROP TABLE IF EXISTS SQLForm_fieldOrder'); - print "\n\t\tSQL Form not used, dropping table..." unless $quiet; - } - print "Done.\n" unless $quiet; -} - -#---------------------------------------------------------------------------- -# Describe what our function does -sub removeOldSubscriptionTables { - my $session = shift; - print "\tRemoving tables leftover from the old 7.5 Commerce System... " unless $quiet; - $session->db->write('DROP TABLE IF EXISTS subscriptionCode'); - $session->db->write('DROP TABLE IF EXISTS subscriptionCodeBatch'); - $session->db->write('DROP TABLE IF EXISTS subscriptionCodeSubscriptions'); - print "Done.\n" unless $quiet; -} - -#---------------------------------------------------------------------------- -# Describe what our function does -sub removeOldITransactTables { - my $session = shift; - print "\tRemoving tables leftover from the old 7.5 ITransact Plugin... " unless $quiet; - $session->db->write('DROP TABLE IF EXISTS ITransact_recurringStatus'); - print "Done.\n" unless $quiet; -} - -#---------------------------------------------------------------------------- -# Describe what our function does -sub removeAdminFromVisitorGroup { - my $session = shift; - print "\tRemoving Admin group from Visitor group... " unless $quiet; - $session->db->write("delete from groupGroupings where groupId='3' and inGroup='1'"); - print "Done.\n" unless $quiet; -} - - -#---------------------------------------------------------------------------- -# Describe what our function does -sub fixWikis { - my $session = shift; - print "\tFixing Wikis... " unless $quiet; - $session->db->write('INSERT IGNORE INTO assetAspect_Subscribable (assetId, revisionDate) SELECT assetId, revisionDate FROM WikiMaster'); - $session->db->write('INSERT IGNORE INTO assetAspect_Subscribable (assetId, revisionDate) SELECT assetId, revisionDate FROM WikiPage'); - print "Done.\n" unless $quiet; -} - -#---------------------------------------------------------------------------- -# Describe what our function does -sub fixEMSTemplates { - my $session = shift; - print "\tFixing bad usage of Event Management System templates... " unless $quiet; - $session->db->write(q|update EventManagementSystem set templateId='2rC4ErZ3c77OJzJm7O5s3w' where templateId='S2_LsvVa95OSqc66ITAoig'|); - $session->db->write(q|update EventManagementSystem set scheduleTemplateId='S2_LsvVa95OSqc66ITAoig' where scheduleTemplateId='2rC4ErZ3c77OJzJm7O5s3w'|); - print "Done.\n" unless $quiet; -} - -#---------------------------------------------------------------------------- -# Describe what our function does -sub removeImportCruft { - my $session = shift; - print "\tRemoving cruft from the import node... " unless $quiet; - my $propFolder = WebGUI::Asset->newByDynamicClass($session, '2c4RcwsUfQMup_WNujoTGg'); - if ($propFolder) { - $propFolder->purge; - } - 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 diff --git a/docs/upgrades/upgrade_7.8.1-7.8.2.pl b/docs/upgrades/upgrade_7.8.1-7.8.2.pl deleted file mode 100644 index 99d09a1fc..000000000 --- a/docs/upgrades/upgrade_7.8.1-7.8.2.pl +++ /dev/null @@ -1,275 +0,0 @@ -#!/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 ); -addVendorPayouts($session); - -finish($session); # this line required - - -#---------------------------------------------------------------------------- -sub addVendorPayouts { - my $session = shift; - print "\tAdding vendor payouts... " unless $quiet; - my $db = $session->db; - $db->write(" create table if not exists vendorPayoutLog ( - payoutId char(22) binary not null primary key, - isSuccessful tinyint(1) not null, - errorCode char(10), - errorMessage char(255), - paypalTimestamp char(20) not null, - amount decimal(7,2) not null, - currency char(3) not null, - correlationId char(13) not null, - paymentInformation char(255) not null - )"); - $db->write(" create table if not exists vendorPayoutLog_items ( - payoutId char(22) binary not null, - transactionItemId char(22) binary not null, - amount decimal(7,2) not null, - primary key( payoutId, transactionItemId ) - )"); - - 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; - ATTACHMENT: foreach my $attachment (@{ $wikiPage->getLineage(['children'], { returnObjects => 1, })}) { - next ATTACHMENT unless $attachment; - $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 diff --git a/docs/upgrades/upgrade_7.8.10-7.8.11.pl b/docs/upgrades/upgrade_7.8.10-7.8.11.pl deleted file mode 100644 index a20214634..000000000 --- a/docs/upgrades/upgrade_7.8.10-7.8.11.pl +++ /dev/null @@ -1,141 +0,0 @@ -#!/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; - - -my $toVersion = '7.8.11'; -my $quiet; # this line required - - -my $session = start(); # this line required - -# upgrade functions go here -addSiteIndexToConfig($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; -#} - -#---------------------------------------------------------------------------- -# 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 -------------------------------- - -#---------------------------------------------------------------------------- -# 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 diff --git a/docs/upgrades/upgrade_7.8.11-7.8.12.pl b/docs/upgrades/upgrade_7.8.11-7.8.12.pl deleted file mode 100644 index ca0f0099d..000000000 --- a/docs/upgrades/upgrade_7.8.11-7.8.12.pl +++ /dev/null @@ -1,170 +0,0 @@ -#!/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; - - -my $toVersion = '7.8.12'; -my $quiet; # this line required - - -my $session = start(); # this line required - -# upgrade functions go here -fixWorkflowSizeLimits($session); -growMapPointDataColumns($session); -addKarmaToAdSku($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; -#} - - -#---------------------------------------------------------------------------- -# Describe what our function does -sub fixWorkflowSizeLimits { - my $session = shift; - print "\tAdjust size limits on File and Database cache cleanups... " unless $quiet; - ACTIVITY: foreach my $workflowActivityId (qw{pbwfactivity0000000002 pbwfactivity0000000022}) { - my $activity = WebGUI::Workflow::Activity->new($session, $workflowActivityId); - next ACTIVITY unless $activity; - next ACTIVITY unless $activity->get('sizeLimit') == 1_000_000_000; - $activity->set('sizeLimit', 100_000_000); - } - print "DONE!\n" unless $quiet; -} - -#---------------------------------------------------------------------------- -# Describe what our function does -sub growMapPointDataColumns { - my $session = shift; - print "\tIncrease the size of Map Point data columns... " unless $quiet; - foreach my $column (qw{address1 address2 city state zipCode country email}) { - $session->db->write(qq|ALTER TABLE MapPoint MODIFY $column CHAR(35)|); - } - $session->db->write(qq|ALTER TABLE MapPoint MODIFY website CHAR(255)|); - # and here's our code - print "DONE!\n" unless $quiet; -} - -#---------------------------------------------------------------------------- -# Describe what our function does -sub addKarmaToAdSku { - my $session = shift; - print "\tAdd the Karma column to the Ad Sku table... " unless $quiet; - $session->db->write(qq|ALTER TABLE AdSku ADD COLUMN karma INTEGER|); - # and here's our code - 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 diff --git a/docs/upgrades/upgrade_7.8.12-7.8.13.pl b/docs/upgrades/upgrade_7.8.12-7.8.13.pl deleted file mode 100644 index 5435fe2be..000000000 --- a/docs/upgrades/upgrade_7.8.12-7.8.13.pl +++ /dev/null @@ -1,130 +0,0 @@ -#!/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; - - -my $toVersion = '7.8.13'; -my $quiet; # this line required - - -my $session = start(); # this line required - -# upgrade functions go here - -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; -#} - - -# -------------- 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 diff --git a/docs/upgrades/upgrade_7.8.2-7.8.3.pl b/docs/upgrades/upgrade_7.8.2-7.8.3.pl deleted file mode 100644 index 33bd06557..000000000 --- a/docs/upgrades/upgrade_7.8.2-7.8.3.pl +++ /dev/null @@ -1,245 +0,0 @@ -#!/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::Utility; -use WebGUI::ProfileField; - - -my $toVersion = '7.8.3'; -my $quiet; # this line required - - -my $session = start(); # this line required - -# upgrade functions go here -reKeyTemplateAttachments($session); -addSelectPaymentGatewayTemplateToSettings($session); -addClipboardAdminSetting($session); -addTrashAdminSetting($session); -addPickLanguageMacro($session); -installSetLanguage($session); -i18nAbleToBeFriend($session); -addEMSEnhancements($session); -installUPSDriver($session); - -finish($session); # this line required - -#---------------------------------------------------------------------------- -sub addEMSEnhancements { - my $session = shift; - print "\tAdding EMS Enhancements, if needed... " unless $quiet; - my $sth = $session->db->read('describe EventManagementSystem printRemainingTicketsTemplateId'); - if (! defined $sth->hashRef) { - $session->db->write("alter table EventManagementSystem add column printRemainingTicketsTemplateId char(22) not null default 'hreA_bgxiTX-EzWCSZCZJw' after printTicketTemplateId"); - } - print "Done.\n" unless $quiet; -} - - -#---------------------------------------------------------------------------- -sub installUPSDriver { - my $session = shift; - print "\tAdding UPS Shipping Driver... " unless $quiet; - $session->config->addToArray('shippingDrivers', 'WebGUI::Shop::ShipDriver::UPS'); - - print "Done.\n" unless $quiet; -} - -#---------------------------------------------------------------------------- -sub i18nAbleToBeFriend { - my $session = shift; - print "\tInternationalize the Able To Be Friend profile field... " unless $quiet; - my $field = WebGUI::ProfileField->new($session, 'ableToBeFriend'); - if ($field) { - my $props = $field->get(); - $props->{label} = q{WebGUI::International::get('user profile field friend availability','WebGUI')}; - $field->set($props); - } - print "Done.\n" unless $quiet; -} - -#---------------------------------------------------------------------------- -sub addClipboardAdminSetting { - my $session = shift; - print "\tAdding clipboard admin setting... " unless $quiet; - $session->setting->add('groupIdAdminClipboard', 3); - print "Done.\n" unless $quiet; -} - -#---------------------------------------------------------------------------- -sub addTrashAdminSetting { - my $session = shift; - print "\tAdding trash admin setting... " unless $quiet; - $session->setting->add('groupIdAdminTrash', 3); - print "Done.\n" unless $quiet; -} - - -#---------------------------------------------------------------------------- -# Describe what our function does -sub reKeyTemplateAttachments { - my $session = shift; - print "\tChanging the key structure for the template attachments table... " unless $quiet; - my $columnExists = $session->db->dbh->column_info(undef, undef, 'template_attachments', 'attachId')->fetchrow_hashref; - if (! $columnExists) { - # and here's our code - $session->db->write('ALTER TABLE template_attachments ADD COLUMN attachId CHAR(22) BINARY NOT NULL'); - my $rh = $session->db->read('select url, templateId, revisionDate from template_attachments'); - my $wh = $session->db->prepare('update template_attachments set attachId=? where url=? and templateId=? and revisionDate=?'); - while (my @key = $rh->array) { - $wh->execute([$session->id->generate, @key ]); - } - $rh->finish; - $wh->finish; - $session->db->write('ALTER TABLE template_attachments DROP PRIMARY KEY'); - $session->db->write('ALTER TABLE template_attachments ADD PRIMARY KEY (attachId)'); - } - print "DONE!\n" unless $quiet; -} - -#---------------------------------------------------------------------------- -# add default template for selectPaymentGateway -sub addSelectPaymentGatewayTemplateToSettings { - my $session = shift; - print "\tAdding select payment gateway template to settings... " unless $quiet; - $session->setting->add('selectGatewayTemplateId', '2GxjjkRuRkdUg_PccRPjpA') unless $session->setting->has('selectGatewayTemplateId'); - print "Done.\n" unless $quiet; -} - -#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 addPickLanguageMacro { - my $session = shift; - print "\tAdding Pick Language macro... " unless $quiet; - $session->config->set('macros/PickLanguage', 'PickLanguage'); - print "Done.\n" unless $quiet; -} - -#------------------------------------------------------------------------ -sub installSetLanguage { - my $session = shift; - print "\tAdding SetLanguage content handler... " unless $quiet; - ##Content Handler - my $contentHandlers = $session->config->get('contentHandlers'); - if (!isIn('WebGUI::Content::SetLanguage', @{ $contentHandlers }) ) { - my @newHandlers = (); - foreach my $handler (@{ $contentHandlers }) { - push @newHandlers, $handler; - push @newHandlers, 'WebGUI::Content::SetLanguage' if - $handler eq 'WebGUI::Content::PassiveAnalytics'; - } - $session->config->set('contentHandlers', \@newHandlers); - } - 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 diff --git a/docs/upgrades/upgrade_7.8.3-7.8.4.pl b/docs/upgrades/upgrade_7.8.3-7.8.4.pl deleted file mode 100644 index a6055695d..000000000 --- a/docs/upgrades/upgrade_7.8.3-7.8.4.pl +++ /dev/null @@ -1,148 +0,0 @@ -#!/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; - - -my $toVersion = '7.8.4'; -my $quiet; # this line required - - -my $session = start(); # this line required - -# upgrade functions go here -dropSkipNotification($session); -resetShopNotificationGroup($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 dropSkipNotification { - my $session = shift; - print "\tRemoving duplicate skipNotification field from the Subscribable aspect... " unless $quiet; - $session->db->write('alter table assetAspect_Subscribable drop column skipNotification'); - print "Done.\n" unless $quiet; -} - -#------------------------------------------------------------------------ -sub resetShopNotificationGroup { - my $session = shift; - print "\tResetting the shop reciept notification group to Admins if it is set to Everyone... " unless $quiet; - $session->db->write(q{update settings set value='3' where name='shopSaleNotificationGroupId' and value='7'}); - 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 diff --git a/docs/upgrades/upgrade_7.8.4-7.8.5.pl b/docs/upgrades/upgrade_7.8.4-7.8.5.pl deleted file mode 100644 index d5fddd0b6..000000000 --- a/docs/upgrades/upgrade_7.8.4-7.8.5.pl +++ /dev/null @@ -1,361 +0,0 @@ -#!/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; - - -my $toVersion = '7.8.5'; -my $quiet; # this line required - - -my $session = start(); # this line required -fixPackageFlagOnOlder( $session ); -addEMSSubmissionTables($session); -configEMSActivities($session); -removeOldWebGUICSS($session); -addUSPSInternationalShippingDriver( $session ); - -# upgrade functions go here - -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; -#} - -#---------------------------------------------------------------------------- -# Describe what our function does -sub removeOldWebGUICSS { - my $session = shift; - print "\tRemoving the old webgui.css file... " unless $quiet; - my $snippet = WebGUI::Asset->newByDynamicClass($session, 'PcRRPhh-0KfvLLNIPdxJTw'); - if ($snippet) { - $snippet->purge; - } - # and here's our code - print "DONE!\n" unless $quiet; -} - -#---------------------------------------------------------------------------- -# Describe what our function does -sub configEMSActivities { - my $session = shift; - print "\tConfigure EMS Activities... " unless $quiet; - my $config = $session->config; - $config->addToArray('workflowActivities/None', 'WebGUI::Workflow::Activity::CleanupEMSSubmissions'); - $config->addToArray('workflowActivities/None', 'WebGUI::Workflow::Activity::ProcessEMSApprovals'); - my $workflow = WebGUI::Workflow->new($session, 'pbworkflow000000000001'); # Daily - BREAK: { foreach my $activity (@{ $workflow->getActivities }) { - last BREAK if $activity->getName() eq 'WebGUI::Workflow::Activity::CleanupEMSSubmissions'; - } - my $activity = $workflow->addActivity('WebGUI::Workflow::Activity::CleanupEMSSubmissions'); - $activity->set('title', 'Purge Denied EMS Submissions'); - $activity->set('description', 'Purges EMS Submissions that were denied and are aged according to parameters.'); - } # end of BREAK block - $workflow = WebGUI::Workflow->new($session, 'pbworkflow000000000004'); # Hourly - BREAK: { foreach my $activity (@{ $workflow->getActivities }) { - last BREAK if $activity->getName() eq 'WebGUI::Workflow::Activity::ProcessEMSApprovals'; - } - my $activity = $workflow->addActivity('WebGUI::Workflow::Activity::ProcessEMSApprovals'); - $activity->set('title', 'Process Approves EMS Submissions'); - $activity->set('description', 'Create EMS Ticket Assets for approved submissions.'); - } # end of BREAK block - print "DONE!\n" unless $quiet; -} - -#---------------------------------------------------------------------------- -# make database changes relevant to EMS Submission system -sub addEMSSubmissionTables { - my $session = shift; - print "\tCreate EMS Submission Tables... " unless $quiet; - my $db = $session->db; - - $db->write(<write(<write(<write(<write(<write(<write(<write(<write(<config->addToArray('shippingDrivers', 'WebGUI::Shop::ShipDriver::USPSInternational'); - print "DONE!\n" unless $quiet; -} - -sub fixPackageFlagOnOlder { - my $session = shift; - print "\tFixing isPackage flag on folders and isDefault on templates from 7.6.35 to 7.7.17 upgrade. If default templates have been deleted from your site, you may see warnings about not being able to find assets. You may safely ignore those warnings. This entire process may take a while.. " unless $quiet; - - my @assetIds = qw( -AldPGu0u-jm_5xK13atCSQ S3zpVitAmhy58CAioH359Q wAc4azJViVTpo-2NYOXWvg NBVSVNLp9X_bV7WrCprtCA -QHn6T9rU7KsnS3Y70KCNTg ohjyzab5i-yW6GOWTeDUHg AjhlNO3wZvN5k4i4qioWcg matrixtmpl000000000002 -HPDOcsj4gBme8D4svHodBw YP9WaMPJHvCJl-YwrLVcPw qsG6B24a0SC5KrhQjmdZBw matrixtmpl000000000001 -FJbUTvZ2nUTn65LpW6gjsA TvOZs8U1kRXLtwtmyW75pg kwTL1SWCk0GlpiJ5zAAEPQ matrixtmpl000000000003 -75CmQgpcCSkdsL-oawdn3Q PBtmpl0000000000000103 oGfxez5sksyB_PcaAsEm_Q matrixtmpl000000000005 -2CS-BErrjMmESOtGT90qOg PBtmpl0000000000000002 PBtmpl0000000000000065 hkj6WeChxFyqfP85UlRP8w -MBmWlA_YEA2I6D29OMGtRg PBtmpl0000000000000115 GNvjCFQWjY2AF2uf0aCM8Q alraubvBu-YJJ614jAHD5w -IZkrow_zwvbf4FCH-taVTQ PBtmpl0000000000000123 SynConXSLT000000000001 matrixtmpl000000000007 -gfZOwaTWYjbSoVaQtHBBEw zb_OPKNqcTuIjdvvbEkRjw SynConXSLT000000000002 BFfNj5wA9bDw8H3cnr8pTw -c8xrwVuu5QE0XtF9DiVzLw i9-G00ALhJOr0gMh-vHbKA SynConXSLT000000000003 PBtmpl0000000000000093 -0n4HtbXaWa_XJHkFjetnLQ PBtmpl0000000000000135 SynConXSLT000000000004 PBtmpl0000000000000108 -ErEzulFiEKDkaCDVmxUavw PBtmpl0000000000000131 3n3H85BsdeRQ0I08WmvlOg PBtmpl0000000000000117 -6uQEULvXFgCYlRWnYzZsuA PBtmpl0000000000000054 pbtmpl0000000000000221 PBtmpl0000000000000124 -DUoxlTBXhVS-Zl3CFDpt9g PBtmpl0000000000000109 pbtmpl0000000000000220 PBtmpl0000000000000130 -1Q4Je3hKCJzeo0ZBB5YB8g VyCINX2KixKYr2pzQGX9Mg b1316COmd9xRv4fCI3LLGA PBtmpl0000000000000134 -5A8Hd9zXvByTDy4x-H28qw -PkdI8l1idu-8gDX3iOdcw matrixtmpl000000000006 PBtmpl0000000000000136 -VBkY05f-E3WJS50WpdKd1Q VZK3CRgiMb8r4dBjUmCTgQ CarouselTmpl0000000001 PBnav00000000000bullet -XgcsoDrbC0duVla7N7JAdw PBtmpl0000000000000055 RSAMkc6WQmfRE3TOr1_3Mw PBnav00000000indentnav -cR0UFm7I1qUI2Wbpj--08Q i5kt5aodVs_oepNEkE7Okw ExpireIncResptmpl00001 FEDP3dk8J3Chw_gyr7_XEQ -SVIhz68689hwUGgcDM-gWw f_tn9FfoSfKWX43F83v_3w CarouselTmpl0000000002 PBtmpl0000000000000056 -K0YjxqOqr7RupSo6sIdcAg PBtmpl0000000000000200 lo1rpxn3t8YPyKGers5eQg nFen0xjkZn8WkpM93C9ceQ -zrNpGbT3odfIkg6nFSUy8Q tXwf1zaOXTvsqPn6yu-GSw 64tqS80D53Z0JoAs2cX2VQ aIpCmr9Hi__vgdZnDTz1jw -1Yn_zE_dSiNuaBGNLPbxtw PBtmpl0000000000000024 yxD5ka7XHebPLD-LXBwJqw XNd7a_g_cTvJVYrVHcx2Mw -AZFU33p0jpPJ-E6qLSWZng MK4fCNoyrx5SE8eyDfOpxg E3tzZjzhmYoNlAyP2VW33Q g8W53Pd71uHB9pxaXhWf_A -AGJBGviWGAwjnwziiPjvDg PBtmpl0000000000000062 TbDcVLbbznPi0I0rxQf2CQ PBtmpl0000000000000137 -7Ijdd8SW32lVgg2H8R-Aqw 2c4RcwsUfQMup_WNujoTGg A16v-YjWAShXWvSACsraeg PBtmpl0000000000000063 -K8F0j_cq_jgo8dvWY_26Ag olxhUOpdclI-sl4Q5FYNdA 0EAJ9EYb9ap2XwfrcXfdLQ PcRRPhh-0KfvLLNIPdxJTw -G5V6neXIDiFXN05oL-U3AQ CcFIbiAykwArJrJeTPgbDg nWNVoMLrMo059mDRmfOp9g ThingyTmpl000000000001 -_ilRXNR3s8F2vGJ_k9ePcg fCibAeqRifEEAhFL6-pEKg brxm_faNdZX5tRo3p50g3g PBtmpl0000000000000061 -9ThW278DWLV0-Svf68ljFQ 1LiN6-Mh0rXBPoRaG8_BbQ 9j0_Z1j3Jd0QBbY2akb6qw GRUNFctldUgop-qRLuo_DA -AOjPG2NHgfL9Cq6dDJ7mew CGirMWuhmjFFXITINo9djw oHh0UqAJeY7u2n--WD-BAA d8jMMMRddSQ7twP4l1ZSIw -aUDsJ-vB9RgP-AYvPOy8FQ GaBAW-2iVhLMJaZQzVLE5A u9vfx33XDk5la1-QC5FK7g CxMpE_UPauZA3p8jdrOABw --zxyB-O50W8YnL39Ouoc4Q TKmhv8boP3TD2xwSwUBq0g D6cJpRcey35aSkh9Q_FPUQ 1oBRscNIcFOI-pETrCOspA - -qaVcU0FFzzraMX_bzELqzw hIB-z34r8Xl-vYVYCkKr-w _hELmIJfgbAyXFNqPyApxQ -b4n3VyUIsAHyIvT-W-jziA -mPUoFlYcjqjPUPRLAlxNQ _9_eiaPgxzF_x_upt6-PNQ -1IzRpX0tgW7iuCfaU2Kk0A MDpUOR-N8KMyt1J7Hh_h4w kaPRSaf8UKiskiGEgJgLAw -N716tpSna0iIQTKxS4gTWA YfXKByTwDZVituMc4h13Dg bANo8aiAPA7aY_oQZKxIWw -_XfvgNH__bY1ykMiKYSobQ esko_HSU0Gh-uJZ1h3xRmQ 2ci_v2d4x4uvyjTRlC49OA -HW-sPoDDZR8wBZ0YgFgPtg oSqpGswzpBG_ErdfYwIO8A O-EsSzKgAk1KolFT-x_KsA -hBpisL-_URyZnh9clR5ohA MXJklShZvLLB_DSnZQmXrQ fdd8tGExyVwHyrB8RBbKXg -FOBV6KkifreXa4GmEAUU4A BthxD5oJ0idmsyI3ioA2FA BpisgHl4ZDcSECJp6oib1w -PBtmpl0000000000000001 aZ-1HYQamkRHYXvzAra8WQ zshreRgPAXtnF0DtVbQ1Yg -PBtmpl0000000000000016 eRkb94OYcS5AdcrrerOP5Q POVcY79vIqAHR8OfGt36aw -PBtmpl0000000000000011 TbnkjAJQEASORXIpYqDkcA -kj3b-X3i6zRKnhLb4ZiCLw er-3faBjY-hhlDcc5aKqdQ -CalendarMonth000000001 8bFsu2FJUqHRUiHcozcVFw -PBtmpl0000000000000081 34Aayx5eA320D8VfhdfDBw -BMybD3cEnmXVk2wQ_qEsRQ TlhKOVmWblZOsAdqmhEpeg -2rC4ErZ3c77OJzJm7O5s3w Nx0ypjO3cN6QdZUBUEE0lA -GYaFxnMu9UsEG8oanwB6TA CmFZLN7iPS7XXvUEsxKPKA -PBtmpl0000000000000078 v_XBgwwZqgW1D5s4y05qfg -gI_TxK-5S4DNuv42wpImmw 4TdAkKoQbSCvI7QWcW889A -jME5BEDYVDlBZ8jIQA9-jQ SAgK6eDPCG1cgkJ59WapHQ -azCqD0IjdQSlM3ar29k5Sg XJYLuvGy9ubF7JNKyINtpA -05FpjceLYhq4csF1Kww1KQ RWj7hyv2SpZuXxwj1Wocug -q5O62aH4pjUXsrQR3Pq4lw aq8QElnlm3YufAoxRz9Pcg -KAMdiUdJykjN02CPHpyZOw mM3bjP_iG9sv5nQb4S17tQ -OkphOEdaSGTXnFGhK4GT5A ilu5BrM-VGaOsec9Lm7M6Q -TEId5V-jEvUULsZA0wuRuA -ANLpoTEP-n4POAdRxCzRw -6X-7Twabn5KKO_AbgK3PEw OxJWQgnGsgyGohP2L3zJPQ -7JCTAiu1U_bT9ldr655Blw 7fE8md51vTCcuJFOvxNaGA -0X4Q3tBWUb_thsVbsYz9xQ 1oGhfj00KkCzP1ez01AfKA -m3IbBavqzuKDd2PGGhKPlA 3qiVYhNTXMVC5hfsumVHgg -UTNFeV7B_aSCRmmaFCq4Vw THQhn1C-ooj-TLlEP7aIJQ -zcX-wIUct0S_np14xxOA-A tPagC0AQErZXjLFZQ6OI1g -MBZK_LPVzqhb4TV4mMRTJg PBtmpl0000000000000088 -); - - for my $assetId ( @assetIds ) { - my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId ); - next unless $asset; - my $data = {}; - if( $asset->get('isPackage') ) { - $data->{isPackage} = 0; - } - if( $asset->isa('WebGUI::Asset::Template') ) { - $data->{isDefault} = 1; - } - if (scalar keys %{ $data }) { - print "\n\t\tUpdating ".$asset->getTitle." ... " unless $quiet; - $asset->update($data); - } - } - - 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 diff --git a/docs/upgrades/upgrade_7.8.5-7.8.6.pl b/docs/upgrades/upgrade_7.8.5-7.8.6.pl deleted file mode 100644 index 1c3374a44..000000000 --- a/docs/upgrades/upgrade_7.8.5-7.8.6.pl +++ /dev/null @@ -1,141 +0,0 @@ -#!/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; - - -my $toVersion = '7.8.6'; -my $quiet; # this line required - - -my $session = start(); # this line required - -# upgrade functions go here -addMaxCacheOverrideSetting($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; -#} - -#---------------------------------------------------------------------------- -# Describe what our function does -sub addMaxCacheOverrideSetting { - my $session = shift; - print "\tAdding maximum cache timeout setting... " unless $quiet; - # and here's our code - $session->setting->add('maxCacheTimeout', 86400) unless $session->setting->has('maxCacheTimeout'); - 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 diff --git a/docs/upgrades/upgrade_7.8.6-7.8.7.pl b/docs/upgrades/upgrade_7.8.6-7.8.7.pl deleted file mode 100644 index 86f93c6be..000000000 --- a/docs/upgrades/upgrade_7.8.6-7.8.7.pl +++ /dev/null @@ -1,174 +0,0 @@ -#!/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::Workflow::Cron; -use WebGUI::Asset::Wobject::Collaboration; - - -my $toVersion = '7.8.7'; -my $quiet; # this line required - - -my $session = start(); # this line required - -# upgrade functions go here -clearOrphanedCSMailCronJobs($session); -deleteExtraCronJobsForCS($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; -#} - -#---------------------------------------------------------------------------- -# Describe what our function does -sub clearOrphanedCSMailCronJobs { - my $session = shift; - print "\tClear orphaned csworkflow000000000001 Cron Jobs with no CS attached... " unless $quiet; - my $crons = WebGUI::Workflow::Cron->getAllTasks($session); - ##This section of code handles cron jobs created for CS'es where the revision of the - ##CS with the cron has been deleted. - CRON: foreach my $cron (@{ $crons }) { - next CRON unless $cron->get('workflowId') eq 'csworkflow000000000001'; - my $assetId = $cron->get('parameters'); - my $asset = WebGUI::Asset->newByDynamicClass($session, $assetId); - next CRON if $asset; - print "\n\t\tDeleting ".$cron->get('title') unless $quiet; - $cron->delete; - } - print "\tDONE!\n" unless $quiet; -} - -#---------------------------------------------------------------------------- -# Describe what our function does -sub deleteExtraCronJobsForCS { - my $session = shift; - print "\tGuarantee that each CS has one and only one Cron job. Older jobs will be deleted... " unless $quiet; - my $cses = WebGUI::Asset::Wobject::Collaboration->getIsa($session, 0, { returnAll => 1 } ); - CS: while( my $cs = $cses->() ) { - my @cronIds = $session->db->buildArray('select distinct(getMailCronId) from Collaboration where assetId=?',[$cs->getId]); - next CS unless @cronIds > 1; - my @oldCronIds = grep { $_ ne $cs->get('getMailCronId') } @cronIds; - CRON: foreach my $cronId (@oldCronIds) { - my $cron = WebGUI::Workflow::Cron->new($session, $cronId); - next CRON unless $cron; - print "\n\t\tDeleting ".$cron->get('title') unless $quiet; - $cron->delete; - } - $session->db->write('update Collaboration set getMailCronId=? where assetId=?', [$cs->get('getMailCronId'), $cs->getId]); - } - print "\tDONE!\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 diff --git a/docs/upgrades/upgrade_7.8.7-7.8.8.pl b/docs/upgrades/upgrade_7.8.7-7.8.8.pl deleted file mode 100644 index 6185d5d0e..000000000 --- a/docs/upgrades/upgrade_7.8.7-7.8.8.pl +++ /dev/null @@ -1,145 +0,0 @@ -#!/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; - - -my $toVersion = '7.8.8'; -my $quiet; # this line required - - -my $session = start(); # this line required - -# upgrade functions go here -deleteFieldFromEMSSubmission($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; -#} - -#---------------------------------------------------------------------------- -# Drop send mail on change collumn from ems submission table -sub deleteFieldFromEMSSubmission { - my $session = shift; - print "\tDrop collumn from EMS Submission Table... " unless $quiet; - my $db = $session->db; - - $db->write(<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 diff --git a/docs/upgrades/upgrade_7.8.8-7.8.9.pl b/docs/upgrades/upgrade_7.8.8-7.8.9.pl deleted file mode 100644 index d49ab1817..000000000 --- a/docs/upgrades/upgrade_7.8.8-7.8.9.pl +++ /dev/null @@ -1,141 +0,0 @@ -#!/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; - - -my $toVersion = '7.8.9'; -my $quiet; # this line required - - -my $session = start(); # this line required - -# upgrade functions go here -addEuTaxRecheckWorkflow( $session ); - -finish($session); # this line required - - -#---------------------------------------------------------------------------- -sub addEuTaxRecheckWorkflow { - my $session = shift; - - print "\tAdding EU Tax plugin VAT number recheck workflow..." unless $quiet; - - my $workflow = WebGUI::Workflow->create( $session, { - title => 'Recheck unverified EU VAT numbers', - description => - 'Utility workflow that automatically rechecks VAT numbers that could not be checked when they were submitted', - enabled => 1, - type => 'None', - mode => 'parallel', - }, 'taxeurecheckworkflow01' ); - $workflow->addActivity( 'WebGUI::Workflow::Activity::RecheckVATNumber', 'taxeurecheckactivity01' ); - - 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 diff --git a/docs/upgrades/upgrade_7.8.9-7.8.10.pl b/docs/upgrades/upgrade_7.8.9-7.8.10.pl deleted file mode 100644 index 29269a11a..000000000 --- a/docs/upgrades/upgrade_7.8.9-7.8.10.pl +++ /dev/null @@ -1,146 +0,0 @@ -#!/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::Asset::Wobject::Collaboration; - - -my $toVersion = '7.8.10'; -my $quiet; # this line required - - -my $session = start(); # this line required - -# upgrade functions go here -recountCsThreads($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; -#} - -#---------------------------------------------------------------------------- -# Describe what our function does -sub recountCsThreads { - my $session = shift; - print "\tRecount all threads in each CS on the site. This may take a long time... " unless $quiet; - # and here's our code - my $iterator = WebGUI::Asset::Wobject::Collaboration->getIsa($session); - while ( my $cs = $iterator->() ) { - print "\n\t\tRecounting ".$cs->getTitle." ..." unless $quiet; - $cs->incrementReplies($cs->get('lastPostDate'), $cs->get('lastPostId')); - } - 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