当前位置: 首页>>代码示例>>PHP>>正文


PHP wfWikiId函数代码示例

本文整理汇总了PHP中wfWikiId函数的典型用法代码示例。如果您正苦于以下问题:PHP wfWikiId函数的具体用法?PHP wfWikiId怎么用?PHP wfWikiId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wfWikiId函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute()
 {
     $conn = $this->getCirrusConnection();
     foreach ($conn->getAllIndexTypes() as $index) {
         $this->getResult()->addValue(array($index, 'page'), 'index', $conn->getIndex(wfWikiId(), $index)->getSettings()->get());
     }
 }
开发者ID:zoglun,项目名称:mediawiki-extensions-CirrusSearch,代码行数:7,代码来源:SettingsDump.php

示例2: onAfterInsert

 /**
  * @param AbstractRevision $revision Revision object
  * @param array $row Revision row
  * @param array $metadata;
  */
 public function onAfterInsert($revision, array $row, array $metadata)
 {
     global $wgRCFeeds;
     // No action on imported revisions
     if (isset($metadata['imported']) && $metadata['imported']) {
         return;
     }
     $action = $revision->getChangeType();
     $revisionId = $revision->getRevisionId()->getAlphadecimal();
     $timestamp = $revision->getRevisionId()->getTimestamp();
     /** @var Workflow $workflow */
     $workflow = $metadata['workflow'];
     $user = $revision->getUser();
     if (!$this->isAllowed($revision, $action)) {
         return;
     }
     $title = $this->getRcTitle($workflow, $revision->getChangeType());
     $attribs = array('rc_namespace' => $title->getNamespace(), 'rc_title' => $title->getDBkey(), 'rc_user' => $row['rev_user_id'], 'rc_user_text' => $this->usernames->get(wfWikiId(), $row['rev_user_id'], $row['rev_user_ip']), 'rc_type' => RC_FLOW, 'rc_source' => self::SRC_FLOW, 'rc_minor' => 0, 'rc_bot' => 0, 'rc_patrolled' => $user->isAllowed('autopatrol') ? 1 : 0, 'rc_old_len' => $revision->getPreviousContentLength(), 'rc_new_len' => $revision->getContentLength(), 'rc_this_oldid' => 0, 'rc_last_oldid' => 0, 'rc_log_type' => null, 'rc_params' => serialize(array('flow-workflow-change' => array('action' => $action, 'revision_type' => get_class($revision), 'revision' => $revisionId, 'workflow' => $workflow->getId()->getAlphadecimal()))), 'rc_cur_id' => 0, 'rc_comment' => '', 'rc_timestamp' => $timestamp, 'rc_deleted' => 0);
     $rc = $this->rcFactory->newFromRow((object) $attribs);
     $rc->save(true);
     // Insert into db
     $feeds = $wgRCFeeds;
     // Override the IRC formatter with our own formatter
     foreach (array_keys($feeds) as $name) {
         $feeds[$name]['original_formatter'] = $feeds[$name]['formatter'];
         $feeds[$name]['formatter'] = $this->ircFormatter;
     }
     // pre-load the irc formatter which will be triggered via hook
     $this->ircFormatter->associate($rc, array('revision' => $revision) + $metadata);
     // run the feeds/irc/etc external notifications
     $rc->notifyRCFeeds($feeds);
 }
开发者ID:TarLocesilion,项目名称:mediawiki-extensions-Flow,代码行数:37,代码来源:RecentChangesListener.php

示例3: wfGlobalInterwikis

function wfGlobalInterwikis($prefix, &$iwData)
{
    global $wgInterwikiCentralDB;
    // docs/hooks.txt says: Return true without providing an interwiki to continue interwiki search.
    if ($wgInterwikiCentralDB === null || $wgInterwikiCentralDB === wfWikiId()) {
        // No global set or this is global, nothing to add
        return true;
    }
    if (!Language::fetchLanguageName($prefix)) {
        // Check if prefix exists locally and skip
        foreach (Interwiki::getAllPrefixes(null) as $id => $localPrefixInfo) {
            if ($prefix === $localPrefixInfo['iw_prefix']) {
                return true;
            }
        }
        $dbr = wfGetDB(DB_SLAVE, array(), $wgInterwikiCentralDB);
        $res = $dbr->selectRow('interwiki', '*', array('iw_prefix' => $prefix), __METHOD__);
        if (!$res) {
            return true;
        }
        // Excplicitly make this an array since it's expected to be one
        $iwData = (array) $res;
        // At this point, we can safely return false because we know that we have something
        return false;
    }
    return true;
}
开发者ID:whysasse,项目名称:kmwiki,代码行数:27,代码来源:Interwiki.php

示例4: 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

示例5: 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:admonkey,项目名称:mediawiki,代码行数:30,代码来源:updateSearchIndex.php

