本文整理汇总了PHP中PhabricatorEnv::getProductionURI方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorEnv::getProductionURI方法的具体用法?PHP PhabricatorEnv::getProductionURI怎么用?PHP PhabricatorEnv::getProductionURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorEnv
的用法示例。
在下文中一共展示了PhabricatorEnv::getProductionURI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute(ConduitAPIRequest $conduit_request)
{
$revision_phids = $conduit_request->getValue('revisionPHIDs');
$requested_commit_phids = $conduit_request->getValue('requestedCommitPHIDs');
$result = array();
if (!$revision_phids && !$requested_commit_phids) {
return $result;
}
$query = new ReleephRequestQuery();
$query->setViewer($conduit_request->getUser());
if ($revision_phids) {
$query->withRequestedObjectPHIDs($revision_phids);
} else {
if ($requested_commit_phids) {
$query->withRequestedCommitPHIDs($requested_commit_phids);
}
}
$releeph_requests = $query->execute();
foreach ($releeph_requests as $releeph_request) {
$branch = $releeph_request->getBranch();
$request_commit_phid = $releeph_request->getRequestCommitPHID();
$object = $releeph_request->getRequestedObject();
if ($object instanceof DifferentialRevision) {
$object_phid = $object->getPHID();
} else {
$object_phid = null;
}
$status = $releeph_request->getStatus();
$status_name = ReleephRequestStatus::getStatusDescriptionFor($status);
$url = PhabricatorEnv::getProductionURI('/RQ' . $releeph_request->getID());
$result[] = array('branchBasename' => $branch->getBasename(), 'branchSymbolic' => $branch->getSymbolicName(), 'requestID' => $releeph_request->getID(), 'revisionPHID' => $object_phid, 'status' => $status, 'status_name' => $status_name, 'url' => $url);
}
return $result;
}
示例2: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $this->getViewer();
$append = $request->getURIData('append');
$main_domain_uri = PhabricatorEnv::getProductionURI('/u/' . $append);
return id(new AphrontRedirectResponse())->setIsExternal(true)->setURI($main_domain_uri);
}
示例3: buildPropertyView
private function buildPropertyView(PhameBlog $blog)
{
$viewer = $this->getViewer();
require_celerity_resource('aphront-tooltip-css');
Javelin::initBehavior('phabricator-tooltips');
$properties = id(new PHUIPropertyListView())->setUser($viewer)->setObject($blog);
$domain = $blog->getDomain();
if (!$domain) {
$domain = phutil_tag('em', array(), pht('No external domain'));
}
$properties->addProperty(pht('Domain'), $domain);
$feed_uri = PhabricatorEnv::getProductionURI($this->getApplicationURI('blog/feed/' . $blog->getID() . '/'));
$properties->addProperty(pht('Atom URI'), javelin_tag('a', array('href' => $feed_uri, 'sigil' => 'has-tooltip', 'meta' => array('tip' => pht('Atom URI does not support custom domains.'), 'size' => 320)), $feed_uri));
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $blog);
$properties->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
$engine = id(new PhabricatorMarkupEngine())->setViewer($viewer)->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION)->process();
$properties->invokeWillRenderEvent();
$description = $blog->getDescription();
if (strlen($description)) {
$description = new PHUIRemarkupView($viewer, $description);
$properties->addSectionHeader(pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
$properties->addTextContent($description);
}
return $properties;
}
示例4: buildMailBody
protected function buildMailBody(PhabricatorLiskDAO $object, array $xactions)
{
$body = parent::buildMailBody($object, $xactions);
$detail_uri = PhabricatorEnv::getProductionURI($object->getURI());
$body->addLinkSection(pht('PACKAGE DETAIL'), $detail_uri);
return $body;
}
示例5: execute
public function execute(PhutilArgumentParser $args)
{
$viewer = $this->getViewer();
$names = $args->getArg('buildable');
if (count($names) != 1) {
throw new PhutilArgumentUsageException(pht('Specify exactly one buildable object, by object name.'));
}
$name = head($names);
$buildable = id(new PhabricatorObjectQuery())->setViewer($viewer)->withNames($names)->executeOne();
if (!$buildable) {
throw new PhutilArgumentUsageException(pht('No such buildable "%s"!', $name));
}
if (!$buildable instanceof HarbormasterBuildableInterface) {
throw new PhutilArgumentUsageException(pht('Object "%s" is not a buildable!', $name));
}
$plan_id = $args->getArg('plan');
if (!$plan_id) {
throw new PhutilArgumentUsageException(pht('Use --plan to specify a build plan to run.'));
}
$plan = id(new HarbormasterBuildPlanQuery())->setViewer($viewer)->withIDs(array($plan_id))->executeOne();
if (!$plan) {
throw new PhutilArgumentUsageException(pht('Build plan "%s" does not exist.', $plan_id));
}
$console = PhutilConsole::getConsole();
$buildable = HarbormasterBuildable::initializeNewBuildable($viewer)->setIsManualBuildable(true)->setBuildablePHID($buildable->getHarbormasterBuildablePHID())->setContainerPHID($buildable->getHarbormasterContainerPHID())->save();
$console->writeOut("%s\n", pht('Applying plan %s to new buildable %s...', $plan->getID(), 'B' . $buildable->getID()));
$console->writeOut("\n %s\n\n", PhabricatorEnv::getProductionURI('/B' . $buildable->getID()));
PhabricatorWorker::setRunAllTasksInProcess(true);
$buildable->applyPlan($plan);
$console->writeOut("%s\n", pht('Done.'));
return 0;
}
示例6: validateCustomDomain
/**
* Makes sure a given custom blog uri is properly configured in DNS
* to point at this Phabricator instance. If there is an error in
* the configuration, return a string describing the error and how
* to fix it. If there is no error, return an empty string.
*
* @return string
*/
public function validateCustomDomain($custom_domain)
{
$example_domain = 'blog.example.com';
$label = pht('Invalid');
// note this "uri" should be pretty busted given the desired input
// so just use it to test if there's a protocol specified
$uri = new PhutilURI($custom_domain);
if ($uri->getProtocol()) {
return array($label, pht('The custom domain should not include a protocol. Just provide ' . 'the bare domain name (for example, "%s").', $example_domain));
}
if ($uri->getPort()) {
return array($label, pht('The custom domain should not include a port number. Just provide ' . 'the bare domain name (for example, "%s").', $example_domain));
}
if (strpos($custom_domain, '/') !== false) {
return array($label, pht('The custom domain should not specify a path (hosting a Phame ' . 'blog at a path is currently not supported). Instead, just provide ' . 'the bare domain name (for example, "%s").', $example_domain));
}
if (strpos($custom_domain, '.') === false) {
return array($label, pht('The custom domain should contain at least one dot (.) because ' . 'some browsers fail to set cookies on domains without a dot. ' . 'Instead, use a normal looking domain name like "%s".', $example_domain));
}
if (!PhabricatorEnv::getEnvConfig('policy.allow-public')) {
$href = PhabricatorEnv::getProductionURI('/config/edit/policy.allow-public/');
return array(pht('Fix Configuration'), pht('For custom domains to work, this Phabricator instance must be ' . 'configured to allow the public access policy. Configure this ' . 'setting %s, or ask an administrator to configure this setting. ' . 'The domain can be specified later once this setting has been ' . 'changed.', phutil_tag('a', array('href' => $href), pht('here'))));
}
return null;
}
示例7: processReceivedMail
protected function processReceivedMail(PhabricatorMetaMTAReceivedMail $mail, PhabricatorUser $sender)
{
$title = $mail->getSubject();
if (!$title) {
$title = pht('Email Paste');
}
$file = PhabricatorPasteEditor::initializeFileForPaste($sender, $title, $mail->getCleanTextBody());
$xactions = array();
$xactions[] = id(new PhabricatorPasteTransaction())->setTransactionType(PhabricatorPasteTransaction::TYPE_CONTENT)->setNewValue($file->getPHID());
$xactions[] = id(new PhabricatorPasteTransaction())->setTransactionType(PhabricatorPasteTransaction::TYPE_TITLE)->setNewValue($title);
$xactions[] = id(new PhabricatorPasteTransaction())->setTransactionType(PhabricatorPasteTransaction::TYPE_LANGUAGE)->setNewValue('');
// auto-detect
$paste = PhabricatorPaste::initializeNewPaste($sender);
$content_source = PhabricatorContentSource::newForSource(PhabricatorContentSource::SOURCE_EMAIL, array('id' => $mail->getID()));
$editor = id(new PhabricatorPasteEditor())->setActor($sender)->setContentSource($content_source)->setContinueOnNoEffect(true);
$xactions = $editor->applyTransactions($paste, $xactions);
$mail->setRelatedPHID($paste->getPHID());
$subject_prefix = PhabricatorEnv::getEnvConfig('metamta.paste.subject-prefix');
$subject = pht('You successfully created a paste.');
$paste_uri = PhabricatorEnv::getProductionURI($paste->getURI());
$body = new PhabricatorMetaMTAMailBody();
$body->addRawSection($subject);
$body->addTextSection(pht('PASTE LINK'), $paste_uri);
id(new PhabricatorMetaMTAMail())->addTos(array($sender->getPHID()))->setSubject($subject)->setSubjectPrefix($subject_prefix)->setFrom($sender->getPHID())->setRelatedPHID($paste->getPHID())->setBody($body->render())->saveAndSend();
}
示例8: markupDocumentLink
public function markupDocumentLink($matches)
{
$link = trim($matches[1]);
$name = trim(idx($matches, 2, $link));
if (empty($matches[2])) {
$name = explode('/', trim($name, '/'));
$name = end($name);
}
$uri = new PhutilURI($link);
$slug = $uri->getPath();
$fragment = $uri->getFragment();
$slug = PhabricatorSlug::normalize($slug);
$slug = PhrictionDocument::getSlugURI($slug);
$href = (string) id(new PhutilURI($slug))->setFragment($fragment);
if ($this->getEngine()->getState('toc')) {
$text = $name;
} else {
if ($this->getEngine()->isTextMode()) {
return PhabricatorEnv::getProductionURI($href);
} else {
$text = $this->newTag('a', array('href' => $href, 'class' => 'phriction-link'), $name);
}
}
return $this->getEngine()->storeText($text);
}
示例9: execute
protected function execute(ConduitAPIRequest $request)
{
$name = $request->getValue('name');
$name_prefix = $request->getValue('namePrefix');
$language = $request->getValue('language');
$type = $request->getValue('type');
$query = new DiffusionSymbolQuery();
if ($name !== null) {
$query->setName($name);
}
if ($name_prefix !== null) {
$query->setNamePrefix($name_prefix);
}
if ($language !== null) {
$query->setLanguage($language);
}
if ($type !== null) {
$query->setType($type);
}
$query->needPaths(true);
$query->needArcanistProjects(true);
$query->needRepositories(true);
$results = $query->execute();
$response = array();
foreach ($results as $result) {
$response[] = array('name' => $result->getSymbolName(), 'type' => $result->getSymbolType(), 'language' => $result->getSymbolLanguage(), 'path' => $result->getPath(), 'line' => $result->getLineNumber(), 'uri' => PhabricatorEnv::getProductionURI($result->getURI()));
}
return $response;
}
示例10: execute
protected function execute(ConduitAPIRequest $request)
{
$viewer = $request->getUser();
$query = id(new ReleephProductQuery())->setViewer($viewer);
$ids = $request->getValue('ids');
if ($ids !== null) {
$query->withIDs($ids);
}
$phids = $request->getValue('phids');
if ($phids !== null) {
$query->withPHIDs($phids);
}
$repository_phids = $request->getValue('repositoryPHIDs');
if ($repository_phids !== null) {
$query->withRepositoryPHIDs($repository_phids);
}
$is_active = $request->getValue('isActive');
if ($is_active !== null) {
$query->withActive($is_active);
}
$pager = $this->newPager($request);
$products = $query->executeWithCursorPager($pager);
$data = array();
foreach ($products as $product) {
$id = $product->getID();
$uri = '/releeph/product/' . $id . '/';
$uri = PhabricatorEnv::getProductionURI($uri);
$data[] = array('id' => $id, 'phid' => $product->getPHID(), 'uri' => $uri, 'name' => $product->getName(), 'isActive' => (bool) $product->getIsActive(), 'repositoryPHID' => $product->getRepositoryPHID());
}
return $this->addPagerResults(array('data' => $data), $pager);
}
示例11: execute
protected function execute(ConduitAPIRequest $request)
{
$viewer = $request->getUser();
$query = id(new ReleephBranchQuery())->setViewer($viewer);
$ids = $request->getValue('ids');
if ($ids !== null) {
$query->withIDs($ids);
}
$phids = $request->getValue('phids');
if ($phids !== null) {
$query->withPHIDs($phids);
}
$product_phids = $request->getValue('productPHIDs');
if ($product_phids !== null) {
$query->withProductPHIDs($product_phids);
}
$pager = $this->newPager($request);
$branches = $query->executeWithCursorPager($pager);
$data = array();
foreach ($branches as $branch) {
$id = $branch->getID();
$uri = '/releeph/branch/' . $id . '/';
$uri = PhabricatorEnv::getProductionURI($uri);
$data[] = array('id' => $id, 'phid' => $branch->getPHID(), 'uri' => $uri, 'name' => $branch->getName(), 'productPHID' => $branch->getProduct()->getPHID());
}
return $this->addPagerResults(array('data' => $data), $pager);
}
示例12: execute
protected function execute(ConduitAPIRequest $request)
{
$query = new PhabricatorFlagQuery();
$owner_phids = $request->getValue('ownerPHIDs', array());
if ($owner_phids) {
$query->withOwnerPHIDs($owner_phids);
}
$object_phids = $request->getValue('objectPHIDs', array());
if ($object_phids) {
$query->withObjectPHIDs($object_phids);
}
$types = $request->getValue('types', array());
if ($types) {
$query->withTypes($types);
}
$query->needHandles(true);
$query->setOffset($request->getValue('offset', 0));
$query->setLimit($request->getValue('limit', 100));
$flags = $query->execute();
$results = array();
foreach ($flags as $flag) {
$color = $flag->getColor();
$uri = PhabricatorEnv::getProductionURI($flag->getHandle()->getURI());
$results[] = array('id' => $flag->getID(), 'ownerPHID' => $flag->getOwnerPHID(), 'type' => $flag->getType(), 'objectPHID' => $flag->getObjectPHID(), 'reasonPHID' => $flag->getReasonPHID(), 'color' => $color, 'colorName' => PhabricatorFlagColor::getColorName($color), 'note' => $flag->getNote(), 'handle' => array('uri' => $uri, 'name' => $flag->getHandle()->getName()), 'dateCreated' => $flag->getDateCreated(), 'dateModified' => $flag->getDateModified());
}
return $results;
}
示例13: doWork
protected function doWork()
{
$data = $this->getTaskData();
$viewer = PhabricatorUser::getOmnipotentUser();
$address = idx($data, 'address');
$author_phid = idx($data, 'authorPHID');
$author = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withPHIDs(array($author_phid))->executeOne();
if (!$author) {
throw new PhabricatorWorkerPermanentFailureException(pht('Invite has invalid author PHID ("%s").', $author_phid));
}
$invite = id(new PhabricatorAuthInviteQuery())->setViewer($viewer)->withEmailAddresses(array($address))->executeOne();
if ($invite) {
// If we're inviting a user who has already been invited, we just
// regenerate their invite code.
$invite->regenerateVerificationCode();
} else {
// Otherwise, we're creating a new invite.
$invite = id(new PhabricatorAuthInvite())->setEmailAddress($address);
}
// Whether this is a new invite or not, tag this most recent author as
// the invite author.
$invite->setAuthorPHID($author_phid);
$code = $invite->getVerificationCode();
$invite_uri = '/auth/invite/' . $code . '/';
$invite_uri = PhabricatorEnv::getProductionURI($invite_uri);
$template = idx($data, 'template');
$template = str_replace('{$INVITE_URI}', $invite_uri, $template);
$invite->save();
$mail = id(new PhabricatorMetaMTAMail())->addRawTos(array($invite->getEmailAddress()))->setForceDelivery(true)->setSubject(pht('[Phabricator] %s has invited you to join Phabricator', $author->getFullName()))->setBody($template)->saveAndSend();
}
示例14: buildDocumentContentDictionary
protected final function buildDocumentContentDictionary(PhrictionDocument $doc, PhrictionContent $content)
{
$uri = PhrictionDocument::getSlugURI($content->getSlug());
$uri = PhabricatorEnv::getProductionURI($uri);
$doc_status = $doc->getStatus();
return array('phid' => $doc->getPHID(), 'uri' => $uri, 'slug' => $content->getSlug(), 'version' => $content->getVersion(), 'authorPHID' => $content->getAuthorPHID(), 'title' => $content->getTitle(), 'content' => $content->getContent(), 'status' => PhrictionDocumentStatus::getConduitConstant($doc_status), 'description' => $content->getDescription(), 'dateCreated' => $content->getDateCreated());
}
示例15: render
public function render()
{
$handle = $this->handle;
$type_name = nonempty($handle->getTypeName(), 'Document');
require_celerity_resource('phabricator-search-results-css');
$link = phutil_render_tag('a', array('href' => $handle->getURI()), PhabricatorEnv::getProductionURI($handle->getURI()));
$img = $handle->getImageURI();
if ($img) {
$img = phutil_render_tag('div', array('class' => 'result-image', 'style' => "background-image: url('{$img}');"), '');
}
switch ($handle->getType()) {
case PhabricatorPHIDConstants::PHID_TYPE_CMIT:
$object_name = $handle->getName();
if ($this->object) {
$data = $this->object->getCommitData();
$summary = $data->getSummary();
if (strlen($summary)) {
$object_name = $handle->getName() . ': ' . $data->getSummary();
}
}
break;
default:
$object_name = $handle->getFullName();
break;
}
return '<div class="phabricator-search-result">' . $img . '<div class="result-desc">' . phutil_render_tag('a', array('class' => 'result-name', 'href' => $handle->getURI()), $this->emboldenQuery($object_name)) . '<div class="result-type">' . $type_name . ' · ' . $link . '</div>' . '</div>' . '<div style="clear: both;"></div>' . '</div>';
}