1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
# Movable Type (r) Open Source (C) 2001-2012 Six Apart, Ltd.
# This program is distributed under the terms of the
# GNU General Public License, version 2.
#
# $Id$
package MT::Upgrade::v2;
use strict;
sub upgrade_functions {
return {
# < 2.1
'core_fix_placement_blog_ids' => {
version_limit => 2.1,
priority => 9.2,
updater => {
type => 'placement',
label => 'Updating category placements...',
condition => sub { !$_[0]->blog_id },
code => sub {
require MT::Category;
my $cat = MT::Category->load( $_[0]->category_id );
$_[0]->blog_id( $cat->blog_id ) if $cat;
},
},
},
# < 3.0
'core_set_blog_allow_comments' => {
version_limit => 3.0,
priority => 9.3,
updater => {
type => 'blog',
label => 'Assigning comment/moderation settings...',
condition => sub {
!( defined $_[0]->allow_unreg_comments
|| defined $_[0]->allow_reg_comments
|| defined $_[0]->manual_approve_comments
|| defined $_[0]->moderate_unreg_comments );
},
code => sub {
$_[0]->allow_unreg_comments(1)
unless defined $_[0]->allow_unreg_comments;
$_[0]->allow_reg_comments(1)
unless defined $_[0]->allow_reg_comments;
$_[0]->manual_approve_commenters(0)
unless defined $_[0]->manual_approve_commenters;
$_[0]->moderate_unreg_comments(0)
unless defined $_[0]->moderate_unreg_comments;
$_[0]->moderate_pings(0)
unless defined $_[0]->moderate_pings;
},
sql => [
'update mt_blog
set blog_allow_unreg_comments = 1
where blog_allow_unreg_comments is null',
'update mt_blog
set blog_allow_reg_comments = 1
where blog_allow_reg_comments is null',
'update mt_blog
set blog_manual_approve_commenters = 0
where blog_manual_approve_commenters is null',
'update mt_blog
set blog_moderate_unreg_comments = 0
where blog_moderate_unreg_comments is null'
],
},
},
};
}
1;
|