示例6: getMocks

 protected function getMocks()
 {
     $dbMock = $this->getMockBuilder('DatabaseMysql')->disableOriginalConstructor()->getMock();
     $backendMock = $this->getMock('FSFileBackend', array(), array(array('name' => $this->backendName, 'wikiId' => wfWikiId())));
     $wrapperMock = $this->getMock('FileBackendDBRepoWrapper', array('getDB'), array(array('backend' => $backendMock, 'repoName' => $this->repoName, 'dbHandleFactory' => null)));
     $wrapperMock->expects($this->any())->method('getDB')->will($this->returnValue($dbMock));
     return array($dbMock, $backendMock, $wrapperMock);
 }
开发者ID:Acidburn0zzz,项目名称:mediawiki,代码行数:8,代码来源:FileBackendDBRepoWrapperTest.php

示例7: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->filePath = __DIR__ . '/../../data/media';
     $this->backend = new FSFileBackend(array('name' => 'localtesting', 'wikiId' => wfWikiId(), 'containerPaths' => array('data' => $this->filePath)));
     $this->repo = new FSRepo(array('name' => 'temp', 'url' => 'http://localhost/thumbtest', 'backend' => $this->backend));
     $this->handler = new PNGHandler();
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:8,代码来源:PNGTest.php

示例8: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->checkPHPExtension('exif');
     $filePath = __DIR__ . '/../../data/media';
     $this->backend = new FSFileBackend(array('name' => 'localtesting', 'wikiId' => wfWikiId(), 'containerPaths' => array('data' => $filePath)));
     $this->repo = new FSRepo(array('name' => 'temp', 'url' => 'http://localhost/thumbtest', 'backend' => $this->backend));
     $this->setMwGlobals('wgShowEXIF', true);
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:9,代码来源:FormatMetadataTest.php

示例9: execute

 public function execute()
 {
     $conn = $this->getCirrusConnection();
     foreach ($conn->getAllIndexTypes() as $index) {
         $mapping = $conn->getPageType(wfWikiId(), $index)->getMapping();
         $this->getResult()->addValue(null, $index, $mapping);
         $this->getResult()->addPreserveKeysList(array($index, 'page'), '_all');
     }
 }
开发者ID:zoglun,项目名称:mediawiki-extensions-CirrusSearch,代码行数:9,代码来源:MappingDump.php

示例10: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->checkPHPExtension('exif');
     $this->handler = new BitmapHandler();
     $filePath = __DIR__ . '/../../data/media';
     $tmpDir = $this->getNewTempDirectory();
     $this->repo = new FSRepo(array('name' => 'temp', 'url' => 'http://localhost/thumbtest', 'backend' => new FSFileBackend(array('name' => 'localtesting', 'wikiId' => wfWikiId(), 'containerPaths' => array('temp-thumb' => $tmpDir, 'data' => $filePath)))));
     $this->setMwGlobals(array('wgShowEXIF' => true, 'wgEnableAutoRotation' => true));
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:10,代码来源:ExifRotationTest.php

示例11: __construct

 /**
  * @param UserNameBatch $batch
  * @param array $keys key - a list of keys from storage that contain user ids, value - the wiki for the user id lookup, default to $wiki if null
  * @param string|null $wiki The wikiid to use when $wikiKey is null. If both are null wfWikiId() is used
  */
 public function __construct(UserNameBatch $batch, array $keys, $wiki = null)
 {
     $this->batch = $batch;
     $this->keys = $keys;
     if ($wiki === null) {
         $this->wiki = wfWikiId();
     } else {
         $this->wiki = $wiki;
     }
 }
开发者ID:TarLocesilion,项目名称:mediawiki-extensions-Flow,代码行数:15,代码来源:UserNameListener.php

示例12: makeTitle

 /**
  * Many loaded references typically point to the same Title, cache those instead
  * of generating a bunch of duplicate title classes.
  */
 public static function makeTitle($namespace, $title)
 {
     try {
         return Workflow::getFromTitleCache(wfWikiId(), $namespace, $title);
     } catch (InvalidInputException $e) {
         // duplicate Title::makeTitleSafe which returns null on failure,
         // but only for InvalidInputException
         return null;
     }
 }
开发者ID:TarLocesilion,项目名称:mediawiki-extensions-Flow,代码行数:14,代码来源:WikiReference.php

