fixed upgrade problem caused by allowMedia rich editor addition

This commit is contained in:
Doug Bell 2008-06-20 20:50:48 +00:00
parent abfbaf5242
commit 658335ac2b
3 changed files with 24 additions and 0 deletions

View file

@ -3,6 +3,7 @@
- fixed: Non-admin users can now add Gallery assets
- fixed: Thingy Data now retains File and Images if they aren't explicitly deleted
- fixed: Rich Editor no longer makes other form controls show up as code in Safari 3
- fixed: allowMedia addition to Rich Editor no longer causes upgrade problems
- fixed: Shop->hasShippingAddress help grammatical error
- fixed: can now turn off inheritUrlFromParent and the code is now more
robust, moved from Asset->update to Asset->fixUrl.

View file

@ -42,6 +42,15 @@ sub addRichEditMedia {
my $session = shift;
print "\tAdding Media switch to Rich Edit..." unless $quiet;
# Make sure it wasn't added by previous upgrade
my $sth = $session->db->read('DESCRIBE `RichEdit`');
while (my ($col) = $sth->array) {
if ( $col eq 'allowMedia' ) {
print "Already done, skipping.\n" unless $quiet;
return;
}
}
$session->db->write(
q{ ALTER TABLE RichEdit ADD COLUMN allowMedia INT },
);

View file

@ -29,6 +29,7 @@ my $quiet; # this line required
my $session = start(); # this line required
addRichEditInlinePopup($session);
addRichEditMedia( $session );
updateRichEditorButtons($session);
setPMFloatingDuration($session);
@ -59,6 +60,19 @@ sub addRichEditInlinePopup {
print "Done!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Add the "allowMedia" field to Rich Edit assets
sub addRichEditMedia {
my $session = shift;
print "\tAdding Media switch to Rich Edit..." unless $quiet;
$session->db->write(
q{ ALTER TABLE RichEdit ADD COLUMN allowMedia INT },
);
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub updateRichEditorButtons {
my $session = shift;