Exemplo n.º 1
0
function addWiki($lang, $site, $dbName)
{
    global $IP, $wgLanguageNames, $wgDefaultExternalStore;
    $name = $wgLanguageNames[$lang];
    $dbw =& wfGetDB(DB_WRITE);
    $common = "/home/wikipedia/common";
    $maintenance = "{$IP}/maintenance";
    print "Creating database {$dbName} for {$lang}.{$site}\n";
    # Set up the database
    $dbw->query("SET table_type=Innodb");
    $dbw->query("CREATE DATABASE {$dbName}");
    $dbw->selectDB($dbName);
    print "Initialising tables\n";
    dbsource("{$maintenance}/tables.sql", $dbw);
    dbsource("{$IP}/extensions/OAI/update_table.sql", $dbw);
    $dbw->query("INSERT INTO site_stats(ss_row_id) VALUES (1)");
    # Initialise external storage
    if ($wgDefaultExternalStore && preg_match('!^DB://(.*)$!', $wgDefaultExternalStore, $m)) {
        print "Initialising external storage...\n";
        require_once 'ExternalStoreDB.php';
        global $wgDBuser, $wgDBpassword, $wgExternalServers;
        $cluster = $m[1];
        # Hack
        $wgExternalServers[$cluster][0]['user'] = $wgDBuser;
        $wgExternalServers[$cluster][0]['password'] = $wgDBpassword;
        $store = new ExternalStoreDB();
        $extdb =& $store->getMaster($cluster);
        $extdb->query("SET table_type=InnoDB");
        $extdb->query("CREATE DATABASE {$dbName}");
        $extdb->selectDB($dbName);
        dbsource("{$maintenance}/storage/blobs.sql", $extdb);
        $extdb->immediateCommit();
    }
    $wgTitle = Title::newMainPage();
    $wgArticle = new Article($wgTitle);
    $ucsite = ucfirst($site);
    $wgArticle->insertNewArticle("\n==This subdomain is reserved for the creation of a {$ucsite} in '''[[:en:{$name}|{$name}]]''' language==\n\nIf you can write in this language and want to collaborate in the creation of this encyclopedia then '''you''' can make it.\n\nGo ahead. Translate this page and start working on your encyclopedia.\n\nFor help, see '''[[m:Help:How to start a new Wikipedia|how to start a new Wikipedia]]'''.\n\n==Sister projects==\n[http://meta.wikipedia.org Meta-Wikipedia] | [http://www.wiktionary.org Wikitonary] | [http://www.wikibooks.org Wikibooks] | [http://www.wikinews.org Wikinews] | [http://www.wikiquote.org Wikiquote] | [http://www.wikisource.org Wikisource]\n\nSee the [http://www.wikipedia.org Wikipedia portal] for other language Wikipedias.\n\n[[aa:]]\n[[af:]]\n[[als:]]\n[[ar:]]\n[[de:]]\n[[en:]]\n[[as:]]\n[[ast:]]\n[[ay:]]\n[[az:]]\n[[be:]]\n[[bg:]]\n[[bn:]]\n[[bo:]]\n[[bs:]]\n[[cs:]]\n[[co:]]\n[[cs:]]\n[[cy:]]\n[[da:]]\n[[el:]]\n[[eo:]]\n[[es:]]\n[[et:]]\n[[eu:]]\n[[fa:]]\n[[fi:]]\n[[fr:]]\n[[fy:]]\n[[ga:]]\n[[gl:]]\n[[gn:]]\n[[gu:]]\n[[he:]]\n[[hi:]]\n[[hr:]]\n[[hy:]]\n[[ia:]]\n[[id:]]\n[[is:]]\n[[it:]]\n[[ja:]]\n[[ka:]]\n[[kk:]]\n[[km:]]\n[[kn:]]\n[[ko:]]\n[[ks:]]\n[[ku:]]\n[[ky:]]\n[[la:]]\n[[ln:]]\n[[lo:]]\n[[lt:]]\n[[lv:]]\n[[hu:]]\n[[mi:]]\n[[mk:]]\n[[ml:]]\n[[mn:]]\n[[mr:]]\n[[ms:]]\n[[mt:]]\n[[my:]]\n[[na:]]\n[[nah:]]\n[[nds:]]\n[[ne:]]\n[[nl:]]\n[[no:]]\n[[oc:]]\n[[om:]]\n[[pa:]]\n[[pl:]]\n[[ps:]]\n[[pt:]]\n[[qu:]]\n[[ro:]]\n[[ru:]]\n[[sa:]]\n[[si:]]\n[[sk:]]\n[[sl:]]\n[[sq:]]\n[[sr:]]\n[[sv:]]\n[[sw:]]\n[[ta:]]\n[[te:]]\n[[tg:]]\n[[th:]]\n[[tk:]]\n[[tl:]]\n[[tr:]]\n[[tt:]]\n[[ug:]]\n[[uk:]]\n[[ur:]]\n[[uz:]]\n[[vi:]]\n[[vo:]]\n[[xh:]]\n[[yo:]]\n[[za:]]\n[[zh:]]\n[[zu:]]\n", '', false, false);
    print "Adding to dblists\n";
    # Add to dblist
    $file = fopen("{$common}/all.dblist", "a");
    fwrite($file, "{$dbName}\n");
    fclose($file);
    # Update the sublists
    system("cd {$common} && ./refresh-dblist");
    print "Constructing interwiki SQL\n";
    # Rebuild interwiki tables
    $sql = getRebuildInterwikiSQL();
    $tempname = tempnam('/tmp', 'addwiki');
    $file = fopen($tempname, 'w');
    if (!$file) {
        wfDie("Error, unable to open temporary file {$tempname}\n");
    }
    fwrite($file, $sql);
    fclose($file);
    print "Sourcing interwiki SQL\n";
    dbsource($tempname, $dbw);
    unlink($tempname);
    print "Script ended. You now want to run sync-common-all to publish *dblist files (check them for duplicates first)\n";
}
Exemplo n.º 2
0
 function ChangePassword($user, $password)
 {
     global $USAGE;
     if (!strlen($user) or !strlen($password)) {
         wfDie($USAGE);
     }
     $this->user = User::newFromName($user);
     if (!$this->user->getId()) {
         die("No such user: {$user}\n");
     }
     $this->password = $password;
     $this->dbw = wfGetDB(DB_MASTER);
 }
