Exemple #1
0
require_once dirname(__FILE__) . '/commandLine.inc';
require "updaters.inc";
$wgTitle = Title::newFromText("MediaWiki database updater");
echo "MediaWiki {$wgVersion} Updater\n\n";
if (!isset($options['skip-compat-checks'])) {
    install_version_checks();
} else {
    print "Skipping compatibility checks, proceed at your own risk (Ctrl+C to abort)\n";
    wfCountdown(5);
}
# Attempt to connect to the database as a privileged user
# This will vomit up an error if there are permissions problems
$wgDatabase = wfGetDB(DB_MASTER);
print "Going to run database updates for " . wfWikiID() . "\n";
print "Depending on the size of your database this may take a while!\n";
if (!isset($options['quick'])) {
    print "Abort with control-c in the next five seconds (skip this countdown with --quick) ... ";
    wfCountDown(5);
}
$shared = isset($options['doshared']);
$purge = !isset($options['nopurge']);
do_all_updates($shared, $purge);
print "Done.\n";
function wfSetupUpdateScript()
{
    global $wgLocalisationCacheConf;
    # Don't try to access the database
    # This needs to be disabled early since extensions will try to use the l10n
    # cache from $wgExtensionSetupFunctions (bug 20471)
    $wgLocalisationCacheConf = array('class' => 'LocalisationCache', 'storeClass' => 'LCStore_Null', 'storeDirectory' => false, 'manualRecache' => false);
}
                 print "<li>Granting user permissions...";
                 if ($mysqlOldClient && $mysqlNewAuth) {
                     print " <b class='error'>If the next step fails, see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'>http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>";
                 }
                 print "</li>\n";
                 $res = $wgDatabase->sourceFile("../maintenance/users.sql");
                 if ($res !== true) {
                     dieout($res);
                 }
             }
         }
     }
     print "</ul><pre>\n";
     chdir("..");
     flush();
     do_all_updates();
     chdir("config");
     print "</pre>\n";
     print "<ul><li>Finished update checks.</li>\n";
     // if tables don't yet exist
 } else {
     # Determine available storage engines if possible
     if ($conf->DBtype == 'mysql' && version_compare($myver, "4.1.2", "ge")) {
         $res = $wgDatabase->query('SHOW ENGINES');
         $found = false;
         while ($row = $wgDatabase->fetchObject($res)) {
             if ($row->Engine == $conf->DBengine && ($row->Support == 'YES' || $row->Support == 'DEFAULT')) {
                 $found = true;
                 break;
             }
         }
Exemple #3
0
}
# Attempt to connect to the database as a privileged user
# This will vomit up an error if there are permissions problems
$wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname, 1);
if (!$wgDatabase->isOpen()) {
    # Appears to have failed
    echo "A connection to the database could not be established. Check the\n";
    # Let's be a bit clever and guess at what's wrong
    if (isset($wgDBadminuser) && isset($wgDBadminpassword)) {
        # Tell the user the value(s) are wrong
        echo 'values of $wgDBadminuser and $wgDBadminpassword.' . "\n";
    }
    exit;
}
print "Going to run database updates for {$wgDBname}\n";
print "Depending on the size of your database this may take a while!\n";
if (!isset($options['quick'])) {
    print "Abort with control-c in the next five seconds... ";
    for ($i = 6; $i >= 1;) {
        print_c($i, --$i);
        sleep(1);
    }
    echo "\n";
}
if (isset($options['doshared'])) {
    $doShared = true;
} else {
    $doShared = false;
}
do_all_updates($doShared);
print "Done.\n";