本文整理汇总了PHP中wfWikiID函数的典型用法代码示例。如果您正苦于以下问题:PHP wfWikiID函数的具体用法?PHP wfWikiID怎么用?PHP wfWikiID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfWikiID函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$posFile = $this->getOption('p', 'searchUpdate.' . wfWikiID() . '.pos');
$end = $this->getOption('e', wfTimestampNow());
if ($this->hasOption('s')) {
$start = $this->getOption('s');
} elseif (is_readable('searchUpdate.pos')) {
# B/c to the old position file name which was hardcoded
# We can safely delete the file when we're done though.
$start = file_get_contents('searchUpdate.pos');
unlink('searchUpdate.pos');
} elseif (is_readable($posFile)) {
$start = file_get_contents($posFile);
} else {
$start = wfTimestamp(TS_MW, time() - 86400);
}
$lockTime = $this->getOption('l', 20);
$this->doUpdateSearchIndex($start, $end, $lockTime);
if (is_writable(dirname(realpath($posFile)))) {
$file = fopen($posFile, 'w');
if ($file !== false) {
fwrite($file, $end);
fclose($file);
} else {
$this->error("*** Couldn't write to the {$posFile}!\n");
}
} else {
$this->error("*** Couldn't write to the {$posFile}!\n");
}
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:30,代码来源:updateSearchIndex.php
示例2: verifyPFData
/**
* Verifies the user submitted data to check it's valid
* @param string $page
* @param string $site
* @return array
*/
public static function verifyPFData($page, $site)
{
global $wgServer, $wgAllowGlobalMessaging;
$data = array('site' => $site, 'title' => $page);
if (trim($site) === '') {
$site = MassMessage::getBaseUrl($wgServer);
$data['site'] = $site;
$data['wiki'] = wfWikiID();
} elseif (filter_var('http://' . $site, FILTER_VALIDATE_URL) === false) {
// Try and see if the site provided is not valid
// We can just prefix http:// in front since it needs some kind of protocol
// return MassMessage::parserError( 'massmessage-parse-badurl', $site );
}
if (is_null(Title::newFromText($page))) {
// Check if the page provided is not valid
return MassMessage::parserError('massmessage-parse-badpage', $page);
}
if (!isset($data['wiki'])) {
$data['wiki'] = MassMessage::getDBName($data['site']);
if ($data['wiki'] === null) {
//return MassMessage::parserError( 'massmessage-parse-badurl', $site );
}
}
if (!$wgAllowGlobalMessaging && $data['wiki'] != wfWikiID()) {
return MassMessage::parserError('massmessage-global-disallowed');
}
return $data;
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:34,代码来源:MassMessage.hooks.php
示例3: execute
public function execute()
{
$this->output("Looking for pages with page_latest set to 0...\n");
$dbw = wfGetDB(DB_MASTER);
$result = $dbw->select('page', array('page_id', 'page_namespace', 'page_title'), array('page_latest' => 0), __METHOD__);
$n = 0;
foreach ($result as $row) {
$pageId = intval($row->page_id);
$title = Title::makeTitle($row->page_namespace, $row->page_title);
$name = $title->getPrefixedText();
$latestTime = $dbw->selectField('revision', 'MAX(rev_timestamp)', array('rev_page' => $pageId), __METHOD__);
if (!$latestTime) {
$this->output(wfWikiID() . " {$pageId} [[{$name}]] can't find latest rev time?!\n");
continue;
}
$revision = Revision::loadFromTimestamp($dbw, $title, $latestTime);
if (is_null($revision)) {
$this->output(wfWikiID() . " {$pageId} [[{$name}]] latest time {$latestTime}, can't find revision id\n");
continue;
}
$id = $revision->getId();
$this->output(wfWikiID() . " {$pageId} [[{$name}]] latest time {$latestTime}, rev id {$id}\n");
if ($this->hasOption('fix')) {
$article = new Article($title);
$article->updateRevisionOn($dbw, $revision);
}
$n++;
}
$dbw->freeResult($result);
$this->output("Done! Processed {$n} pages.\n");
if (!$this->hasOption('fix')) {
$this->output("This was a dry run; rerun with --fix to update page_latest.\n");
}
}
开发者ID:rocLv,项目名称:conference,代码行数:34,代码来源:attachLatest.php
示例4: execute
public function execute()
{
// FIXME: This is horrible, no good, very bad hack. Only for testing,
// and probably should be eventually replaced with something more sane.
$updaterScript = "extensions/CirrusSearch/maintenance/updateSuggesterIndex.php";
$this->getResult()->addValue(null, 'result', wfShellExecWithStderr("unset REQUEST_METHOD; /usr/local/bin/mwscript {$updaterScript} --wiki " . wfWikiID()));
}
开发者ID:zoglun,项目名称:mediawiki-extensions-CirrusSearch,代码行数:7,代码来源:SuggestIndex.php
示例5: setUp
protected function setUp()
{
global $wgFileBackends;
parent::setUp();
# Forge a FSRepo object to not have to rely on local wiki settings
$tmpPrefix = wfTempDir() . '/storebatch-test-' . time() . '-' . mt_rand();
if ($this->getCliArg('use-filebackend=')) {
$name = $this->getCliArg('use-filebackend=');
$useConfig = array();
foreach ($wgFileBackends as $conf) {
if ($conf['name'] == $name) {
$useConfig = $conf;
}
}
$useConfig['lockManager'] = LockManagerGroup::singleton()->get($useConfig['lockManager']);
unset($useConfig['fileJournal']);
$useConfig['name'] = 'local-testing';
// swap name
$class = $useConfig['class'];
$backend = new $class($useConfig);
} else {
$backend = new FSFileBackend(array('name' => 'local-testing', 'wikiId' => wfWikiID(), 'containerPaths' => array('unittests-public' => "{$tmpPrefix}-public", 'unittests-thumb' => "{$tmpPrefix}-thumb", 'unittests-temp' => "{$tmpPrefix}-temp", 'unittests-deleted' => "{$tmpPrefix}-deleted")));
}
$this->repo = new FileRepo(array('name' => 'unittests', 'backend' => $backend));
$this->date = gmdate("YmdHis");
$this->createdFiles = array();
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:27,代码来源:StoreBatchTest.php
示例6: execute
public function execute()
{
$username = $this->getArg(0);
$password = $this->getArg(1);
$this->output(wfWikiID() . ": Creating and promoting User:{$username}...");
$user = User::newFromName($username);
if (!is_object($user)) {
$this->error("invalid username.", true);
} elseif (0 != $user->idForName()) {
$this->error("account exists.", true);
}
# Try to set the password
try {
$user->setPassword($password);
} catch (PasswordError $pwe) {
$this->error($pwe->getText(), true);
}
# Insert the account into the database
$user->addToDatabase();
$user->saveSettings();
# Promote user
if ($this->hasOption('sysop')) {
$user->addGroup('sysop');
}
if ($this->hasOption('bureaucrat')) {
$user->addGroup('bureaucrat');
}
# Increment site_stats.ss_users
$ssu = new SiteStatsUpdate(0, 0, 0, 0, 1);
$ssu->doUpdate();
$this->output("done.\n");
}
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:32,代码来源:createAndPromote.php
示例7: setUp
protected function setUp()
{
global $wgFileBackends;
parent::setUp();
$uniqueId = time() . '-' . mt_rand();
$tmpPrefix = wfTempDir() . '/filebackend-unittest-' . $uniqueId;
if ($this->getCliArg('use-filebackend=')) {
if (self::$backendToUse) {
$this->singleBackend = self::$backendToUse;
} else {
$name = $this->getCliArg('use-filebackend=');
$useConfig = array();
foreach ($wgFileBackends as $conf) {
if ($conf['name'] == $name) {
$useConfig = $conf;
break;
}
}
$useConfig['name'] = 'localtesting';
// swap name
$useConfig['shardViaHashLevels'] = array('unittest-cont1' => array('levels' => 1, 'base' => 16, 'repeat' => 1));
$class = $useConfig['class'];
self::$backendToUse = new $class($useConfig);
$this->singleBackend = self::$backendToUse;
}
} else {
$this->singleBackend = new FSFileBackend(array('name' => 'localtesting', 'lockManager' => 'fsLockManager', 'wikiId' => wfWikiID() . $uniqueId, 'containerPaths' => array('unittest-cont1' => "{$tmpPrefix}-localtesting-cont1", 'unittest-cont2' => "{$tmpPrefix}-localtesting-cont2")));
}
$this->multiBackend = new FileBackendMultiWrite(array('name' => 'localtesting', 'lockManager' => 'fsLockManager', 'parallelize' => 'implicit', 'wikiId' => wfWikiId() . $uniqueId, 'backends' => array(array('name' => 'localmultitesting1', 'class' => 'FSFileBackend', 'lockManager' => 'nullLockManager', 'containerPaths' => array('unittest-cont1' => "{$tmpPrefix}-localtestingmulti1-cont1", 'unittest-cont2' => "{$tmpPrefix}-localtestingmulti1-cont2"), 'isMultiMaster' => false), array('name' => 'localmultitesting2', 'class' => 'FSFileBackend', 'lockManager' => 'nullLockManager', 'containerPaths' => array('unittest-cont1' => "{$tmpPrefix}-localtestingmulti2-cont1", 'unittest-cont2' => "{$tmpPrefix}-localtestingmulti2-cont2"), 'isMultiMaster' => true))));
$this->filesToPrune = array();
}
开发者ID:mangowi,项目名称:mediawiki,代码行数:31,代码来源:FileBackendTest.php
示例8: execute
public function execute()
{
if (count($this->mArgs) == 0) {
$this->error("No revisions specified", true);
}
$this->output("Deleting revision(s) " . implode(',', $this->mArgs) . " from " . wfWikiID() . "...\n");
$dbw = wfGetDB(DB_MASTER);
$affected = 0;
foreach ($this->mArgs as $revID) {
$dbw->insertSelect('archive', array('page', 'revision'), array('ar_namespace' => 'page_namespace', 'ar_title' => 'page_title', 'ar_page_id' => 'page_id', 'ar_comment' => 'rev_comment', 'ar_user' => 'rev_user', 'ar_user_text' => 'rev_user_text', 'ar_timestamp' => 'rev_timestamp', 'ar_minor_edit' => 'rev_minor_edit', 'ar_rev_id' => 'rev_id', 'ar_text_id' => 'rev_text_id', 'ar_deleted' => 'rev_deleted', 'ar_len' => 'rev_len'), array('rev_id' => $revID, 'page_id = rev_page'), __METHOD__);
if (!$dbw->affectedRows()) {
$this->output("Revision {$revID} not found\n");
} else {
$affected += $dbw->affectedRows();
$pageID = $dbw->selectField('revision', 'rev_page', array('rev_id' => $revID), __METHOD__);
$pageLatest = $dbw->selectField('page', 'page_latest', array('page_id' => $pageID), __METHOD__);
$dbw->delete('revision', array('rev_id' => $revID));
if ($pageLatest == $revID) {
// Database integrity
$newLatest = $dbw->selectField('revision', 'rev_id', array('rev_page' => $pageID), __METHOD__, array('ORDER BY' => 'rev_timestamp DESC'));
$dbw->update('page', array('page_latest' => $newLatest), array('page_id' => $pageID), __METHOD__);
}
}
}
$this->output("Deleted {$affected} revisions\n");
}
开发者ID:Tarendai,项目名称:spring-website,代码行数:26,代码来源:deleteRevision.php
示例9: execute
function execute()
{
global $wgVersion, $wgTitle, $wgLang;
$wgLang = Language::factory('en');
$wgTitle = Title::newFromText("MediaWiki database updater");
$this->output("MediaWiki {$wgVersion} Updater\n\n");
if (!$this->hasOption('skip-compat-checks')) {
$this->compatChecks();
} else {
$this->output("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
$db = wfGetDB(DB_MASTER);
$this->output("Going to run database updates for " . wfWikiID() . "\n");
$this->output("Depending on the size of your database this may take a while!\n");
if (!$this->hasOption('quick')) {
$this->output("Abort with control-c in the next five seconds (skip this countdown with --quick) ... ");
wfCountDown(5);
}
$shared = $this->hasOption('doshared');
$updates = array('core', 'extensions');
if (!$this->hasOption('nopurge')) {
$updates[] = 'purge';
}
$updater = DatabaseUpdater::newForDb($db, $shared, $this);
$updater->doUpdates($updates);
foreach ($updater->getPostDatabaseUpdateMaintenance() as $maint) {
$child = $this->runChild($maint);
$child->execute();
}
$this->output("\nDone.\n");
}
开发者ID:GodelDesign,项目名称:Godel,代码行数:34,代码来源:update.php
示例10: run
/**
* Try to create and attach the user.
* @throws Exception
* @return bool Success
*/
public function run()
{
$username = $this->params['name'];
$from = $this->params['from'];
$wiki = wfWikiID();
if (isset($this->params['session'])) {
// restore IP and other request data
$this->params['session']['userId'] = 0;
$this->params['session']['sessionId'] = '';
$callback = RequestContext::importScopedSession($this->params['session']);
}
$user = User::newFromName($username);
$centralUser = CentralAuthUser::getInstance($user);
if ($user->getId() !== 0) {
wfDebugLog('CentralAuth', __CLASS__ . ": tried to create local account for {$username} " . "on {$wiki} from {$from} but one already exists\n");
return true;
} elseif (!$centralUser->exists()) {
wfDebugLog('CentralAuth', __CLASS__ . ": tried to create local account for {$username} " . "on {$wiki} from {$from} but no global account exists\n");
return true;
} elseif ($centralUser->attachedOn($wiki)) {
wfDebugLog('CentralAuth', __CLASS__ . ": tried to create local account for {$username} " . "on {$wiki} from {$from} but an attached local account already exists\n");
return true;
}
$success = CentralAuthHooks::attemptAddUser($user);
if ($success) {
$centralUser->invalidateCache();
}
return true;
}
开发者ID:NDKilla,项目名称:mediawiki-extensions-CentralAuth,代码行数:34,代码来源:CreateLocalAccountJob.php
示例11: refreshBatch
public function refreshBatch(DatabaseBase $dbr, UUID $continue, $countableActions, UUID $stop)
{
$rows = $dbr->select('flow_revision', array('rev_id', 'rev_user_id'), array('rev_id > ' . $dbr->addQuotes($continue->getBinary()), 'rev_id <= ' . $dbr->addQuotes($stop->getBinary()), 'rev_user_id > 0', 'rev_user_wiki' => wfWikiID(), 'rev_change_type' => $countableActions), __METHOD__, array('ORDER BY' => 'rev_id ASC', 'LIMIT' => $this->mBatchSize));
// end of data
if (!$rows || $rows->numRows() === 0) {
return false;
}
foreach ($rows as $row) {
// User::incEditCount only allows for edit count to be increased 1
// at a time. It'd be better to immediately be able to increase the
// edit count by the exact number it should be increased with, but
// I'd rather re-use existing code, especially in a run-once script,
// where performance is not the most important thing ;)
$user = User::newFromId($row->rev_user_id);
$user->incEditCount();
// save updates so we can print them when the script is done running
if (!isset($this->updates[$user->getId()])) {
$this->updates[$user->getId()] = 0;
}
$this->updates[$user->getId()]++;
// set value for next batch to continue at
$continue = $row->rev_id;
}
return UUID::create($continue);
}
开发者ID:TarLocesilion,项目名称:mediawiki-extensions-Flow,代码行数:25,代码来源:FlowFixEditCount.php
示例12: getFunctionReport
function getFunctionReport()
{
global $wgUDPProfilerHost;
global $wgUDPProfilerPort;
if ($this->mCollated['-total']['real'] < $this->mMinimumTime) {
# Less than minimum, ignore
return;
}
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
$plength = 0;
$packet = "";
foreach ($this->mCollated as $entry => $pfdata) {
$pfline = sprintf("%s %s %d %f %f %f %f %s\n", wfWikiID(), "-", $pfdata['count'], $pfdata['cpu'], $pfdata['cpu_sq'], $pfdata['real'], $pfdata['real_sq'], $entry);
$length = strlen($pfline);
/* printf("<!-- $pfline -->"); */
if ($length + $plength > 1400) {
socket_sendto($sock, $packet, $plength, 0, $wgUDPProfilerHost, $wgUDPProfilerPort);
$packet = "";
$plength = 0;
}
$packet .= $pfline;
$plength += $length;
}
socket_sendto($sock, $packet, $plength, 0x100, $wgUDPProfilerHost, $wgUDPProfilerPort);
}
开发者ID:puring0815,项目名称:OpenKore,代码行数:25,代码来源:ProfilerSimpleUDP.php
示例13: setUp
/**
* Setup a fresh set of global users for each test.
* Note: MediaWikiTestCase::resetDB() will delete all tables between
* test runs, so no explicite tearDown() is needed.
*/
protected function setUp()
{
parent::setUp();
$u = new CentralAuthTestUser('GlobalUser', 'GUP@ssword', array('gu_id' => '1001'), array(array(wfWikiID(), 'primary'), array('enwiki', 'primary'), array('dewiki', 'login'), array('metawiki', 'password')));
$u->save($this->db);
$u = new CentralAuthTestUser('GlobalLockedUser', 'GLUP@ssword', array('gu_id' => '1003', 'gu_locked' => 1, 'gu_hidden' => CentralAuthUser::HIDDEN_NONE, 'gu_email' => 'testlocked@localhost', 'gu_home_db' => 'metawiki'), array(array('metawiki', 'primary')));
$u->save($this->db);
}
开发者ID:NDKilla,项目名称:mediawiki-extensions-CentralAuth,代码行数:13,代码来源:CentralAuthHooksUsingDatabaseTest.php
示例14: singleton
/**
* @param $wiki string Wiki ID
* @return JobQueueGroup
*/
public static function singleton($wiki = false)
{
$wiki = $wiki === false ? wfWikiID() : $wiki;
if (!isset(self::$instances[$wiki])) {
self::$instances[$wiki] = new self($wiki);
}
return self::$instances[$wiki];
}
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:12,代码来源:JobQueueGroup.php
示例15: getProfileID
function getProfileID()
{
if ($this->mProfileID === false) {
return wfWikiID();
} else {
return $this->mProfileID;
}
}
开发者ID:amjadtbssm,项目名称:website,代码行数:8,代码来源:ProfilerSimple.php
示例16: getMocks
protected function getMocks()
{
$dbMock = $this->getMockBuilder('DatabaseMysql')->disableOriginalConstructor()->getMock();
$backendMock = $this->getMock('FSFileBackend', [], [['name' => $this->backendName, 'wikiId' => wfWikiID()]]);
$wrapperMock = $this->getMock('FileBackendDBRepoWrapper', ['getDB'], [['backend' => $backendMock, 'repoName' => $this->repoName, 'dbHandleFactory' => null]]);
$wrapperMock->expects($this->any())->method('getDB')->will($this->returnValue($dbMock));
return [$dbMock, $backendMock, $wrapperMock];
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:8,代码来源:FileBackendDBRepoWrapperTest.php
示例17: testGetWiki
/**
* @dataProvider provider_queueLists
* @covers JobQueue::getWiki
*/
public function testGetWiki($queue, $recycles, $desc)
{
$queue = $this->{$queue};
if (!$queue) {
$this->markTestSkipped($desc);
}
$this->assertEquals(wfWikiID(), $queue->getWiki(), "Proper wiki ID ({$desc})");
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:12,代码来源:JobQueueTest.php
示例18: execute
function execute($par)
{
global $wgMemc;
$tempToken = $this->getRequest()->getVal('token');
$logout = $this->getRequest()->getBool('logout');
# Don't cache error messages
$this->getOutput()->enableClientCache(false);
if (strlen($tempToken) == 0) {
$this->setHeaders();
$this->getOutput()->addWikiMsg('centralauth-autologin-desc');
return;
}
$key = CentralAuthUser::memcKey('login-token', $tempToken);
$data = $wgMemc->get($key);
$wgMemc->delete($key);
if (!$data) {
$msg = 'Token is invalid or has expired';
wfDebug(__METHOD__ . ": {$msg}\n");
$this->setHeaders();
$this->getOutput()->addWikiText($msg);
return;
}
$userName = $data['userName'];
$token = $data['token'];
$remember = $data['remember'];
if ($data['wiki'] != wfWikiID()) {
$msg = 'Bad token (wrong wiki)';
wfDebug(__METHOD__ . ": {$msg}\n");
$this->setHeaders();
$this->getOutput()->addWikiText($msg);
return;
}
$centralUser = new CentralAuthUser($userName);
$loginResult = $centralUser->authenticateWithToken($token);
if ($loginResult != 'ok') {
$msg = "Bad token: {$loginResult}";
wfDebug(__METHOD__ . ": {$msg}\n");
$this->setHeaders();
$this->getOutput()->addWikiText($msg);
return;
}
// Auth OK.
if ($logout) {
$centralUser->deleteGlobalCookies();
} else {
$centralUser->setGlobalCookies($remember);
}
$this->getOutput()->disable();
wfResetOutputBuffers();
header('Cache-Control: no-cache');
header('Content-Type: image/png');
global $wgCentralAuthLoginIcon;
if ($wgCentralAuthLoginIcon) {
readfile($wgCentralAuthLoginIcon);
} else {
readfile(dirname(__FILE__) . '/1x1.png');
}
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:58,代码来源:SpecialAutoLogin.php
示例19: testLoadByRevisionId_notFound
public function testLoadByRevisionId_notFound()
{
if (!defined('WB_VERSION')) {
$this->markTestSkipped("Skipping because WikibaseClient doesn't have a local wb_changes table.");
}
$lookup = new ChangeLookup(array('wikibase-item~remove' => 'Wikibase\\EntityChange'), wfWikiID());
$changes = $lookup->loadByRevisionId(PHP_INT_MAX);
$this->assertNull($changes);
}
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:9,代码来源:ChangeLookupTest.php
示例20: singleton
/**
* @param bool|string $domain Domain (usually wiki ID). Default: false.
* @return LockManagerGroup
*/
public static function singleton($domain = false)
{
$domain = $domain === false ? wfWikiID() : $domain;
if (!isset(self::$instances[$domain])) {
self::$instances[$domain] = new self($domain);
self::$instances[$domain]->initFromGlobals();
}
return self::$instances[$domain];
}
开发者ID:whysasse,项目名称:kmwiki,代码行数:13,代码来源:LockManagerGroup.php
注:本文中的wfWikiID函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论