Exemplo n.º 3
0
 function dump()
 {
     # This shouldn't happen if on console... ;)
     header('Content-type: text/html; charset=UTF-8');
     # Notice messages will foul up your XML output even if they're
     # relatively harmless.
     //		ini_set( 'display_errors', false );
     $this->initProgress($this->history);
     $this->db =& $this->backupDb();
     $this->egress = new ExportProgressFilter($this->sink, $this);
     $input = fopen($this->input, "rt");
     $result = $this->readDump($input);
     if (WikiError::isError($result)) {
         wfDie($result->getMessage());
     }
     $this->report(true);
 }
Exemplo n.º 4
0
 /**
  * Usually aborts on failure
  * If the failFunction is set to a non-zero integer, returns success
  */
 function open($server, $user, $password, $dbName)
 {
     if (!function_exists('oci_connect')) {
         wfDie("Oracle functions missing, have you compiled PHP with the --with-oci8 option?\n");
     }
     $this->close();
     $this->mServer = $server;
     $this->mUser = $user;
     $this->mPassword = $password;
     $this->mDBname = $dbName;
     $success = false;
     $hstring = "";
     $this->mConn = oci_new_connect($user, $password, $dbName, "AL32UTF8");
     if ($this->mConn === false) {
         wfDebug("DB connection error\n");
         wfDebug("Server: {$server}, Database: {$dbName}, User: {$user}, Password: "******"...\n");
         wfDebug($this->lastError() . "\n");
     } else {
         $this->mOpened = true;
     }
     return $this->mConn;
 }
 /**
  * @param string $serverType
  * @param array $tables
  */
 protected function buildTestDatabase($tables)
 {
     global $testOptions, $wgDBprefix, $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname;
     $wgDBprefix = 'parsertest';
     $db = new Database($wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname);
     if ($db->isOpen()) {
         if (!(strcmp($db->getServerVersion(), '4.1') < 0 and stristr($db->getSoftwareLink(), 'MySQL'))) {
             # Database that supports CREATE TABLE ... LIKE
             foreach ($tables as $tbl) {
                 $newTableName = $db->tableName($tbl);
                 #$tableName = $this->oldTableNames[$tbl];
                 $tableName = $tbl;
                 $db->query("CREATE TEMPORARY TABLE {$newTableName} (LIKE {$tableName})");
             }
         } else {
             # Hack for MySQL versions < 4.1, which don't support
             # "CREATE TABLE ... LIKE". Note that
             # "CREATE TEMPORARY TABLE ... SELECT * FROM ... LIMIT 0"
             # would not create the indexes we need....
             foreach ($tables as $tbl) {
                 $res = $db->query("SHOW CREATE TABLE {$tbl}");
                 $row = $db->fetchRow($res);
                 $create = $row[1];
                 $create_tmp = preg_replace('/CREATE TABLE `(.*?)`/', 'CREATE TEMPORARY TABLE `' . $wgDBprefix . '\\1`', $create);
                 if ($create === $create_tmp) {
                     # Couldn't do replacement
                     wfDie("could not create temporary table {$tbl}");
                 }
                 $db->query($create_tmp);
             }
         }
         return $db;
     } else {
         // Something amiss
         return null;
     }
 }
