@Ghazascanner
_2019runbot
Ghazascanner File Manager
server :Linux phosweb011 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64
Current Path :
/
homepage
/
v-mt
/
tools
/
Path :
Upload File :
New :
File
Dir
//homepage/v-mt/tools/upgrade
#!/usr/bin/perl -w # Movable Type (r) (C) 2001-2008 Six Apart, Ltd. All Rights Reserved. # This code cannot be redistributed without permission from www.sixapart.com. # For more information, consult your Movable Type license. # # $Id$ use strict; use Getopt::Long; use Carp qw(confess); GetOptions("dryrun", \my($dryrun), "name:s", \my($name), "sql", \my($sqlonly)); use lib 'extlib'; use lib 'lib'; use MT; use MT::Upgrade; my $mt = new MT(Config => 'mt.cfg') or die MT->errstr; MT->add_callback('MT::Upgrade::SQL', 1, undef, \&sql_cb) if $sqlonly; $dryrun = 1 if $sqlonly; if (!$sqlonly) { print "upgrade -- A command line tool for upgrading the schema for Movable Type.\n"; print "(Non-destructive mode)\n" if $dryrun; } my $install; my $driver = MT::Object->driver; if (!$driver || !$driver->table_exists('MT::Author')) { $install = 1; } unless ($install || $name) { print "Please set username to set superuser at upgrading. cf: upgrade --name Melody\n"; exit; } my $author_id; if (!$install && $name) { require MT::BasicAuthor; my $a = MT::BasicAuthor->load({name => $name}); die "Not found user $name:" . MT::BasicAuthor->errstr if !$a; $author_id = $a->id || 0; } my $updated = MT::Upgrade->do_upgrade(App => 'main', DryRun => $dryrun, Install => $install, SuperUser => $author_id, CLI => 1, ); if ($install) { print "Installation complete.\n"; } else { print "Upgrade complete!\n" if !$dryrun && $updated; print "Your schema is up to date already.\n" if defined $updated && !$updated; } sub progress { my $pkg = shift; my $msg = shift; print "\t* " . $msg . "\n" unless $sqlonly; } sub error { my $pkg = shift; my $err = shift; confess $err; } sub sql_cb { my $cb = shift; my ($upgrade, $stmt) = @_; print "$stmt\n"; }