mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Merge branch 'master' into redesign-2015
This commit is contained in:
commit
14a395ed8e
23 changed files with 195 additions and 100 deletions
2
resources/sql/autopatches/20150624.spaces.1.repo.sql
Normal file
2
resources/sql/autopatches/20150624.spaces.1.repo.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE {$NAMESPACE}_repository.repository
|
||||
ADD spacePHID VARBINARY(64);
|
|
@ -6189,6 +6189,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorMarkupInterface',
|
||||
'PhabricatorDestructibleInterface',
|
||||
'PhabricatorProjectInterface',
|
||||
'PhabricatorSpacesInterface',
|
||||
),
|
||||
'PhabricatorRepositoryArcanistProject' => array(
|
||||
'PhabricatorRepositoryDAO',
|
||||
|
|
|
@ -585,6 +585,8 @@ final class DifferentialTransactionEditor
|
|||
'a race?'));
|
||||
}
|
||||
|
||||
// TODO: This can race with diff updates, particularly those from
|
||||
// Harbormaster. See discussion in T8650.
|
||||
$diff->setRevisionID($object->getID());
|
||||
$diff->save();
|
||||
|
||||
|
@ -593,6 +595,8 @@ final class DifferentialTransactionEditor
|
|||
// the old (`null`) container.
|
||||
|
||||
// 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();
|
||||
$conn_w = $table->establishConnection('w');
|
||||
queryfx(
|
||||
|
|
|
@ -137,6 +137,7 @@ final class DiffusionRepositoryCreateController
|
|||
$type_credential = PhabricatorRepositoryTransaction::TYPE_CREDENTIAL;
|
||||
$type_view = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
||||
$type_edit = PhabricatorTransactions::TYPE_EDIT_POLICY;
|
||||
$type_space = PhabricatorTransactions::TYPE_SPACE;
|
||||
$type_push = PhabricatorRepositoryTransaction::TYPE_PUSH_POLICY;
|
||||
$type_service = PhabricatorRepositoryTransaction::TYPE_SERVICE;
|
||||
|
||||
|
@ -225,22 +226,26 @@ final class DiffusionRepositoryCreateController
|
|||
}
|
||||
|
||||
if ($is_policy) {
|
||||
$policy_page = $form->getPage('policy');
|
||||
|
||||
$xactions[] = id(clone $template)
|
||||
->setTransactionType($type_view)
|
||||
->setNewValue(
|
||||
$form->getPage('policy')->getControl('viewPolicy')->getValue());
|
||||
->setNewValue($policy_page->getControl('viewPolicy')->getValue());
|
||||
|
||||
$xactions[] = id(clone $template)
|
||||
->setTransactionType($type_edit)
|
||||
->setNewValue(
|
||||
$form->getPage('policy')->getControl('editPolicy')->getValue());
|
||||
->setNewValue($policy_page->getControl('editPolicy')->getValue());
|
||||
|
||||
if ($is_init || $repository->isHosted()) {
|
||||
$xactions[] = id(clone $template)
|
||||
->setTransactionType($type_push)
|
||||
->setNewValue(
|
||||
$form->getPage('policy')->getControl('pushPolicy')->getValue());
|
||||
->setNewValue($policy_page->getControl('pushPolicy')->getValue());
|
||||
}
|
||||
|
||||
$xactions[] = id(clone $template)
|
||||
->setTransactionType($type_space)
|
||||
->setNewValue(
|
||||
$policy_page->getControl('viewPolicy')->getSpacePHID());
|
||||
}
|
||||
|
||||
id(new PhabricatorRepositoryEditor())
|
||||
|
@ -261,6 +266,7 @@ final class DiffusionRepositoryCreateController
|
|||
'viewPolicy' => $repository->getViewPolicy(),
|
||||
'editPolicy' => $repository->getEditPolicy(),
|
||||
'pushPolicy' => $repository->getPushPolicy(),
|
||||
'spacePHID' => $repository->getSpacePHID(),
|
||||
);
|
||||
}
|
||||
$form->readFromObject($dict);
|
||||
|
@ -596,7 +602,7 @@ final class DiffusionRepositoryCreateController
|
|||
|
||||
$page->addRemarkupInstructions(
|
||||
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:'.
|
||||
"\n\n".
|
||||
" lang=text\n".
|
||||
|
@ -729,15 +735,15 @@ final class DiffusionRepositoryCreateController
|
|||
->setName('pushPolicy');
|
||||
|
||||
return id(new PHUIFormPageView())
|
||||
->setPageName(pht('Policies'))
|
||||
->setValidateFormPageCallback(array($this, 'validatePolicyPage'))
|
||||
->setAdjustFormPageCallback(array($this, 'adjustPolicyPage'))
|
||||
->setUser($viewer)
|
||||
->addRemarkupInstructions(
|
||||
pht('Select access policies for this repository.'))
|
||||
->addControl($view_policy)
|
||||
->addControl($edit_policy)
|
||||
->addControl($push_policy);
|
||||
->setPageName(pht('Policies'))
|
||||
->setValidateFormPageCallback(array($this, 'validatePolicyPage'))
|
||||
->setAdjustFormPageCallback(array($this, 'adjustPolicyPage'))
|
||||
->setUser($viewer)
|
||||
->addRemarkupInstructions(
|
||||
pht('Select access policies for this repository.'))
|
||||
->addControl($view_policy)
|
||||
->addControl($edit_policy)
|
||||
->addControl($push_policy);
|
||||
}
|
||||
|
||||
public function adjustPolicyPage(PHUIFormPageView $page) {
|
||||
|
|
|
@ -386,9 +386,17 @@ final class DiffusionRepositoryEditMainController
|
|||
$viewer,
|
||||
$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(
|
||||
pht('Visible To'),
|
||||
$descriptions[PhabricatorPolicyCapability::CAN_VIEW]);
|
||||
phutil_implode_html(" \xC2\xB7 ", $view_parts));
|
||||
|
||||
$view->addProperty(
|
||||
pht('Editable By'),
|
||||
|
|
|
@ -219,7 +219,7 @@ final class DivinerAtomQuery extends PhabricatorCursorPagedPolicyAwareQuery {
|
|||
}
|
||||
|
||||
// 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()];
|
||||
if (isset($matches[$atom->getBookPHID()])) {
|
||||
$maybe = $matches[$atom->getBookPHID()];
|
||||
|
|
|
@ -6,13 +6,16 @@ final class FeedPublisherWorker extends FeedPushWorker {
|
|||
$story = $this->loadFeedStory();
|
||||
|
||||
$uris = PhabricatorEnv::getEnvConfig('feed.http-hooks');
|
||||
foreach ($uris as $uri) {
|
||||
$this->queueTask(
|
||||
'FeedPublisherHTTPWorker',
|
||||
array(
|
||||
'key' => $story->getChronologicalKey(),
|
||||
'uri' => $uri,
|
||||
));
|
||||
|
||||
if ($uris) {
|
||||
foreach ($uris as $uri) {
|
||||
$this->queueTask(
|
||||
'FeedPublisherHTTPWorker',
|
||||
array(
|
||||
'key' => $story->getChronologicalKey(),
|
||||
'uri' => $uri,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$argv = array(
|
||||
|
|
|
@ -542,7 +542,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
|
|||
// just bail out.
|
||||
throw $status;
|
||||
} 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.
|
||||
$params = $params + array(
|
||||
'name' => basename($uri),
|
||||
|
|
|
@ -161,7 +161,7 @@ final class PhabricatorFileTestCase extends PhabricatorTestCase {
|
|||
|
||||
$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.
|
||||
$first_handle = $first_file->getStorageHandle();
|
||||
$second_handle = $second_file->getStorageHandle();
|
||||
|
|
|
@ -406,43 +406,59 @@ final class HarbormasterBuildEngine extends Phobject {
|
|||
$should_publish = $did_update &&
|
||||
$new_status != HarbormasterBuildable::STATUS_BUILDING &&
|
||||
!$buildable->getIsManualBuildable();
|
||||
if ($should_publish) {
|
||||
$object = id(new PhabricatorObjectQuery())
|
||||
->setViewer($viewer)
|
||||
->withPHIDs(array($buildable->getBuildablePHID()))
|
||||
->executeOne();
|
||||
|
||||
if ($object instanceof PhabricatorApplicationTransactionInterface) {
|
||||
$template = $object->getApplicationTransactionTemplate();
|
||||
if ($template) {
|
||||
$template
|
||||
->setTransactionType(PhabricatorTransactions::TYPE_BUILDABLE)
|
||||
->setMetadataValue(
|
||||
'harbormaster:buildablePHID',
|
||||
$buildable->getPHID())
|
||||
->setOldValue($old_status)
|
||||
->setNewValue($new_status);
|
||||
|
||||
$harbormaster_phid = id(new PhabricatorHarbormasterApplication())
|
||||
->getPHID();
|
||||
|
||||
$daemon_source = PhabricatorContentSource::newForSource(
|
||||
PhabricatorContentSource::SOURCE_DAEMON,
|
||||
array());
|
||||
|
||||
$editor = $object->getApplicationTransactionEditor()
|
||||
->setActor($viewer)
|
||||
->setActingAsPHID($harbormaster_phid)
|
||||
->setContentSource($daemon_source)
|
||||
->setContinueOnNoEffect(true)
|
||||
->setContinueOnMissingFields(true);
|
||||
|
||||
$editor->applyTransactions(
|
||||
$object->getApplicationTransactionObject(),
|
||||
array($template));
|
||||
}
|
||||
}
|
||||
if (!$should_publish) {
|
||||
return;
|
||||
}
|
||||
|
||||
$object = id(new PhabricatorObjectQuery())
|
||||
->setViewer($viewer)
|
||||
->withPHIDs(array($buildable->getBuildablePHID()))
|
||||
->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;
|
||||
}
|
||||
|
||||
$template = $object->getApplicationTransactionTemplate();
|
||||
if (!$template) {
|
||||
return;
|
||||
}
|
||||
|
||||
$template
|
||||
->setTransactionType(PhabricatorTransactions::TYPE_BUILDABLE)
|
||||
->setMetadataValue(
|
||||
'harbormaster:buildablePHID',
|
||||
$buildable->getPHID())
|
||||
->setOldValue($old_status)
|
||||
->setNewValue($new_status);
|
||||
|
||||
$harbormaster_phid = id(new PhabricatorHarbormasterApplication())
|
||||
->getPHID();
|
||||
|
||||
$daemon_source = PhabricatorContentSource::newForSource(
|
||||
PhabricatorContentSource::SOURCE_DAEMON,
|
||||
array());
|
||||
|
||||
$editor = $object->getApplicationTransactionEditor()
|
||||
->setActor($viewer)
|
||||
->setActingAsPHID($harbormaster_phid)
|
||||
->setContentSource($daemon_source)
|
||||
->setContinueOnNoEffect(true)
|
||||
->setContinueOnMissingFields(true);
|
||||
|
||||
$editor->applyTransactions(
|
||||
$object->getApplicationTransactionObject(),
|
||||
array($template));
|
||||
}
|
||||
|
||||
private function releaseAllArtifacts(HarbormasterBuild $build) {
|
||||
|
|
|
@ -32,7 +32,7 @@ final class HarbormasterBuildUnitMessage
|
|||
'result' => 'string',
|
||||
'duration' => 'optional float',
|
||||
'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
|
||||
|
|
|
@ -49,6 +49,26 @@ final class PhabricatorMetaMTAMailViewController
|
|||
->setUser($viewer)
|
||||
->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()) {
|
||||
$actor_str = $viewer->renderHandle($mail->getActorPHID());
|
||||
} else {
|
||||
|
|
|
@ -6,16 +6,15 @@ final class MetaMTAMailSentGarbageCollector
|
|||
public function collectGarbage() {
|
||||
$ttl = phutil_units('90 days in seconds');
|
||||
|
||||
$table = new PhabricatorMetaMTAMail();
|
||||
$conn_w = $table->establishConnection('w');
|
||||
$mails = id(new PhabricatorMetaMTAMail())->loadAllWhere(
|
||||
'dateCreated < %d LIMIT 100',
|
||||
PhabricatorTime::getNow());
|
||||
|
||||
queryfx(
|
||||
$conn_w,
|
||||
'DELETE FROM %T WHERE dateCreated < %d LIMIT 100',
|
||||
$table->getTableName(),
|
||||
time() - $ttl);
|
||||
foreach ($mails as $mail) {
|
||||
$mail->delete();
|
||||
}
|
||||
|
||||
return ($conn_w->getAffectedRows() == 100);
|
||||
return (count($mails) == 100);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -101,18 +101,16 @@ final class PhabricatorMetaMTAMailSearchEngine
|
|||
|
||||
foreach ($mails as $mail) {
|
||||
if ($mail->hasSensitiveContent()) {
|
||||
$header = pht(
|
||||
'Mail %d: < content redacted >',
|
||||
$mail->getID());
|
||||
$header = pht('< content redacted >');
|
||||
} else {
|
||||
$header = pht(
|
||||
'Mail %d: %s',
|
||||
$mail->getID(),
|
||||
$mail->getSubject());
|
||||
$header = $mail->getSubject();
|
||||
}
|
||||
|
||||
$item = id(new PHUIObjectItemView())
|
||||
->setUser($viewer)
|
||||
->setObject($mail)
|
||||
->setEpoch($mail->getDateCreated())
|
||||
->setObjectName('Mail '.$mail->getID())
|
||||
->setHeader($header)
|
||||
->setHref($this->getURI('detail/'.$mail->getID()));
|
||||
$list->addItem($item);
|
||||
|
|
|
@ -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 )----------------------------------------- */
|
||||
|
||||
|
|
|
@ -153,6 +153,7 @@ final class PhabricatorRepositorySearchEngine
|
|||
|
||||
$item = id(new PHUIObjectItemView())
|
||||
->setUser($viewer)
|
||||
->setObject($repository)
|
||||
->setHeader($repository->getName())
|
||||
->setObjectName('r'.$repository->getCallsign())
|
||||
->setHref($this->getApplicationURI($repository->getCallsign().'/'));
|
||||
|
|
|
@ -11,7 +11,8 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
|
|||
PhabricatorFlaggableInterface,
|
||||
PhabricatorMarkupInterface,
|
||||
PhabricatorDestructibleInterface,
|
||||
PhabricatorProjectInterface {
|
||||
PhabricatorProjectInterface,
|
||||
PhabricatorSpacesInterface {
|
||||
|
||||
/**
|
||||
* Shortest hash we'll recognize in raw "a829f32" form.
|
||||
|
@ -54,6 +55,7 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
|
|||
protected $details = array();
|
||||
protected $credentialPHID;
|
||||
protected $almanacServicePHID;
|
||||
protected $spacePHID;
|
||||
|
||||
private $commitCount = self::ATTACHABLE;
|
||||
private $mostRecentCommit = self::ATTACHABLE;
|
||||
|
@ -72,7 +74,8 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
|
|||
$repository = id(new PhabricatorRepository())
|
||||
->setViewPolicy($view_policy)
|
||||
->setEditPolicy($edit_policy)
|
||||
->setPushPolicy($push_policy);
|
||||
->setPushPolicy($push_policy)
|
||||
->setSpacePHID($actor->getDefaultSpacePHID());
|
||||
|
||||
// Put the repository in "Importing" mode until we finish
|
||||
// parsing it.
|
||||
|
@ -1909,6 +1912,7 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
|
|||
|
||||
/* -( PhabricatorDestructibleInterface )----------------------------------- */
|
||||
|
||||
|
||||
public function destroyObjectPermanently(
|
||||
PhabricatorDestructionEngine $engine) {
|
||||
|
||||
|
@ -1935,4 +1939,12 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
|
|||
$this->saveTransaction();
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorSpacesInterface )----------------------------------------- */
|
||||
|
||||
|
||||
public function getSpacePHID() {
|
||||
return $this->spacePHID;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,33 +3,27 @@
|
|||
final class PhabricatorSubscriptionsListController
|
||||
extends PhabricatorController {
|
||||
|
||||
private $phid;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->phid = idx($data, 'phid');
|
||||
}
|
||||
|
||||
public function shouldAllowPublic() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getUser();
|
||||
$phid = $this->phid;
|
||||
|
||||
$object = id(new PhabricatorObjectQuery())
|
||||
->setViewer($viewer)
|
||||
->withPHIDs(array($phid))
|
||||
->withPHIDs(array($request->getURIData('phid')))
|
||||
->executeOne();
|
||||
|
||||
if ($object instanceof PhabricatorSubscribableInterface) {
|
||||
$subscriber_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID(
|
||||
$phid);
|
||||
if (!$object) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$handle_phids = $subscriber_phids;
|
||||
if (!($object instanceof PhabricatorSubscribableInterface)) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$phid = $object->getPHID();
|
||||
|
||||
$handle_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID($phid);
|
||||
$handle_phids[] = $phid;
|
||||
|
||||
$handles = id(new PhabricatorHandleQuery())
|
||||
|
|
|
@ -12,7 +12,7 @@ the problem.
|
|||
|
||||
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
|
||||
certificates).
|
||||
- The SSL certificate is signed for the wrong domain. For example, a
|
||||
|
|
|
@ -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>
|
||||
```
|
||||
|
||||
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
|
||||
running steps out of order.
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ which calls `diffusion.looksoon`. This should make an external repository about
|
|||
as responsive as a hosted repository.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
|
|
@ -39,6 +39,22 @@ final class AphrontFormPolicyControl extends AphrontFormControl {
|
|||
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) {
|
||||
$this->capability = $capability;
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ final class PHUICalendarMonthView extends AphrontView {
|
|||
if ($counter <= $max_daily) {
|
||||
$list->addEvent($item);
|
||||
}
|
||||
$counter++;
|
||||
}
|
||||
|
||||
$uri = $this->getBrowseURI();
|
||||
|
|
Loading…
Reference in a new issue