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


PHP MWExceptionHandler::logException方法代码示例

本文整理汇总了PHP中MWExceptionHandler::logException方法的典型用法代码示例。如果您正苦于以下问题:PHP MWExceptionHandler::logException方法的具体用法?PHP MWExceptionHandler::logException怎么用?PHP MWExceptionHandler::logException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MWExceptionHandler的用法示例。


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

示例1: getInlineScript

 /**
  * Get contents of a javascript file for inline use.
  *
  * Roughly based MediaWiki core methods:
  * - ResourceLoader::filter()
  * - ResourceLoaderFileModule::readScriptFiles()
  *
  * @param string $name Path to file relative to /modules/inline/
  * @return string Minified script
  * @throws Exception If file doesn't exist
  */
 protected static function getInlineScript($name)
 {
     // Get file
     $filePath = __DIR__ . '/../../modules/inline/' . $name;
     if (!file_exists($filePath)) {
         throw new Exception(__METHOD__ . ": file not found: \"{$filePath}\"");
     }
     $contents = file_get_contents($filePath);
     // Try minified from cache
     $key = wfMemcKey('centralauth', 'minify-js', md5($contents));
     $cache = wfGetCache(CACHE_ANYTHING);
     $cacheEntry = $cache->get($key);
     if (is_string($cacheEntry)) {
         return $cacheEntry;
     }
     // Compute new value
     $result = '';
     try {
         $result = JavaScriptMinifier::minify($contents) . "\n/* cache key: {$key} */";
         $cache->set($key, $result);
     } catch (Exception $e) {
         MWExceptionHandler::logException($e);
         wfDebugLog('CentralAuth', __METHOD__ . ": minification failed for {$name}: {$e}");
         $result = ResourceLoader::formatException($e) . "\n" . $contents;
     }
     return $result;
 }
开发者ID:NDKilla,项目名称:mediawiki-extensions-CentralAuth,代码行数:38,代码来源:SpecialCentralAutoLogin.php

