• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wfWarn函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __construct

 /**
  * Additional params include:
  *   - dbDirectory : directory containing the DB and the lock file directory
  *                   [defaults to $wgSQLiteDataDir]
  *   - dbFilePath  : use this to force the path of the DB file
  *   - trxMode     : one of (deferred, immediate, exclusive)
  * @param array $p
  */
 function __construct(array $p)
 {
     global $wgSharedDB, $wgSQLiteDataDir;
     $this->dbDir = isset($p['dbDirectory']) ? $p['dbDirectory'] : $wgSQLiteDataDir;
     if (isset($p['dbFilePath'])) {
         parent::__construct($p);
         // Standalone .sqlite file mode.
         // Super doesn't open when $user is false, but we can work with $dbName,
         // which is derived from the file path in this case.
         $this->openFile($p['dbFilePath']);
     } else {
         $this->mDBname = $p['dbname'];
         // Stock wiki mode using standard file names per DB.
         parent::__construct($p);
         // Super doesn't open when $user is false, but we can work with $dbName
         if ($p['dbname'] && !$this->isOpen()) {
             if ($this->open($p['host'], $p['user'], $p['password'], $p['dbname'])) {
                 if ($wgSharedDB) {
                     $this->attachDatabase($wgSharedDB);
                 }
             }
         }
     }
     $this->trxMode = isset($p['trxMode']) ? strtoupper($p['trxMode']) : null;
     if ($this->trxMode && !in_array($this->trxMode, array('DEFERRED', 'IMMEDIATE', 'EXCLUSIVE'))) {
         $this->trxMode = null;
         wfWarn("Invalid SQLite transaction mode provided.");
     }
     $this->lockMgr = new FSLockManager(array('lockDirectory' => "{$this->dbDir}/locks"));
 }
开发者ID:D66Ha,项目名称:mediawiki,代码行数:38,代码来源:DatabaseSqlite.php


