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


PHP DiffusionRequest::getPath方法代码示例

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


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

示例1: newFile

 private function newFile(DiffusionRequest $drequest, $content)
 {
     $path = $drequest->getPath();
     $name = basename($path);
     $repository = $drequest->getRepository();
     $repository_phid = $repository->getPHID();
     $file = PhabricatorFile::buildFromFileDataOrHash($content, array('name' => $name, 'ttl' => time() + phutil_units('48 hours in seconds'), 'viewPolicy' => PhabricatorPolicies::POLICY_NOONE));
     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
     $file->attachToObject($repository_phid);
     unset($unguarded);
     return $file;
 }
开发者ID:modernfactory,项目名称:phabricator,代码行数:12,代码来源:DiffusionFileContentQueryConduitAPIMethod.php

示例2: buildPropertyView

 protected function buildPropertyView(DiffusionRequest $drequest, PhabricatorActionListView $actions)
 {
     $viewer = $this->getViewer();
     $view = id(new PHUIPropertyListView())->setUser($viewer)->setActionList($actions);
     $stable_commit = $drequest->getStableCommit();
     $callsign = $drequest->getRepository()->getCallsign();
     $view->addProperty(pht('Commit'), phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'commit', 'commit' => $stable_commit))), $drequest->getRepository()->formatCommitName($stable_commit)));
     if ($drequest->getSymbolicType() == 'tag') {
         $symbolic = $drequest->getSymbolicCommit();
         $view->addProperty(pht('Tag'), $symbolic);
         $tags = $this->callConduitWithDiffusionRequest('diffusion.tagsquery', array('names' => array($symbolic), 'needMessages' => true));
         $tags = DiffusionRepositoryTag::newFromConduit($tags);
         $tags = mpull($tags, null, 'getName');
         $tag = idx($tags, $symbolic);
         if ($tag && strlen($tag->getMessage())) {
             $view->addSectionHeader(pht('Tag Content'));
             $view->addTextContent($this->markupText($tag->getMessage()));
         }
     }
     $repository = $drequest->getRepository();
     $owners = 'PhabricatorOwnersApplication';
     if (PhabricatorApplication::isClassInstalled($owners)) {
         $package_query = id(new PhabricatorOwnersPackageQuery())->setViewer($viewer)->withControl($repository->getPHID(), array($drequest->getPath()));
         $package_query->execute();
         $packages = $package_query->getControllingPackagesForPath($repository->getPHID(), $drequest->getPath());
         if ($packages) {
             $ownership = id(new PHUIStatusListView())->setUser($viewer);
             foreach ($packages as $package) {
                 $icon = 'fa-list-alt';
                 $color = 'grey';
                 $item = id(new PHUIStatusItemView())->setIcon($icon, $color)->setTarget($viewer->renderHandle($package->getPHID()));
                 $ownership->addItem($item);
             }
         } else {
             $ownership = phutil_tag('em', array(), pht('None'));
         }
         $view->addProperty(pht('Packages'), $ownership);
     }
     return $view;
 }
开发者ID:bohanlin,项目名称:phabricator,代码行数:40,代码来源:DiffusionBrowseController.php