示例13: execute

 public function execute()
 {
     global $wgGlobalUsageDatabase;
     $dbr = wfGetDB(DB_SLAVE);
     $dbw = wfGetDB(DB_MASTER, array(), $wgGlobalUsageDatabase);
     $gu = new GlobalUsage(wfWikiId(), $dbw);
     $lastPageId = intval($this->getOption('start-page', 0));
     $lastIlTo = $this->getOption('start-image');
     $limit = 500;
     $maxlag = intval($this->getOption('maxlag', 5));
     do {
         $this->output("Querying links after (page_id, il_to) = ({$lastPageId}, {$lastIlTo})\n");
         # Query all pages and any imagelinks associated with that
         $quotedLastIlTo = $dbr->addQuotes($lastIlTo);
         $res = $dbr->select(array('page', 'imagelinks', 'image'), array('page_id', 'page_namespace', 'page_title', 'il_to', 'img_name'), "(page_id = {$lastPageId} AND il_to > {$quotedLastIlTo})" . " OR page_id > {$lastPageId}", __METHOD__, array('ORDER BY' => $dbr->implicitOrderBy() ? 'page_id' : 'page_id, il_to', 'LIMIT' => $limit), array('imagelinks' => array('LEFT JOIN', 'page_id = il_from'), 'image' => array('LEFT JOIN', 'il_to = img_name')));
         # Build up a tree per pages
         $pages = array();
         $lastRow = null;
         foreach ($res as $row) {
             if (!isset($pages[$row->page_id])) {
                 $pages[$row->page_id] = array();
             }
             # Add the imagelinks entry to the pages array if the image
             # does not exist locally
             if (!is_null($row->il_to) && is_null($row->img_name)) {
                 $pages[$row->page_id][$row->il_to] = $row;
             }
             $lastRow = $row;
         }
         # Insert the imagelinks data to the global table
         foreach ($pages as $pageId => $rows) {
             # Delete all original links if this page is not a continuation
             # of last iteration.
             if ($pageId != $lastPageId) {
                 $gu->deleteLinksFromPage($pageId);
             }
             if ($rows) {
                 $title = Title::newFromRow(reset($rows));
                 $images = array_keys($rows);
                 # Since we have a pretty accurate page_id, don't specify
                 # Title::GAID_FOR_UPDATE
                 $gu->insertLinks($title, $images, 0);
             }
         }
         if ($lastRow) {
             # We've processed some rows in this iteration, so save
             # continuation variables
             $lastPageId = $lastRow->page_id;
             $lastIlTo = $lastRow->il_to;
             # Be nice to the database
             $dbw->commit();
             wfWaitForSlaves($maxlag, $wgGlobalUsageDatabase);
         }
     } while (!is_null($lastRow));
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:55,代码来源:refreshGlobalimagelinks.php

示例14: processParam

 protected function processParam($event, $param, $message, $user)
 {
     $extra = $event->getExtra();
     if ($param === 'subject') {
         if (isset($extra['topic-title']) && $extra['topic-title']) {
             $this->processParamEscaped($message, trim($extra['topic-title']));
         } else {
             $message->params('');
         }
     } elseif ($param === 'commentText') {
         if (isset($extra['content']) && $extra['content']) {
             // @todo assumes content is html, make explicit
             $message->params(Utils::htmlToPlaintext($extra['content'], 200));
         } else {
             $message->params('');
         }
     } elseif ($param === 'post-permalink') {
         $anchor = $this->getPostLinkAnchor($event, $user);
         if ($anchor) {
             $message->params($anchor->getFullUrl());
         } else {
             $message->params('');
         }
     } elseif ($param === 'topic-permalink') {
         // link to individual new-topic
         if (isset($extra['topic-workflow'])) {
             $title = Workflow::getFromTitleCache(wfWikiId(), NS_TOPIC, $extra['topic-workflow']->getAlphadecimal());
         } else {
             $title = $event->getTitle();
         }
         $anchor = $this->getUrlGenerator()->workflowLink($title, $extra['topic-workflow']);
         $anchor->query['fromnotif'] = 1;
         $message->params($anchor->getFullUrl());
     } elseif ($param === 'new-topics-permalink') {
         // link to board sorted by newest topics
         $anchor = $this->getUrlGenerator()->boardLink($event->getTitle(), 'newest');
         $anchor->query['fromnotif'] = 1;
         $message->params($anchor->getFullUrl());
     } elseif ($param == 'flow-title') {
         $title = $event->getTitle();
         if ($title) {
             $formatted = $this->formatTitle($title);
         } else {
             $formatted = $this->getMessage('echo-no-title')->text();
         }
         $message->params($formatted);
     } elseif ($param == 'old-subject') {
         $this->processParamEscaped($message, trim($extra['old-subject']));
     } elseif ($param == 'new-subject') {
         $this->processParamEscaped($message, trim($extra['new-subject']));
     } else {
         parent::processParam($event, $param, $message, $user);
     }
 }
开发者ID:TarLocesilion,项目名称:mediawiki-extensions-Flow,代码行数:54,代码来源:Formatter.php

示例15: check

 private function check()
 {
     for ($pageId = $this->fromId; $pageId <= $this->toId; $pageId++) {
         $status = $this->checker->check($pageId);
         if (!$status->isOK()) {
             $this->error($status->getWikiText(), 1);
         }
         if (($pageId - $this->fromId) % 100 === 0) {
             $this->output(sprintf("[%20s]%10d/%d\n", wfWikiId(), $pageId, $this->toId));
         }
     }
 }
开发者ID:zoglun,项目名称:mediawiki-extensions-CirrusSearch,代码行数:12,代码来源:saneitize.php


注:本文中的wfWikiId函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。