From fb33859cc686061088910893afb45fbd84944b78 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Thu, 13 Dec 2007 20:13:27 +0000 Subject: [PATCH] fix: when upgrading, two revisions of same asset in same second broke upgrade --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/AssetVersioning.pm | 18 +++++++++++++----- sbin/upgrade.pl | 1 + 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 42484418c..9ac7f803a 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -13,6 +13,7 @@ - fix: Import Package does nothing when re-importing trashed package - fix: CS Posts get re-ordered when copy/paste - fix: Matrix best/worst now must have 10 or more votes + - fix: When upgrading, two revisions of same asset added in same second. 7.4.18 - fix: Graph draws black triangle covering half the image diff --git a/lib/WebGUI/AssetVersioning.pm b/lib/WebGUI/AssetVersioning.pm index d85035c98..7eeff27d6 100644 --- a/lib/WebGUI/AssetVersioning.pm +++ b/lib/WebGUI/AssetVersioning.pm @@ -44,23 +44,28 @@ These methods are available from this class: =cut -#------------------------------------------------------------------- +#---------------------------------------------------------------------------- =head2 addRevision ( properties [ , revisionDate, options ] ) Creates a new revision of an existing asset. Returns the new revision of the asset. -Note that programmers should almost never call this method directly, but +Programmers should almost never call this method directly, but rather use the update() method instead. +When using this method, take care that an asset doesn't try to add two +revisions of the same asset within the same second. It will cause things to +fail. This is not a bug + =head3 properties A hash reference containing a list of properties to associate with the child. =head3 revisionDate -An epoch date representing the date/time stamp that this revision was created. Defaults to$self->session->datetime->time(). +An epoch date representing the date/time stamp that this revision was +created. Defaults to $self->session->datetime->time(). =head3 options @@ -68,11 +73,14 @@ A hash reference of options that change the behavior of this method. =head4 skipAutoCommitWorkflows -If this is set to 1 then assets that would normally autocommit their workflow (like CS Posts) will instead add themselves to the normal working version tag. +If this is set to 1 then assets that would normally autocommit their +workflow (like CS Posts) will instead add themselves to the normal working +version tag. =head4 skipNotification -If this is set to 1 then assets that normally send notifications will (like CS Posts) will know not to send them under certain conditions. +If this is set to 1 then assets that normally send notifications will (like CS +Posts) will know not to send them under certain conditions. =cut diff --git a/sbin/upgrade.pl b/sbin/upgrade.pl index b30180031..06f43b763 100644 --- a/sbin/upgrade.pl +++ b/sbin/upgrade.pl @@ -290,6 +290,7 @@ foreach my $filename (keys %config) { } $config{$filename}{version} = $upgrade{$upgrade}{to}; $notRun = 0; + sleep 1; # Sleep a second to avoid adding asset revisions too quickly } my $session = WebGUI::Session->open("../..",$filename); print "\tSetting site upgrade completed..." unless ($quiet);