Exemplo n.º 6
0
 function moveInconsistentPage($row, $title)
 {
     if ($title->exists() || $title->getInterwiki()) {
         if ($title->getInterwiki()) {
             $prior = $title->getPrefixedDbKey();
         } else {
             $prior = $title->getDbKey();
         }
         $clean = 'Broken/' . $prior;
         $verified = Title::makeTitleSafe($row->page_namespace, $clean);
         if ($verified->exists()) {
             $blah = "Broken/id:" . $row->page_id;
             $this->log("Couldn't legalize; form '{$clean}' exists; using '{$blah}'");
             $verified = Title::makeTitleSafe($row->page_namespace, $blah);
         }
         $title = $verified;
     }
     if (is_null($title)) {
         wfDie("Something awry; empty title.\n");
     }
     $ns = $title->getNamespace();
     $dest = $title->getDbKey();
     if ($this->dryrun) {
         $this->log("DRY RUN: would rename {$row->page_id} ({$row->page_namespace},'{$row->page_title}') to ({$row->page_namespace},'{$dest}')");
     } else {
         $this->log("renaming {$row->page_id} ({$row->page_namespace},'{$row->page_title}') to ({$ns},'{$dest}')");
         $dbw =& wfGetDB(DB_MASTER);
         $dbw->update('page', array('page_namespace' => $ns, 'page_title' => $dest), array('page_id' => $row->page_id), 'cleanupTitles::moveInconsistentPage');
         $linkCache =& LinkCache::singleton();
         $linkCache->clear();
     }
 }
