Skip to content

Instantly share code, notes, and snippets.

@preaction
Created September 1, 2009 22:19
Show Gist options
  • Save preaction/179429 to your computer and use it in GitHub Desktop.
Save preaction/179429 to your computer and use it in GitHub Desktop.
#----------------------------------------------------------------------------
# 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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment