remove orphaned version tags
This commit is contained in:
parent
d8ae7fc68e
commit
c671e94056
1 changed files with 23 additions and 0 deletions
|
|
@ -37,6 +37,7 @@ addInboxSmsNotificationTemplateIdSetting($session);
|
|||
upgradeJSONDatabaseFields($session);
|
||||
moveCalendarFeedsToJSON($session);
|
||||
addEmsScheduleColumnsDefaultValue($session);
|
||||
removeOrphanedVersionTags( $session );
|
||||
finish($session); # this line required
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -131,6 +132,28 @@ sub moveCalendarFeedsToJSON {
|
|||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Remove the orphan version tags, tags with no revisions in them
|
||||
sub removeOrphanedVersionTags {
|
||||
my $session = shift;
|
||||
print "\tRemoving orphan version tags (this may take a while)... " unless $quiet;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue