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

PHP phlog函数代码示例

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

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



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

示例1: handleException

 public function handleException(Exception $ex)
 {
     // Always log the unhandled exception.
     phlog($ex);
     $class = phutil_escape_html(get_class($ex));
     $message = phutil_escape_html($ex->getMessage());
     if (PhabricatorEnv::getEnvConfig('phabricator.show-stack-traces')) {
         $trace = $this->renderStackTrace($ex->getTrace());
     } else {
         $trace = null;
     }
     $content = '<div class="aphront-unhandled-exception">' . '<div class="exception-message">' . $message . '</div>' . $trace . '</div>';
     $user = $this->getRequest()->getUser();
     if (!$user) {
         // If we hit an exception very early, we won't have a user.
         $user = new PhabricatorUser();
     }
     $dialog = new AphrontDialogView();
     $dialog->setTitle('Unhandled Exception ("' . $class . '")')->setClass('aphront-exception-dialog')->setUser($user)->appendChild($content);
     if ($this->getRequest()->isAjax()) {
         $dialog->addCancelButton('/', 'Close');
     }
     $response = new AphrontDialogResponse();
     $response->setDialog($dialog);
     return $response;
 }
开发者ID:hwang36,项目名称:phabricator,代码行数:26,代码来源:AphrontDefaultApplicationConfiguration.php


示例2: processRequest

 public function processRequest()
 {
     // No CSRF for SendGrid.
     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
     $request = $this->getRequest();
     $user = $request->getUser();
     $raw_headers = $request->getStr('headers');
     $raw_headers = explode("\n", rtrim($raw_headers));
     $raw_dict = array();
     foreach (array_filter($raw_headers) as $header) {
         list($name, $value) = explode(':', $header, 2);
         $raw_dict[$name] = ltrim($value);
     }
     $headers = array('to' => $request->getStr('to'), 'from' => $request->getStr('from'), 'subject' => $request->getStr('subject')) + $raw_dict;
     $received = new PhabricatorMetaMTAReceivedMail();
     $received->setHeaders($headers);
     $received->setBodies(array('text' => $request->getStr('text'), 'html' => $request->getStr('from')));
     $file_phids = array();
     foreach ($_FILES as $file_raw) {
         try {
             $file = PhabricatorFile::newFromPHPUpload($file_raw, array('authorPHID' => $user->getPHID()));
             $file_phids[] = $file->getPHID();
         } catch (Exception $ex) {
             phlog($ex);
         }
     }
     $received->setAttachments($file_phids);
     $received->save();
     $received->processReceivedMail();
     $response = new AphrontWebpageResponse();
     $response->setContent("Got it! Thanks, SendGrid!\n");
     return $response;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:33,代码来源:PhabricatorMetaMTASendGridReceiveController.php


示例3: doWork

 protected function doWork()
 {
     $lock = $this->acquireTaskLock();
     $task = $this->loadTask();
     $status = $task->getStatus();
     switch ($task->getStatus()) {
         case PhabricatorWorkerBulkTask::STATUS_WAITING:
             // This is what we expect.
             break;
         default:
             throw new PhabricatorWorkerPermanentFailureException(pht('Found unexpected task status ("%s").', $status));
     }
     $task->setStatus(PhabricatorWorkerBulkTask::STATUS_RUNNING)->save();
     $lock->unlock();
     $job = $this->loadJob();
     $actor = $this->loadActor($job);
     try {
         $job->runTask($actor, $task);
         $status = PhabricatorWorkerBulkTask::STATUS_DONE;
     } catch (Exception $ex) {
         phlog($ex);
         $status = PhabricatorWorkerBulkTask::STATUS_FAIL;
     }
     $task->setStatus($status)->save();
     $this->updateJob($job);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:26,代码来源:PhabricatorWorkerBulkJobTaskWorker.php


示例4: assertParserResult

 private function assertParserResult(array $expect, $input, $file)
 {
     list($x, $y) = PhutilSocketChannel::newChannelPair();
     $xp = new DiffusionMercurialWireClientSSHProtocolChannel($x);
     $y->write($input);
     $y->flush();
     $y->closeWriteChannel();
     $messages = array();
     for ($ii = 0; $ii < count($expect); $ii++) {
         try {
             $messages[] = $xp->waitForMessage();
         } catch (Exception $ex) {
             // This is probably the parser not producing as many messages as
             // we expect. Log the exception, but continue to the assertion below
             // since that will often be easier to diagnose.
             phlog($ex);
             break;
         }
     }
     $this->assertEqual($expect, $messages, $file);
     // Now, make sure the channel doesn't have *more* messages than we expect.
     // Specifically, it should throw when we try to read another message.
     $caught = null;
     try {
         $xp->waitForMessage();
     } catch (Exception $ex) {
         $caught = $ex;
     }
     $this->assertTrue($caught instanceof Exception, pht("No extra messages for '%s'.", $file));
 }
开发者ID:pugong,项目名称:phabricator,代码行数:30,代码来源:DiffusionMercurialWireSSHTestCase.php


示例5: getKeys

 public function getKeys(array $keys)
 {
     $results = array();
     if ($keys) {
         $map = $this->digestKeys($keys);
         $rows = queryfx_all($this->establishConnection('r'), 'SELECT * FROM %T WHERE cacheKeyHash IN (%Ls)', $this->getTableName(), $map);
         $rows = ipull($rows, null, 'cacheKey');
         foreach ($keys as $key) {
             if (empty($rows[$key])) {
                 continue;
             }
             $row = $rows[$key];
             if ($row['cacheExpires'] && $row['cacheExpires'] < time()) {
                 continue;
             }
             try {
                 $results[$key] = $this->didReadValue($row['cacheFormat'], $row['cacheData']);
             } catch (Exception $ex) {
                 // Treat this as a cache miss.
                 phlog($ex);
             }
         }
     }
     return $results;
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:25,代码来源:PhabricatorKeyValueDatabaseCache.php


示例6: addRemarkupSection

 public function addRemarkupSection($header, $text)
 {
     try {
         $engine = PhabricatorMarkupEngine::newMarkupEngine(array());
         $engine->setConfig('viewer', $this->getViewer());
         $engine->setMode(PhutilRemarkupEngine::MODE_TEXT);
         $styled_text = $engine->markupText($text);
         $this->addPlaintextSection($header, $styled_text);
     } catch (Exception $ex) {
         phlog($ex);
         $this->addTextSection($header, $text);
     }
     try {
         $mail_engine = PhabricatorMarkupEngine::newMarkupEngine(array());
         $mail_engine->setConfig('viewer', $this->getViewer());
         $mail_engine->setMode(PhutilRemarkupEngine::MODE_HTML_MAIL);
         $mail_engine->setConfig('uri.base', PhabricatorEnv::getProductionURI('/'));
         $html = $mail_engine->markupText($text);
         $this->addHTMLSection($header, $html);
     } catch (Exception $ex) {
         phlog($ex);
         $this->addHTMLSection($header, $text);
     }
     return $this;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:25,代码来源:PhabricatorMetaMTAMailBody.php


示例7: destroyObject

 public function destroyObject(PhabricatorDestructionEngine $engine, $object)
 {
     $src_phid = $object->getPHID();
     try {
         $edges = id(new PhabricatorEdgeQuery())->withSourcePHIDs(array($src_phid))->execute();
     } catch (Exception $ex) {
         // This is (presumably) a "no edges for this PHID type" exception.
         return;
     }
     $editor = new PhabricatorEdgeEditor();
     foreach ($edges as $type => $type_edges) {
         foreach ($type_edges as $src => $src_edges) {
             foreach ($src_edges as $dst => $edge) {
                 try {
                     $editor->removeEdge($edge['src'], $edge['type'], $edge['dst']);
                 } catch (Exception $ex) {
                     // We can run into an exception while removing the edge if the
                     // edge type no longer exists. This prevents us from figuring out
                     // if there's an inverse type. Just ignore any errors here and
                     // continue, since the best we can do is clean up all the edges
                     // we still have information about. See T11201.
                     phlog($ex);
                 }
             }
         }
     }
     $editor->save();
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:28,代码来源:PhabricatorEdgesDestructionEngineExtension.php


示例8: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     // No CSRF for Mailgun.
     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
     if (!$this->verifyMessage()) {
         throw new Exception(pht('Mail signature is not valid. Check your Mailgun API key.'));
     }
     $user = $request->getUser();
     $raw_headers = $request->getStr('headers');
     $raw_headers = explode("\n", rtrim($raw_headers));
     $raw_dict = array();
     foreach (array_filter($raw_headers) as $header) {
         list($name, $value) = explode(':', $header, 2);
         $raw_dict[$name] = ltrim($value);
     }
     $headers = array('to' => $request->getStr('recipient'), 'from' => $request->getStr('from'), 'subject' => $request->getStr('subject')) + $raw_dict;
     $received = new PhabricatorMetaMTAReceivedMail();
     $received->setHeaders($headers);
     $received->setBodies(array('text' => $request->getStr('stripped-text'), 'html' => $request->getStr('stripped-html')));
     $file_phids = array();
     foreach ($_FILES as $file_raw) {
         try {
             $file = PhabricatorFile::newFromPHPUpload($file_raw, array('viewPolicy' => PhabricatorPolicies::POLICY_NOONE));
             $file_phids[] = $file->getPHID();
         } catch (Exception $ex) {
             phlog($ex);
         }
     }
     $received->setAttachments($file_phids);
     $received->save();
     $received->processReceivedMail();
     $response = new AphrontWebpageResponse();
     $response->setContent(pht("Got it! Thanks, Mailgun!\n"));
     return $response;
 }
开发者ID:barcelonascience,项目名称:phabricator,代码行数:35,代码来源:PhabricatorMetaMTAMailgunReceiveController.php


示例9: handleRequestException

 public function handleRequestException(AphrontRequest $request, Exception $ex)
 {
     $viewer = $this->getViewer($request);
     // Some types of uninteresting request exceptions don't get logged, usually
     // because they are caused by the background radiation of bot traffic on
     // the internet. These include requests with bad CSRF tokens and
     // questionable "Host" headers.
     $should_log = true;
     if ($ex instanceof AphrontMalformedRequestException) {
         $should_log = !$ex->getIsUnlogged();
     }
     if ($should_log) {
         phlog($ex);
     }
     $class = get_class($ex);
     $message = $ex->getMessage();
     if ($ex instanceof AphrontSchemaQueryException) {
         $message .= "\n\n" . pht("NOTE: This usually indicates that the MySQL schema has not been " . "properly upgraded. Run '%s' to ensure your schema is up to date.", 'bin/storage upgrade');
     }
     if (PhabricatorEnv::getEnvConfig('phabricator.developer-mode')) {
         $trace = id(new AphrontStackTraceView())->setUser($viewer)->setTrace($ex->getTrace());
     } else {
         $trace = null;
     }
     $content = phutil_tag('div', array('class' => 'aphront-unhandled-exception'), array(phutil_tag('div', array('class' => 'exception-message'), $message), $trace));
     $dialog = new AphrontDialogView();
     $dialog->setTitle(pht('Unhandled Exception ("%s")', $class))->setClass('aphront-exception-dialog')->setUser($viewer)->appendChild($content);
     if ($request->isAjax()) {
         $dialog->addCancelButton('/', pht('Close'));
     }
     return id(new AphrontDialogResponse())->setDialog($dialog)->setHTTPResponseCode(500);
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:32,代码来源:PhabricatorDefaultRequestExceptionHandler.php


示例10: setKeys

 public function setKeys(array $keys, $ttl = null)
 {
     $this->validateKeys(array_keys($keys));
     $this->lockCache(15);
     if ($ttl) {
         $ttl_epoch = time() + $ttl;
     } else {
         $ttl_epoch = null;
     }
     foreach ($keys as $key => $value) {
         $dict = array('value' => $value);
         if ($ttl_epoch) {
             $dict['ttl'] = $ttl_epoch;
         }
         try {
             $key_file = $this->getKeyFile($key);
             $key_dir = dirname($key_file);
             if (!Filesystem::pathExists($key_dir)) {
                 Filesystem::createDirectory($key_dir, $mask = 0755, $recursive = true);
             }
             $new_file = $key_file . '.new';
             Filesystem::writeFile($new_file, serialize($dict));
             Filesystem::rename($new_file, $key_file);
         } catch (FilesystemException $ex) {
             phlog($ex);
         }
     }
     $this->unlockCache();
     return $this;
 }
开发者ID:lsubra,项目名称:libphutil,代码行数:30,代码来源:PhutilDirectoryKeyValueCache.php


示例11: establishConnection

 private function establishConnection()
 {
     $host = $this->getConfiguration('host');
     $database = $this->getConfiguration('database');
     $profiler = PhutilServiceProfiler::getInstance();
     $call_id = $profiler->beginServiceCall(array('type' => 'connect', 'host' => $host, 'database' => $database));
     $retries = max(1, $this->getConfiguration('retries', 3));
     while ($retries--) {
         try {
             $conn = $this->connect();
             $profiler->endServiceCall($call_id, array());
             break;
         } catch (AphrontQueryException $ex) {
             if ($retries && $ex->getCode() == 2003) {
                 $class = get_class($ex);
                 $message = $ex->getMessage();
                 phlog(pht('Retrying (%d) after %s: %s', $retries, $class, $message));
             } else {
                 $profiler->endServiceCall($call_id, array());
                 throw $ex;
             }
         }
     }
     $this->connection = $conn;
 }
开发者ID:billtt,项目名称:libphutil,代码行数:25,代码来源:AphrontBaseMySQLDatabaseConnection.php


示例12: indexDocumentByPHID

 public function indexDocumentByPHID($phid)
 {
     try {
         $document = $this->buildAbstractDocumentByPHID($phid);
         $object = $this->loadDocumentByPHID($phid);
         // Automatically rebuild CustomField indexes if the object uses custom
         // fields.
         if ($object instanceof PhabricatorCustomFieldInterface) {
             $this->indexCustomFields($document, $object);
         }
         // Automatically rebuild subscriber indexes if the object is subscribable.
         if ($object instanceof PhabricatorSubscribableInterface) {
             $this->indexSubscribers($document);
         }
         $engine = PhabricatorSearchEngineSelector::newSelector()->newEngine();
         try {
             $engine->reindexAbstractDocument($document);
         } catch (Exception $ex) {
             $phid = $document->getPHID();
             $class = get_class($engine);
             phlog("Unable to index document {$phid} with engine {$class}.");
             phlog($ex);
         }
         $this->dispatchDidUpdateIndexEvent($phid, $document);
     } catch (Exception $ex) {
         $class = get_class($this);
         phlog("Unable to build document {$phid} with indexer {$class}.");
         phlog($ex);
     }
     return $this;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:31,代码来源:PhabricatorSearchDocumentIndexer.php


示例13: addRemarkupSection

 public function addRemarkupSection($text)
 {
     try {
         $engine = PhabricatorMarkupEngine::newMarkupEngine(array());
         $engine->setConfig('viewer', $this->getViewer());
         $engine->setMode(PhutilRemarkupEngine::MODE_TEXT);
         $styled_text = $engine->markupText($text);
         $this->sections[] = $styled_text;
     } catch (Exception $ex) {
         phlog($ex);
         $this->sections[] = $text;
     }
     try {
         $mail_engine = PhabricatorMarkupEngine::newMarkupEngine(array());
         $mail_engine->setConfig('viewer', $this->getViewer());
         $mail_engine->setMode(PhutilRemarkupEngine::MODE_HTML_MAIL);
         $mail_engine->setConfig('uri.base', PhabricatorEnv::getProductionURI('/'));
         $html = $mail_engine->markupText($text);
         $this->htmlSections[] = $html;
     } catch (Exception $ex) {
         phlog($ex);
         $this->htmlSections[] = phutil_escape_html_newlines(phutil_tag('div', array(), $text));
     }
     return $this;
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:25,代码来源:PhabricatorMetaMTAMailBody.php


示例14: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $results = array();
     $user = $request->getUser();
     $view_type = $request->getValue('view');
     if (!$view_type) {
         $view_type = 'data';
     }
     $limit = $request->getValue('limit');
     if (!$limit) {
         $limit = $this->getDefaultLimit();
     }
     $filter_phids = $request->getValue('filterPHIDs');
     if (!$filter_phids) {
         $filter_phids = array();
     }
     $query = id(new PhabricatorFeedQuery())->setLimit($limit)->setFilterPHIDs($filter_phids)->setViewer($user);
     $after = $request->getValue('after');
     if (strlen($after)) {
         $query->setAfterID($after);
     }
     $before = $request->getValue('before');
     if (strlen($before)) {
         $query->setBeforeID($before);
     }
     $stories = $query->execute();
     if ($stories) {
         foreach ($stories as $story) {
             $story_data = $story->getStoryData();
             $data = null;
             try {
                 $view = $story->renderView();
             } catch (Exception $ex) {
                 // When stories fail to render, just fail that story.
                 phlog($ex);
                 continue;
             }
             $view->setEpoch($story->getEpoch());
             $view->setUser($user);
             switch ($view_type) {
                 case 'html':
                     $data = $view->render();
                     break;
                 case 'html-summary':
                     $data = $view->render();
                     break;
                 case 'data':
                     $data = array('class' => $story_data->getStoryType(), 'epoch' => $story_data->getEpoch(), 'authorPHID' => $story_data->getAuthorPHID(), 'chronologicalKey' => $story_data->getChronologicalKey(), 'data' => $story_data->getStoryData());
                     break;
                 case 'text':
                     $data = array('class' => $story_data->getStoryType(), 'epoch' => $story_data->getEpoch(), 'authorPHID' => $story_data->getAuthorPHID(), 'chronologicalKey' => $story_data->getChronologicalKey(), 'objectPHID' => $story->getPrimaryObjectPHID(), 'text' => $story->renderText());
                     break;
                 default:
                     throw new ConduitException('ERR-UNKNOWN-TYPE');
             }
             $results[$story_data->getPHID()] = $data;
         }
     }
     return $results;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:60,代码来源:FeedQueryConduitAPIMethod.php


示例15: execute

 public function execute(PhutilArgumentParser $args)
 {
     $console = PhutilConsole::getConsole();
     $iterator = $this->buildIterator($args);
     if (!$iterator) {
         throw new PhutilArgumentUsageException(pht('Either specify a list of files to compact, or use `--all` ' . 'to compact all files.'));
     }
     $is_dry_run = $args->getArg('dry-run');
     foreach ($iterator as $file) {
         $monogram = $file->getMonogram();
         $hash = $file->getContentHash();
         if (!$hash) {
             $console->writeOut("%s\n", pht('%s: No content hash.', $monogram));
             continue;
         }
         // Find other files with the same content hash. We're going to point
         // them at the data for this file.
         $similar_files = id(new PhabricatorFile())->loadAllWhere('contentHash = %s AND id != %d AND
       (storageEngine != %s OR storageHandle != %s)', $hash, $file->getID(), $file->getStorageEngine(), $file->getStorageHandle());
         if (!$similar_files) {
             $console->writeOut("%s\n", pht('%s: No other files with the same content hash.', $monogram));
             continue;
         }
         // Only compact files into this one if we can load the data. This
         // prevents us from breaking working files if we're missing some data.
         try {
             $data = $file->loadFileData();
         } catch (Exception $ex) {
             $data = null;
         }
         if ($data === null) {
             $console->writeOut("%s\n", pht('%s: Unable to load file data; declining to compact.', $monogram));
             continue;
         }
         foreach ($similar_files as $similar_file) {
             if ($is_dry_run) {
                 $console->writeOut("%s\n", pht('%s: Would compact storage with %s.', $monogram, $similar_file->getMonogram()));
                 continue;
             }
             $console->writeOut("%s\n", pht('%s: Compacting storage with %s.', $monogram, $similar_file->getMonogram()));
             $old_instance = null;
             try {
                 $old_instance = $similar_file->instantiateStorageEngine();
                 $old_engine = $similar_file->getStorageEngine();
                 $old_handle = $similar_file->getStorageHandle();
             } catch (Exception $ex) {
                 // If the old stuff is busted, we just won't try to delete the
                 // old data.
                 phlog($ex);
             }
             $similar_file->setStorageEngine($file->getStorageEngine())->setStorageHandle($file->getStorageHandle())->save();
             if ($old_instance) {
                 $similar_file->deleteFileDataIfUnused($old_instance, $old_engine, $old_handle);
             }
         }
     }
     return 0;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:58,代码来源:PhabricatorFilesManagementCompactWorkflow.php


示例16: doWork

 protected function doWork()
 {
     $target = $this->loadBuildTarget();
     $build = $target->getBuild();
     $viewer = $this->getViewer();
     $target->setDateStarted(time());
     try {
         if ($target->getBuildGeneration() !== $build->getBuildGeneration()) {
             throw new HarbormasterBuildAbortedException();
         }
         $status_pending = HarbormasterBuildTarget::STATUS_PENDING;
         if ($target->getTargetStatus() == $status_pending) {
             $target->setTargetStatus(HarbormasterBuildTarget::STATUS_BUILDING);
             $target->save();
         }
         $implementation = $target->getImplementation();
         $implementation->setCurrentWorkerTaskID($this->getCurrentWorkerTaskID());
         $implementation->execute($build, $target);
         $next_status = HarbormasterBuildTarget::STATUS_PASSED;
         if ($implementation->shouldWaitForMessage($target)) {
             $next_status = HarbormasterBuildTarget::STATUS_WAITING;
         }
         $target->setTargetStatus($next_status);
         if ($target->isComplete()) {
             $target->setDateCompleted(PhabricatorTime::getNow());
         }
         $target->save();
     } catch (PhabricatorWorkerYieldException $ex) {
         // If the target wants to yield, let that escape without further
         // processing. We'll resume after the task retries.
         throw $ex;
     } catch (HarbormasterBuildFailureException $ex) {
         // A build step wants to fail explicitly.
         $target->setTargetStatus(HarbormasterBuildTarget::STATUS_FAILED);
         $target->setDateCompleted(PhabricatorTime::getNow());
         $target->save();
     } catch (HarbormasterBuildAbortedException $ex) {
         // A build step is aborting because the build has been restarted.
         $target->setTargetStatus(HarbormasterBuildTarget::STATUS_ABORTED);
         $target->setDateCompleted(PhabricatorTime::getNow());
         $target->save();
     } catch (Exception $ex) {
         phlog($ex);
         try {
             $log = $build->createLog($target, 'core', 'exception');
             $start = $log->start();
             $log->append((string) $ex);
             $log->finalize($start);
         } catch (Exception $log_ex) {
             phlog($log_ex);
         }
         $target->setTargetStatus(HarbormasterBuildTarget::STATUS_FAILED);
         $target->setDateCompleted(time());
         $target->save();
     }
     id(new HarbormasterBuildEngine())->setViewer($viewer)->setBuild($build)->continueBuild();
 }
开发者ID:pugong,项目名称:phabricator,代码行数:57,代码来源:HarbormasterTargetWorker.php


示例17: handleRequestException

 public function handleRequestException(AphrontRequest $request, Exception $ex)
 {
     // Log these; they don't get shown on the client and can be difficult
     // to debug.
     phlog($ex);
     $response = new AphrontAjaxResponse();
     $response->setError(array('code' => get_class($ex), 'info' => $ex->getMessage()));
     return $response;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:9,代码来源:PhabricatorAjaxRequestExceptionHandler.php


示例18: receiveMessage

 public function receiveMessage(PhabricatorBotMessage $message)
 {
     switch ($message->getCommand()) {
         case 'MESSAGE':
             $matches = null;
             $text = $message->getBody();
             $target_name = $message->getTarget()->getName();
             if (empty($this->recentlyMentioned[$target_name])) {
                 $this->recentlyMentioned[$target_name] = array();
             }
             $pattern = '@^' . '(?:' . $this->getConfig('nick', 'phabot') . ')?' . '.?\\s*tell me about ' . '(.*)' . '$@';
             if (preg_match($pattern, $text, $matches)) {
                 $slug = $matches[1];
                 $quiet_until = idx($this->recentlyMentioned[$target_name], $slug, 0) + 60 * 10;
                 if (time() < $quiet_until) {
                     // Remain quiet on this channel.
                     break;
                 } else {
                     $this->recentlyMentioned[$target_name][$slug] = time();
                 }
                 try {
                     $result = $this->getConduit()->callMethodSynchronous('phriction.info', array('slug' => 'docbot/docs/' . $slug));
                 } catch (ConduitClientException $ex) {
                     phlog($ex);
                     $result = null;
                 }
                 $response = array();
                 if ($result) {
                     $content = phutil_split_lines($result['content'], $retain_newlines = false);
                     foreach ($content as $line) {
                         $response = array_merge($response, str_split($line, 400));
                         if (count($response) >= 3) {
                             break;
                         }
                     }
                 } else {
                     $response[] = "Nothing to say about " . $slug;
                 }
                 foreach (array_slice($response, 0, 3) as $output) {
                     $this->replyTo($message, html_entity_decode($output));
                 }
                 break;
             }
             $pattern = '@' . $this->getConfig('nick', 'phabot') . ' remember ' . '(.*?)' . ' as:' . '(.*)$' . '@';
             if (preg_match($pattern, $text, $matches)) {
                 $result = $this->getConduit()->callMethodSynchronous('phriction.edit', array('slug' => 'docbot/docs/' . $matches[1], 'content' => $matches[2]));
                 $slug = explode('/', trim($result['slug'], '/'), 3);
                 $output = "Saved as '{$slug[2]}' at {$result['uri']}";
                 $this->replyTo($message, $output);
                 unset($this->recentlyMentioned[$target_name][$slug[2]]);
                 unset($this->recentlyMentioned[$target_name][$matches[1]]);
                 break;
             }
             break;
     }
 }
开发者ID:fengshao0907,项目名称:disqus-arcanist,代码行数:56,代码来源:PhabricatorBotDocHandler.php


示例19: mirrorRepository

 private function mirrorRepository(PhabricatorRepository $repository)
 {
     try {
         id(new PhabricatorRepositoryMirrorEngine())->setRepository($repository)->pushToMirrors();
     } catch (Exception $ex) {
         // TODO: We should report these into the UI properly, but for now just
         // complain. These errors are much less severe than pull errors.
         $proxy = new PhutilProxyException(pht('Error while pushing "%s" repository to mirrors.', $repository->getMonogram()), $ex);
         phlog($proxy);
     }
 }
开发者ID:truSense,项目名称:phabricator,代码行数:11,代码来源:PhabricatorRepositoryManagementUpdateWorkflow.php


示例20: reindexAbstractDocument

 protected static final function reindexAbstractDocument(PhabricatorSearchAbstractDocument $document)
 {
     $engine = PhabricatorSearchEngineSelector::newSelector()->newEngine();
     try {
         $engine->reindexAbstractDocument($document);
     } catch (Exception $ex) {
         $phid = $document->getPHID();
         $class = get_class($engine);
         phlog("Unable to index document {$phid} by engine {$class}.");
     }
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:11,代码来源:PhabricatorSearchDocumentIndexer.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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