1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 09:12:41 +01:00

Merge branch 'master' into redesign-2015

This commit is contained in:
epriestley 2015-06-25 10:06:50 -07:00
commit 14a395ed8e
23 changed files with 195 additions and 100 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_repository.repository
ADD spacePHID VARBINARY(64);

View file

@ -6189,6 +6189,7 @@ phutil_register_library_map(array(
'PhabricatorMarkupInterface', 'PhabricatorMarkupInterface',
'PhabricatorDestructibleInterface', 'PhabricatorDestructibleInterface',
'PhabricatorProjectInterface', 'PhabricatorProjectInterface',
'PhabricatorSpacesInterface',
), ),
'PhabricatorRepositoryArcanistProject' => array( 'PhabricatorRepositoryArcanistProject' => array(
'PhabricatorRepositoryDAO', 'PhabricatorRepositoryDAO',

View file

@ -585,6 +585,8 @@ final class DifferentialTransactionEditor
'a race?')); 'a race?'));
} }
// TODO: This can race with diff updates, particularly those from
// Harbormaster. See discussion in T8650.
$diff->setRevisionID($object->getID()); $diff->setRevisionID($object->getID());
$diff->save(); $diff->save();
@ -593,6 +595,8 @@ final class DifferentialTransactionEditor
// the old (`null`) container. // the old (`null`) container.
// TODO: This is a bit iffy, maybe we can find a cleaner approach? // TODO: This is a bit iffy, maybe we can find a cleaner approach?
// In particular, this could (rarely) be overwritten by Harbormaster
// workers.
$table = new HarbormasterBuildable(); $table = new HarbormasterBuildable();
$conn_w = $table->establishConnection('w'); $conn_w = $table->establishConnection('w');
queryfx( queryfx(

View file

@ -137,6 +137,7 @@ final class DiffusionRepositoryCreateController
$type_credential = PhabricatorRepositoryTransaction::TYPE_CREDENTIAL; $type_credential = PhabricatorRepositoryTransaction::TYPE_CREDENTIAL;
$type_view = PhabricatorTransactions::TYPE_VIEW_POLICY; $type_view = PhabricatorTransactions::TYPE_VIEW_POLICY;
$type_edit = PhabricatorTransactions::TYPE_EDIT_POLICY; $type_edit = PhabricatorTransactions::TYPE_EDIT_POLICY;
$type_space = PhabricatorTransactions::TYPE_SPACE;
$type_push = PhabricatorRepositoryTransaction::TYPE_PUSH_POLICY; $type_push = PhabricatorRepositoryTransaction::TYPE_PUSH_POLICY;
$type_service = PhabricatorRepositoryTransaction::TYPE_SERVICE; $type_service = PhabricatorRepositoryTransaction::TYPE_SERVICE;
@ -225,22 +226,26 @@ final class DiffusionRepositoryCreateController
} }
if ($is_policy) { if ($is_policy) {
$policy_page = $form->getPage('policy');
$xactions[] = id(clone $template) $xactions[] = id(clone $template)
->setTransactionType($type_view) ->setTransactionType($type_view)
->setNewValue( ->setNewValue($policy_page->getControl('viewPolicy')->getValue());
$form->getPage('policy')->getControl('viewPolicy')->getValue());
$xactions[] = id(clone $template) $xactions[] = id(clone $template)
->setTransactionType($type_edit) ->setTransactionType($type_edit)
->setNewValue( ->setNewValue($policy_page->getControl('editPolicy')->getValue());
$form->getPage('policy')->getControl('editPolicy')->getValue());
if ($is_init || $repository->isHosted()) { if ($is_init || $repository->isHosted()) {
$xactions[] = id(clone $template) $xactions[] = id(clone $template)
->setTransactionType($type_push) ->setTransactionType($type_push)
->setNewValue( ->setNewValue($policy_page->getControl('pushPolicy')->getValue());
$form->getPage('policy')->getControl('pushPolicy')->getValue());
} }
$xactions[] = id(clone $template)
->setTransactionType($type_space)
->setNewValue(
$policy_page->getControl('viewPolicy')->getSpacePHID());
} }
id(new PhabricatorRepositoryEditor()) id(new PhabricatorRepositoryEditor())
@ -261,6 +266,7 @@ final class DiffusionRepositoryCreateController
'viewPolicy' => $repository->getViewPolicy(), 'viewPolicy' => $repository->getViewPolicy(),
'editPolicy' => $repository->getEditPolicy(), 'editPolicy' => $repository->getEditPolicy(),
'pushPolicy' => $repository->getPushPolicy(), 'pushPolicy' => $repository->getPushPolicy(),
'spacePHID' => $repository->getSpacePHID(),
); );
} }
$form->readFromObject($dict); $form->readFromObject($dict);
@ -596,7 +602,7 @@ final class DiffusionRepositoryCreateController
$page->addRemarkupInstructions( $page->addRemarkupInstructions(
pht( pht(
'Choose or add the SSH credentials to use to connect to the the '. 'Choose or add the SSH credentials to use to connect to the '.
'repository hosted at:'. 'repository hosted at:'.
"\n\n". "\n\n".
" lang=text\n". " lang=text\n".

View file

@ -386,9 +386,17 @@ final class DiffusionRepositoryEditMainController
$viewer, $viewer,
$repository); $repository);
$view_parts = array();
if (PhabricatorSpacesNamespaceQuery::getViewerSpacesExist($viewer)) {
$space_phid = PhabricatorSpacesNamespaceQuery::getObjectSpacePHID(
$repository);
$view_parts[] = $viewer->renderHandle($space_phid);
}
$view_parts[] = $descriptions[PhabricatorPolicyCapability::CAN_VIEW];
$view->addProperty( $view->addProperty(
pht('Visible To'), pht('Visible To'),
$descriptions[PhabricatorPolicyCapability::CAN_VIEW]); phutil_implode_html(" \xC2\xB7 ", $view_parts));
$view->addProperty( $view->addProperty(
pht('Editable By'), pht('Editable By'),

View file

@ -219,7 +219,7 @@ final class DivinerAtomQuery extends PhabricatorCursorPagedPolicyAwareQuery {
} }
// If we found matches in the same documentation book, prefer them // If we found matches in the same documentation book, prefer them
// over other matches. Otherwise, look at all the the matches. // over other matches. Otherwise, look at all the matches.
$matches = $xatoms[$xref->getName()][$xref->getType()]; $matches = $xatoms[$xref->getName()][$xref->getType()];
if (isset($matches[$atom->getBookPHID()])) { if (isset($matches[$atom->getBookPHID()])) {
$maybe = $matches[$atom->getBookPHID()]; $maybe = $matches[$atom->getBookPHID()];

View file

@ -6,6 +6,8 @@ final class FeedPublisherWorker extends FeedPushWorker {
$story = $this->loadFeedStory(); $story = $this->loadFeedStory();
$uris = PhabricatorEnv::getEnvConfig('feed.http-hooks'); $uris = PhabricatorEnv::getEnvConfig('feed.http-hooks');
if ($uris) {
foreach ($uris as $uri) { foreach ($uris as $uri) {
$this->queueTask( $this->queueTask(
'FeedPublisherHTTPWorker', 'FeedPublisherHTTPWorker',
@ -14,6 +16,7 @@ final class FeedPublisherWorker extends FeedPushWorker {
'uri' => $uri, 'uri' => $uri,
)); ));
} }
}
$argv = array( $argv = array(
array(), array(),

View file

@ -542,7 +542,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
// just bail out. // just bail out.
throw $status; throw $status;
} else { } else {
// This is HTTP 2XX, so use the the response body to save the // This is HTTP 2XX, so use the response body to save the
// file data. // file data.
$params = $params + array( $params = $params + array(
'name' => basename($uri), 'name' => basename($uri),

View file

@ -161,7 +161,7 @@ final class PhabricatorFileTestCase extends PhabricatorTestCase {
$second_file = PhabricatorFile::newFromFileData($other_data, $params); $second_file = PhabricatorFile::newFromFileData($other_data, $params);
// Test that the the second file uses different storage handle from // Test that the second file uses different storage handle from
// the first file. // the first file.
$first_handle = $first_file->getStorageHandle(); $first_handle = $first_file->getStorageHandle();
$second_handle = $second_file->getStorageHandle(); $second_handle = $second_file->getStorageHandle();

View file

@ -406,15 +406,34 @@ final class HarbormasterBuildEngine extends Phobject {
$should_publish = $did_update && $should_publish = $did_update &&
$new_status != HarbormasterBuildable::STATUS_BUILDING && $new_status != HarbormasterBuildable::STATUS_BUILDING &&
!$buildable->getIsManualBuildable(); !$buildable->getIsManualBuildable();
if ($should_publish) {
if (!$should_publish) {
return;
}
$object = id(new PhabricatorObjectQuery()) $object = id(new PhabricatorObjectQuery())
->setViewer($viewer) ->setViewer($viewer)
->withPHIDs(array($buildable->getBuildablePHID())) ->withPHIDs(array($buildable->getBuildablePHID()))
->executeOne(); ->executeOne();
if (!$object) {
return;
}
if (!($object instanceof PhabricatorApplicationTransactionInterface)) {
return;
}
// TODO: Publishing these transactions is causing a race. See T8650.
// We shouldn't be publishing to diffs anyway.
if ($object instanceof DifferentialDiff) {
return;
}
if ($object instanceof PhabricatorApplicationTransactionInterface) {
$template = $object->getApplicationTransactionTemplate(); $template = $object->getApplicationTransactionTemplate();
if ($template) { if (!$template) {
return;
}
$template $template
->setTransactionType(PhabricatorTransactions::TYPE_BUILDABLE) ->setTransactionType(PhabricatorTransactions::TYPE_BUILDABLE)
->setMetadataValue( ->setMetadataValue(
@ -441,9 +460,6 @@ final class HarbormasterBuildEngine extends Phobject {
$object->getApplicationTransactionObject(), $object->getApplicationTransactionObject(),
array($template)); array($template));
} }
}
}
}
private function releaseAllArtifacts(HarbormasterBuild $build) { private function releaseAllArtifacts(HarbormasterBuild $build) {
$targets = id(new HarbormasterBuildTargetQuery()) $targets = id(new HarbormasterBuildTargetQuery())

View file

@ -32,7 +32,7 @@ final class HarbormasterBuildUnitMessage
'result' => 'string', 'result' => 'string',
'duration' => 'optional float', 'duration' => 'optional float',
'path' => 'optional string', 'path' => 'optional string',
'coverage' => 'optional string', 'coverage' => 'optional map<string, wild>',
); );
// We're just going to ignore extra keys for now, to make it easier to // We're just going to ignore extra keys for now, to make it easier to

View file

@ -49,6 +49,26 @@ final class PhabricatorMetaMTAMailViewController
->setUser($viewer) ->setUser($viewer)
->setObject($mail); ->setObject($mail);
$properties->addProperty(
pht('ID'),
$mail->getID());
$properties->addProperty(
pht('Status'),
$mail->getStatus());
if ($mail->getMessage()) {
$properties->addProperty(
pht('Status Details'),
$mail->getMessage());
}
if ($mail->getRelatedPHID()) {
$properties->addProperty(
pht('Related Object'),
$viewer->renderHandle($mail->getRelatedPHID()));
}
if ($mail->getActorPHID()) { if ($mail->getActorPHID()) {
$actor_str = $viewer->renderHandle($mail->getActorPHID()); $actor_str = $viewer->renderHandle($mail->getActorPHID());
} else { } else {

View file

@ -6,16 +6,15 @@ final class MetaMTAMailSentGarbageCollector
public function collectGarbage() { public function collectGarbage() {
$ttl = phutil_units('90 days in seconds'); $ttl = phutil_units('90 days in seconds');
$table = new PhabricatorMetaMTAMail(); $mails = id(new PhabricatorMetaMTAMail())->loadAllWhere(
$conn_w = $table->establishConnection('w'); 'dateCreated < %d LIMIT 100',
PhabricatorTime::getNow());
queryfx( foreach ($mails as $mail) {
$conn_w, $mail->delete();
'DELETE FROM %T WHERE dateCreated < %d LIMIT 100', }
$table->getTableName(),
time() - $ttl);
return ($conn_w->getAffectedRows() == 100); return (count($mails) == 100);
} }
} }

View file

@ -101,18 +101,16 @@ final class PhabricatorMetaMTAMailSearchEngine
foreach ($mails as $mail) { foreach ($mails as $mail) {
if ($mail->hasSensitiveContent()) { if ($mail->hasSensitiveContent()) {
$header = pht( $header = pht('< content redacted >');
'Mail %d: < content redacted >',
$mail->getID());
} else { } else {
$header = pht( $header = $mail->getSubject();
'Mail %d: %s',
$mail->getID(),
$mail->getSubject());
} }
$item = id(new PHUIObjectItemView()) $item = id(new PHUIObjectItemView())
->setUser($viewer)
->setObject($mail) ->setObject($mail)
->setEpoch($mail->getDateCreated())
->setObjectName('Mail '.$mail->getID())
->setHeader($header) ->setHeader($header)
->setHref($this->getURI('detail/'.$mail->getID())); ->setHref($this->getURI('detail/'.$mail->getID()));
$list->addItem($item); $list->addItem($item);

View file

@ -1038,6 +1038,20 @@ final class PhabricatorMetaMTAMail
} }
} }
public function delete() {
$this->openTransaction();
queryfx(
$this->establishConnection('w'),
'DELETE FROM %T WHERE src = %s AND type = %d',
PhabricatorEdgeConfig::TABLE_NAME_EDGE,
$this->getPHID(),
PhabricatorMetaMTAMailHasRecipientEdgeType::EDGECONST);
$ret = parent::delete();
$this->saveTransaction();
return $ret;
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */ /* -( PhabricatorPolicyInterface )----------------------------------------- */

View file

@ -153,6 +153,7 @@ final class PhabricatorRepositorySearchEngine
$item = id(new PHUIObjectItemView()) $item = id(new PHUIObjectItemView())
->setUser($viewer) ->setUser($viewer)
->setObject($repository)
->setHeader($repository->getName()) ->setHeader($repository->getName())
->setObjectName('r'.$repository->getCallsign()) ->setObjectName('r'.$repository->getCallsign())
->setHref($this->getApplicationURI($repository->getCallsign().'/')); ->setHref($this->getApplicationURI($repository->getCallsign().'/'));

View file

@ -11,7 +11,8 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
PhabricatorFlaggableInterface, PhabricatorFlaggableInterface,
PhabricatorMarkupInterface, PhabricatorMarkupInterface,
PhabricatorDestructibleInterface, PhabricatorDestructibleInterface,
PhabricatorProjectInterface { PhabricatorProjectInterface,
PhabricatorSpacesInterface {
/** /**
* Shortest hash we'll recognize in raw "a829f32" form. * Shortest hash we'll recognize in raw "a829f32" form.
@ -54,6 +55,7 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
protected $details = array(); protected $details = array();
protected $credentialPHID; protected $credentialPHID;
protected $almanacServicePHID; protected $almanacServicePHID;
protected $spacePHID;
private $commitCount = self::ATTACHABLE; private $commitCount = self::ATTACHABLE;
private $mostRecentCommit = self::ATTACHABLE; private $mostRecentCommit = self::ATTACHABLE;
@ -72,7 +74,8 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
$repository = id(new PhabricatorRepository()) $repository = id(new PhabricatorRepository())
->setViewPolicy($view_policy) ->setViewPolicy($view_policy)
->setEditPolicy($edit_policy) ->setEditPolicy($edit_policy)
->setPushPolicy($push_policy); ->setPushPolicy($push_policy)
->setSpacePHID($actor->getDefaultSpacePHID());
// Put the repository in "Importing" mode until we finish // Put the repository in "Importing" mode until we finish
// parsing it. // parsing it.
@ -1909,6 +1912,7 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
/* -( PhabricatorDestructibleInterface )----------------------------------- */ /* -( PhabricatorDestructibleInterface )----------------------------------- */
public function destroyObjectPermanently( public function destroyObjectPermanently(
PhabricatorDestructionEngine $engine) { PhabricatorDestructionEngine $engine) {
@ -1935,4 +1939,12 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
$this->saveTransaction(); $this->saveTransaction();
} }
/* -( PhabricatorSpacesInterface )----------------------------------------- */
public function getSpacePHID() {
return $this->spacePHID;
}
} }

View file

@ -3,33 +3,27 @@
final class PhabricatorSubscriptionsListController final class PhabricatorSubscriptionsListController
extends PhabricatorController { extends PhabricatorController {
private $phid;
public function willProcessRequest(array $data) {
$this->phid = idx($data, 'phid');
}
public function shouldAllowPublic() { public function shouldAllowPublic() {
return true; return true;
} }
public function processRequest() { public function handleRequest(AphrontRequest $request) {
$request = $this->getRequest();
$viewer = $request->getUser(); $viewer = $request->getUser();
$phid = $this->phid;
$object = id(new PhabricatorObjectQuery()) $object = id(new PhabricatorObjectQuery())
->setViewer($viewer) ->setViewer($viewer)
->withPHIDs(array($phid)) ->withPHIDs(array($request->getURIData('phid')))
->executeOne(); ->executeOne();
if (!$object) {
if ($object instanceof PhabricatorSubscribableInterface) { return new Aphront404Response();
$subscriber_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID(
$phid);
} }
$handle_phids = $subscriber_phids; if (!($object instanceof PhabricatorSubscribableInterface)) {
return new Aphront404Response();
}
$phid = $object->getPHID();
$handle_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID($phid);
$handle_phids[] = $phid; $handle_phids[] = $phid;
$handles = id(new PhabricatorHandleQuery()) $handles = id(new PhabricatorHandleQuery())

View file

@ -12,7 +12,7 @@ the problem.
Connection negotiation can fail for several reasons. The major ones are: Connection negotiation can fail for several reasons. The major ones are:
- You have not added the the Certificate Authority as a trusted authority - You have not added the Certificate Authority as a trusted authority
(this is the most common problem, and usually the issue for self-signed (this is the most common problem, and usually the issue for self-signed
certificates). certificates).
- The SSL certificate is signed for the wrong domain. For example, a - The SSL certificate is signed for the wrong domain. For example, a

View file

@ -234,7 +234,7 @@ you can use `help` to learn more about what it does and which flag it takes:
phabricator/ $ bin/repository help <command> phabricator/ $ bin/repository help <command>
``` ```
In particular, you can use flags with the the `repository reparse` command to In particular, you can use flags with the `repository reparse` command to
manually run parse steps in the foreground, including re-running steps and manually run parse steps in the foreground, including re-running steps and
running steps out of order. running steps out of order.

View file

@ -99,7 +99,7 @@ which calls `diffusion.looksoon`. This should make an external repository about
as responsive as a hosted repository. as responsive as a hosted repository.
If a repository has an update scheduled, the Diffusion > (Choose a If a repository has an update scheduled, the Diffusion > (Choose a
Repository) > Edit Repository interface will show that the the repository is Repository) > Edit Repository interface will show that the repository is
prioritized and will be updated soon. prioritized and will be updated soon.

View file

@ -39,6 +39,22 @@ final class AphrontFormPolicyControl extends AphrontFormControl {
return $this; return $this;
} }
public function readValueFromDictionary(array $dictionary) {
// TODO: This is a little hacky but will only get us into trouble if we
// have multiple view policy controls in multiple paged form views on the
// same page, which seems unlikely.
$this->setSpacePHID(idx($dictionary, 'spacePHID'));
return parent::readValueFromDictionary($dictionary);
}
public function readValueFromRequest(AphrontRequest $request) {
// See note in readValueFromDictionary().
$this->setSpacePHID($request->getStr('spacePHID'));
return parent::readValueFromRequest($request);
}
public function setCapability($capability) { public function setCapability($capability) {
$this->capability = $capability; $this->capability = $capability;

View file

@ -104,6 +104,7 @@ final class PHUICalendarMonthView extends AphrontView {
if ($counter <= $max_daily) { if ($counter <= $max_daily) {
$list->addEvent($item); $list->addEvent($item);
} }
$counter++;
} }
$uri = $this->getBrowseURI(); $uri = $this->getBrowseURI();