Skip to content

Commit

Permalink
(stable) Promote 2015 Week 43
Browse files Browse the repository at this point in the history
  • Loading branch information
epriestley committed Oct 24, 2015
2 parents 064d9a9 + b038041 commit 9520a6b
Show file tree
Hide file tree
Showing 54 changed files with 779 additions and 368 deletions.
7 changes: 7 additions & 0 deletions resources/celerity/map.php
Expand Up @@ -373,6 +373,7 @@
'rsrc/js/application/diffusion/behavior-locate-file.js' => '6d3e1947',
'rsrc/js/application/diffusion/behavior-pull-lastmodified.js' => 'f01586dc',
'rsrc/js/application/doorkeeper/behavior-doorkeeper-tag.js' => 'e5822781',
'rsrc/js/application/drydock/drydock-live-operation-status.js' => '901935ef',
'rsrc/js/application/files/behavior-icon-composer.js' => '8ef9ab58',
'rsrc/js/application/files/behavior-launch-icon-composer.js' => '48086888',
'rsrc/js/application/herald/HeraldRuleEditor.js' => '91a6031b',
Expand Down Expand Up @@ -576,6 +577,7 @@
'javelin-behavior-diffusion-locate-file' => '6d3e1947',
'javelin-behavior-diffusion-pull-lastmodified' => 'f01586dc',
'javelin-behavior-doorkeeper-tag' => 'e5822781',
'javelin-behavior-drydock-live-operation-status' => '901935ef',
'javelin-behavior-durable-column' => 'c72aa091',
'javelin-behavior-error-log' => '6882e80a',
'javelin-behavior-event-all-day' => '38dcf3c8',
Expand Down Expand Up @@ -1518,6 +1520,11 @@
'javelin-dom',
'javelin-stratcom',
),
'901935ef' => array(
'javelin-behavior',
'javelin-dom',
'javelin-request',
),
'91a6031b' => array(
'multirow-row-manager',
'javelin-install',
Expand Down
6 changes: 6 additions & 0 deletions src/__phutil_library_map__.php
Expand Up @@ -885,6 +885,8 @@
'DrydockRepositoryOperationPHIDType' => 'applications/drydock/phid/DrydockRepositoryOperationPHIDType.php',
'DrydockRepositoryOperationQuery' => 'applications/drydock/query/DrydockRepositoryOperationQuery.php',
'DrydockRepositoryOperationSearchEngine' => 'applications/drydock/query/DrydockRepositoryOperationSearchEngine.php',
'DrydockRepositoryOperationStatusController' => 'applications/drydock/controller/DrydockRepositoryOperationStatusController.php',
'DrydockRepositoryOperationStatusView' => 'applications/drydock/view/DrydockRepositoryOperationStatusView.php',
'DrydockRepositoryOperationType' => 'applications/drydock/operation/DrydockRepositoryOperationType.php',
'DrydockRepositoryOperationUpdateWorker' => 'applications/drydock/worker/DrydockRepositoryOperationUpdateWorker.php',
'DrydockRepositoryOperationViewController' => 'applications/drydock/controller/DrydockRepositoryOperationViewController.php',
Expand Down Expand Up @@ -2552,6 +2554,7 @@
'PhabricatorPasteRemarkupRule' => 'applications/paste/remarkup/PhabricatorPasteRemarkupRule.php',
'PhabricatorPasteSchemaSpec' => 'applications/paste/storage/PhabricatorPasteSchemaSpec.php',
'PhabricatorPasteSearchEngine' => 'applications/paste/query/PhabricatorPasteSearchEngine.php',
'PhabricatorPasteSnippet' => 'applications/paste/snippet/PhabricatorPasteSnippet.php',
'PhabricatorPasteTestDataGenerator' => 'applications/paste/lipsum/PhabricatorPasteTestDataGenerator.php',
'PhabricatorPasteTransaction' => 'applications/paste/storage/PhabricatorPasteTransaction.php',
'PhabricatorPasteTransactionComment' => 'applications/paste/storage/PhabricatorPasteTransactionComment.php',
Expand Down Expand Up @@ -4671,6 +4674,8 @@
'DrydockRepositoryOperationPHIDType' => 'PhabricatorPHIDType',
'DrydockRepositoryOperationQuery' => 'DrydockQuery',
'DrydockRepositoryOperationSearchEngine' => 'PhabricatorApplicationSearchEngine',
'DrydockRepositoryOperationStatusController' => 'DrydockController',
'DrydockRepositoryOperationStatusView' => 'AphrontView',
'DrydockRepositoryOperationType' => 'Phobject',
'DrydockRepositoryOperationUpdateWorker' => 'DrydockWorker',
'DrydockRepositoryOperationViewController' => 'DrydockController',
Expand Down Expand Up @@ -6633,6 +6638,7 @@
'PhabricatorPasteRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'PhabricatorPasteSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorPasteSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorPasteSnippet' => 'Phobject',
'PhabricatorPasteTestDataGenerator' => 'PhabricatorTestDataGenerator',
'PhabricatorPasteTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorPasteTransactionComment' => 'PhabricatorApplicationTransactionComment',
Expand Down
Expand Up @@ -113,6 +113,27 @@ public function handleRequest(AphrontRequest $request) {
$provider->getProviderName()));
}
} else {

// If the user already has a linked account of this type, prevent them
// from linking a second account. This can happen if they swap logins
// and then refresh the account link. See T6707. We will eventually
// allow this after T2549.
$existing_accounts = id(new PhabricatorExternalAccountQuery())
->setViewer($viewer)
->withUserPHIDs(array($viewer->getPHID()))
->withAccountTypes(array($account->getAccountType()))
->execute();
if ($existing_accounts) {
return $this->renderError(
pht(
'Your Phabricator account is already connected to an external '.
'account on this provider ("%s"), but you are currently logged '.
'in to the provider with a different account. Log out of the '.
'external service, then log back in with the correct account '.
'before refreshing the account link.',
$provider->getProviderName()));
}

if ($provider->shouldAllowAccountLink()) {
return $this->processLinkUser($account);
} else {
Expand Down
36 changes: 4 additions & 32 deletions src/applications/cache/PhabricatorCaches.php
Expand Up @@ -206,40 +206,12 @@ private static function getSetupCacheDiskCachePath() {
// otherwise (we desire this property to give the cache the best hit rate
// we can).

// In some setups, the parent PID is more stable and longer-lived that the
// PID (e.g., under apache, our PID will be a worker while the ppid will
// be the main httpd process). If we're confident we're running under such
// a setup, we can try to use the PPID as the basis for our cache instead
// of our own PID.
$use_ppid = false;

switch (php_sapi_name()) {
case 'cli-server':
// This is the PHP5.4+ built-in webserver. We should use the pid
// (the server), not the ppid (probably a shell or something).
$use_ppid = false;
break;
case 'fpm-fcgi':
// We should be safe to use PPID here.
$use_ppid = true;
break;
case 'apache2handler':
// We're definitely safe to use the PPID.
$use_ppid = true;
break;
}
// Unfortunately, we don't have a very good strategy for minimizing the
// churn rate of the cache. We previously tried to use the parent process
// PID in some cases, but this was not reliable. See T9599 for one case of
// this.

$pid_basis = getmypid();
if ($use_ppid) {
if (function_exists('posix_getppid')) {
$parent_pid = posix_getppid();
// On most systems, normal processes can never have PIDs lower than 100,
// so something likely went wrong if we we get one of these.
if ($parent_pid > 100) {
$pid_basis = $parent_pid;
}
}
}

// If possible, we also want to know when the process launched, so we can
// drop the cache if a process restarts but gets the same PID an earlier
Expand Down
4 changes: 3 additions & 1 deletion src/applications/cache/spec/PhabricatorDataCacheSpec.php
Expand Up @@ -63,7 +63,9 @@ private function initAPCuSpec() {
private function initNoneSpec() {
if (version_compare(phpversion(), '5.5', '>=')) {
$message = pht(
'Installing the "APCu" PHP extension will improve performance.');
'Installing the "APCu" PHP extension will improve performance. '.
'This extension is strongly recommended. Without it, Phabricator '.
'must rely on a very inefficient disk-based cache.');

$this
->newIssue('extension.apcu')
Expand Down
Expand Up @@ -7,18 +7,9 @@ public function shouldRequireLogin() {
return false;
}

private $method;

public function willProcessRequest(array $data) {
$this->method = $data['method'];
return $this;
}

public function processRequest() {
public function handleRequest(AphrontRequest $request) {
$method = $request->getURIData('method');
$time_start = microtime(true);
$request = $this->getRequest();

$method = $this->method;

$api_request = null;
$method_implementation = null;
Expand Down Expand Up @@ -55,7 +46,7 @@ public function processRequest() {
$conduit_username = '-';
if ($call->shouldRequireAuthentication()) {
$metadata['scope'] = $call->getRequiredScope();
$auth_error = $this->authenticateUser($api_request, $metadata);
$auth_error = $this->authenticateUser($api_request, $metadata, $method);
// If we've explicitly authenticated the user here and either done
// CSRF validation or are using a non-web authentication mechanism.
$allow_unguarded_writes = true;
Expand Down Expand Up @@ -169,7 +160,8 @@ public function processRequest() {
*/
private function authenticateUser(
ConduitAPIRequest $api_request,
array $metadata) {
array $metadata,
$method) {

$request = $this->getRequest();

Expand Down Expand Up @@ -207,7 +199,7 @@ private function authenticateUser(
unset($protocol_data['scope']);

ConduitClient::verifySignature(
$this->method,
$method,
$api_request->getAllParameters(),
$protocol_data,
$ssl_public_key);
Expand Down
Expand Up @@ -3,19 +3,13 @@
final class PhabricatorConduitListController
extends PhabricatorConduitController {

private $queryKey;

public function shouldAllowPublic() {
return true;
}

public function willProcessRequest(array $data) {
$this->queryKey = idx($data, 'queryKey');
}

public function processRequest() {
public function handleRequest(AphrontRequest $request) {
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey)
->setQueryKey($request->getURIData('queryKey'))
->setSearchEngine(new PhabricatorConduitSearchEngine())
->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller);
Expand Down
Expand Up @@ -3,9 +3,8 @@
final class PhabricatorConduitLogController
extends PhabricatorConduitController {

public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();

$conn_table = new PhabricatorConduitConnectionLog();
$call_table = new PhabricatorConduitMethodCallLog();
Expand Down
Expand Up @@ -3,11 +3,11 @@
final class PhabricatorConduitTokenController
extends PhabricatorConduitController {

public function processRequest() {
$user = $this->getRequest()->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();

id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession(
$user,
$viewer,
$this->getRequest(),
'/');

Expand All @@ -19,13 +19,13 @@ public function processRequest() {
$old_token = id(new PhabricatorConduitCertificateToken())
->loadOneWhere(
'userPHID = %s',
$user->getPHID());
$viewer->getPHID());
if ($old_token) {
$old_token->delete();
}

$token = id(new PhabricatorConduitCertificateToken())
->setUserPHID($user->getPHID())
->setUserPHID($viewer->getPHID())
->setToken(Filesystem::readRandomCharacters(40))
->save();

Expand All @@ -42,7 +42,7 @@ public function processRequest() {
Javelin::initBehavior('select-on-click');

$form = id(new AphrontFormView())
->setUser($user)
->setUser($viewer)
->appendRemarkupInstructions($pre_instructions)
->appendChild(
id(new AphrontFormTextAreaControl())
Expand Down
Expand Up @@ -5,8 +5,8 @@ final class PhabricatorConduitTokenEditController

public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();

$id = $request->getURIData('id');

if ($id) {
$token = id(new PhabricatorConduitTokenQuery())
->setViewer($viewer)
Expand Down
Expand Up @@ -5,9 +5,9 @@ final class PhabricatorConduitTokenTerminateController

public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();

$object_phid = $request->getStr('objectPHID');
$id = $request->getURIData('id');

if ($id) {
$token = id(new PhabricatorConduitTokenQuery())
->setViewer($viewer)
Expand Down
Expand Up @@ -225,18 +225,8 @@ public function buildWelcomeScreen(AphrontRequest $request) {
'fa-globe',
$content);

$support_href = PhabricatorEnv::getDoclink('Give Feedback! Get Support!');
$content = pht(
"=== Need Help with Setup? ===\n\n".
'Having trouble getting something set up? See '.
'**[[ %s | Give Feedback! Get Support! ]]** for ways to get in touch '.
'to get answers to questions, report bugs, and request features.',
$support_href);

$explore[] = $this->newItem(
$request,
'fa-life-ring',
$content);
// TODO: Restore some sort of "Support" link here, but just nuke it for
// now as we figure stuff out.

$differential_uri = PhabricatorEnv::getURI('/differential/');
$differential_create_uri = PhabricatorEnv::getURI(
Expand Down
Expand Up @@ -20,8 +20,6 @@ public function getGroup() {
}

public function getOptions() {
$support_href = PhabricatorEnv::getDoclink('Give Feedback! Get Support!');

$doc_href = PhabricatorEnv::getDoclink('Configuring a File Domain');
$doc_name = pht('Configuration Guide: Configuring a File Domain');

Expand Down Expand Up @@ -197,11 +195,8 @@ public function getOptions() {
->setSummary(pht('Whitelists editor protocols for "Open in Editor".'))
->setDescription(
pht(
"Users can configure a URI pattern to open files in a text ".
"editor. The URI must use a protocol on this whitelist.\n\n".
"(If you use an editor which defines a protocol not on this ".
"list, [[ %s | let us know ]] and we'll update the defaults.)",
$support_href))
'Users can configure a URI pattern to open files in a text '.
'editor. The URI must use a protocol on this whitelist.'))
->setLocked(true),
$this->newOption(
'celerity.resource-hash',
Expand Down
Expand Up @@ -1060,30 +1060,13 @@ private function buildOperationsBox(DifferentialRevision $revision) {

$operation = head(msort($operations, 'getID'));

// TODO: This is completely made up for now, give it useful information and
// a sweet progress bar.

switch ($operation->getOperationState()) {
case DrydockRepositoryOperation::STATE_WAIT:
case DrydockRepositoryOperation::STATE_WORK:
$severity = PHUIInfoView::SEVERITY_NOTICE;
$text = pht(
'Some sort of repository operation is currently running.');
break;
default:
$severity = PHUIInfoView::SEVERITY_ERROR;
$text = pht(
'Some sort of repository operation failed.');
break;
}

$info_view = id(new PHUIInfoView())
->setSeverity($severity)
->appendChild($text);
$box_view = id(new PHUIObjectBoxView())
->setHeaderText(pht('Active Operations'));

return id(new PHUIObjectBoxView())
->setHeaderText(pht('Active Operations (EXPERIMENTAL!)'))
->setInfoView($info_view);
return id(new DrydockRepositoryOperationStatusView())
->setUser($viewer)
->setBoxView($box_view)
->setOperation($operation);
}

}
Expand Up @@ -288,7 +288,7 @@ private function buildCorpus(

$repo = $drequest->getRepository();
$symbol_repos = nonempty($repo->getSymbolSources(), array());
$symbol_repos[] = $repo;
$symbol_repos[] = $repo->getPHID();

$lang = last(explode('.', $drequest->getPath()));
$repo_languages = $repo->getSymbolLanguages();
Expand Down
Expand Up @@ -95,6 +95,7 @@ public function getRoutes() {
=> 'DrydockRepositoryOperationListController',
'(?P<id>[1-9]\d*)/' => array(
'' => 'DrydockRepositoryOperationViewController',
'status/' => 'DrydockRepositoryOperationStatusController',
),
),
),
Expand Down

0 comments on commit 9520a6b

Please sign in to comment.