示例3: buildActionView

 protected function buildActionView(DiffusionRequest $drequest)
 {
     $viewer = $this->getRequest()->getUser();
     $view = id(new PhabricatorActionListView())->setUser($viewer);
     $history_uri = $drequest->generateURI(array('action' => 'history'));
     $view->addAction(id(new PhabricatorActionView())->setName(pht('View History'))->setHref($history_uri)->setIcon('fa-list'));
     $behind_head = $drequest->getSymbolicCommit();
     $head_uri = $drequest->generateURI(array('commit' => '', 'action' => 'browse'));
     $view->addAction(id(new PhabricatorActionView())->setName(pht('Jump to HEAD'))->setHref($head_uri)->setIcon('fa-home')->setDisabled(!$behind_head));
     // TODO: Ideally, this should live in Owners and be event-triggered, but
     // there's no reasonable object for it to react to right now.
     $owners = 'PhabricatorOwnersApplication';
     if (PhabricatorApplication::isClassInstalled($owners)) {
         $owners_uri = id(new PhutilURI('/owners/view/search/'))->setQueryParams(array('repository' => $drequest->getCallsign(), 'path' => '/' . $drequest->getPath()));
         $view->addAction(id(new PhabricatorActionView())->setName(pht('Find Owners'))->setHref((string) $owners_uri)->setIcon('fa-users'));
     }
     return $view;
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:18,代码来源:DiffusionBrowseController.php

示例4: buildRawDiffResponse

 private function buildRawDiffResponse(DiffusionRequest $drequest)
 {
     $raw_diff = $this->callConduitWithDiffusionRequest('diffusion.rawdiffquery', array('commit' => $drequest->getCommit(), 'path' => $drequest->getPath()));
     $file = PhabricatorFile::buildFromFileDataOrHash($raw_diff, array('name' => $drequest->getCommit() . '.diff', 'ttl' => 60 * 60 * 24, 'viewPolicy' => PhabricatorPolicies::POLICY_NOONE));
     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
     $file->attachToObject($drequest->getRepository()->getPHID());
     unset($unguarded);
     return $file->getRedirectResponse();
 }
开发者ID:ryancford,项目名称:phabricator,代码行数:9,代码来源:DiffusionCommitController.php

示例5: buildNormalContent

 private function buildNormalContent(DiffusionRequest $drequest)
 {
     $repository = $drequest->getRepository();
     $phids = array();
     $content = array();
     try {
         $history_results = $this->callConduitWithDiffusionRequest('diffusion.historyquery', array('commit' => $drequest->getCommit(), 'path' => $drequest->getPath(), 'offset' => 0, 'limit' => 15));
         $history = DiffusionPathChange::newFromConduit($history_results['pathChanges']);
         foreach ($history as $item) {
             $data = $item->getCommitData();
             if ($data) {
                 if ($data->getCommitDetail('authorPHID')) {
                     $phids[$data->getCommitDetail('authorPHID')] = true;
                 }
                 if ($data->getCommitDetail('committerPHID')) {
                     $phids[$data->getCommitDetail('committerPHID')] = true;
                 }
             }
         }
         $history_exception = null;
     } catch (Exception $ex) {
         $history_results = null;
         $history = null;
         $history_exception = $ex;
     }
     try {
         $browse_results = DiffusionBrowseResultSet::newFromConduit($this->callConduitWithDiffusionRequest('diffusion.browsequery', array('path' => $drequest->getPath(), 'commit' => $drequest->getCommit())));
         $browse_paths = $browse_results->getPaths();
         foreach ($browse_paths as $item) {
             $data = $item->getLastCommitData();
             if ($data) {
                 if ($data->getCommitDetail('authorPHID')) {
                     $phids[$data->getCommitDetail('authorPHID')] = true;
                 }
                 if ($data->getCommitDetail('committerPHID')) {
                     $phids[$data->getCommitDetail('committerPHID')] = true;
                 }
             }
         }
         $browse_exception = null;
     } catch (Exception $ex) {
         $browse_results = null;
         $browse_paths = null;
         $browse_exception = $ex;
     }
     $phids = array_keys($phids);
     $handles = $this->loadViewerHandles($phids);
     $readme = null;
     if ($browse_results) {
         $readme_path = $browse_results->getReadmePath();
         if ($readme_path) {
             $readme_content = $this->callConduitWithDiffusionRequest('diffusion.filecontentquery', array('path' => $readme_path, 'commit' => $drequest->getStableCommit()));
             if ($readme_content) {
                 $readme = id(new DiffusionReadmeView())->setUser($this->getViewer())->setPath($readme_path)->setContent($readme_content['corpus']);
             }
         }
     }
     $content[] = $this->buildBrowseTable($browse_results, $browse_paths, $browse_exception, $handles);
     $content[] = $this->buildHistoryTable($history_results, $history, $history_exception);
     try {
         $content[] = $this->buildTagListTable($drequest);
     } catch (Exception $ex) {
         if (!$repository->isImporting()) {
             $content[] = $this->renderStatusMessage(pht('Unable to Load Tags'), $ex->getMessage());
         }
     }
     try {
         $content[] = $this->buildBranchListTable($drequest);
     } catch (Exception $ex) {
         if (!$repository->isImporting()) {
             $content[] = $this->renderStatusMessage(pht('Unable to Load Branches'), $ex->getMessage());
         }
     }
     if ($readme) {
         $content[] = $readme;
     }
     return $content;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:78,代码来源:DiffusionRepositoryController.php

示例6: renderPathLinks

 protected function renderPathLinks(DiffusionRequest $drequest, $action)
 {
     $path = $drequest->getPath();
     $path_parts = array_filter(explode('/', trim($path, '/')));
     $divider = phutil_tag('span', array('class' => 'phui-header-divider'), '/');
     $links = array();
     if ($path_parts) {
         $links[] = phutil_tag('a', array('href' => $drequest->generateURI(array('action' => $action, 'path' => ''))), 'r' . $drequest->getRepository()->getCallsign());
         $links[] = $divider;
         $accum = '';
         $last_key = last_key($path_parts);
         foreach ($path_parts as $key => $part) {
             $accum .= '/' . $part;
             if ($key === $last_key) {
                 $links[] = $part;
             } else {
                 $links[] = phutil_tag('a', array('href' => $drequest->generateURI(array('action' => $action, 'path' => $accum . '/'))), $part);
                 $links[] = $divider;
             }
         }
     } else {
         $links[] = 'r' . $drequest->getRepository()->getCallsign();
         $links[] = $divider;
     }
     return $links;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:26,代码来源:DiffusionController.php

示例7: enrichCurtain

 private function enrichCurtain(PHUICurtainView $curtain, DiffusionRequest $drequest, $show_blame, $show_color)
 {
     $viewer = $this->getViewer();
     $base_uri = $this->getRequest()->getRequestURI();
     $curtain->addAction(id(new PhabricatorActionView())->setName(pht('Show Last Change'))->setHref($drequest->generateURI(array('action' => 'change')))->setIcon('fa-backward'));
     if ($show_blame) {
         $blame_text = pht('Disable Blame');
         $blame_icon = 'fa-exclamation-circle lightgreytext';
         $blame_value = 0;
     } else {
         $blame_text = pht('Enable Blame');
         $blame_icon = 'fa-exclamation-circle';
         $blame_value = 1;
     }
     $curtain->addAction(id(new PhabricatorActionView())->setName($blame_text)->setHref($base_uri->alter('blame', $blame_value))->setIcon($blame_icon)->setUser($viewer)->setRenderAsForm($viewer->isLoggedIn()));
     if ($show_color) {
         $highlight_text = pht('Disable Highlighting');
         $highlight_icon = 'fa-star-o grey';
         $highlight_value = 0;
     } else {
         $highlight_text = pht('Enable Highlighting');
         $highlight_icon = 'fa-star';
         $highlight_value = 1;
     }
     $curtain->addAction(id(new PhabricatorActionView())->setName($highlight_text)->setHref($base_uri->alter('color', $highlight_value))->setIcon($highlight_icon)->setUser($viewer)->setRenderAsForm($viewer->isLoggedIn()));
     $href = null;
     if ($this->getRequest()->getStr('lint') !== null) {
         $lint_text = pht('Hide %d Lint Message(s)', count($this->lintMessages));
         $href = $base_uri->alter('lint', null);
     } else {
         if ($this->lintCommit === null) {
             $lint_text = pht('Lint not Available');
         } else {
             $lint_text = pht('Show %d Lint Message(s)', count($this->lintMessages));
             $href = $this->getDiffusionRequest()->generateURI(array('action' => 'browse', 'commit' => $this->lintCommit))->alter('lint', '');
         }
     }
     $curtain->addAction(id(new PhabricatorActionView())->setName($lint_text)->setHref($href)->setIcon('fa-exclamation-triangle')->setDisabled(!$href));
     $repository = $drequest->getRepository();
     $owners = 'PhabricatorOwnersApplication';
     if (PhabricatorApplication::isClassInstalled($owners)) {
         $package_query = id(new PhabricatorOwnersPackageQuery())->setViewer($viewer)->withStatuses(array(PhabricatorOwnersPackage::STATUS_ACTIVE))->withControl($repository->getPHID(), array($drequest->getPath()));
         $package_query->execute();
         $packages = $package_query->getControllingPackagesForPath($repository->getPHID(), $drequest->getPath());
         if ($packages) {
             $ownership = id(new PHUIStatusListView())->setUser($viewer);
             foreach ($packages as $package) {
                 $icon = 'fa-list-alt';
                 $color = 'grey';
                 $item = id(new PHUIStatusItemView())->setIcon($icon, $color)->setTarget($viewer->renderHandle($package->getPHID()));
                 $ownership->addItem($item);
             }
         } else {
             $ownership = phutil_tag('em', array(), pht('None'));
         }
         $curtain->newPanel()->setHeaderText(pht('Owners'))->appendChild($ownership);
     }
     return $curtain;
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:59,代码来源:DiffusionBrowseController.php

示例8: buildNormalContent

 private function buildNormalContent(DiffusionRequest $drequest)
 {
     $repository = $drequest->getRepository();
     $phids = array();
     $content = array();
     try {
         $history_results = $this->callConduitWithDiffusionRequest('diffusion.historyquery', array('commit' => $drequest->getCommit(), 'path' => $drequest->getPath(), 'offset' => 0, 'limit' => 15));
         $history = DiffusionPathChange::newFromConduit($history_results['pathChanges']);
         foreach ($history as $item) {
             $data = $item->getCommitData();
             if ($data) {
                 if ($data->getCommitDetail('authorPHID')) {
                     $phids[$data->getCommitDetail('authorPHID')] = true;
                 }
                 if ($data->getCommitDetail('committerPHID')) {
                     $phids[$data->getCommitDetail('committerPHID')] = true;
                 }
             }
         }
         $history_exception = null;
     } catch (Exception $ex) {
         $history_results = null;
         $history = null;
         $history_exception = $ex;
     }
     try {
         $browse_results = DiffusionBrowseResultSet::newFromConduit($this->callConduitWithDiffusionRequest('diffusion.browsequery', array('path' => $drequest->getPath(), 'commit' => $drequest->getCommit())));
         $browse_paths = $browse_results->getPaths();
         foreach ($browse_paths as $item) {
             $data = $item->getLastCommitData();
             if ($data) {
                 if ($data->getCommitDetail('authorPHID')) {
                     $phids[$data->getCommitDetail('authorPHID')] = true;
                 }
                 if ($data->getCommitDetail('committerPHID')) {
                     $phids[$data->getCommitDetail('committerPHID')] = true;
                 }
             }
         }
         $browse_exception = null;
     } catch (Exception $ex) {
         $browse_results = null;
         $browse_paths = null;
         $browse_exception = $ex;
     }
     $phids = array_keys($phids);
     $handles = $this->loadViewerHandles($phids);
     if ($browse_results) {
         $readme = $this->callConduitWithDiffusionRequest('diffusion.readmequery', array('paths' => $browse_results->getPathDicts(), 'commit' => $drequest->getStableCommit()));
     } else {
         $readme = null;
     }
     $content[] = $this->buildBrowseTable($browse_results, $browse_paths, $browse_exception, $handles);
     $content[] = $this->buildHistoryTable($history_results, $history, $history_exception, $handles);
     try {
         $content[] = $this->buildTagListTable($drequest);
     } catch (Exception $ex) {
         if (!$repository->isImporting()) {
             $content[] = $this->renderStatusMessage(pht('Unable to Load Tags'), $ex->getMessage());
         }
     }
     try {
         $content[] = $this->buildBranchListTable($drequest);
     } catch (Exception $ex) {
         if (!$repository->isImporting()) {
             $content[] = $this->renderStatusMessage(pht('Unable to Load Branches'), $ex->getMessage());
         }
     }
     if ($readme) {
         $box = new PHUIBoxView();
         $box->appendChild($readme);
         $box->addPadding(PHUI::PADDING_LARGE);
         $panel = new PHUIObjectBoxView();
         $panel->setHeaderText(pht('README'));
         $panel->appendChild($box);
         $content[] = $panel;
     }
     return $content;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:79,代码来源:DiffusionRepositoryController.php

示例9: buildRawDiffResponse

 private function buildRawDiffResponse(DiffusionRequest $drequest)
 {
     $diff_info = $this->callConduitWithDiffusionRequest('diffusion.rawdiffquery', array('commit' => $drequest->getCommit(), 'path' => $drequest->getPath()));
     $file_phid = $diff_info['filePHID'];
     $file = id(new PhabricatorFileQuery())->setViewer($this->getViewer())->withPHIDs(array($file_phid))->executeOne();
     if (!$file) {
         throw new Exception(pht('Failed to load file ("%s") returned by "%s".', $file_phid, 'diffusion.rawdiffquery'));
     }
     return $file->getRedirectResponse();
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:10,代码来源:DiffusionCommitController.php


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