示例2: __construct

 /**
  * Additional params include:
  *   - dbDirectory : directory containing the DB and the lock file directory
  *                   [defaults to $wgSQLiteDataDir]
  *   - dbFilePath  : use this to force the path of the DB file
  *   - trxMode     : one of (deferred, immediate, exclusive)
  * @param array $p
  */
 function __construct(array $p)
 {
     global $wgSharedDB, $wgSQLiteDataDir;
     $this->dbDir = isset($p['dbDirectory']) ? $p['dbDirectory'] : $wgSQLiteDataDir;
     if (isset($p['dbFilePath'])) {
         $this->mFlags = isset($p['flags']) ? $p['flags'] : 0;
         // Standalone .sqlite file mode
         $this->openFile($p['dbFilePath']);
         // @FIXME: clean up base constructor so this can call super instead
         $this->mTrxAtomicLevels = new SplStack();
     } else {
         $this->mDBname = $p['dbname'];
         // Stock wiki mode using standard file names per DB
         parent::__construct($p);
         // parent doesn't open when $user is false, but we can work with $dbName
         if ($p['dbname'] && !$this->isOpen()) {
             if ($this->open($p['host'], $p['user'], $p['password'], $p['dbname'])) {
                 if ($wgSharedDB) {
                     $this->attachDatabase($wgSharedDB);
                 }
             }
         }
     }
     $this->trxMode = isset($p['trxMode']) ? strtoupper($p['trxMode']) : null;
     if ($this->trxMode && !in_array($this->trxMode, array('DEFERRED', 'IMMEDIATE', 'EXCLUSIVE'))) {
         $this->trxMode = null;
         wfWarn("Invalid SQLite transaction mode provided.");
     }
     $this->lockMgr = new FSLockManager(array('lockDirectory' => "{$this->dbDir}/locks"));
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:38,代码来源:DatabaseSqlite.php


示例3: onAfterInsert

 public function onAfterInsert($object, array $row, array $metadata)
 {
     if (!$object instanceof PostRevision) {
         wfWarn(__METHOD__ . ': Object is no PostRevision instance');
         return;
     }
     if (!isset($metadata['workflow'])) {
         wfWarn(__METHOD__ . ': Missing required metadata: workflow');
         return;
     }
     $workflow = $metadata['workflow'];
     if (!$workflow instanceof Workflow) {
         throw new InvalidDataException('Workflow metadata is not Workflow instance');
     }
     if ($workflow->getType() !== 'topic') {
         wfWarn(__METHOD__ . ': Expected "topic" workflow but received "' . $workflow->getType() . '"');
         return;
     }
     /** @var $title Title */
     $title = $workflow->getArticleTitle();
     if (!$title) {
         return;
     }
     $this->onAfterInsertExpectedChange($row['rev_change_type'], $metadata['workflow']);
 }
开发者ID:TarLocesilion,项目名称:mediawiki-extensions-Flow,代码行数:25,代码来源:WatchTopicListener.php


示例4: cleanWrapped

 /**
  * Use the HTML tidy extension to use the tidy library in-process,
  * saving the overhead of spawning a new process.
  *
  * @param string $text HTML to check
  * @param bool $stderr Whether to read result from error status instead of output
  * @param int &$retval Exit code (-1 on internal error)
  * @return string|null
  */
 protected function cleanWrapped($text, $stderr = false, &$retval = null)
 {
     if (!class_exists('tidy')) {
         wfWarn("Unable to load internal tidy class.");
         $retval = -1;
         return null;
     }
     $tidy = new \tidy();
     $tidy->parseString($text, $this->config['tidyConfigFile'], 'utf8');
     if ($stderr) {
         $retval = $tidy->getStatus();
         return $tidy->errorBuffer;
     }
     $tidy->cleanRepair();
     $retval = $tidy->getStatus();
     if ($retval == 2) {
         // 2 is magic number for fatal error
         // http://www.php.net/manual/en/function.tidy-get-status.php
         $cleansource = null;
     } else {
         $cleansource = tidy_get_output($tidy);
         if (!empty($this->config['debugComment']) && $retval > 0) {
             $cleansource .= "<!--\nTidy reports:\n" . str_replace('-->', '--&gt;', $tidy->errorBuffer) . "\n-->";
         }
     }
     return $cleansource;
 }
开发者ID:Acidburn0zzz,项目名称:mediawiki,代码行数:36,代码来源:RaggettInternalPHP.php


示例5: registerServiceFeature

 /**
  * Registeres a feature for a service object.
  * Registers a warning when the service is not registered, but does not give an error.
  * 
  * @since 0.6.6
  * 
  * @param $serviceIdentifier String: internal service identifier
  * @param $featureName String
  * @param $featureClassName String
  */
 public static function registerServiceFeature($serviceIdentifier, $featureName, $featureClassName)
 {
     if (array_key_exists($serviceIdentifier, self::$registeredServices)) {
         $service = self::getServiceInstance($serviceIdentifier);
         $service->addFeature($featureName, $featureClassName);
     } else {
         // If the feature is not registered, register a warning. This is not an error though!
         wfWarn("Tried to register feature '{$featureName}' with class '{$featureClassName}' to non-registered service '{$serviceIdentifier}'.");
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:20,代码来源:Maps_MappingServices.php


示例6: __construct

 function __construct()
 {
     $this->cliMode = true;
     $this->connLogger = new \Psr\Log\NullLogger();
     $this->queryLogger = new \Psr\Log\NullLogger();
     $this->errorLogger = function (Exception $e) {
         wfWarn(get_class($e) . ": {$e->getMessage()}");
     };
     $this->currentDomain = DatabaseDomain::newUnspecified();
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:10,代码来源:DatabaseUpdaterTest.php


示例7: __construct

 public function __construct($text, $model_id = CONTENT_MODEL_TEXT)
 {
     parent::__construct($model_id);
     if ($text === null || $text === false) {
         wfWarn("TextContent constructed with \$text = " . var_export($text, true) . "! " . "This may indicate an error in the caller's scope.");
         $text = '';
     }
     if (!is_string($text)) {
         throw new MWException("TextContent expects a string in the constructor.");
     }
     $this->mText = $text;
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:12,代码来源:TextContent.php


示例8: __construct

 public function __construct($testName, array $opts = [])
 {
     $this->testName = $testName;
     $this->profiler = new ProfilerStub([]);
     $this->trxProfiler = new TransactionProfiler();
     $this->cliMode = isset($opts['cliMode']) ? $opts['cliMode'] : true;
     $this->connLogger = new \Psr\Log\NullLogger();
     $this->queryLogger = new \Psr\Log\NullLogger();
     $this->errorLogger = function (Exception $e) {
         wfWarn(get_class($e) . ": {$e->getMessage()}");
     };
     $this->currentDomain = DatabaseDomain::newUnspecified();
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:13,代码来源:DatabaseTestHelper.php


示例9: manipulate

 /**
  * @see ParameterManipulation::manipulate
  * 
  * @since 0.7
  */
 public function manipulate(Parameter &$parameter, array &$parameters)
 {
     global $egMapsOLLayerGroups, $egMapsOLAvailableLayers;
     $layerDefs = array();
     $layerNames = array();
     foreach ($parameter->getValue() as $layerOrGroup) {
         $lcLayerOrGroup = strtolower($layerOrGroup);
         // Layer groups. Loop over all items and add them when not present yet.
         if (array_key_exists($lcLayerOrGroup, $egMapsOLLayerGroups)) {
             foreach ($egMapsOLLayerGroups[$lcLayerOrGroup] as $layerName) {
                 if (!in_array($layerName, $layerNames)) {
                     if (is_array($egMapsOLAvailableLayers[$layerName])) {
                         $layerDefs[] = 'new ' . $egMapsOLAvailableLayers[$layerName][0];
                     } else {
                         $layerDefs[] = 'new ' . $egMapsOLAvailableLayers[$layerName];
                     }
                     $layerNames[] = $layerName;
                 }
             }
         } elseif (array_key_exists($lcLayerOrGroup, $egMapsOLAvailableLayers)) {
             if (!in_array($lcLayerOrGroup, $layerNames)) {
                 if (is_array($egMapsOLAvailableLayers[$lcLayerOrGroup])) {
                     $layerDefs[] = 'new ' . $egMapsOLAvailableLayers[$lcLayerOrGroup][0];
                 } else {
                     $layerDefs[] = 'new ' . $egMapsOLAvailableLayers[$lcLayerOrGroup];
                 }
                 $layerNames[] = $lcLayerOrGroup;
             }
         } else {
             $title = Title::newFromText($layerOrGroup, Maps_NS_LAYER);
             if ($title->getNamespace() == Maps_NS_LAYER && $title->exists()) {
                 $layerPage = new MapsLayerPage($title);
                 if ($layerPage->hasValidDefinition('openlayers')) {
                     $layer = $layerPage->getLayer();
                     if (!in_array($layerOrGroup, $layerNames)) {
                         $layerDefs[] = $layer->getJavaScriptDefinition();
                         $layerNames[] = $layerOrGroup;
                     }
                 } else {
                     wfWarn("Invalid layer ({$layerOrGroup}) encountered after validation.");
                 }
             } else {
                 wfWarn("Invalid layer ({$layerOrGroup}) encountered after validation.");
             }
         }
     }
     $parameter->setValue($layerDefs);
     MapsMappingServices::getServiceInstance('openlayers')->addLayerDependencies($this->getDependencies($layerNames));
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:54,代码来源:Maps_ParamOLLayers.php


示例10: validate

 /**
  * @param IContextSource $context
  * @param AbstractRevision $newRevision
  * @param AbstractRevision|null $oldRevision
  * @param Title $title
  * @return Status
  */
 public function validate(IContextSource $context, AbstractRevision $newRevision, AbstractRevision $oldRevision = null, Title $title)
 {
     $spamObj = BaseBlacklist::getInstance('spam');
     if (!$spamObj instanceof \SpamBlacklist) {
         wfWarn(__METHOD__ . ': Expected a SpamBlacklist instance but instead received: ' . get_class($spamObj));
         return Status::newFatal('something');
     }
     $links = $this->getLinks($newRevision, $title);
     $matches = $spamObj->filter($links, $title);
     if ($matches !== false) {
         $status = Status::newFatal('spamprotectiontext');
         foreach ($matches as $match) {
             $status->fatal('spamprotectionmatch', $match);
         }
         return $status;
     }
     return Status::newGood();
 }
开发者ID:TarLocesilion,项目名称:mediawiki-extensions-Flow,代码行数:25,代码来源:SpamBlacklist.php


示例11: getOtherProjectsSiteIds

 /**
  * Get the site ids of other projects to use.
  *
  * @param array $siteLinkGroups
  * @return string[]
  */
 public function getOtherProjectsSiteIds(array $siteLinkGroups)
 {
     $localSite = $this->getLocalSite();
     if ($localSite === null) {
         wfWarn('Site not found for ' . $this->localSiteId);
         return array();
     }
     $currentGroupId = $localSite->getGroup();
     $otherProjectsSiteIds = array();
     $this->expandSpecialGroups($siteLinkGroups);
     foreach ($siteLinkGroups as $groupId) {
         if ($groupId === $currentGroupId) {
             continue;
         }
         $siteToAdd = $this->getSiteForGroup($groupId, $localSite->getLanguageCode());
         if ($siteToAdd) {
             $otherProjectsSiteIds[] = $siteToAdd->getGlobalId();
         }
     }
     return $otherProjectsSiteIds;
 }
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:27,代码来源:OtherProjectsSitesGenerator.php


示例12: partitionBacklinkJob

 /**
  * Break down $job into approximately ($bSize/$cSize) leaf jobs and a single partition
  * job that covers the remaining backlink range (if needed). Jobs for the first $bSize
  * titles are collated ($cSize per job) into leaf jobs to do actual work. All the
  * resulting jobs are of the same class as $job. No partition job is returned if the
  * range covered by $job was less than $bSize, as the leaf jobs have full coverage.
  *
  * The leaf jobs have the 'pages' param set to a (<page ID>:(<namespace>,<DB key>),...)
  * map so that the run() function knows what pages to act on. The leaf jobs will keep
  * the same job title as the parent job (e.g. $job).
  *
  * The partition jobs have the 'range' parameter set to a map of the format
  * (start:<integer>, end:<integer>, batchSize:<integer>, subranges:((<start>,<end>),...)),
  * the 'table' parameter set to that of $job, and the 'recursive' parameter set to true.
  * This method can be called on the resulting job to repeat the process again.
  *
  * The job provided ($job) must have the 'recursive' parameter set to true and the 'table'
  * parameter must be set to a backlink table. The job title will be used as the title to
  * find backlinks for. Any 'range' parameter must follow the same format as mentioned above.
  * This should be managed by recursive calls to this method.
  *
  * The first jobs return are always the leaf jobs. This lets the caller use push() to
  * put them directly into the queue and works well if the queue is FIFO. In such a queue,
  * the leaf jobs have to get finished first before anything can resolve the next partition
  * job, which keeps the queue very small.
  *
  * $opts includes:
  *   - params : extra job parameters to include in each job
  *
  * @param Job $job
  * @param int $bSize BacklinkCache partition size; usually $wgUpdateRowsPerJob
  * @param int $cSize Max titles per leaf job; Usually 1 or a modest value
  * @param array $opts Optional parameter map
  * @return Job[] List of Job objects
  */
 public static function partitionBacklinkJob(Job $job, $bSize, $cSize, $opts = array())
 {
     $class = get_class($job);
     $title = $job->getTitle();
     $params = $job->getParams();
     if (isset($params['pages']) || empty($params['recursive'])) {
         $ranges = array();
         // sanity; this is a leaf node
         wfWarn(__METHOD__ . " called on {$job->getType()} leaf job (explosive recursion).");
     } elseif (isset($params['range'])) {
         // This is a range job to trigger the insertion of partitioned/title jobs...
         $ranges = $params['range']['subranges'];
         $realBSize = $params['range']['batchSize'];
     } else {
         // This is a base job to trigger the insertion of partitioned jobs...
         $ranges = $title->getBacklinkCache()->partition($params['table'], $bSize);
         $realBSize = $bSize;
     }
     $extraParams = isset($opts['params']) ? $opts['params'] : array();
     $jobs = array();
     // Combine the first range (of size $bSize) backlinks into leaf jobs
     if (isset($ranges[0])) {
         list($start, $end) = $ranges[0];
         $titles = $title->getBacklinkCache()->getLinks($params['table'], $start, $end);
         foreach (array_chunk(iterator_to_array($titles), $cSize) as $titleBatch) {
             $pages = array();
             foreach ($titleBatch as $tl) {
                 $pages[$tl->getArticleId()] = array($tl->getNamespace(), $tl->getDBKey());
             }
             $jobs[] = new $class($title, array('pages' => $pages) + $extraParams);
         }
     }
     // Take all of the remaining ranges and build a partition job from it
     if (isset($ranges[1])) {
         $jobs[] = new $class($title, array('recursive' => true, 'table' => $params['table'], 'range' => array('start' => $ranges[1][0], 'end' => $ranges[count($ranges) - 1][1], 'batchSize' => $realBSize, 'subranges' => array_slice($ranges, 1))) + $extraParams);
     }
     return $jobs;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:73,代码来源:BacklinkJobUtils.php


示例13: cleanWrapped

 /**
  * Spawn an external HTML tidy process and get corrected markup back from it.
  * Also called in OutputHandler.php for full page validation
  *
  * @param string $text HTML to check
  * @param bool $stderr Whether to read result from STDERR rather than STDOUT
  * @param int &$retval Exit code (-1 on internal error)
  * @return string|null
  */
 protected function cleanWrapped($text, $stderr = false, &$retval = null)
 {
     $cleansource = '';
     $opts = ' -utf8';
     if ($stderr) {
         $descriptorspec = [0 => ['pipe', 'r'], 1 => ['file', wfGetNull(), 'a'], 2 => ['pipe', 'w']];
     } else {
         $descriptorspec = [0 => ['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['file', wfGetNull(), 'a']];
     }
     $readpipe = $stderr ? 2 : 1;
     $pipes = [];
     $process = proc_open("{$this->config['tidyBin']} -config {$this->config['tidyConfigFile']} " . $this->config['tidyCommandLine'] . $opts, $descriptorspec, $pipes);
     // NOTE: At least on linux, the process will be created even if tidy is not installed.
     //      This means that missing tidy will be treated as a validation failure.
     if (is_resource($process)) {
         // Theoretically, this style of communication could cause a deadlock
         // here. If the stdout buffer fills up, then writes to stdin could
         // block. This doesn't appear to happen with tidy, because tidy only
         // writes to stdout after it's finished reading from stdin. Search
         // for tidyParseStdin and tidySaveStdout in console/tidy.c
         fwrite($pipes[0], $text);
         fclose($pipes[0]);
         while (!feof($pipes[$readpipe])) {
             $cleansource .= fgets($pipes[$readpipe], 1024);
         }
         fclose($pipes[$readpipe]);
         $retval = proc_close($process);
     } else {
         wfWarn("Unable to start external tidy process");
         $retval = -1;
     }
     if (!$stderr && $cleansource == '' && $text != '') {
         // Some kind of error happened, so we couldn't get the corrected text.
         // Just give up; we'll use the source text and append a warning.
         $cleansource = null;
     }
     return $cleansource;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:47,代码来源:RaggettExternal.php


示例14: getResultText

 protected function getResultText(SMWQueryResult $res, $outputmode)
 {
     if (!is_callable('renderGraphviz')) {
         wfWarn('The SRF Graph printer needs the GraphViz extension to be installed.');
         return '';
     }
     global $wgGraphVizSettings;
     $this->isHTML = true;
     $graphInput = "digraph {$this->m_graphName} {";
     if ($this->m_graphSize != '') {
         $graphInput .= "size=\"{$this->m_graphSize}\";";
     }
     if ($this->m_nodeShape) {
         $graphInput .= "node [shape={$this->m_nodeShape}];";
     }
     $graphInput .= "rankdir={$this->m_rankdir};";
     while ($row = $res->getNext()) {
         $graphInput .= $this->getGVForItem($row, $outputmode);
     }
     $graphInput .= "}";
     // Calls renderGraphViz function from MediaWiki GraphViz extension
     $result = renderGraphviz($graphInput);
     if ($this->m_graphLegend && $this->m_graphColor) {
         $arrayCount = 0;
         $arraySize = count($this->m_graphColors);
         $result .= "<P>";
         foreach ($this->m_labelArray as $m_label) {
             if ($arrayCount >= $arraySize) {
                 $arrayCount = 0;
             }
             $color = $this->m_graphColors[$arrayCount];
             $result .= "<font color={$color}>{$color}: {$m_label} </font><br />";
             $arrayCount += 1;
         }
         $result .= "</P>";
     }
     return $result;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:38,代码来源:SRF_Graph.php


示例15: doSchemaUpdate

 /**
  * @param DatabaseUpdater $updater
  */
 public function doSchemaUpdate(DatabaseUpdater $updater)
 {
     $db = $updater->getDB();
     $type = $db->getType();
     if ($type !== 'mysql' && $type !== 'sqlite') {
         wfWarn("Database type '{$type}' is not supported by the Wikibase repository.");
         return;
     }
     $this->addChangesTable($updater, $type);
     // Update from 0.1.
     if (!$db->tableExists('wb_terms')) {
         $updater->dropTable('wb_items_per_site');
         $updater->dropTable('wb_items');
         $updater->dropTable('wb_aliases');
         $updater->dropTable('wb_texts_per_lang');
         $updater->addExtensionTable('wb_terms', $this->getUpdateScriptPath('Wikibase', $db->getType()));
         $this->store->rebuild();
     }
     $this->updateEntityPerPageTable($updater, $db);
     $this->updateTermsTable($updater, $db);
     $this->updateItemsPerSiteTable($updater, $db);
     $this->updateChangesTable($updater, $db);
     $this->registerPropertyInfoTableUpdates($updater);
 }
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:27,代码来源:DatabaseSchemaUpdater.php


示例16: newFromText

 /**
  * Create a new Title from text, such as what one would find in a link. De-
  * codes any HTML entities in the text.
  *
  * @param string $text The link text; spaces, prefixes, and an
  *   initial ':' indicating the main namespace are accepted.
  * @param int $defaultNamespace The namespace to use if none is specified
  *   by a prefix.  If you want to force a specific namespace even if
  *   $text might begin with a namespace prefix, use makeTitle() or
  *   makeTitleSafe().
  * @throws InvalidArgumentException
  * @return Title|null Title or null on an error.
  */
 public static function newFromText($text, $defaultNamespace = NS_MAIN)
 {
     if (is_object($text)) {
         throw new InvalidArgumentException('$text must be a string.');
     } elseif (!is_string($text)) {
         wfDebugLog('T76305', wfGetAllCallers(5));
         wfWarn(__METHOD__ . ': $text must be a string. This will throw an InvalidArgumentException in future.', 2);
     }
     try {
         return Title::newFromTextThrow($text, $defaultNamespace);
     } catch (MalformedTitleException $ex) {
         return null;
     }
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:27,代码来源:Title.php


示例17: getContentModel

	/**
	 * Returns the page's content model id (see the CONTENT_MODEL_XXX constants).
	 *
	 * Will use the revisions actual content model if the page exists,
	 * and the page's default if the page doesn't exist yet.
	 *
	 * @return String
	 *
	 * @since 1.21
	 */
	public function getContentModel() {
		if ( $this->exists() ) {
			// look at the revision's actual content model
			$rev = $this->getRevision();

			if ( $rev !== null ) {
				return $rev->getContentModel();
			} else {
				$title = $this->mTitle->getPrefixedDBkey();
				wfWarn( "Page $title exists but has no (visible) revisions!" );
			}
		}

		// use the default model for this page
		return $this->mTitle->getContentModel();
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:26,代码来源:WikiPage.php


示例18: getLocalNameFor

 /**
  * Get the local name for a specified canonical name
  *
  * @param string $name
  * @param string|bool $subpage
  * @return string
  */
 public static function getLocalNameFor($name, $subpage = false)
 {
     global $wgContLang;
     $aliases = $wgContLang->getSpecialPageAliases();
     $aliasList = self::getAliasList();
     // Find the first alias that maps back to $name
     if (isset($aliases[$name])) {
         $found = false;
         foreach ($aliases[$name] as $alias) {
             $caseFoldedAlias = $wgContLang->caseFold($alias);
             $caseFoldedAlias = str_replace(' ', '_', $caseFoldedAlias);
             if (isset($aliasList[$caseFoldedAlias]) && $aliasList[$caseFoldedAlias] === $name) {
                 $name = $alias;
                 $found = true;
                 break;
             }
         }
         if (!$found) {
             wfWarn("Did not find a usable alias for special page '{$name}'. " . "It seems all defined aliases conflict?");
         }
     } else {
         // Check if someone misspelled the correct casing
         if (is_array($aliases)) {
             foreach ($aliases as $n => $values) {
                 if (strcasecmp($name, $n) === 0) {
                     wfWarn("Found alias defined for {$n} when searching for " . "special page aliases for {$name}. Case mismatch?");
                     return self::getLocalNameFor($n, $subpage);
                 }
             }
         }
         wfWarn("Did not find alias for special page '{$name}'. " . "Perhaps no aliases are defined for it?");
     }
     if ($subpage !== false && !is_null($subpage)) {
         $name = "{$name}/{$subpage}";
     }
     return $wgContLang->ucfirst($name);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:44,代码来源:SpecialPageFactory.php


示例19: getLocalNameFor

 /**
  * Get the local name for a specified canonical name
  *
  * @param $name String
  * @param $subpage String|Bool
  *
  * @return String
  */
 static function getLocalNameFor($name, $subpage = false)
 {
     global $wgContLang;
     $aliases = $wgContLang->getSpecialPageAliases();
     if (isset($aliases[$name][0])) {
         $name = $aliases[$name][0];
     } else {
         // Try harder in case someone misspelled the correct casing
         $found = false;
         foreach ($aliases as $n => $values) {
             if (strcasecmp($name, $n) === 0) {
                 wfWarn("Found alias defined for {$n} when searching for " . "special page aliases for {$name}. Case mismatch?");
                 $name = $values[0];
                 $found = true;
                 break;
             }
         }
         if (!$found) {
             wfWarn("Did not find alias for special page '{$name}'. " . "Perhaps no aliases are defined for it?");
         }
     }
     if ($subpage !== false && !is_null($subpage)) {
         $name = "{$name}/{$subpage}";
     }
     return $wgContLang->ucfirst($name);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:34,代码来源:SpecialPageFactory.php


示例20: getContentModel

 /**
  * Returns the page's content model id (see the CONTENT_MODEL_XXX constants).
  *
  * Will use the revisions actual content model if the page exists,
  * and the page's default if the page doesn't exist yet.
  *
  * @return string
  *
  * @since 1.21
  */
 public function getContentModel()
 {
     if ($this->exists()) {
         $cache = ObjectCache::getMainWANInstance();
         return $cache->getWithSetCallback($cache->makeKey('page', 'content-model', $this->getLatest()), $cache::TTL_MONTH, function () {
             $rev = $this->getRevision();
             if ($rev) {
                 // Look at the revision's actual content model
                 return $rev->getContentModel();
             } else {
                 $title = $this->mTitle->getPrefixedDBkey();
                 wfWarn("Page {$title} exists but has no (visible) revisions!");
                 return $this->mTitle->getContentModel();
             }
         });
     }
     // use the default model for this page
     return $this->mTitle->getContentModel();
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:29,代码来源:WikiPage.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wfWikiID函数代码示例发布时间:2022-05-23
下一篇:
PHP wfWaitForSlaves函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap