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


PHP Logger\WikiaLogger类代码示例

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


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

示例1: onRestInPeace

 /**
  * This method is called via hook at the end of the request handling
  *
  * Make the list of unique URLs and send them to Fastly via Scribe queue
  *
  * @author macbre
  *
  * @return bool true - it's a hook
  */
 static function onRestInPeace()
 {
     // don't process an empty queue
     if (empty(self::$urls)) {
         return true;
     }
     wfProfileIn(__METHOD__);
     $scribe = WScribeClient::singleton(self::SCRIBE_KEY);
     try {
         wfDebug(sprintf("%s: sending %d unique URLs to the purger (%d items were queued in total)\n", __METHOD__, count(self::$urls), self::$urlsCount));
         foreach (self::$urls as $url => $data) {
             wfDebug(sprintf("%s: %s\n", __METHOD__, $url));
             // send to Scribe queue
             $scribe->send(json_encode($data));
             // debugging data to be sent to both sFlow (for monitoring) and Kibana (for debugging)
             $context = ['url' => $data['url'], 'method' => $data['method']];
             // log purges using SFlow (BAC-1258)
             SFlow::operation('varnish.purge', $context);
             // log purges using Kibana (BAC-1317)
             WikiaLogger::instance()->info('varnish.purge', $context);
         }
     } catch (TException $e) {
         Wikia::log(__METHOD__, 'scribeClient exception', $e->getMessage());
     }
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:36,代码来源:ScribePurge.class.php

示例2: run

 function run()
 {
     $this->startTime = $this->endTime = time();
     if ($this->exception) {
         $this->results[] = $this->exception;
         return;
     }
     foreach ($this->callOrder as $callData) {
         list($classIndex, $callIndex) = $callData;
         /** @var \Wikia\Tasks\Tasks\BaseTask $task */
         $task = $this->taskList[$classIndex];
         list($method, $args) = $task->getCall($callIndex);
         foreach ($args as $i => $arg) {
             if (is_array($arg) || is_object($arg)) {
                 continue;
             }
             if (preg_match('/^#([0-9]+)$/', trim($arg), $match)) {
                 if (!isset($this->results[$match[1]])) {
                     throw new InvalidArgumentException();
                 }
                 $args[$i] = $this->results[$match[1]];
             }
         }
         WikiaLogger::instance()->pushContext(['task_call' => get_class($task) . "::{$method}"]);
         $result = $task->execute($method, $args);
         WikiaLogger::instance()->popContext();
         $this->results[] = $result;
         if ($result instanceof Exception) {
             break;
         }
     }
     $this->endTime = time();
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:33,代码来源:TaskRunner.class.php

示例3: getGlobalFooterLinks

 private function getGlobalFooterLinks()
 {
     global $wgCityId, $wgContLang, $wgLang, $wgMemc;
     wfProfileIn(__METHOD__);
     $verticalId = WikiFactoryHub::getInstance()->getVerticalId($wgCityId);
     $memcKey = wfSharedMemcKey(self::MEMC_KEY_GLOBAL_FOOTER_LINKS, $wgContLang->getCode(), $wgLang->getCode(), $verticalId, self::MEMC_KEY_GLOBAL_FOOTER_VERSION);
     $globalFooterLinks = $wgMemc->get($memcKey);
     if (!empty($globalFooterLinks)) {
         wfProfileOut(__METHOD__);
         return $globalFooterLinks;
     }
     if (is_null($globalFooterLinks = getMessageAsArray(self::MESSAGE_KEY_GLOBAL_FOOTER_LINKS . '-' . $verticalId))) {
         if (is_null($globalFooterLinks = getMessageAsArray(self::MESSAGE_KEY_GLOBAL_FOOTER_LINKS))) {
             wfProfileOut(__METHOD__);
             WikiaLogger::instance()->error("Global Footer's links not found in messages", ['exception' => new Exception()]);
             return [];
         }
     }
     $parsedLinks = [];
     foreach ($globalFooterLinks as $link) {
         $link = trim($link);
         if (strpos($link, '*') === 0) {
             $parsedLink = parseItem($link);
             if (strpos($parsedLink['text'], 'LICENSE') !== false || $parsedLink['text'] == 'GFDL') {
                 $parsedLink['isLicense'] = true;
             } else {
                 $parsedLink['isLicense'] = false;
             }
             $parsedLinks[] = $parsedLink;
         }
     }
     $wgMemc->set($memcKey, $parsedLinks, self::MEMC_EXPIRY);
     wfProfileOut(__METHOD__);
     return $parsedLinks;
 }
开发者ID:yusufchang,项目名称:app,代码行数:35,代码来源:GlobalFooterController.class.php

示例4: startExperiment

 /**
  * Initialize the experiment and set all required tracking things
  *
  * @param string $experimentName
  * @param array $experimentConfig
  */
 private static function startExperiment($experimentName, array $experimentConfig)
 {
     wfDebug(sprintf("%s[%s] using %s class with %s params\n", __METHOD__, $experimentName, $experimentConfig['handler'], json_encode($experimentConfig['params'])));
     new $experimentConfig['handler']($experimentConfig['params'] ?: []);
     // mark a transaction with an experiment name
     \Transaction::getInstance()->set(\Transaction::PARAM_AB_PERFORMANCE_TEST, $experimentName);
     // set a global JS variable with an experiment name
     global $wgHooks;
     $wgHooks['WikiaSkinTopScripts'][] = function (array &$vars, &$scripts) use($experimentName) {
         $vars['wgABPerformanceTest'] = $experimentName;
         return true;
     };
     /*
      * Start the session to bypass CDN cache
      *
      * We don't want to polute the CDN cache with the A/B performance testing tracking data.
      * As the test are run for only a small subset of the traffic, start the session for client
      * that are in the test groups to bypass the CDN cache.
      */
     if (session_id() == '') {
         wfSetupSession();
         wfDebug(__METHOD__ . " - session started\n");
         // log started sessions
         global $wgUser;
         WikiaLogger::instance()->info(__METHOD__, ['experiment' => $experimentName, 'session_id' => session_id(), 'is_anon' => $wgUser->isAnon()]);
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:33,代码来源:Hooks.class.php

示例5: deauthorizeCallback

 /**
  * This method is called from Facebook's side whenever a user deletes the Wikia app from their account.  Most
  * of the functionality is based on the example given on Facebook:
  *
  * https://developers.facebook.com/docs/facebook-login/using-login-with-games/#parsingsr
  *
  * Additional general information on the callback here:
  *
  * https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/v2.1#deauth-callback
  *
  */
 public function deauthorizeCallback()
 {
     global $fbAppSecret;
     $log = WikiaLogger::instance();
     $signedRequest = $this->getVal('signed_request', '');
     list($encodedSig, $payload) = explode('.', $signedRequest, 2);
     // decode the data
     $sig = $this->base64UrlDecode($encodedSig);
     $data = json_decode($this->base64UrlDecode($payload), true);
     // confirm the signature
     $expectedSig = hash_hmac('sha256', $payload, $fbAppSecret, $raw = true);
     if ($sig !== $expectedSig) {
         $log->info('Deauthorization callback received with invalid signature', ['method' => __METHOD__]);
         return;
     }
     if (empty($data['user_id'])) {
         $log->warning('Deauthorization callback received with missing user ID', ['method' => __METHOD__]);
         return;
     }
     $facebookUserId = $data['user_id'];
     $map = FacebookMapModel::lookupFromFacebookID($facebookUserId);
     if (empty($map)) {
         $log->info('Deauthorization callback received with no matching Wikia ID mapping found', ['method' => __METHOD__, 'facebookId' => $facebookUserId]);
         return;
     }
     // Send this to the normal disconnect action
     $res = $this->sendSelfRequest('disconnectFromFB', ['user' => $map->getWikiaUserId()]);
     $status = $res->getVal('status', '');
     $logResultParams = ['method' => __METHOD__, 'facebookId' => $facebookUserId, 'wikiaUserId' => $map->getWikiaUserId()];
     if ($status == 'ok') {
         $log->info('Deauthorization callback received and completed successfully', $logResultParams);
     } else {
         $log->error('Deauthorization callback received and did not complete', $logResultParams);
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:46,代码来源:FacebookClientController.class.php

示例6: onParserSectionCreate

 /**
  * Check if infobox (div element or table which contains 'infobox' string in class attribute)
  * exists in first article section, and extract it from this section
  *
  * @param Parser $parser Parser instance
  * @param integer $section number of section in article text
  * @param string $content reference to section content
  * @param boolean $showEditLinks  should add edit link
  * @return bool
  */
 public static function onParserSectionCreate($parser, $section, &$content, $showEditLinks)
 {
     // skip if we're not parsing for venus
     if (!F::app()->checkSkin('venus')) {
         return true;
     }
     try {
         if (self::isInfoboxInFirstSection($parser, $section, $content)) {
             $infoboxExtractor = new InfoboxExtractor($content);
             $dom = $infoboxExtractor->getDOMDocument();
             $nodes = $infoboxExtractor->getInfoboxNodes();
             $node = $nodes->item(0);
             if ($node instanceof DOMElement) {
                 $body = $dom->documentElement->firstChild;
                 // replace extracted infobox with a dummy element to prevent newlines from creating empty paragraphs (CON-2166)
                 // <table infobox-placeholder="1"></table>
                 $placeholder = $dom->createElement('table');
                 $placeholder->setAttribute('infobox-placeholder', 'true');
                 $node->parentNode->insertBefore($placeholder, $node);
                 // perform a magic around infobox wrapper
                 $node = $infoboxExtractor->clearInfoboxStyles($node);
                 $infoboxWrapper = $infoboxExtractor->wrapInfobox($node, 'infoboxWrapper', 'infobox-wrapper');
                 $infoboxContainer = $infoboxExtractor->wrapInfobox($infoboxWrapper, 'infoboxContainer', 'infobox-container');
                 // move infobox to the beginning of article content
                 $infoboxExtractor->insertNode($body, $infoboxContainer, true);
                 $content = $dom->saveHTML();
                 $parser->getOutput()->addModules('ext.wikia.venus.article.infobox');
             }
         }
     } catch (DOMException $e) {
         // log exceptions
         WikiaLogger::instance()->error(__METHOD__, ['exception' => $e]);
     }
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:45,代码来源:VenusHooks.class.php

示例7: getMediaData

 /**
  * Get data for each gallery item
  * @param array $item Data about the media item
  * @param int $index Where the item shows up in the gallery
  * @return array|null
  */
 protected function getMediaData(array $item, $index)
 {
     $file = wfFindFile($item['title']);
     if (!$file instanceof File) {
         WikiaLogger::instance()->error('File with title: ' . $item['title'] . 'doesn\'t exist', ['class' => __CLASS__]);
         return null;
     }
     $dimension = MediaGalleryHelper::getImageWidth($this->itemCount, $index);
     $thumbUrl = WikiaFileHelper::getSquaredThumbnailUrl($file, $dimension);
     $dimensions = ['width' => $dimension, 'height' => $dimension];
     $thumb = $file->transform($dimensions);
     if (!$thumb instanceof ThumbnailImage) {
         WikiaLogger::instance()->error('ThumbnailImage from title: ' . $item['title'] . ' couldn\'t be created.', ['thumbClass' => get_class($thumb)]);
         return null;
     }
     $thumb->setUrl($thumbUrl);
     $thumbnail = $this->app->renderView('ThumbnailController', 'gallery', ['thumb' => $thumb]);
     $caption = '';
     if (!empty($item['caption'])) {
         // parse any wikitext in caption. Logic borrowed from WikiaMobileMediaService::renderMediaGroup.
         $parser = $this->getParser();
         $caption = $parser->internalParse($item['caption']);
         $parser->replaceLinkHolders($caption);
         $caption = $parser->killMarkers($caption);
     }
     $title = $file->getTitle();
     return ['thumbUrl' => $thumbUrl, 'thumbHtml' => $thumbnail, 'caption' => $caption, 'linkHref' => $file->getTitle()->getLinkURL(), 'title' => $title->getText(), 'dbKey' => $title->getDBKey()];
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:34,代码来源:MediaGalleryModel.class.php

示例8: onArticleViewAfterParser

 public static function onArticleViewAfterParser(Article $article, ParserOutput $parserOutput)
 {
     global $wgCityId, $wgDBname;
     // we collect production data from Oasis only
     /*
     $app = F::app();
     if ( !$app->checkSkin( 'oasis', $app->wg->Skin )
     		|| $app->wg->DevelEnvironment || $app->wg->StagingEnvironment ) {
     	return true;
     }
     */
     if (class_exists('WScribeClient')) {
         try {
             $title = $article->getTitle();
             $fields = array('wikiId' => intval($wgCityId), 'databaseName' => $wgDBname, 'articleId' => $title->getArticleID(), 'namespaceId' => $title->getNamespace(), 'articleTitle' => $title->getText(), 'parserTime' => $parserOutput->getPerformanceStats('time'), 'wikitextSize' => $parserOutput->getPerformanceStats('wikitextSize'), 'htmlSize' => $parserOutput->getPerformanceStats('htmlSize'), 'expFuncCount' => $parserOutput->getPerformanceStats('expFuncCount'), 'nodeCount' => $parserOutput->getPerformanceStats('nodeCount'), 'postExpandSize' => $parserOutput->getPerformanceStats('postExpandSize'), 'tempArgSize' => $parserOutput->getPerformanceStats('tempArgSize'));
             $data = json_encode($fields);
             WScribeClient::singleton(self::SCRIBE_KEY)->send($data);
         } catch (TException $e) {
             Wikia::log(__METHOD__, 'scribeClient exception', $e->getMessage());
         }
     }
     // Logging parser activity for monitoring
     // wiki and article info are sent to logstash anyways so no need to repeat them here
     WikiaLogger::instance()->info("Parser execution", ['parser-time' => round($parserOutput->getPerformanceStats('time') * 1000), 'node-count' => (int) $parserOutput->getPerformanceStats('nodeCount'), 'wikitext-size' => (int) $parserOutput->getPerformanceStats('wikitextSize'), 'skin-name' => RequestContext::getMain()->getSkin()->getSkinName()]);
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:26,代码来源:ParserSpeedHooks.class.php

示例9: categories

 /**
  * The category list template. Used by article pages on view and edit save.
  */
 public function categories()
 {
     wfProfileIn(__METHOD__);
     $categories = $this->request->getVal('categories', array());
     $data = array();
     // Because $out->getCategoryLinks doesn't maintain the order of the stored category data,
     // we have to build this information ourselves manually. This is essentially the same
     // code from $out->addCategoryLinks() but it results in a different data format.
     foreach ($categories as $category) {
         // Support category name or category data object
         $name = is_array($category) ? $category['name'] : $category;
         $originalName = $name;
         $title = Title::makeTitleSafe(NS_CATEGORY, $name);
         if ($title != null) {
             $this->wg->ContLang->findVariantLink($name, $title, true);
             if ($name != $originalName && array_key_exists($name, $data)) {
                 continue;
             }
             $text = $this->wg->ContLang->convertHtml($title->getText());
             $data[$name] = array('link' => Linker::link($title, $text), 'name' => $text, 'type' => CategoryHelper::getCategoryType($originalName));
         } else {
             \Wikia\Logger\WikiaLogger::instance()->warning("Unsafe category provided", ['name' => $name]);
         }
     }
     $this->response->setVal('categories', $data);
     wfProfileOut(__METHOD__);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:30,代码来源:CategorySelectController.class.php

示例10: request

 static function request($method, $url, $timeout = 'default')
 {
     global $wgHTTPTimeout, $wgVersion, $wgTitle, $wgDevelEnvironment;
     wfProfileIn(__METHOD__);
     wfDebug(__METHOD__ . ": {$method} {$url}\n");
     # Use curl if available
     if (function_exists('curl_init')) {
         $c = curl_init($url);
         /*
         if ( self::isLocalURL( $url ) ) {
         	curl_setopt( $c, CURLOPT_PROXY, 'localhost:80' );
         } else if ($wgHTTPProxy) {
         	curl_setopt($c, CURLOPT_PROXY, $wgHTTPProxy);
         }
         */
         if (empty($wgDevelEnvironment)) {
             curl_setopt($c, CURLOPT_PROXY, 'localhost:80');
         }
         if ($timeout == 'default') {
             $timeout = $wgHTTPTimeout;
         }
         curl_setopt($c, CURLOPT_TIMEOUT, $timeout);
         curl_setopt($c, CURLOPT_HEADER, true);
         curl_setopt($c, CURLOPT_FOLLOWLOCATION, false);
         curl_setopt($c, CURLOPT_USERAGENT, "MediaWiki/{$wgVersion}");
         if ($method == 'POST') {
             curl_setopt($c, CURLOPT_POST, true);
         } else {
             curl_setopt($c, CURLOPT_CUSTOMREQUEST, $method);
         }
         # Set the referer to $wgTitle, even in command-line mode
         # This is useful for interwiki transclusion, where the foreign
         # server wants to know what the referring page is.
         # $_SERVER['REQUEST_URI'] gives a less reliable indication of the
         # referring page.
         if (is_object($wgTitle)) {
             curl_setopt($c, CURLOPT_REFERER, $wgTitle->getFullURL());
         }
         $requestTime = microtime(true);
         ob_start();
         curl_exec($c);
         $text = ob_get_contents();
         ob_end_clean();
         // log HTTP requests
         $requestTime = (int) ((microtime(true) - $requestTime) * 1000.0);
         $params = ['statusCode' => curl_getinfo($c, CURLINFO_HTTP_CODE), 'reqMethod' => $method, 'reqUrl' => $url, 'caller' => __CLASS__, 'requestTimeMS' => $requestTime];
         \Wikia\Logger\WikiaLogger::instance()->debug('Http request', $params);
         # Don't return the text of error messages, return false on error
         if (curl_getinfo($c, CURLINFO_HTTP_CODE) != 200 && curl_getinfo($c, CURLINFO_HTTP_CODE) != 301) {
             $text = false;
         }
         # Don't return truncated output
         if (curl_errno($c) != CURLE_OK) {
             $text = false;
         }
     }
     wfProfileOut(__METHOD__);
     return array($text, $c);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:59,代码来源:SharedHelp.php

示例11: addVideo

 /**
  * add video
  * @param string $url
  * @return string error message or array( $videoTitle, $videoPageId, $videoProvider )
  */
 public function addVideo($url)
 {
     global $wgIsGhostVideo;
     wfProfileIn(__METHOD__);
     if (!$this->wg->User->isAllowed('videoupload')) {
         wfProfileOut(__METHOD__);
         return wfMessage('videos-error-admin-only')->plain();
     }
     if (empty($url)) {
         wfProfileOut(__METHOD__);
         return wfMessage('videos-error-no-video-url')->text();
     }
     $vHelper = new VideoHandlerHelper();
     # @TODO Commenting out to fix MAIN-4436 -- Should be fixed correctly when content team is back
     #		if ( !$vHelper->isVideoProviderSupported( $url ) ) {
     #			wfProfileOut( __METHOD__ );
     #			return wfMessage( 'videos-error-provider-not-supported' )->parse();
     #		}
     try {
         // is it a WikiLink?
         $title = Title::newFromText($url, NS_FILE);
         if (!$title || !WikiaFileHelper::isFileTypeVideo($title)) {
             $title = Title::newFromText(str_replace(array('[[', ']]'), array('', ''), $url), NS_FILE);
         }
         if (!$title || !WikiaFileHelper::isFileTypeVideo($title)) {
             $file = $this->getVideoFileByUrl($url);
             if ($file) {
                 $title = $file->getTitle();
             }
         }
         if ($title && WikiaFileHelper::isFileTypeVideo($title)) {
             $videoTitle = $title;
             $videoPageId = $title->getArticleId();
             $videoProvider = '';
             wfRunHooks('AddPremiumVideo', array($title));
         } else {
             if (empty($this->wg->allowNonPremiumVideos)) {
                 wfProfileOut(__METHOD__);
                 return wfMessage('videohandler-non-premium')->parse();
             }
             list($videoTitle, $videoPageId, $videoProvider) = $this->addVideoVideoHandlers($url);
             $file = RepoGroup::singleton()->findFile($videoTitle);
         }
         if (!$file instanceof File) {
             WikiaLogger::instance()->error('\\VideoHandlerHelper->adDefaultVideoDescription() - File is empty', ['exception' => new Exception(), 'url' => $url, 'title' => $title, 'videoTitle' => $videoTitle, 'videoPageId' => $videoPageId, 'videoProvider' => $videoProvider, 'wgIsGhostVideo' => $wgIsGhostVideo]);
             wfProfileOut(__METHOD__);
             return wfMessage('videos-something-went-wrong')->parse();
         } else {
             // Add a default description if available and one doesn't already exist
             $vHelper->addDefaultVideoDescription($file);
         }
     } catch (Exception $e) {
         wfProfileOut(__METHOD__);
         return $e->getMessage();
     }
     wfProfileOut(__METHOD__);
     return array($videoTitle, $videoPageId, $videoProvider);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:63,代码来源:VideoService.class.php

示例12: __construct

 /**
  * Construct a database error
  * @param $db DatabaseBase object which threw the error
  * @param $error String A simple error message to be used for debugging
  */
 function __construct(DatabaseBase &$db, $error)
 {
     global $wgDBcluster;
     $this->db = $db;
     parent::__construct($error);
     $isMaster = !is_null($db->getLBInfo('master'));
     // Wikia change - @author macbre - MAIN-2304
     \Wikia\Logger\WikiaLogger::instance()->error('DBError', ['name' => $db->getDBname(), 'cluster' => $wgDBcluster, 'server' => $db->getServer(), 'server_role' => $isMaster ? 'master' : 'slave', 'errno' => $db->lastErrno(), 'err' => $db->lastError(), 'exception' => $this]);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:14,代码来源:DatabaseError.php

示例13: true

 /**
  * @param mixed $check
  * @param string|null $message
  * @return bool true if the check passes
  * @throws AssertionException if the check fails
  */
 public static function true($check, $message = 'Assert::true failed')
 {
     if (!$check) {
         $exception = new AssertionException($message);
         WikiaLogger::instance()->error($message, ['exception' => $exception]);
         throw $exception;
     }
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:15,代码来源:Assert.php

示例14: popInfoboxKeyValue

 public function popInfoboxKeyValue(JsonFormatInfoboxKeyValueNode $keyValueNode)
 {
     if ($this->jsonStack[sizeof($this->jsonStack) - 1] === $keyValueNode->getValue()) {
         array_pop($this->jsonStack);
         $this->currentContainer = $this->jsonStack[sizeof($this->jsonStack) - 1];
     } else {
         # log invalid instead of failing
         \Wikia\Logger\WikiaLogger::instance()->debug('Invalid infobox');
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:10,代码来源:JsonFormatBuilder.php

示例15: efImageReviewDisplayStatus

function efImageReviewDisplayStatus(ImagePage $imagePage, &$html)
{
    global $wgCityId, $wgExternalDatawareDB, $wgUser;
    if (!$wgUser->isAllowed('imagereviewstats')) {
        return true;
    }
    if (!$imagePage->getTitle()->exists()) {
        return true;
    }
    $html .= Xml::element('h2', array(), wfMsg('imagereview-imagepage-header'));
    $reviews = array();
    $headers = array(wfMessage('imagereview-imagepage-table-header-reviewer')->text(), wfMessage('imagereview-imagepage-table-header-state')->text(), wfMessage('imagereview-imagepage-table-header-time')->text());
    $where = array('wiki_id' => $wgCityId, 'page_id' => $imagePage->getId());
    $dbr = wfGetDB(DB_SLAVE, array(), $wgExternalDatawareDB);
    $res = $dbr->select('image_review_stats', '*', $where);
    if ($dbr->numRows($res) == 0) {
        //check if image is in the queue at all!
        $imgCurState = $dbr->selectField('image_review', 'state', $where);
        if (false === $imgCurState) {
            /**
             * If the file is a local one and is older than 1 hour - send it to ImageReview
             * since it's probably been restored, and is not just a fresh file.
             */
            $lastTouched = new DateTime($imagePage->getRevisionFetched()->getTimestamp());
            $now = new DateTime();
            $file = $imagePage->getDisplayedFile();
            if ($file instanceof WikiaLocalFile && $lastTouched < $now->modify('-1 hour')) {
                $scribeEventProducer = new ScribeEventProducer('edit');
                $user = User::newFromName($file->getUser());
                if ($scribeEventProducer->buildEditPackage($imagePage, $user, null, null, $file)) {
                    $logParams = ['cityId' => $wgCityId, 'pageId' => $imagePage->getID(), 'pageTitle' => $imagePage->getTitle()->getText(), 'uploadUser' => $user->getName()];
                    \Wikia\Logger\WikiaLogger::instance()->info('ImageReviewLog', ['message' => 'Image moved back to queue', 'params' => $logParams]);
                    $scribeEventProducer->sendLog();
                }
            }
            // oh oh, image is not in queue at all
            $html .= wfMsg('imagereview-imagepage-not-in-queue');
        } else {
            // image is in the queue but not reviewed yet
            $html .= wfMsg('imagereview-state-0');
        }
    } else {
        // go through the list and display review states
        while ($row = $dbr->fetchObject($res)) {
            $data = array();
            $data[] = User::newFromId($row->reviewer_id)->getName();
            $data[] = wfMsg('imagereview-state-' . $row->review_state);
            $data[] = $row->review_end . ' (UTC)';
            $reviews[] = $data;
        }
        $html .= Xml::buildTable($reviews, array('class' => 'wikitable filehistory sortable', 'style' => 'width: 60%'), $headers);
    }
    return true;
}
开发者ID:yusufchang,项目名称:app,代码行数:54,代码来源:ImageReviewImageStatus.php


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