本文整理汇总了PHP中wfDie函数的典型用法代码示例。如果您正苦于以下问题:PHP wfDie函数的具体用法?PHP wfDie怎么用?PHP wfDie使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfDie函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: addWiki
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";
}
开发者ID:BackupTheBerlios,项目名称:blahtex,代码行数:59,代码来源:addwiki.php
示例2: ChangePassword
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);
}
开发者ID:josephdye,项目名称:wikireader,代码行数:13,代码来源:changePassword.php
示例3: dump
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);
}
开发者ID:BackupTheBerlios,项目名称:blahtex,代码行数:17,代码来源:dumpTextPass.php
示例4: open
/**
* 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: " . substr($password, 0, 3) . "...\n");
wfDebug($this->lastError() . "\n");
} else {
$this->mOpened = true;
}
return $this->mConn;
}
开发者ID:BackupTheBerlios,项目名称:blahtex,代码行数:26,代码来源:DatabaseOracle.php
示例5: buildTestDatabase
/**
* @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;
}
}
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:41,代码来源:MediaWiki_TestCase.php
示例6: moveInconsistentPage
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();
}
}
开发者ID:BackupTheBerlios,项目名称:blahtex,代码行数:32,代码来源:cleanupTitles.php
示例7: importFromHandle
}
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'])) {
开发者ID:amjadtbssm,项目名称:website,代码行数:31,代码来源:importDump.php
示例8: dirname
<?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";
开发者ID:negabaro,项目名称:alfresco,代码行数:23,代码来源:langmemusage.php
示例9: run
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;
}
开发者ID:amjadtbssm,项目名称:website,代码行数:35,代码来源:MediaWikiParserTest.php
示例10: loadDefaultTables
/**
* 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}");
}
开发者ID:BackupTheBerlios,项目名称:swahili-dict,代码行数:11,代码来源:LanguageConverter.php
示例11: getMediawikiMessages
/**
* 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};
}
开发者ID:amjadtbssm,项目名称:website,代码行数:24,代码来源:diffLanguage.php
示例12: ini_set
<?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, '/')) {
开发者ID:Tjorriemorrie,项目名称:app,代码行数:31,代码来源:generateMessageFile.php
示例13: randomUrl
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";
}
}
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:31,代码来源:benchmarkPurge.php
示例14: array
* -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 {
开发者ID:amjadtbssm,项目名称:website,代码行数:31,代码来源:compressOld.php
示例15: rawurlencode
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();
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:31,代码来源:renderDump.php
示例16: addWiki
//.........这里部分代码省略.........
[[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";
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:101,代码来源:addwiki.php
示例17: wfDie
<?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)) {
开发者ID:biribogos,项目名称:wikihow-src,代码行数:31,代码来源:renamewiki.php
示例18: ChangePassword
*
* @package MediaWiki
* @subpackage Maintenance
*
* @author Ævar Arnfjörð Bjarmason <[email protected]>
* @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();
开发者ID:puring0815,项目名称:OpenKore,代码行数:31,代码来源:changePassword.php
示例19: __construct
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");
}
}
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:60,代码来源:checkExtensions.php
示例20: getcwd
*/
$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);
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:31,代码来源:dumpBackup.php
注:本文中的wfDie函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论