Exemplo n.º 7
0
    }
    function importFromHandle($handle)
    {
        $this->startTime = wfTime();
        $source = new ImportStreamSource($handle);
        $importer = new WikiImporter($source);
        $importer->setDebug($this->debug);
        $importer->setPageCallback(array(&$this, 'reportPage'));
        $this->importCallback = $importer->setRevisionCallback(array(&$this, 'handleRevision'));
        $this->uploadCallback = $importer->setUploadCallback(array(&$this, 'handleUpload'));
        $this->logItemCallback = $importer->setLogItemCallback(array(&$this, 'handleLogItem'));
        return $importer->doImport();
    }
}
if (wfReadOnly()) {
    wfDie("Wiki is in read-only mode; you'll need to disable it for import to work.\n");
}
$reader = new BackupReader();
if (isset($options['quiet'])) {
    $reader->reporting = false;
}
if (isset($options['report'])) {
    $reader->reportingInterval = intval($options['report']);
}
if (isset($options['dry-run'])) {
    $reader->dryRun = true;
}
if (isset($options['debug'])) {
    $reader->debug = true;
}
if (isset($options['uploads'])) {
Exemplo n.º 8
0
<?php

/**
 * Dumb program that tries to get the memory usage
 * for each language file.
 */
/** This is a command line script */
require_once dirname(__FILE__) . '/../commandLine.inc';
require_once dirname(__FILE__) . '/languages.inc';
$langtool = new languages();
if (!function_exists('memory_get_usage')) {
    wfDie("You must compile PHP with --enable-memory-limit\n");
}
$memlast = $memstart = memory_get_usage();
print 'Base memory usage: ' . $memstart . "\n";
foreach ($langtool->getLanguages() as $langcode) {
    Language::factory($langcode);
    $memstep = memory_get_usage();
    printf("%12s: %d\n", $langcode, $memstep - $memlast);
    $memlast = $memstep;
}
$memend = memory_get_usage();
echo ' Total Usage: ' . ($memend - $memstart) . "\n";
Exemplo n.º 9
0
 public function run(PHPUnit_Framework_TestResult $result = NULL)
 {
     PHPUnit_Framework_Assert::resetCount();
     if ($result === NULL) {
         $result = new PHPUnit_Framework_TestResult();
     }
     $t = MediaWikiParserTestSuite::$iter->current();
     $k = MediaWikiParserTestSuite::$iter->key();
     if (!MediaWikiParserTestSuite::$iter->valid()) {
         return;
     }
     // The only way this should happen is if the parserTest.txt
     // file were modified while the script is running.
     if ($k != $this->number) {
         $i = $this->number;
         wfDie("I got confused!\n");
     }
     $result->startTest($this);
     PHPUnit_Util_Timer::start();
     $r = false;
     try {
         $r = MediaWikiParserTestSuite::$parser->runTest($t['test'], $t['input'], $t['result'], $t['options'], $t['config']);
         PHPUnit_Framework_Assert::assertTrue(true, $t['test']);
     } catch (PHPUnit_Framework_AssertionFailedError $e) {
         $result->addFailure($this, $e, PHPUnit_Util_Timer::stop());
     } catch (Exception $e) {
         $result->addError($this, $e, PHPUnit_Util_Timer::stop());
     }
     PHPUnit_Framework_Assert::assertTrue(true, $t['test']);
     $result->endTest($this, PHPUnit_Util_Timer::stop());
     MediaWikiParserTestSuite::$parser->recorder->record($t['test'], $r);
     MediaWikiParserTestSuite::$iter->next();
     $this->addToAssertionCount(PHPUnit_Framework_Assert::getCount());
     return $result;
 }
 /**
  * Load default conversion tables.
  * This method must be implemented in derived class.
  *
  * @private
  */
 function loadDefaultTables()
 {
     $name = get_class($this);
     wfDie("Must implement loadDefaultTables() method in class {$name}");
 }
Exemplo n.º 11
0
/**
 * Return a $wgAllmessages array shipped in MediaWiki
 * @param string $languageCode Formated language code
 * @return array The MediaWiki default $wgAllMessages array requested
 */
function getMediawikiMessages($languageCode = 'En')
{
    $foo = "wgAllMessages{$languageCode}";
    global ${$foo};
    global $wgSkinNamesEn;
    // potentially unused global declaration?
    // it might already be loaded in LocalSettings.php
    if (!isset(${$foo})) {
        global $IP;
        $langFile = $IP . '/languages/classes/Language' . $languageCode . '.php';
        if (file_exists($langFile)) {
            print "Including {$langFile}\n";
            include $langFile;
        } else {
            wfDie("ERROR: The file {$langFile} does not exist !\n");
        }
    }
    return ${$foo};
}
Exemplo n.º 12
0
<?php

if (!defined('MEDIAWIKI')) {
    ini_set("include_path", dirname(__FILE__) . "/..");
    require_once 'commandLine.inc';
}
$USAGE = "Usage: php generateLangFile.php [--lang=(all|ja|zh|zh-tw|pl|...)] [--removedb=(no|yes)] [--merge=(no|yes)] [--filename=Messages%s.php] [--dir=/tmp] | --help\n" . "\toptions:\n" . "\t\t--help\tshow this message\n" . "\t\t--lang\tlanguage code (default: 'all': generate all messages)\n" . "\t\t--removedb\tremove articles from database, default: no\n" . "\t\t--merge\tmerge with existing wikia messages, default: no\n" . "\t\t--filename\tformat of output filename, default: Messages%s.php (where '%s' is a --lang parameter)\n" . "\t\t--dir\t output dir name, default: '/tmp' \n";
if (in_array('--help', $argv)) {
    wfDie($USAGE);
}
$params = @$options;
$lang = array_key_exists('lang', $params) && !empty($params['lang']) ? $params['lang'] : 'all';
$removedb = array_key_exists('removedb', $params) && !empty($params['removedb']) ? $params['removedb'] : 'no';
$merge = array_key_exists('merge', $params) && !empty($params['merge']) ? $params['merge'] : 'no';
$filename = array_key_exists('filename', $params) && !empty($params['filename']) ? $params['filename'] : 'Messages%s.php';
$dir = array_key_exists('dir', $params) && !empty($params['dir']) ? $params['dir'] : '/tmp';
$maxRevId = wfGenerateMessagesFile($lang, $removedb, $merge, $filename, $dir);
echo "\n\$maxRevId = {$maxRevId}\n";
function wfGenerateMessagesFile($lang_param, $removedb, $merge, $filename, $dir)
{
    global $wgDefaultMessagesDB, $wgContLang, $IP;
    #-- takes data from DB
    $dbr = wfGetDB(DB_SLAVE);
    $res = $dbr->select(array("`{$wgDefaultMessagesDB}`.`page`", "`{$wgDefaultMessagesDB}`.`revision`", "`{$wgDefaultMessagesDB}`.`text`"), array('page_id', 'page_title', 'old_text', 'old_flags', 'page_namespace', 'rev_id'), array('rev_text_id=old_id', 'page_latest=rev_id', 'page_is_redirect' => 0, 'page_namespace' => NS_MEDIAWIKI), __METHOD__);
    $defaultMessages = array();
    $articleToRemove = array();
    $maxRevId = 0;
    while ($row = $dbr->fetchObject($res)) {
        $maxRevId = max($maxRevId, $row->rev_id);
        $lckey = $wgContLang->lcfirst($row->page_title);
        if (strpos($lckey, '/')) {
function randomUrl()
{
    global $wgServer, $wgArticlePath;
    return $wgServer . str_replace('$1', randomTitle(), $wgArticlePath);
}
/** @todo document */
function randomTitle()
{
    $str = '';
    $length = mt_rand(1, 20);
    for ($i = 0; $i < $length; $i++) {
        $str .= chr(mt_rand(ord('a'), ord('z')));
    }
    return ucfirst($str);
}
if (!$wgUseSquid) {
    wfDie("Squid purge benchmark doesn't do much without squid support on.\n");
} else {
    printf("There are %d defined squid servers:\n", count($wgSquidServers));
    #echo implode( "\n", $wgSquidServers ) . "\n";
    if (isset($options['count'])) {
        $lengths = array(intval($options['count']));
    } else {
        $lengths = array(1, 10, 100);
    }
    foreach ($lengths as $length) {
        $urls = randomUrlList($length);
        $trial = benchSquid($urls);
        print "{$trial}\n";
    }
}
Exemplo n.º 14
0
 *  -c <chunk-size>     maximum number of revisions in a concat chunk
 *  -b <begin-date>     earliest date to check for uncompressed revisions
 *  -e <end-date>       latest revision date to compress
 *  -s <start-id>       the old_id to start from
 *  --extdb <cluster>   store specified revisions in an external cluster (untested)
 *
 * @file
 * @ingroup Maintenance ExternalStorage
 */
$optionsWithArgs = array('t', 'c', 's', 'f', 'h', 'extdb', 'endid', 'e');
require_once dirname(__FILE__) . '/../commandLine.inc';
require_once "compressOld.inc";
if (!function_exists("gzdeflate")) {
    print "You must enable zlib support in PHP to compress old revisions!\n";
    print "Please see http://www.php.net/manual/en/ref.zlib.php\n\n";
    wfDie();
}
$defaults = array('t' => 'concat', 'c' => 20, 's' => 0, 'b' => '', 'e' => '', 'extdb' => '', 'endid' => false);
$options = $options + $defaults;
if ($options['t'] != 'concat' && $options['t'] != 'gzip') {
    print "Type \"{$options['t']}\" not supported\n";
}
if ($options['extdb'] != '') {
    print "Compressing database {$wgDBname} to external cluster {$options['extdb']}\n" . str_repeat('-', 76) . "\n\n";
} else {
    print "Compressing database {$wgDBname}\n" . str_repeat('-', 76) . "\n\n";
}
$success = true;
if ($options['t'] == 'concat') {
    $success = compressWithConcat($options['s'], $options['c'], $options['b'], $options['e'], $options['extdb'], $options['endid']);
} else {
Exemplo n.º 15
0
            return;
        }
        $display = $title->getPrefixedText();
        $this->count++;
        $sanitized = rawurlencode($display);
        $filename = sprintf("%s/wiki-%07d-%s.html", $this->outputDirectory, $this->count, $sanitized);
        fprintf($this->stderr, "%s\n", $filename, $display);
        // fixme
        $user = new User();
        $parser = new Parser();
        $options = ParserOptions::newFromUser($user);
        $output = $parser->parse($rev->getText(), $title, $options);
        file_put_contents($filename, "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" " . "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" . "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" . "<head>\n" . "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n" . "<title>" . htmlspecialchars($display) . "</title>\n" . "</head>\n" . "<body>\n" . $output->getText() . "</body>\n" . "</html>");
    }
    function run()
    {
        $this->startTime = wfTime();
        $file = fopen('php://stdin', 'rt');
        $source = new ImportStreamSource($file);
        $importer = new WikiImporter($source);
        $importer->setRevisionCallback(array(&$this, 'handleRevision'));
        return $importer->doImport();
    }
}
if (isset($options['output-dir'])) {
    $dir = $options['output-dir'];
} else {
    wfDie("Must use --output-dir=/some/dir\n");
}
$render = new DumpRenderer($dir);
$render->run();
Exemplo n.º 16
0
function addWiki($lang, $site, $dbName)
{
    global $IP, $wgLanguageNames, $wgDefaultExternalStore;
    $name = $wgLanguageNames[$lang];
    $dbw = wfGetDB(DB_WRITE);
    $common = "/home/wikipedia/common";
    $maintenance = "{$IP}/maintenance";
    print "Creating database {$dbName} for {$lang}.{$site}\n";
    # Set up the database
    $dbw->query("SET table_type=Innodb");
    $dbw->query("CREATE DATABASE {$dbName}");
    $dbw->selectDB($dbName);
    print "Initialising tables\n";
    dbsource("{$maintenance}/tables.sql", $dbw);
    dbsource("{$IP}/extensions/OAI/update_table.sql", $dbw);
    dbsource("{$IP}/extensions/AntiSpoof/mysql/patch-antispoof.sql", $dbw);
    dbsource("{$IP}/extensions/CheckUser/cu_changes.sql", $dbw);
    $dbw->query("INSERT INTO site_stats(ss_row_id) VALUES (1)");
    # Initialise external storage
    if (is_array($wgDefaultExternalStore)) {
        $stores = $wgDefaultExternalStore;
    } elseif ($stores) {
        $stores = array($wgDefaultExternalStore);
    } else {
        $stores = array();
    }
    if (count($stores)) {
        require_once 'ExternalStoreDB.php';
        print "Initialising external storage {$store}...\n";
        global $wgDBuser, $wgDBpassword, $wgExternalServers;
        foreach ($stores as $storeURL) {
            $m = array();
            if (!preg_match('!^DB://(.*)$!', $storeURL, $m)) {
                continue;
            }
            $cluster = $m[1];
            # Hack
            $wgExternalServers[$cluster][0]['user'] = $wgDBuser;
            $wgExternalServers[$cluster][0]['password'] = $wgDBpassword;
            $store = new ExternalStoreDB();
            $extdb =& $store->getMaster($cluster);
            $extdb->query("SET table_type=InnoDB");
            $extdb->query("CREATE DATABASE {$dbName}");
            $extdb->selectDB($dbName);
            dbsource("{$maintenance}/storage/blobs.sql", $extdb);
            $extdb->immediateCommit();
        }
    }
    global $wgTitle, $wgArticle;
    $wgTitle = Title::newMainPage();
    $wgArticle = new Article($wgTitle);
    $ucsite = ucfirst($site);
    $wgArticle->insertNewArticle(<<<EOT
==This subdomain is reserved for the creation of a [[wikimedia:Our projects|{$ucsite}]] in '''[[w:en:{$name}|{$name}]]''' language==

* Please '''do not start editing''' this new site. This site has a test project on the [[incubator:|Wikimedia Incubator]] (or on the [[betawikiversity:|BetaWikiversity]] or on the [[oldwikisource:|Old Wikisource]]) and it will be imported to here.

* If you would like to help translating the interface to this language, please do not translate here, but go to [[betawiki:|Betawiki]], a special wiki for translating the interface. That way everyone can use it on every wiki using the [[mw:|same software]].

* For information about how to edit and for other general help, see [[m:Help:Contents|Help on Wikimedia's Meta-Wiki]] or [[mw:Help:Contents|Help on MediaWiki.org]].

== Sister projects ==
<span class="plainlinks">
[http://www.wikipedia.org Wikipedia] |
[http://www.wiktionary.org Wiktonary] |
[http://www.wikibooks.org Wikibooks] |
[http://www.wikinews.org Wikinews] |
[http://www.wikiquote.org Wikiquote] |
[http://www.wikisource.org Wikisource]
[http://www.wikiversity.org Wikiversity]
</span>

See Wikimedia's [[m:|Meta-Wiki]] for the coordination of these projects.

[[aa:]]
[[af:]]
[[als:]]
[[ar:]]
[[de:]]
[[en:]]
[[as:]]
[[ast:]]
[[ay:]]
[[az:]]
[[bcl:]]
[[be:]]
[[bg:]]
[[bn:]]
[[bo:]]
[[bs:]]
[[cs:]]
[[co:]]
[[cs:]]
[[cy:]]
[[da:]]
[[el:]]
[[eo:]]
[[es:]]
[[et:]]
[[eu:]]
[[fa:]]
[[fi:]]
[[fr:]]
[[fy:]]
[[ga:]]
[[gl:]]
[[gn:]]
[[gu:]]
[[he:]]
[[hi:]]
[[hr:]]
[[hsb:]]
[[hy:]]
[[ia:]]
[[id:]]
[[is:]]
[[it:]]
[[ja:]]
[[ka:]]
[[kk:]]
[[km:]]
[[kn:]]
[[ko:]]
[[ks:]]
[[ku:]]
[[ky:]]
[[la:]]
[[ln:]]
[[lo:]]
[[lt:]]
[[lv:]]
[[hu:]]
[[mi:]]
[[mk:]]
[[ml:]]
[[mn:]]
[[mr:]]
[[ms:]]
[[mt:]]
[[my:]]
[[na:]]
[[nah:]]
[[nds:]]
[[ne:]]
[[nl:]]
[[no:]]
[[oc:]]
[[om:]]
[[pa:]]
[[pl:]]
[[ps:]]
[[pt:]]
[[qu:]]
[[ro:]]
[[ru:]]
[[sa:]]
[[si:]]
[[sk:]]
[[sl:]]
[[sq:]]
[[sr:]]
[[sv:]]
[[sw:]]
[[ta:]]
[[te:]]
[[tg:]]
[[th:]]
[[tk:]]
[[tl:]]
[[tr:]]
[[tt:]]
[[ug:]]
[[uk:]]
[[ur:]]
[[uz:]]
[[vi:]]
[[vo:]]
[[xh:]]
[[yo:]]
[[za:]]
[[zh:]]
[[zu:]]

EOT
, '', false, false);
    print "Adding to dblists\n";
    # Add to dblist
    $file = fopen("{$common}/all.dblist", "a");
    fwrite($file, "{$dbName}\n");
    fclose($file);
    # Update the sublists
    system("cd {$common} && ./refresh-dblist");
    print "Constructing interwiki SQL\n";
    # Rebuild interwiki tables
    $sql = getRebuildInterwikiSQL();
    $tempname = tempnam('/tmp', 'addwiki');
    $file = fopen($tempname, 'w');
    if (!$file) {
        wfDie("Error, unable to open temporary file {$tempname}\n");
    }
    fwrite($file, $sql);
    fclose($file);
    print "Sourcing interwiki SQL\n";
    dbsource($tempname, $dbw);
    #unlink( $tempname );
    # Create the upload dir
    global $wgUploadDirectory;
    if (file_exists($wgUploadDirectory)) {
        echo "{$wgUploadDirectory} already exists.\n";
    } else {
        echo "Creating {$wgUploadDirectory}...\n";
        mkdir($wgUploadDirectory, 0777);
        chmod($wgUploadDirectory, 0777);
    }
    print "Script ended. You now want to run sync-common-all to publish *dblist files (check them for duplicates first)\n";
}
Exemplo n.º 17
0
<?php

require_once "commandLine.inc";
/**
 * Why yes, this *is* another special-purpose Wikimedia maintenance script!
 * Should be fixed up and generalized.
 */
if (count($args) != 2) {
    wfDie("Rename external storage dbs and leave a new one...\n" . "Usage: php renamewiki.php <olddb> <newdb>\n");
}
list($from, $to) = $args;
echo "Renaming blob tables in ES from {$from} to {$to}...\n";
echo "Sleeping 5 seconds...";
sleep(5);
echo "\n";
$maintenance = "{$IP}/maintenance";
# Initialise external storage
if (is_array($wgDefaultExternalStore)) {
    $stores = $wgDefaultExternalStore;
} elseif ($wgDefaultExternalStore) {
    $stores = array($wgDefaultExternalStore);
} else {
    $stores = array();
}
if (count($stores)) {
    require_once 'ExternalStoreDB.php';
    print "Initialising external storage {$store}...\n";
    global $wgDBuser, $wgDBpassword, $wgExternalServers;
    foreach ($stores as $storeURL) {
        $m = array();
        if (!preg_match('!^DB://(.*)$!', $storeURL, $m)) {
Exemplo n.º 18
0
 *
 * @package MediaWiki
 * @subpackage Maintenance
 *
 * @author Ævar Arnfjörð Bjarmason <*****@*****.**>
 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 */
class ChangePassword
{
    var $dbw;
    var $user, $password;
    function ChangePassword($user, $password)
    {
        $this->user = User::newFromName($user);
        $this->password = $password;
        $this->dbw =& wfGetDB(DB_MASTER);
    }
    function main()
    {
        $fname = 'ChangePassword::main';
        $this->dbw->update('user', array('user_password' => wfEncryptPassword($this->user->getID(), $this->password)), array('user_id' => $this->user->getID()), $fname);
    }
}
$optionsWithArgs = array('user', 'password');
require_once 'commandLine.inc';
if (in_array('--help', $argv)) {
    wfDie("Usage: php changePassword.php [--user=user --password=password | --help]\n" . "\toptions:\n" . "\t\t--help\tshow this message\n" . "\t\t--user\tthe username to operate on\n" . "\t\t--password\tthe password to use\n");
}
$cp = new ChangePassword(@$options['user'], @$options['password']);
$cp->main();
 function __construct($ext18nFilename, $extArrayName)
 {
     $this->mExt18nFilename = $ext18nFilename;
     $this->mExtArrayName = $extArrayName;
     $this->mIgnoredMessages = array();
     $this->mOptionalMessages = array();
     if (file_exists($this->mExt18nFilename)) {
         require_once $this->mExt18nFilename;
         $foundarray = false;
         if (isset(${$this->mExtArrayName})) {
             // File provided in the db file
             $foundarray = ${$this->mExtArrayName};
         } else {
             /* For extensions included elsewhere. For some reason other extensions
              * break with the global statement, so recheck here.
              */
             global ${$this->mExtArrayName};
             if (is_array(${$this->mExtArrayName})) {
                 $foundarray = ${$this->mExtArrayName};
             }
             /* we might have been given a function name, test it too */
             if (function_exists($this->mExtArrayName)) {
                 // Load data
                 $funcName = $this->mExtArrayName;
                 $foundarray = $funcName();
             }
             if (!$foundarray) {
                 // Provided array could not be found we try to guess it.
                 # Using the extension path ($m[1]) and filename ($m[2]):
                 $m = array();
                 preg_match('%.*/(.*)/(.*).i18n\\.php%', $this->mExt18nFilename, $m);
                 $arPathCandidate = 'wg' . $m[1] . 'Messages';
                 $arFileCandidate = 'wg' . $m[2] . 'Messages';
                 $funcCandidate = "ef{$m[2]}Messages";
                 // Try them:
                 if (isset(${$arPathCandidate}) && is_array(${$arPathCandidate})) {
                     print "warning> messages from guessed path array \${$arPathCandidate}.\n";
                     $foundarray = ${$arPathCandidate};
                 } elseif (isset(${$arFileCandidate}) && is_array(${$arFileCandidate})) {
                     print "warning> messages from guessed file array \${$arFileCandidate}.\n";
                     $foundarray = ${$arFileCandidate};
                 } elseif (function_exists($funcCandidate)) {
                     print "warning> messages build from guessed function {$funcCandidate}().\n";
                     $foundarray = $funcCandidate();
                 }
             }
             # We are unlucky, return empty stuff
             if (!$foundarray) {
                 print "ERROR> failed to guess an array to use.\n";
                 $this->mExtArray = null;
                 $this->mLanguages = null;
                 return;
             }
         }
         $this->mExtArray = $foundarray;
         $this->mLanguages = array_keys($this->mExtArray);
     } else {
         wfDie("File {$this->mExt18nFilename} not found\n");
     }
 }
Exemplo n.º 20
0
 */
$originalDir = getcwd();
$optionsWithArgs = array('pagelist', 'start', 'end');
require_once 'commandLine.inc';
require_once 'backup.inc';
$dumper = new BackupDumper($argv);
if (isset($options['quiet'])) {
    $dumper->reporting = false;
}
if (isset($options['pagelist'])) {
    $olddir = getcwd();
    chdir($originalDir);
    $pages = file($options['pagelist']);
    chdir($olddir);
    if ($pages === false) {
        wfDie("Unable to open file {$options['pagelist']}\n");
    }
    $pages = array_map('trim', $pages);
    $dumper->pages = array_filter($pages, create_function('$x', 'return $x !== "";'));
}
if (isset($options['start'])) {
    $dumper->startId = intval($options['start']);
}
if (isset($options['end'])) {
    $dumper->endId = intval($options['end']);
}
$dumper->skipHeader = isset($options['skip-header']);
$dumper->skipFooter = isset($options['skip-footer']);
$textMode = isset($options['stub']) ? WikiExporter::STUB : WikiExporter::TEXT;
if (isset($options['full'])) {
    $dumper->dump(WikiExporter::FULL, $textMode);
Exemplo n.º 21
0
<?php

/**
 * Add a new wiki
 * Wikimedia specific!
 *
 * @file
 * @ingroup Maintenance
 */
$wgNoDBParam = true;
require_once "commandLine.inc";
require_once "rebuildInterwiki.inc";
require_once "languages/Names.php";
if (count($args) != 3) {
    wfDie("Usage: php addwiki.php <language> <site> <dbname>\nThe site for Wikipedia is 'wikipedia'.\n");
}
addWiki($args[0], $args[1], $args[2]);
# -----------------------------------------------------------------
function addWiki($lang, $site, $dbName)
{
    global $IP, $wgLanguageNames, $wgDefaultExternalStore;
    if (!isset($wgLanguageNames[$lang])) {
        print "Language {$lang} not found in \$wgLanguageNames\n";
        return;
    }
    $name = $wgLanguageNames[$lang];
    $dbw = wfGetDB(DB_MASTER);
    $common = "/home/wikipedia/common";
    $maintenance = "{$IP}/maintenance";
    print "Creating database {$dbName} for {$lang}.{$site} ({$name})\n";
    # Set up the database