示例2: doUpdate

 /**
  * Run the update
  */
 public function doUpdate()
 {
     global $wgHitcounterUpdateFreq;
     $dbw = wfGetDB(DB_MASTER);
     if ($wgHitcounterUpdateFreq <= 1 || $dbw->getType() == 'sqlite') {
         $id = $this->id;
         $method = __METHOD__;
         $dbw->onTransactionIdle(function () use($dbw, $id, $method) {
             try {
                 $dbw->update('page', array('page_counter = page_counter + 1'), array('page_id' => $id), $method);
             } catch (DBError $e) {
                 MWExceptionHandler::logException($e);
             }
         });
         return;
     }
     # Not important enough to warrant an error page in case of failure
     try {
         // Since `hitcounter` is non-transactional, the contention is minimal
         $dbw->insert('hitcounter', array('hc_id' => $this->id), __METHOD__);
         $checkfreq = intval($wgHitcounterUpdateFreq / 25 + 1);
         if (rand() % $checkfreq == 0 && $dbw->lastErrno() == 0) {
             $this->collect();
         }
     } catch (DBError $e) {
         MWExceptionHandler::logException($e);
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:31,代码来源:ViewCountUpdate.php

示例3: getResults

 /**
  * @param UUID $postId
  * @param int $limit
  * @param UUID|null $offset
  * @param string $direction 'rev' or 'fwd'
  * @return FormatterRow[]
  */
 public function getResults(UUID $postId, $limit = 50, UUID $offset = null, $direction = 'fwd')
 {
     $history = $this->storage->find('TopicHistoryEntry', array('topic_root_id' => $postId), array('sort' => 'rev_id', 'order' => 'DESC', 'limit' => $limit, 'offset-id' => $offset, 'offset-dir' => $direction, 'offset-include' => false, 'offset-elastic' => false));
     if (!$history) {
         return array();
     }
     $this->loadMetadataBatch($history);
     $results = $replies = array();
     foreach ($history as $revision) {
         try {
             if ($this->excludeFromHistory($revision)) {
                 continue;
             }
             $results[] = $row = new TopicRow();
             $this->buildResult($revision, null, $row);
             if ($revision instanceof PostRevision) {
                 $replyToId = $revision->getReplyToId();
                 if ($replyToId) {
                     // $revisionId into the key rather than value prevents
                     // duplicate insertion
                     $replies[$replyToId->getAlphadecimal()][$revision->getPostId()->getAlphadecimal()] = true;
                 }
             }
         } catch (FlowException $e) {
             \MWExceptionHandler::logException($e);
         }
     }
     foreach ($results as $result) {
         if ($result->revision instanceof PostRevision) {
             $alpha = $result->revision->getPostId()->getAlphadecimal();
             $result->replies = isset($replies[$alpha]) ? array_keys($replies[$alpha]) : array();
         }
     }
     return $results;
 }
开发者ID:TarLocesilion,项目名称:mediawiki-extensions-Flow,代码行数:42,代码来源:TopicHistoryQuery.php

示例4: findMulti

 /**
  * All queries must be against the same index. Results are equivalent to
  * array_map, maintaining order and key relationship between input $queries
  * and $result.
  *
  * @param array $queries
  * @param array $options
  * @return array|null  null is query failure.  empty array is no result.  array is success
  */
 public function findMulti(array $queries, array $options = array())
 {
     if (!$queries) {
         return array();
     }
     $keys = array_keys(reset($queries));
     if (isset($options['sort']) && !is_array($options['sort'])) {
         $options['sort'] = ObjectManager::makeArray($options['sort']);
     }
     try {
         $index = $this->getIndexFor($keys, $options);
         $res = $index->findMulti($queries, $options);
     } catch (NoIndexException $e) {
         if (array_search('topic_root_id', $keys)) {
             wfDebugLog('Flow', __METHOD__ . ': ' . json_encode($keys) . ' : ' . json_encode($options) . ' : ' . json_encode(array_map('get_class', $this->indexes)));
             \MWExceptionHandler::logException($e);
         } else {
             wfDebugLog('FlowDebug', __METHOD__ . ': ' . $e->getMessage());
         }
         $res = $this->storage->findMulti($queries, $this->convertToDbOptions($options));
     }
     if ($res === null) {
         return null;
     }
     $output = array();
     foreach ($res as $index => $queryOutput) {
         foreach ($queryOutput as $k => $v) {
             if ($v) {
                 $output[$index][$k] = $this->load($v);
             }
         }
     }
     return $output;
 }
开发者ID:TarLocesilion,项目名称:mediawiki-extensions-Flow,代码行数:43,代码来源:ObjectLocator.php

示例5: getResults

 /**
  * @param UUID[]|TopicListEntry[] $topicIdsOrEntries
  * @return FormatterRow[]
  */
 public function getResults(array $topicIdsOrEntries)
 {
     $topicIds = $this->getTopicIds($topicIdsOrEntries);
     $allPostIds = $this->collectPostIds($topicIds);
     $topicSummary = $this->collectSummary($topicIds);
     $posts = $this->collectRevisions($allPostIds);
     $watchStatus = $this->collectWatchStatus($topicIds);
     $missing = array_diff(array_keys($allPostIds), array_keys($posts));
     if ($missing) {
         $needed = array();
         foreach ($missing as $alpha) {
             // convert alpha back into UUID object
             $needed[] = $allPostIds[$alpha];
         }
         $posts += $this->createFakePosts($needed);
     }
     $this->loadMetadataBatch($posts);
     $results = array();
     $replies = array();
     foreach ($posts as $post) {
         try {
             if (!$this->permissions->isAllowed($post, 'view')) {
                 continue;
             }
             $row = new TopicRow();
             $this->buildResult($post, null, $row);
             /** @var PostRevision $revision */
             $revision = $row->revision;
             $replyToId = $revision->getReplyToId();
             $replyToId = $replyToId ? $replyToId->getAlphadecimal() : null;
             $postId = $revision->getPostId()->getAlphadecimal();
             $replies[$replyToId] = $postId;
             if ($post->isTopicTitle()) {
                 // Attach the summary
                 if (isset($topicSummary[$postId])) {
                     $row->summary = $this->buildResult($topicSummary[$postId], 'rev_id');
                 }
                 // Attach the watch status
                 if (isset($watchStatus[$postId]) && $watchStatus[$postId]) {
                     $row->isWatched = true;
                 }
             }
             $results[] = $row;
         } catch (FlowException $e) {
             \MWExceptionHandler::logException($e);
         }
     }
     foreach ($results as $result) {
         $alpha = $result->revision->getPostId()->getAlphadecimal();
         $result->replies = isset($replies[$alpha]) ? $replies[$alpha] : array();
     }
     return $results;
 }
开发者ID:TarLocesilion,项目名称:mediawiki-extensions-Flow,代码行数:57,代码来源:TopicListQuery.php

示例6: onSubmit

 /**
  * Creates a flow board.
  * Archives any pre-existing wikitext talk page.
  *
  * @param array $data Form data
  * @return Status Status indicating result
  */
 public function onSubmit(array $data)
 {
     $page = $data['page'];
     $title = Title::newFromText($page);
     if (!$title) {
         return Status::newFatal('flow-special-enableflow-invalid-title', $page);
     }
     // Canonicalize so the error or confirmation message looks nicer (no underscores).
     $page = $title->getPrefixedText();
     if ($this->occupationController->isTalkpageOccupied($title, true)) {
         return Status::newFatal('flow-special-enableflow-board-already-exists', $page);
     }
     $status = Status::newGood();
     if ($title->exists(Title::GAID_FOR_UPDATE)) {
         if (class_exists('LqtDispatch') && \LqtDispatch::isLqtPage($title)) {
             return Status::newFatal('flow-special-enableflow-page-is-liquidthreads', $page);
         }
         $logger = Container::get('default_logger');
         $converter = new Converter(wfGetDB(DB_MASTER), Container::get('importer'), $logger, $this->occupationController->getTalkpageManager(), new EnableFlowWikitextConversionStrategy(Container::get('parser'), new NullImportSourceStore(), $logger, array(), $data['header']));
         try {
             $converter->convert($title);
         } catch (\Exception $e) {
             \MWExceptionHandler::logException($e);
             $status->fatal('flow-error-external', $e->getMessage());
         }
     } else {
         $allowCreationStatus = $this->occupationController->allowCreation($title, $this->getUser(), false);
         if (!$allowCreationStatus->isGood()) {
             return Status::newFatal('flow-special-enableflow-board-creation-not-allowed', $page);
         }
         $loader = $this->loaderFactory->createWorkflowLoader($title);
         $blocks = $loader->getBlocks();
         $action = 'edit-header';
         $params = array('header' => array('content' => $data['header'], 'format' => 'wikitext'));
         $blocksToCommit = $loader->handleSubmit($this->getContext(), $action, $params);
         foreach ($blocks as $block) {
             if ($block->hasErrors()) {
                 $errors = $block->getErrors();
                 foreach ($errors as $errorKey) {
                     $status->fatal($block->getErrorMessage($errorKey));
                 }
             }
         }
         $loader->commit($blocksToCommit);
     }
     $this->page = $data['page'];
     return $status;
 }
开发者ID:TarLocesilion,项目名称:mediawiki-extensions-Flow,代码行数:55,代码来源:SpecialEnableFlow.php

示例7: getResults

 /**
  * @param UUID $postId
  * @param int $limit
  * @param UUID|null $offset
  * @param string $direction 'rev' or 'fwd'
  * @return FormatterRow[]
  */
 public function getResults(UUID $postId, $limit = 50, UUID $offset = null, $direction = 'fwd')
 {
     $history = $this->storage->find('PostRevision', array('rev_type_id' => $postId), array('sort' => 'rev_id', 'order' => 'DESC', 'limit' => $limit, 'offset-id' => $offset, 'offset-dir' => $direction, 'offset-include' => false, 'offset-elastic' => false));
     if (!$history) {
         return array();
     }
     $this->loadMetadataBatch($history);
     $results = array();
     foreach ($history as $revision) {
         try {
             $results[] = $row = new FormatterRow();
             $this->buildResult($revision, null, $row);
         } catch (FlowException $e) {
             \MWExceptionHandler::logException($e);
         }
     }
     return $results;
 }
开发者ID:TarLocesilion,项目名称:mediawiki-extensions-Flow,代码行数:25,代码来源:PostHistoryQuery.php

示例8: handleException

 /**
  * Handle an exception as an API response
  *
  * @since 1.23
  * @param Exception $e
  */
 protected function handleException(Exception $e)
 {
     // Bug 63145: Rollback any open database transactions
     if (!$e instanceof UsageException) {
         // UsageExceptions are intentional, so don't rollback if that's the case
         try {
             MWExceptionHandler::rollbackMasterChangesAndLog($e);
         } catch (DBError $e2) {
             // Rollback threw an exception too. Log it, but don't interrupt
             // our regularly scheduled exception handling.
             MWExceptionHandler::logException($e2);
         }
     }
     // Allow extra cleanup and logging
     Hooks::run('ApiMain::onException', array($this, $e));
     // Log it
     if (!$e instanceof UsageException) {
         MWExceptionHandler::logException($e);
     }
     // Handle any kind of exception by outputting properly formatted error message.
     // If this fails, an unhandled exception should be thrown so that global error
     // handler will process and log it.
     $errCode = $this->substituteResultWithError($e);
     // Error results should not be cached
     $this->setCacheMode('private');
     $response = $this->getRequest()->response();
     $headerStr = 'MediaWiki-API-Error: ' . $errCode;
     if ($e->getCode() === 0) {
         $response->header($headerStr);
     } else {
         $response->header($headerStr, true, $e->getCode());
     }
     // Reset and print just the error message
     ob_clean();
     // Printer may not be initialized if the extractRequestParams() fails for the main module
     $this->createErrorPrinter();
     try {
         $this->printResult(true);
     } catch (UsageException $ex) {
         // The error printer itself is failing. Try suppressing its request
         // parameters and redo.
         $this->setWarning('Error printer failed (will retry without params): ' . $ex->getMessage());
         $this->mPrinter = null;
         $this->createErrorPrinter();
         $this->mPrinter->forceDefaultParams();
         $this->printResult(true);
     }
 }
开发者ID:soumyag213,项目名称:mediawiki,代码行数:54,代码来源:ApiMain.php

示例9: doViewUpdates

 /**
  * Do standard deferred updates after page view (existing or missing page)
  * @param User $user The relevant user
  * @param int $oldid Revision id being viewed; if not given or 0, latest revision is assumed
  */
 public function doViewUpdates(User $user, $oldid = 0)
 {
     if (wfReadOnly()) {
         return;
     }
     Hooks::run('PageViewUpdates', [$this, $user]);
     // Update newtalk / watchlist notification status
     try {
         $user->clearNotification($this->mTitle, $oldid);
     } catch (DBError $e) {
         // Avoid outage if the master is not reachable
         MWExceptionHandler::logException($e);
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:19,代码来源:WikiPage.php

示例10: saveSettings

 /**
  * Save this user's settings into the database.
  * @todo Only rarely do all these fields need to be set!
  */
 public function saveSettings()
 {
     global $wgAuth;
     if (wfReadOnly()) {
         // @TODO: caller should deal with this instead!
         // This should really just be an exception.
         MWExceptionHandler::logException(new DBExpectedError(null, "Could not update user with ID '{$this->mId}'; DB is read-only."));
         return;
     }
     $this->load();
     $this->loadPasswords();
     if (0 == $this->mId) {
         return;
         // anon
     }
     // Get a new user_touched that is higher than the old one.
     // This will be used for a CAS check as a last-resort safety
     // check against race conditions and slave lag.
     $oldTouched = $this->mTouched;
     $newTouched = $this->newTouchedTimestamp();
     if (!$wgAuth->allowSetLocalPassword()) {
         $this->mPassword = self::getPasswordFactory()->newFromCiphertext(null);
     }
     $dbw = wfGetDB(DB_MASTER);
     $dbw->update('user', array('user_name' => $this->mName, 'user_password' => $this->mPassword->toString(), 'user_newpassword' => $this->mNewpassword->toString(), 'user_newpass_time' => $dbw->timestampOrNull($this->mNewpassTime), 'user_real_name' => $this->mRealName, 'user_email' => $this->mEmail, 'user_email_authenticated' => $dbw->timestampOrNull($this->mEmailAuthenticated), 'user_touched' => $dbw->timestamp($newTouched), 'user_token' => strval($this->mToken), 'user_email_token' => $this->mEmailToken, 'user_email_token_expires' => $dbw->timestampOrNull($this->mEmailTokenExpires), 'user_password_expires' => $dbw->timestampOrNull($this->mPasswordExpires)), array('user_id' => $this->mId, 'user_touched' => $dbw->timestamp($oldTouched)), __METHOD__);
     if (!$dbw->affectedRows()) {
         // Maybe the problem was a missed cache update; clear it to be safe
         $this->clearSharedCache();
         // User was changed in the meantime or loaded with stale data
         $from = $this->queryFlagsUsed & self::READ_LATEST ? 'master' : 'slave';
         throw new MWException("CAS update failed on user_touched for user ID '{$this->mId}' (read from {$from});" . " the version of the user to be saved is older than the current version.");
     }
     $this->mTouched = $newTouched;
     $this->saveOptions();
     Hooks::run('UserSaveSettings', array($this));
     $this->clearSharedCache();
     $this->getUserPage()->invalidateCache();
 }
开发者ID:jpena88,项目名称:mediawiki-dokku-deploy,代码行数:42,代码来源:User.php

示例11: wfLogProfilingData

/**
 * @todo document
 */
function wfLogProfilingData()
{
    global $wgDebugLogGroups, $wgDebugRawPage;
    $context = RequestContext::getMain();
    $request = $context->getRequest();
    $profiler = Profiler::instance();
    $profiler->setContext($context);
    $profiler->logData();
    $config = $context->getConfig();
    if ($config->get('StatsdServer')) {
        try {
            $statsdServer = explode(':', $config->get('StatsdServer'));
            $statsdHost = $statsdServer[0];
            $statsdPort = isset($statsdServer[1]) ? $statsdServer[1] : 8125;
            $statsdSender = new SocketSender($statsdHost, $statsdPort);
            $statsdClient = new SamplingStatsdClient($statsdSender, true, false);
            $statsdClient->send($context->getStats()->getBuffer());
        } catch (Exception $ex) {
            MWExceptionHandler::logException($ex);
        }
    }
    # Profiling must actually be enabled...
    if ($profiler instanceof ProfilerStub) {
        return;
    }
    if (isset($wgDebugLogGroups['profileoutput']) && $wgDebugLogGroups['profileoutput'] === false) {
        // Explicitly disabled
        return;
    }
    if (!$wgDebugRawPage && wfIsDebugRawPage()) {
        return;
    }
    $ctx = array('elapsed' => $request->getElapsedTime());
    if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $ctx['forwarded_for'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
        $ctx['client_ip'] = $_SERVER['HTTP_CLIENT_IP'];
    }
    if (!empty($_SERVER['HTTP_FROM'])) {
        $ctx['from'] = $_SERVER['HTTP_FROM'];
    }
    if (isset($ctx['forwarded_for']) || isset($ctx['client_ip']) || isset($ctx['from'])) {
        $ctx['proxy'] = $_SERVER['REMOTE_ADDR'];
    }
    // Don't load $wgUser at this late stage just for statistics purposes
    // @todo FIXME: We can detect some anons even if it is not loaded.
    // See User::getId()
    $user = $context->getUser();
    $ctx['anon'] = $user->isItemLoaded('id') && $user->isAnon();
    // Command line script uses a FauxRequest object which does not have
    // any knowledge about an URL and throw an exception instead.
    try {
        $ctx['url'] = urldecode($request->getRequestURL());
    } catch (Exception $ignored) {
        // no-op
    }
    $ctx['output'] = $profiler->getOutput();
    $log = LoggerFactory::getInstance('profileoutput');
    $log->info("Elapsed: {elapsed}; URL: <{url}>\n{output}", $ctx);
}
开发者ID:ErdemA,项目名称:mediawiki,代码行数:64,代码来源:GlobalFunctions.php

示例12: triggerJobs

 /**
  * Potentially open a socket and sent an HTTP request back to the server
  * to run a specified number of jobs. This registers a callback to cleanup
  * the socket once it's done.
  */
 public function triggerJobs()
 {
     $jobRunRate = $this->config->get('JobRunRate');
     if ($this->getTitle()->isSpecial('RunJobs')) {
         return;
         // recursion guard
     } elseif ($jobRunRate <= 0 || wfReadOnly()) {
         return;
     }
     if ($jobRunRate < 1) {
         $max = mt_getrandmax();
         if (mt_rand(0, $max) > $max * $jobRunRate) {
             return;
             // the higher the job run rate, the less likely we return here
         }
         $n = 1;
     } else {
         $n = intval($jobRunRate);
     }
     $runJobsLogger = LoggerFactory::getInstance('runJobs');
     // Fall back to running the job(s) while the user waits if needed
     if (!$this->config->get('RunJobsAsync')) {
         $runner = new JobRunner($runJobsLogger);
         $runner->run(['maxJobs' => $n]);
         return;
     }
     // Do not send request if there are probably no jobs
     try {
         $group = JobQueueGroup::singleton();
         if (!$group->queuesHaveJobs(JobQueueGroup::TYPE_DEFAULT)) {
             return;
         }
     } catch (JobQueueError $e) {
         MWExceptionHandler::logException($e);
         return;
         // do not make the site unavailable
     }
     $query = ['title' => 'Special:RunJobs', 'tasks' => 'jobs', 'maxjobs' => $n, 'sigexpiry' => time() + 5];
     $query['signature'] = SpecialRunJobs::getQuerySignature($query, $this->config->get('SecretKey'));
     $errno = $errstr = null;
     $info = wfParseUrl($this->config->get('CanonicalServer'));
     $host = $info ? $info['host'] : null;
     $port = 80;
     if (isset($info['scheme']) && $info['scheme'] == 'https') {
         $host = "tls://" . $host;
         $port = 443;
     }
     if (isset($info['port'])) {
         $port = $info['port'];
     }
     MediaWiki\suppressWarnings();
     $sock = $host ? fsockopen($host, $port, $errno, $errstr, 0.1) : false;
     MediaWiki\restoreWarnings();
     $invokedWithSuccess = true;
     if ($sock) {
         $special = SpecialPageFactory::getPage('RunJobs');
         $url = $special->getPageTitle()->getCanonicalURL($query);
         $req = "POST {$url} HTTP/1.1\r\n" . "Host: {$info['host']}\r\n" . "Connection: Close\r\n" . "Content-Length: 0\r\n\r\n";
         $runJobsLogger->info("Running {$n} job(s) via '{$url}'");
         // Send a cron API request to be performed in the background.
         // Give up if this takes too long to send (which should be rare).
         stream_set_timeout($sock, 2);
         $bytes = fwrite($sock, $req);
         if ($bytes !== strlen($req)) {
             $invokedWithSuccess = false;
             $runJobsLogger->error("Failed to start cron API (socket write error)");
         } else {
             // Do not wait for the response (the script should handle client aborts).
             // Make sure that we don't close before that script reaches ignore_user_abort().
             $start = microtime(true);
             $status = fgets($sock);
             $sec = microtime(true) - $start;
             if (!preg_match('#^HTTP/\\d\\.\\d 202 #', $status)) {
                 $invokedWithSuccess = false;
                 $runJobsLogger->error("Failed to start cron API: received '{$status}' ({$sec})");
             }
         }
         fclose($sock);
     } else {
         $invokedWithSuccess = false;
         $runJobsLogger->error("Failed to start cron API (socket error {$errno}): {$errstr}");
     }
     // Fall back to running the job(s) while the user waits if needed
     if (!$invokedWithSuccess) {
         $runJobsLogger->warning("Jobs switched to blocking; Special:RunJobs disabled");
         $runner = new JobRunner($runJobsLogger);
         $runner->run(['maxJobs' => $n]);
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:94,代码来源:MediaWiki.php

示例13: doGetSiblingQueueSizes

 protected function doGetSiblingQueueSizes(array $types)
 {
     $result = array();
     $failed = 0;
     /** @var JobQueue $queue */
     foreach ($this->partitionQueues as $queue) {
         try {
             $sizes = $queue->doGetSiblingQueueSizes($types);
             if (is_array($sizes)) {
                 foreach ($sizes as $type => $size) {
                     $result[$type] = isset($result[$type]) ? $result[$type] + $size : $size;
                 }
             } else {
                 return null;
                 // not supported on all partitions; bail
             }
         } catch (JobQueueError $e) {
             ++$failed;
             MWExceptionHandler::logException($e);
         }
     }
     $this->throwErrorIfAllPartitionsDown($failed);
     return $result;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:24,代码来源:JobQueueFederated.php

示例14: execute

 public static function execute(array &$queue, $mode)
 {
     $updates = $queue;
     // snapshot of queue
     // Keep doing rounds of updates until none get enqueued
     while (count($updates)) {
         $queue = array();
         // clear the queue
         /** @var DataUpdate[] $dataUpdates */
         $dataUpdates = array();
         /** @var DeferrableUpdate[] $otherUpdates */
         $otherUpdates = array();
         foreach ($updates as $update) {
             if ($update instanceof DataUpdate) {
                 $dataUpdates[] = $update;
             } else {
                 $otherUpdates[] = $update;
             }
         }
         // Delegate DataUpdate execution to the DataUpdate class
         DataUpdate::runUpdates($dataUpdates, $mode);
         // Execute the non-DataUpdate tasks
         foreach ($otherUpdates as $update) {
             try {
                 $update->doUpdate();
                 wfGetLBFactory()->commitMasterChanges(__METHOD__);
             } catch (Exception $e) {
                 // We don't want exceptions thrown during deferred updates to
                 // be reported to the user since the output is already sent
                 if (!$e instanceof ErrorPageError) {
                     MWExceptionHandler::logException($e);
                 }
                 // Make sure incomplete transactions are not committed and end any
                 // open atomic sections so that other DB updates have a chance to run
                 wfGetLBFactory()->rollbackMasterChanges(__METHOD__);
             }
         }
         $updates = $queue;
         // new snapshot of queue (check for new entries)
     }
 }
开发者ID:xiebinyi,项目名称:mediawiki,代码行数:41,代码来源:DeferredUpdates.php

示例15: report

 /**
  * Output a report about the exception and takes care of formatting.
  * It will be either HTML or plain text based on isCommandLine().
  */
 function report()
 {
     global $wgMimeType;
     MWExceptionHandler::logException($this);
     if (defined('MW_API')) {
         // Unhandled API exception, we can't be sure that format printer is alive
         header('MediaWiki-API-Error: internal_api_error_' . get_class($this));
         wfHttpError(500, 'Internal Server Error', $this->getText());
     } elseif (self::isCommandLine()) {
         MWExceptionHandler::printError($this->getText());
     } else {
         header('HTTP/1.1 500 MediaWiki exception');
         header('Status: 500 MediaWiki exception', true);
         header("Content-Type: {$wgMimeType}; charset=utf-8", true);
         $this->reportHTML();
     }
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:21,代码来源:Exception.php


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