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

PHP wfSuppressWarnings函数代码示例

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

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



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

示例1: checkIfToolExists

 /**
  * Check if a tool exist
  *
  * @param string $path path to the tool
  * @return bool
  */
 protected function checkIfToolExists($path)
 {
     wfSuppressWarnings();
     $result = file_exists($path);
     wfRestoreWarnings();
     return $result;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:13,代码来源:DjVuTest.php


示例2: getBackgroundColor

 public function getBackgroundColor($subset, $total, $fuzzy = false)
 {
     wfSuppressWarnings();
     $v = round(255 * $subset / $total);
     wfRestoreWarnings();
     if ($fuzzy) {
         // Weigh fuzzy with factor 20.
         $v = $v * 20;
         if ($v > 255) {
             $v = 255;
         }
         $v = 255 - $v;
     }
     if ($v < 128) {
         // Red to Yellow
         $red = 'FF';
         $green = sprintf('%02X', 2 * $v);
     } else {
         // Yellow to Green
         $red = sprintf('%02X', 2 * (255 - $v));
         $green = 'FF';
     }
     $blue = '00';
     return $red . $green . $blue;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:25,代码来源:StatsTable.php


示例3: get

 /**
  * @param $key
  * @return Status
  */
 function get($key)
 {
     $hashes = array();
     foreach ($this->hostNames as $hostName) {
         $hashes[$hostName] = md5($hostName . $key);
     }
     asort($hashes);
     $errno = $errstr = '';
     foreach ($hashes as $hostName => $hash) {
         if (isset($this->conns[$hostName])) {
             $this->refCounts[$hostName]++;
             return Status::newGood($this->conns[$hostName]);
         }
         $parts = explode(':', $hostName, 2);
         if (count($parts) < 2) {
             $parts[] = 7531;
         }
         wfProfileIn(__METHOD__ . '-connect');
         wfSuppressWarnings();
         $conn = fsockopen($parts[0], $parts[1], $errno, $errstr, $this->timeout);
         wfRestoreWarnings();
         wfProfileOut(__METHOD__ . '-connect');
         if ($conn) {
             break;
         }
     }
     if (!$conn) {
         return Status::newFatal('poolcounter-connection-error', $errstr);
     }
     wfDebug("Connected to pool counter server: {$hostName}\n");
     $this->conns[$hostName] = $conn;
     $this->refCounts[$hostName] = 1;
     return Status::newGood($conn);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:38,代码来源:PoolCounterClient_body.php


示例4: useMWlock

 private function useMWlock()
 {
     global $wgReadOnlyFile, $wgContLang;
     wfSuppressWarnings();
     $fp = fopen($wgReadOnlyFile, 'w');
     wfRestoreWarnings();
     // wikia change start
     global $wgUser, $wgCityId;
     $reason = $this->reason . "\nby " . $wgUser->getName() . ' at ' . $wgContLang->timeanddate(wfTimestampNow());
     if (!WikiFactory::setVarByName('wgReadOnly', $wgCityId, $reason) || !WikiFactory::clearCache($wgCityId)) {
         return Status::newFatal('lockdb-wikifactory-error');
     }
     // wikia change end
     if (false === $fp) {
         # This used to show a file not found error, but the likeliest reason for fopen()
         # to fail at this point is insufficient permission to write to the file...good old
         # is_writable() is plain wrong in some cases, it seems...
         return false;
     }
     fwrite($fp, $data['Reason']);
     $timestamp = wfTimestampNow();
     fwrite($fp, "\n<p>" . wfMsgExt('lockedbyandtime', array('content', 'parsemag'), $this->getUser()->getName(), $wgContLang->date($timestamp), $wgContLang->time($timestamp)) . "</p>\n");
     fclose($fp);
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:SpecialLockdb.php


示例5: cleanupDeletedBatch

 /**
  * Delete files in the deleted directory if they are not referenced in the
  * filearchive table. This needs to be done in the repo because it needs to
  * interleave database locks with file operations, which is potentially a
  * remote operation.
  *
  * @param $storageKeys array
  *
  * @return FileRepoStatus
  */
 function cleanupDeletedBatch($storageKeys)
 {
     $root = $this->getZonePath('deleted');
     $dbw = $this->getMasterDB();
     $status = $this->newGood();
     $storageKeys = array_unique($storageKeys);
     foreach ($storageKeys as $key) {
         $hashPath = $this->getDeletedHashPath($key);
         $path = "{$root}/{$hashPath}{$key}";
         $dbw->begin();
         $inuse = $dbw->selectField('filearchive', '1', array('fa_storage_group' => 'deleted', 'fa_storage_key' => $key), __METHOD__, array('FOR UPDATE'));
         if (!$inuse) {
             $sha1 = self::getHashFromKey($key);
             $ext = substr($key, strcspn($key, '.') + 1);
             $ext = File::normalizeExtension($ext);
             $inuse = $dbw->selectField('oldimage', '1', array('oi_sha1' => $sha1, 'oi_archive_name ' . $dbw->buildLike($dbw->anyString(), ".{$ext}"), $dbw->bitAnd('oi_deleted', File::DELETED_FILE) => File::DELETED_FILE), __METHOD__, array('FOR UPDATE'));
         }
         if (!$inuse) {
             wfDebug(__METHOD__ . ": deleting {$key}\n");
             wfSuppressWarnings();
             $unlink = unlink($path);
             wfRestoreWarnings();
             if (!$unlink) {
                 $status->error('undelete-cleanup-error', $path);
                 $status->failCount++;
             }
         } else {
             wfDebug(__METHOD__ . ": {$key} still in use\n");
             $status->successCount++;
         }
         $dbw->commit();
     }
     return $status;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:44,代码来源:LocalRepo.php


示例6: stream

 /**
  * Stream a file to the browser, adding all the headings and fun stuff.
  * Headers sent include: Content-type, Content-Length, Last-Modified,
  * and Content-Disposition.
  *
  * @param string $fname Full name and path of the file to stream
  * @param array $headers Any additional headers to send
  * @param bool $sendErrors Send error messages if errors occur (like 404)
  * @throws MWException
  * @return bool Success
  */
 public static function stream($fname, $headers = array(), $sendErrors = true)
 {
     wfProfileIn(__METHOD__);
     if (FileBackend::isStoragePath($fname)) {
         // sanity
         wfProfileOut(__METHOD__);
         throw new MWException(__FUNCTION__ . " given storage path '{$fname}'.");
     }
     wfSuppressWarnings();
     $stat = stat($fname);
     wfRestoreWarnings();
     $res = self::prepareForStream($fname, $stat, $headers, $sendErrors);
     if ($res == self::NOT_MODIFIED) {
         $ok = true;
         // use client cache
     } elseif ($res == self::READY_STREAM) {
         wfProfileIn(__METHOD__ . '-send');
         $ok = readfile($fname);
         wfProfileOut(__METHOD__ . '-send');
     } else {
         $ok = false;
         // failed
     }
     wfProfileOut(__METHOD__);
     return $ok;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:37,代码来源:StreamFile.php


示例7: parseToDOM

 /**
  * Parses given HTML into DOM tree (using XML/HTML parser)
  */
 private function parseToDOM($html, $parseAsXML = true)
 {
     wfProfileIn(__METHOD__);
     $ret = false;
     wfSuppressWarnings();
     if ($parseAsXML) {
         // form proper XML string
         $html = str_replace('&', '&amp;', $html);
         $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><body>{$html}</body>";
         // try to parse as XML
         if ($this->dom->loadXML($xml)) {
             // parsing successful
             $ret = $this->dom->getElementsByTagName('body')->item(0);
         } else {
             $this->handleParseErrors(__METHOD__);
         }
     } else {
         // form proper HTML string
         $html = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><body>{$html}</body></html>";
         // try to parse as HTML
         if ($this->dom->loadHTML($html)) {
             $ret = $this->dom->getElementsByTagName('body')->item(0);
         }
     }
     wfRestoreWarnings();
     wfProfileOut(__METHOD__);
     // return <body> node or false if XML parsing failed
     return $ret;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:32,代码来源:RTEReverseParser.class.php


示例8: dataDirOKmaybeCreate

 private static function dataDirOKmaybeCreate($dir, $create = false)
 {
     if (!is_dir($dir)) {
         if (!is_writable(dirname($dir))) {
             $webserverGroup = Installer::maybeGetWebserverPrimaryGroup();
             if ($webserverGroup !== null) {
                 return Status::newFatal('config-sqlite-parent-unwritable-group', $dir, dirname($dir), basename($dir), $webserverGroup);
             } else {
                 return Status::newFatal('config-sqlite-parent-unwritable-nogroup', $dir, dirname($dir), basename($dir));
             }
         }
         # Called early on in the installer, later we just want to sanity check
         # if it's still writable
         if ($create) {
             wfSuppressWarnings();
             $ok = wfMkdirParents($dir, 0700);
             wfRestoreWarnings();
             if (!$ok) {
                 return Status::newFatal('config-sqlite-mkdir-error', $dir);
             }
             # Put a .htaccess file in in case the user didn't take our advice
             file_put_contents("{$dir}/.htaccess", "Deny from all\n");
         }
     }
     if (!is_writable($dir)) {
         return Status::newFatal('config-sqlite-dir-unwritable', $dir);
     }
     # We haven't blown up yet, fall through
     return Status::newGood();
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:30,代码来源:SqliteInstaller.php


示例9: __construct

 /**
  * Constructor
  *
  * Creates an SVGReader drawing from the source provided
  * @param $source String: URI from which to read
  */
 function __construct($source)
 {
     global $wgSVGMetadataCutoff;
     $this->reader = new XMLReader();
     // Don't use $file->getSize() since file object passed to SVGHandler::getMetadata is bogus.
     $size = filesize($source);
     if ($size === false) {
         throw new MWException("Error getting filesize of SVG.");
     }
     if ($size > $wgSVGMetadataCutoff) {
         $this->debug("SVG is {$size} bytes, which is bigger than {$wgSVGMetadataCutoff}. Truncating.");
         $contents = file_get_contents($source, false, null, -1, $wgSVGMetadataCutoff);
         if ($contents === false) {
             throw new MWException('Error reading SVG file.');
         }
         $this->reader->XML($contents, null, LIBXML_NOERROR | LIBXML_NOWARNING);
     } else {
         $this->reader->open($source, null, LIBXML_NOERROR | LIBXML_NOWARNING);
     }
     $this->metadata['width'] = self::DEFAULT_WIDTH;
     $this->metadata['height'] = self::DEFAULT_HEIGHT;
     // Because we cut off the end of the svg making an invalid one. Complicated
     // try catch thing to make sure warnings get restored. Seems like there should
     // be a better way.
     wfSuppressWarnings();
     try {
         $this->read();
     } catch (Exception $e) {
         wfRestoreWarnings();
         throw $e;
     }
     wfRestoreWarnings();
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:39,代码来源:SVGMetadataExtractor.php


示例10: execute

 function execute()
 {
     global $IP, $wgTitle;
     $siteName = isset($this->mArgs[0]) ? $this->mArgs[0] : "Don't care";
     // Will not be set if used with --env-checks
     $adminName = isset($this->mArgs[1]) ? $this->mArgs[1] : null;
     $wgTitle = Title::newFromText('Installer script');
     $dbpassfile = $this->getOption('dbpassfile', false);
     if ($dbpassfile !== false) {
         wfSuppressWarnings();
         $dbpass = file_get_contents($dbpassfile);
         wfRestoreWarnings();
         if ($dbpass === false) {
             $this->error("Couldn't open {$dbpassfile}", true);
         }
         $this->mOptions['dbpass'] = trim($dbpass, "\r\n");
     }
     $installer = InstallerOverrides::getCliInstaller($siteName, $adminName, $this->mOptions);
     $status = $installer->doEnvironmentChecks();
     if ($status->isGood()) {
         $installer->showMessage('config-env-good');
     } else {
         $installer->showStatusMessage($status);
         return;
     }
     if (!$this->hasOption('env-checks')) {
         $installer->execute();
         $installer->writeConfigurationFile($this->getOption('confpath', $IP));
     }
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:30,代码来源:install.php


示例11: initialize

 public function initialize()
 {
     $dbr = wfGetDB(DB_MASTER);
     $res = $dbr->select('categorylinks', array('cl_to', 'COUNT(*) AS count'), array(), __METHOD__, array('GROUP BY' => 'cl_to', 'ORDER BY' => 'count DESC', 'LIMIT' => $this->limit));
     wfSuppressWarnings();
     // prevent PHP from bitching about strtotime()
     foreach ($res as $row) {
         $tag_name = Title::makeTitle(NS_CATEGORY, $row->cl_to);
         $tag_text = $tag_name->getText();
         if (strtotime($tag_text) == '') {
             // don't want dates to show up
             if ($row->count > $this->tags_highest_count) {
                 $this->tags_highest_count = $row->count;
             }
             $this->tags[$tag_text] = array('count' => $row->count);
         }
     }
     wfRestoreWarnings();
     // sort tag array by key (tag name)
     if ($this->tags_highest_count == 0) {
         return;
     }
     ksort($this->tags);
     /* and what if we have _1_ category? like on a new wiki with nteen articles, mhm? */
     if ($this->tags_highest_count == 1) {
         $coef = $this->tags_max_pts - $this->tags_min_pts;
     } else {
         $coef = ($this->tags_max_pts - $this->tags_min_pts) / (($this->tags_highest_count - 1) * 2);
     }
     foreach ($this->tags as $tag => $att) {
         $this->tags[$tag]['size'] = $this->tags_min_pts + ($this->tags[$tag]['count'] - 1) * $coef;
     }
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:33,代码来源:TagCloudClass.php


示例12: __construct

	protected function __construct() {
		$idFile = wfTempDir() . '/mw-' . __CLASS__ . '-UID-nodeid';
		$nodeId = is_file( $idFile ) ? file_get_contents( $idFile ) : '';
		// Try to get some ID that uniquely identifies this machine (RFC 4122)...
		if ( !preg_match( '/^[0-9a-f]{12}$/i', $nodeId ) ) {
			wfSuppressWarnings();
			if ( wfIsWindows() ) {
				// http://technet.microsoft.com/en-us/library/bb490913.aspx
				$csv = trim( wfShellExec( 'getmac /NH /FO CSV' ) );
				$line = substr( $csv, 0, strcspn( $csv, "\n" ) );
				$info = str_getcsv( $line );
				$nodeId = isset( $info[0] ) ? str_replace( '-', '', $info[0] ) : '';
			} elseif ( is_executable( '/sbin/ifconfig' ) ) { // Linux/BSD/Solaris/OS X
				// See http://linux.die.net/man/8/ifconfig
				$m = array();
				preg_match( '/\s([0-9a-f]{2}(:[0-9a-f]{2}){5})\s/',
					wfShellExec( '/sbin/ifconfig -a' ), $m );
				$nodeId = isset( $m[1] ) ? str_replace( ':', '', $m[1] ) : '';
			}
			wfRestoreWarnings();
			if ( !preg_match( '/^[0-9a-f]{12}$/i', $nodeId ) ) {
				$nodeId = MWCryptRand::generateHex( 12, true );
				$nodeId[1] = dechex( hexdec( $nodeId[1] ) | 0x1 ); // set multicast bit
			}
			file_put_contents( $idFile, $nodeId ); // cache
		}
		$this->nodeId32 = wfBaseConvert( substr( sha1( $nodeId ), 0, 8 ), 16, 2, 32 );
		$this->nodeId48 = wfBaseConvert( $nodeId, 16, 2, 48 );
		// If different processes run as different users, they may have different temp dirs.
		// This is dealt with by initializing the clock sequence number and counters randomly.
		$this->lockFile88 = wfTempDir() . '/mw-' . __CLASS__ . '-UID-88';
		$this->lockFile128 = wfTempDir() . '/mw-' . __CLASS__ . '-UID-128';
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:33,代码来源:UIDGenerator.php


示例13: sendRPC

 /**
  * @access private
  * @static
  */
 function sendRPC($method, $params = array())
 {
     global $mwBlockerHost, $mwBlockerPort, $mwBlockerDebug;
     $client = new XML_RPC_Client('/Blocker', $mwBlockerHost, $mwBlockerPort);
     if ($mwBlockerDebug) {
         $client->debug = true;
     }
     $rpcParams = array_map(array('MWBlocker', 'outParam'), $params);
     $message = new XML_RPC_Message($method, $rpcParams);
     wfSuppressWarnings();
     $start = wfTime();
     $result = $client->send($message);
     $delta = wfTime() - $start;
     wfRestoreWarnings();
     $debug = sprintf("MWBlocker::sendRPC for %s took %0.2fms\n", $method, $delta * 1000.0);
     wfDebug($debug);
     if ($mwBlockerDebug) {
         echo $debug;
     }
     if (!is_object($result)) {
         throw new MWException("Unknown XML-RPC error");
     } elseif ($result->faultCode()) {
         throw new MWException($result->faultCode() . ': ' . $result->faultString());
     } else {
         $value = $result->value();
         return $value->getval();
     }
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:32,代码来源:MWBlocker.php


示例14: extensionCredits

 function extensionCredits()
 {
     global $wgExtensionCredits, $wgExtensionFunctions, $wgSkinExtensionFunction;
     if (!count($wgExtensionCredits) && !count($wgExtensionFunctions) && !count($wgSkinExtensionFunction)) {
         return '';
     }
     $extensionTypes = array('specialpage' => 'Special pages', 'parserhook' => 'Parser hooks', 'other' => 'Other');
     $out = "\n* Extensions:\n";
     foreach ($extensionTypes as $type => $text) {
         if (count(@$wgExtensionCredits[$type])) {
             $out .= "** {$text}:\n";
             foreach ($wgExtensionCredits[$type] as $extension) {
                 wfSuppressWarnings();
                 $out .= $this->formatCredits($extension['name'], $extension['version'], $extension['author'], $extension['url'], $extension['description']);
                 wfRestoreWarnings();
             }
         }
     }
     if (count($wgExtensionFunctions)) {
         $out .= "** Extension functions:\n";
         $out .= '***' . $this->langObj->listToText($wgExtensionFunctions) . "\n";
     }
     if (count($wgSkinExtensionFunction)) {
         $out .= "** Skin extension functions:\n";
         $out .= '***' . $this->langObj->listToText($wgSkinExtensionFunction) . "\n";
     }
     return $out;
 }
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:28,代码来源:SpecialVersion.php


示例15: getLongDesc

 function getLongDesc($image)
 {
     global $wgLang;
     $original = parent::getLongDesc($image);
     wfSuppressWarnings();
     $metadata = unserialize($image->getMetadata());
     wfRestoreWarnings();
     if (!$metadata || $metadata['frameCount'] <= 0) {
         return $original;
     }
     $info = array();
     $info[] = $original;
     if ($metadata['loopCount'] == 0) {
         $info[] = wfMsgExt('file-info-png-looped', 'parseinline');
     } elseif ($metadata['loopCount'] > 1) {
         $info[] = wfMsgExt('file-info-png-repeat', 'parseinline', $metadata['loopCount']);
     }
     if ($metadata['frameCount'] > 0) {
         $info[] = wfMsgExt('file-info-png-frames', 'parseinline', $metadata['frameCount']);
     }
     if ($metadata['duration']) {
         $info[] = $wgLang->formatTimePeriod($metadata['duration']);
     }
     return $wgLang->commaList($info);
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:25,代码来源:PNG.php


示例16: execute

 public function execute()
 {
     if ($this->hasArg()) {
         $files = $this->mArgs;
     } else {
         $this->maybeHelp(true);
         // @todo fixme this is a lame API :)
         exit(1);
         // it should exit from the above first...
     }
     $parser = new JSParser();
     foreach ($files as $filename) {
         wfSuppressWarnings();
         $js = file_get_contents($filename);
         wfRestoreWarnings();
         if ($js === false) {
             $this->output("{$filename} ERROR: could not read file\n");
             $this->errs++;
             continue;
         }
         try {
             $parser->parse($js, $filename, 1);
         } catch (Exception $e) {
             $this->errs++;
             $this->output("{$filename} ERROR: " . $e->getMessage() . "\n");
             continue;
         }
         $this->output("{$filename} OK\n");
     }
     if ($this->errs > 0) {
         exit(1);
     }
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:33,代码来源:jsparse.php


示例17: execute

 public function execute()
 {
     global $wgRequest, $wgUser, $wgSitename, $wgSitenameshort, $wgCopyrightLink;
     global $wgCopyright, $wgBootstrap, $wgArticlePath, $wgGoogleAnalyticsID;
     global $wgSiteCSS;
     global $wgEnableUploads;
     global $wgLogo;
     global $wgTOCLocation;
     global $wgNavBarClasses;
     global $wgSubnavBarClasses;
     $this->skin = $this->data['skin'];
     $action = $wgRequest->getText('action');
     $url_prefix = str_replace('$1', '', $wgArticlePath);
     // Suppress warnings to prevent notices about missing indexes in $this->data
     wfSuppressWarnings();
     $this->html('headelement');
     ?>
   <div class="ololo-wiki">
   <?php 
     $this->header($wgUser);
     $this->body();
     $this->footer();
     $this->html('bottomscripts');
     /* JS call to runBodyOnloadHook */
     $this->html('reporttime');
     ?>
   </div>
 <?php 
     echo Html::closeElement('body');
     echo Html::closeElement('html');
     wfRestoreWarnings();
 }
开发者ID:alexeygrigorev,项目名称:TyrianMediawiki-Skin,代码行数:32,代码来源:TyrianMediaWiki.skin.php


示例18: connect

 /**
  * Establish conncetion
  *
  * @access private
  *
  * @return bool
  */
 function connect()
 {
     wfSuppressWarnings();
     $errno = $errstr = '';
     $this->mFP = fsockopen($this->mHost, $this->mPort, $errno, $errstr, 30);
     wfRestoreWarnings();
     return !$this->mFP;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:15,代码来源:ZhClient.php


示例19: startSessionIfNotStarted

 function startSessionIfNotStarted()
 {
     \wfSuppressWarnings();
     if (!isset($_SESSION)) {
         session_start();
     }
     \wfRestoreWarnings();
 }
开发者ID:mediawiki-extensions,项目名称:mediawiki-page-attachment,代码行数:8,代码来源:Session.php


示例20: getLine

 /**
  * Generates a notification that can be easily interpreted by a machine.
  * @see RCFeedFormatter::getLine
  */
 public function getLine(array $feed, RecentChange $rc, $actionComment)
 {
     global $wgCanonicalServer, $wgServerName, $wgScriptPath;
     $packet = array('id' => $rc->getAttribute('rc_id'), 'type' => RecentChange::parseFromRCType($rc->getAttribute('rc_type')), 'namespace' => $rc->getTitle()->getNamespace(), 'title' => $rc->getTitle()->getPrefixedText(), 'comment' => $rc->getAttribute('rc_comment'), 'timestamp' => (int) wfTimestamp(TS_UNIX, $rc->getAttribute('rc_timestamp')), 'user' => $rc->getAttribute('rc_user_text'), 'bot' => (bool) $rc->getAttribute('rc_bot'));
     if (isset($feed['channel'])) {
         $packet['channel'] = $feed['channel'];
     }
     $type = $rc->getAttribute('rc_type');
     if ($type == RC_EDIT || $type == RC_NEW) {
         global $wgUseRCPatrol, $wgUseNPPatrol;
         $packet['minor'] = (bool) $rc->getAttribute('rc_minor');
         if ($wgUseRCPatrol || $type == RC_NEW && $wgUseNPPatrol) {
             $packet['patrolled'] = (bool) $rc->getAttribute('rc_patrolled');
         }
     }
     switch ($type) {
         case RC_EDIT:
             $packet['length'] = array('old' => $rc->getAttribute('rc_old_len'), 'new' => $rc->getAttribute('rc_new_len'));
             $packet['revision'] = array('old' => $rc->getAttribute('rc_last_oldid'), 'new' => $rc->getAttribute('rc_this_oldid'));
             break;
         case RC_NEW:
             $packet['length'] = array('old' => null, 'new' => $rc->getAttribute('rc_new_len'));
             $packet['revision'] = array('old' => null, 'new' => $rc->getAttribute('rc_this_oldid'));
             break;
         case RC_LOG:
             $packet['log_id'] = $rc->getAttribute('rc_logid');
             $packet['log_type'] = $rc->getAttribute('rc_log_type');
             $packet['log_action'] = $rc->getAttribute('rc_log_action');
             if ($rc->getAttribute('rc_params')) {
                 wfSuppressWarnings();
                 $params = unserialize($rc->getAttribute('rc_params'));
                 wfRestoreWarnings();
                 if ($rc->getAttribute('rc_params') == serialize(false) || $params !== false) {
                     // From ApiQueryLogEvents::addLogParams
                     $logParams = array();
                     // Keys like "4::paramname" can't be used for output so we change them to "paramname"
                     foreach ($params as $key => $value) {
                         if (strpos($key, ':') === false) {
                             $logParams[$key] = $value;
                             continue;
                         }
                         $logParam = explode(':', $key, 3);
                         $logParams[$logParam[2]] = $value;
                     }
                     $packet['log_params'] = $logParams;
                 } else {
                     $packet['log_params'] = explode("\n", $rc->getAttribute('rc_params'));
                 }
             }
             $packet['log_action_comment'] = $actionComment;
             break;
     }
     $packet['server_url'] = $wgCanonicalServer;
     $packet['server_name'] = $wgServerName;
     $packet['server_script_path'] = $wgScriptPath ?: '/';
     $packet['wiki'] = wfWikiID();
     return $this->formatArray($packet);
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:62,代码来源:MachineReadableRCFeedFormatter.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP wfTempDir函数代码示例发布时间:2022-05-23
下一篇:
PHP wfStripIllegalFilenameChars函数代码示例发布时间: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