From db1cd6586609b53029c45d1aecd7598e942266f1 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 14 May 2015 10:39:28 -0700 Subject: [PATCH 01/86] Allow setup checks to perform writes Summary: Fixes T8198. Currently, if the `policy.locked` configuration setting includes a value which is a user PHID, we may perform a cache fill during setup as a side effect of validating it. Right now, there is no WriteGuard active during setup, because we don't have a Request object yet so we can't actually perform CSRF validation. Two possible approaches are: # Prevent the write from occuring. # Change the code to allow the write. In the past, I think we've hit similar cases and done (1). However, IIRC those writes were sketchier, more isolated, and easy to remove (I think there was one with PKCS8 keys). This one is pretty legit and not very easy to remove without making a bit of a mess. There's no techncial reason we can't do (2), we just have to create a no-op WriteGuard for the setup phase. Test Plan: - To reproduce this issue: set some value in `policy.locked` to a user PHID, then wipe out profile caches in the database, then restart the webserver. - Reproduced the issue. - Added the new dummy write guard, fixed a minor issue with disposal semantics (see D12841). - Verified this fixed the issue. - Added a `throw` to the real CSRF validator and performed a real write. Verified I got CSRF-blocked. - Removed a CSRF token from a form and double-checked that CSRF protection still works. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8198 Differential Revision: https://secure.phabricator.com/D12842 --- .../AphrontApplicationConfiguration.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/aphront/configuration/AphrontApplicationConfiguration.php b/src/aphront/configuration/AphrontApplicationConfiguration.php index 3e7abe6a9d..d828b9a8ce 100644 --- a/src/aphront/configuration/AphrontApplicationConfiguration.php +++ b/src/aphront/configuration/AphrontApplicationConfiguration.php @@ -62,6 +62,11 @@ abstract class AphrontApplicationConfiguration { $multimeter->setEventContext(''); $multimeter->setEventViewer(''); + // Build a no-op write guard for the setup phase. We'll replace this with a + // real write guard later on, but we need to survive setup and build a + // request object first. + $write_guard = new AphrontWriteGuard('id'); + PhabricatorEnv::initializeWebEnvironment(); $multimeter->setSampleRate( @@ -108,6 +113,11 @@ abstract class AphrontApplicationConfiguration { $application->willBuildRequest(); $request = $application->buildRequest(); + // Now that we have a request, convert the write guard into one which + // actually checks CSRF tokens. + $write_guard->dispose(); + $write_guard = new AphrontWriteGuard(array($request, 'validateCSRF')); + // Build the server URI implied by the request headers. If an administrator // has not configured "phabricator.base-uri" yet, we'll use this to generate // links. @@ -121,8 +131,6 @@ abstract class AphrontApplicationConfiguration { 'U' => (string)$request->getRequestURI()->getPath(), )); - $write_guard = new AphrontWriteGuard(array($request, 'validateCSRF')); - $processing_exception = null; try { $response = $application->processRequest( From bc101e7c734b95d8eeb67ea7593b926bdb8ac06a Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Thu, 14 May 2015 11:14:07 -0700 Subject: [PATCH 02/86] Conpherence - fix disappearing older messages bug Summary: Fixes T8194. If you loaded a conpherence directly via a URI like /Z1 or /conpherence/1/ we didn't correctly cache the loaded transactions such that sending a message would only show that message and subsequent messages. Fix is to build the cache properly in this case. Note this codepath is different because the server sends back more of the thread data in the initial request. Test Plan: loaded a conpherence directly, sent messages, paged back, everything kept showing! Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8194 Differential Revision: https://secure.phabricator.com/D12844 --- resources/celerity/map.php | 60 +++++++++---------- .../conpherence/ConpherenceThreadManager.js | 18 +++--- .../application/conpherence/behavior-menu.js | 1 + 3 files changed, 42 insertions(+), 37 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index c4bb78b856..6b31b64958 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -8,7 +8,7 @@ return array( 'names' => array( 'core.pkg.css' => '7ac320f1', - 'core.pkg.js' => 'ac41c400', + 'core.pkg.js' => 'a2f2598e', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => 'bb338e4b', 'differential.pkg.js' => '895b8d62', @@ -332,10 +332,10 @@ return array( 'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18', 'rsrc/js/application/calendar/event-all-day.js' => 'ca5fa62a', 'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de', - 'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => 'b7342ddb', + 'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '10246726', 'rsrc/js/application/conpherence/behavior-drag-and-drop-photo.js' => 'cf86d16a', 'rsrc/js/application/conpherence/behavior-durable-column.js' => '16c695bf', - 'rsrc/js/application/conpherence/behavior-menu.js' => '4351c4a0', + 'rsrc/js/application/conpherence/behavior-menu.js' => 'c0348cac', 'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861', 'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3', 'rsrc/js/application/conpherence/behavior-widget-pane.js' => '93568464', @@ -500,7 +500,7 @@ return array( 'conpherence-menu-css' => 'f389e048', 'conpherence-message-pane-css' => '5bb4b76d', 'conpherence-notification-css' => '919974b6', - 'conpherence-thread-manager' => 'b7342ddb', + 'conpherence-thread-manager' => '10246726', 'conpherence-transaction-css' => '42a457f6', 'conpherence-update-css' => '1099a660', 'conpherence-widget-pane-css' => '2af42ebe', @@ -541,7 +541,7 @@ return array( 'javelin-behavior-choose-control' => '6153c708', 'javelin-behavior-config-reorder-fields' => '14a827de', 'javelin-behavior-conpherence-drag-and-drop-photo' => 'cf86d16a', - 'javelin-behavior-conpherence-menu' => '4351c4a0', + 'javelin-behavior-conpherence-menu' => 'c0348cac', 'javelin-behavior-conpherence-pontificate' => '21ba5861', 'javelin-behavior-conpherence-widget-pane' => '93568464', 'javelin-behavior-countdown-timer' => 'e4cc26b3', @@ -876,6 +876,17 @@ return array( 'javelin-install', 'javelin-util', ), + 10246726 => array( + 'javelin-dom', + 'javelin-util', + 'javelin-stratcom', + 'javelin-install', + 'javelin-aphlict', + 'javelin-workflow', + 'javelin-router', + 'javelin-behavior-device', + 'javelin-vector', + ), '13c739ea' => array( 'javelin-behavior', 'javelin-stratcom', @@ -1067,20 +1078,6 @@ return array( 'javelin-dom', 'javelin-request', ), - '4351c4a0' => array( - 'javelin-behavior', - 'javelin-dom', - 'javelin-util', - 'javelin-stratcom', - 'javelin-workflow', - 'javelin-behavior-device', - 'javelin-history', - 'javelin-vector', - 'javelin-scrollbar', - 'phabricator-title', - 'phabricator-shaped-request', - 'conpherence-thread-manager', - ), '44168bad' => array( 'javelin-behavior', 'javelin-dom', @@ -1703,17 +1700,6 @@ return array( 'javelin-dom', 'javelin-util', ), - 'b7342ddb' => array( - 'javelin-dom', - 'javelin-util', - 'javelin-stratcom', - 'javelin-install', - 'javelin-aphlict', - 'javelin-workflow', - 'javelin-router', - 'javelin-behavior-device', - 'javelin-vector', - ), 'ba4fa35c' => array( 'javelin-behavior', 'javelin-dom', @@ -1747,6 +1733,20 @@ return array( 'javelin-util', 'phabricator-shaped-request', ), + 'c0348cac' => array( + 'javelin-behavior', + 'javelin-dom', + 'javelin-util', + 'javelin-stratcom', + 'javelin-workflow', + 'javelin-behavior-device', + 'javelin-history', + 'javelin-vector', + 'javelin-scrollbar', + 'phabricator-title', + 'phabricator-shaped-request', + 'conpherence-thread-manager', + ), 'c1700f6f' => array( 'javelin-install', 'javelin-util', diff --git a/webroot/rsrc/js/application/conpherence/ConpherenceThreadManager.js b/webroot/rsrc/js/application/conpherence/ConpherenceThreadManager.js index c1c47c5c78..71c1af139b 100644 --- a/webroot/rsrc/js/application/conpherence/ConpherenceThreadManager.js +++ b/webroot/rsrc/js/application/conpherence/ConpherenceThreadManager.js @@ -330,6 +330,16 @@ JX.install('ConpherenceThreadManager', { JX.DOM.setContent(this._messagesRootCallback(), transactions); }, + cacheCurrentTransactions: function() { + var root = this._messagesRootCallback(); + var transactions = JX.DOM.scry( + root , + 'div', + 'conpherence-transaction-view'); + this._updateTransactionIDMap(transactions); + this._updateTransactionCache(transactions); + }, + _updateThread: function() { var params = this._getParams({ action: 'load', @@ -422,13 +432,7 @@ JX.install('ConpherenceThreadManager', { r.aphlictDropdownData); this._didLoadThreadCallback(r); - var messages_root = this._messagesRootCallback(); - var messages = JX.DOM.scry( - messages_root, - 'div', - 'conpherence-transaction-view'); - this._updateTransactionIDMap(messages); - this._updateTransactionCache(messages); + this.cacheCurrentTransactions(); if (force_reload) { JX.Stratcom.invoke('hashchange'); diff --git a/webroot/rsrc/js/application/conpherence/behavior-menu.js b/webroot/rsrc/js/application/conpherence/behavior-menu.js index 2233b3ff28..5dcbffaed8 100644 --- a/webroot/rsrc/js/application/conpherence/behavior-menu.js +++ b/webroot/rsrc/js/application/conpherence/behavior-menu.js @@ -191,6 +191,7 @@ JX.behavior('conpherence-menu', function(config) { threadManager.setLoadedThreadPHID(config.selectedThreadPHID); threadManager.setLatestTransactionID(config.latestTransactionID); threadManager.setCanEditLoadedThread(config.canEditSelectedThread); + threadManager.cacheCurrentTransactions(); _scrollMessageWindow(); _focusTextarea(); } else { From 04186e02cfd8949468e49e8f5eba4514efbdc43f Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 14 May 2015 11:14:44 -0700 Subject: [PATCH 03/86] Separate handle "status" and "availability" Summary: Ref T7707. Handles currently have a "status" field and a "disabled" field. The "status" field has these possible values: "open", "closed", "1", "2". durp durp durp Instead, do: - status = - availability = I think these make more sense? And are a bit more general? And use the same kind of constants for all values! Test Plan: Looked at all affected handles in all states (probably). Reviewers: chad, btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7707 Differential Revision: https://secure.phabricator.com/D12832 --- resources/celerity/map.php | 6 +- src/__phutil_library_map__.php | 2 - .../phid/PhabricatorCalendarEventPHIDType.php | 2 +- .../PhabricatorDashboardPanelPHIDType.php | 2 +- .../phid/DifferentialRevisionPHIDType.php | 2 +- .../query/PhabricatorFlagSearchEngine.php | 2 +- .../fund/phid/FundInitiativePHIDType.php | 2 +- .../maniphest/phid/ManiphestTaskPHIDType.php | 2 +- .../phid/PassphraseCredentialPHIDType.php | 2 +- .../phid/PhabricatorPeopleUserPHIDType.php | 27 +++++++-- .../phid/PhabricatorObjectHandle.php | 60 ++++++++----------- .../const/PhabricatorObjectHandleStatus.php | 9 --- .../pholio/phid/PholioMockPHIDType.php | 2 +- .../phid/PhrictionDocumentPHIDType.php | 2 +- .../phid/PhabricatorProjectColumnPHIDType.php | 5 +- .../PhabricatorProjectProjectPHIDType.php | 2 +- .../view/PhabricatorSearchResultView.php | 2 +- .../view/PhabricatorTypeaheadTokenView.php | 2 +- .../rule/PhabricatorObjectRemarkupRule.php | 6 +- .../application/base/standard-page-view.css | 12 ++-- 20 files changed, 76 insertions(+), 75 deletions(-) delete mode 100644 src/applications/phid/handle/const/PhabricatorObjectHandleStatus.php diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 6b31b64958..0372651ba5 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -7,7 +7,7 @@ */ return array( 'names' => array( - 'core.pkg.css' => '7ac320f1', + 'core.pkg.css' => '9990f46d', 'core.pkg.js' => 'a2f2598e', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => 'bb338e4b', @@ -37,7 +37,7 @@ return array( 'rsrc/css/application/base/main-menu-view.css' => '663e3810', 'rsrc/css/application/base/notification-menu.css' => '3c9d8aa1', 'rsrc/css/application/base/phabricator-application-launch-view.css' => '16ca323f', - 'rsrc/css/application/base/standard-page-view.css' => '2acd4611', + 'rsrc/css/application/base/standard-page-view.css' => '61e68a55', 'rsrc/css/application/chatlog/chatlog.css' => '852140ff', 'rsrc/css/application/conduit/conduit-api.css' => '7bc725c4', 'rsrc/css/application/config/config-options.css' => '7fedf08b', @@ -731,7 +731,7 @@ return array( 'phabricator-side-menu-view-css' => 'c1db9e9c', 'phabricator-slowvote-css' => '266df6a1', 'phabricator-source-code-view-css' => '2ceee894', - 'phabricator-standard-page-view' => '2acd4611', + 'phabricator-standard-page-view' => '61e68a55', 'phabricator-textareautils' => '5c93c52c', 'phabricator-title' => 'df5e11d2', 'phabricator-tooltip' => '1d298e3a', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 0fa277df27..638674126b 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2143,7 +2143,6 @@ phutil_register_library_map(array( 'PhabricatorOAuthServerTokenController' => 'applications/oauthserver/controller/PhabricatorOAuthServerTokenController.php', 'PhabricatorObjectHandle' => 'applications/phid/PhabricatorObjectHandle.php', 'PhabricatorObjectHandleConstants' => 'applications/phid/handle/const/PhabricatorObjectHandleConstants.php', - 'PhabricatorObjectHandleStatus' => 'applications/phid/handle/const/PhabricatorObjectHandleStatus.php', 'PhabricatorObjectHasAsanaSubtaskEdgeType' => 'applications/doorkeeper/edge/PhabricatorObjectHasAsanaSubtaskEdgeType.php', 'PhabricatorObjectHasAsanaTaskEdgeType' => 'applications/doorkeeper/edge/PhabricatorObjectHasAsanaTaskEdgeType.php', 'PhabricatorObjectHasContributorEdgeType' => 'applications/transactions/edges/PhabricatorObjectHasContributorEdgeType.php', @@ -5549,7 +5548,6 @@ phutil_register_library_map(array( 'PhabricatorOAuthServerTestController' => 'PhabricatorOAuthServerController', 'PhabricatorOAuthServerTokenController' => 'PhabricatorAuthController', 'PhabricatorObjectHandle' => 'PhabricatorPolicyInterface', - 'PhabricatorObjectHandleStatus' => 'PhabricatorObjectHandleConstants', 'PhabricatorObjectHasAsanaSubtaskEdgeType' => 'PhabricatorEdgeType', 'PhabricatorObjectHasAsanaTaskEdgeType' => 'PhabricatorEdgeType', 'PhabricatorObjectHasContributorEdgeType' => 'PhabricatorEdgeType', diff --git a/src/applications/calendar/phid/PhabricatorCalendarEventPHIDType.php b/src/applications/calendar/phid/PhabricatorCalendarEventPHIDType.php index 0486474dcd..7acc968f21 100644 --- a/src/applications/calendar/phid/PhabricatorCalendarEventPHIDType.php +++ b/src/applications/calendar/phid/PhabricatorCalendarEventPHIDType.php @@ -42,7 +42,7 @@ final class PhabricatorCalendarEventPHIDType extends PhabricatorPHIDType { ->setURI('/E'.$id); if ($is_cancelled) { - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); } } } diff --git a/src/applications/dashboard/phid/PhabricatorDashboardPanelPHIDType.php b/src/applications/dashboard/phid/PhabricatorDashboardPanelPHIDType.php index 725945f407..c4aec82b8e 100644 --- a/src/applications/dashboard/phid/PhabricatorDashboardPanelPHIDType.php +++ b/src/applications/dashboard/phid/PhabricatorDashboardPanelPHIDType.php @@ -36,7 +36,7 @@ final class PhabricatorDashboardPanelPHIDType extends PhabricatorPHIDType { $handle->setURI("/{$monogram}"); if ($panel->getIsArchived()) { - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); } } } diff --git a/src/applications/differential/phid/DifferentialRevisionPHIDType.php b/src/applications/differential/phid/DifferentialRevisionPHIDType.php index d65d2d601c..a46dc71c65 100644 --- a/src/applications/differential/phid/DifferentialRevisionPHIDType.php +++ b/src/applications/differential/phid/DifferentialRevisionPHIDType.php @@ -41,7 +41,7 @@ final class DifferentialRevisionPHIDType extends PhabricatorPHIDType { $handle->setFullName("D{$id}: {$title}"); if ($revision->isClosed()) { - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); } } } diff --git a/src/applications/flag/query/PhabricatorFlagSearchEngine.php b/src/applications/flag/query/PhabricatorFlagSearchEngine.php index eec7027fa1..0e56fbf0e0 100644 --- a/src/applications/flag/query/PhabricatorFlagSearchEngine.php +++ b/src/applications/flag/query/PhabricatorFlagSearchEngine.php @@ -152,7 +152,7 @@ final class PhabricatorFlagSearchEngine ->setHeader($flag->getHandle()->getFullName()) ->setHref($flag->getHandle()->getURI()); - $status_open = PhabricatorObjectHandleStatus::STATUS_OPEN; + $status_open = PhabricatorObjectHandle::STATUS_OPEN; if ($flag->getHandle()->getStatus() != $status_open) { $item->setDisabled(true); } diff --git a/src/applications/fund/phid/FundInitiativePHIDType.php b/src/applications/fund/phid/FundInitiativePHIDType.php index cd2d0c83da..3399dc0a3f 100644 --- a/src/applications/fund/phid/FundInitiativePHIDType.php +++ b/src/applications/fund/phid/FundInitiativePHIDType.php @@ -37,7 +37,7 @@ final class FundInitiativePHIDType extends PhabricatorPHIDType { $name = $initiative->getName(); if ($initiative->isClosed()) { - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); } $handle->setName($name); diff --git a/src/applications/maniphest/phid/ManiphestTaskPHIDType.php b/src/applications/maniphest/phid/ManiphestTaskPHIDType.php index 8c1b3c0d8e..719b4a8446 100644 --- a/src/applications/maniphest/phid/ManiphestTaskPHIDType.php +++ b/src/applications/maniphest/phid/ManiphestTaskPHIDType.php @@ -39,7 +39,7 @@ final class ManiphestTaskPHIDType extends PhabricatorPHIDType { $handle->setURI("/T{$id}"); if ($task->isClosed()) { - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); } } } diff --git a/src/applications/passphrase/phid/PassphraseCredentialPHIDType.php b/src/applications/passphrase/phid/PassphraseCredentialPHIDType.php index 63105fd010..25681906e3 100644 --- a/src/applications/passphrase/phid/PassphraseCredentialPHIDType.php +++ b/src/applications/passphrase/phid/PassphraseCredentialPHIDType.php @@ -39,7 +39,7 @@ final class PassphraseCredentialPHIDType extends PhabricatorPHIDType { $handle->setURI("/K{$id}"); if ($credential->getIsDestroyed()) { - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); } } } diff --git a/src/applications/people/phid/PhabricatorPeopleUserPHIDType.php b/src/applications/people/phid/PhabricatorPeopleUserPHIDType.php index 7f089b4be5..16453987c9 100644 --- a/src/applications/people/phid/PhabricatorPeopleUserPHIDType.php +++ b/src/applications/people/phid/PhabricatorPeopleUserPHIDType.php @@ -43,11 +43,28 @@ final class PhabricatorPeopleUserPHIDType extends PhabricatorPHIDType { $handle->setURI('/p/'.$user->getUsername().'/'); $handle->setFullName($user->getFullName()); $handle->setImageURI($user->getProfileImageURI()); - $handle->setDisabled(!$user->isUserActivated()); - if ($user->hasStatus()) { - $status = $user->getStatus(); - $handle->setStatus($status->getTextStatus()); - $handle->setTitle($status->getTerseSummary($query->getViewer())); + + $availability = null; + if (!$user->isUserActivated()) { + $availability = PhabricatorObjectHandle::AVAILABILITY_DISABLED; + } else { + if ($user->hasStatus()) { + // NOTE: This first call returns an event; then we get the event + // status. + $status = $user->getStatus()->getStatus(); + switch ($status) { + case PhabricatorCalendarEvent::STATUS_AWAY: + $availability = PhabricatorObjectHandle::AVAILABILITY_NONE; + break; + case PhabricatorCalendarEvent::STATUS_SPORADIC: + $availability = PhabricatorObjectHandle::AVAILABILITY_PARTIAL; + break; + } + } + } + + if ($availability) { + $handle->setAvailability($availability); } } } diff --git a/src/applications/phid/PhabricatorObjectHandle.php b/src/applications/phid/PhabricatorObjectHandle.php index f36c21516a..2f7cda8377 100644 --- a/src/applications/phid/PhabricatorObjectHandle.php +++ b/src/applications/phid/PhabricatorObjectHandle.php @@ -3,6 +3,14 @@ final class PhabricatorObjectHandle implements PhabricatorPolicyInterface { + const AVAILABILITY_FULL = 'full'; + const AVAILABILITY_NONE = 'none'; + const AVAILABILITY_PARTIAL = 'partial'; + const AVAILABILITY_DISABLED = 'disabled'; + + const STATUS_OPEN = 'open'; + const STATUS_CLOSED = 'closed'; + private $uri; private $phid; private $type; @@ -13,9 +21,9 @@ final class PhabricatorObjectHandle private $icon; private $tagColor; private $timestamp; - private $status = PhabricatorObjectHandleStatus::STATUS_OPEN; + private $status = self::STATUS_OPEN; + private $availability = self::AVAILABILITY_FULL; private $complete; - private $disabled; private $objectName; private $policyFiltered; @@ -129,6 +137,19 @@ final class PhabricatorObjectHandle return $this->name; } + public function setAvailability($availability) { + $this->availability = $availability; + return $this; + } + + public function getAvailability() { + return $this->availability; + } + + public function isDisabled() { + return ($this->getAvailability() == self::AVAILABILITY_DISABLED); + } + public function setStatus($status) { $this->status = $status; return $this; @@ -225,33 +246,6 @@ final class PhabricatorObjectHandle } - /** - * Set whether or not the underlying object is disabled. See - * @{method:isDisabled} for an explanation of what it means to be disabled. - * - * @param bool True if the handle represents a disabled object. - * @return this - */ - public function setDisabled($disabled) { - $this->disabled = $disabled; - return $this; - } - - - /** - * Determine if the handle represents an object which has been disabled -- - * for example, disabled users, archived projects, etc. These objects are - * complete and exist, but should be excluded from some system interactions - * (for instance, they usually should not appear in typeaheads, and should - * not have mail/notifications delivered to or about them). - * - * @return bool True if the handle represents a disabled object. - */ - public function isDisabled() { - return $this->disabled; - } - - public function renderLink($name = null) { if ($name === null) { $name = $this->getLinkName(); @@ -260,14 +254,12 @@ final class PhabricatorObjectHandle $classes[] = 'phui-handle'; $title = $this->title; - if ($this->status != PhabricatorObjectHandleStatus::STATUS_OPEN) { + if ($this->status != self::STATUS_OPEN) { $classes[] = 'handle-status-'.$this->status; - $title = $title ? $title : $this->status; } - if ($this->disabled) { - $classes[] = 'handle-disabled'; - $title = pht('Disabled'); // Overwrite status. + if ($this->availability != self::AVAILABILITY_FULL) { + $classes[] = 'handle-availability-'.$this->availability; } if ($this->getType() == PhabricatorPeopleUserPHIDType::TYPECONST) { diff --git a/src/applications/phid/handle/const/PhabricatorObjectHandleStatus.php b/src/applications/phid/handle/const/PhabricatorObjectHandleStatus.php deleted file mode 100644 index 37407428b4..0000000000 --- a/src/applications/phid/handle/const/PhabricatorObjectHandleStatus.php +++ /dev/null @@ -1,9 +0,0 @@ -setFullName("M{$id}: {$name}"); if ($mock->isClosed()) { - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); } } } diff --git a/src/applications/phriction/phid/PhrictionDocumentPHIDType.php b/src/applications/phriction/phid/PhrictionDocumentPHIDType.php index 4166263946..934dc73b30 100644 --- a/src/applications/phriction/phid/PhrictionDocumentPHIDType.php +++ b/src/applications/phriction/phid/PhrictionDocumentPHIDType.php @@ -42,7 +42,7 @@ final class PhrictionDocumentPHIDType extends PhabricatorPHIDType { $handle->setURI(PhrictionDocument::getSlugURI($slug)); if ($status != PhrictionDocumentStatus::STATUS_EXISTS) { - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); } } } diff --git a/src/applications/project/phid/PhabricatorProjectColumnPHIDType.php b/src/applications/project/phid/PhabricatorProjectColumnPHIDType.php index a78939e4f7..4ac0399cf7 100644 --- a/src/applications/project/phid/PhabricatorProjectColumnPHIDType.php +++ b/src/applications/project/phid/PhabricatorProjectColumnPHIDType.php @@ -34,7 +34,10 @@ final class PhabricatorProjectColumnPHIDType extends PhabricatorPHIDType { $handle->setName($column->getDisplayName()); $handle->setURI('/project/board/'.$column->getProject()->getID().'/'); - $handle->setDisabled($column->isHidden()); + + if ($column->isHidden()) { + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); + } } } diff --git a/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php b/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php index ae74610dcc..5689be49ce 100644 --- a/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php +++ b/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php @@ -49,7 +49,7 @@ final class PhabricatorProjectProjectPHIDType extends PhabricatorPHIDType { $handle->setTagColor($project->getColor()); if ($project->isArchived()) { - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); } } } diff --git a/src/applications/search/view/PhabricatorSearchResultView.php b/src/applications/search/view/PhabricatorSearchResultView.php index 978e1b41ed..63219b3252 100644 --- a/src/applications/search/view/PhabricatorSearchResultView.php +++ b/src/applications/search/view/PhabricatorSearchResultView.php @@ -41,7 +41,7 @@ final class PhabricatorSearchResultView extends AphrontView { ->setImageURI($handle->getImageURI()) ->addAttribute($type_name); - if ($handle->getStatus() == PhabricatorObjectHandleStatus::STATUS_CLOSED) { + if ($handle->getStatus() == PhabricatorObjectHandle::STATUS_CLOSED) { $item->setDisabled(true); $item->addAttribute(pht('Closed')); } diff --git a/src/applications/typeahead/view/PhabricatorTypeaheadTokenView.php b/src/applications/typeahead/view/PhabricatorTypeaheadTokenView.php index d08b1b406d..2dacd84022 100644 --- a/src/applications/typeahead/view/PhabricatorTypeaheadTokenView.php +++ b/src/applications/typeahead/view/PhabricatorTypeaheadTokenView.php @@ -35,7 +35,7 @@ final class PhabricatorTypeaheadTokenView ->setIcon($handle->getIcon()); if ($handle->isDisabled() || - $handle->getStatus() == PhabricatorObjectHandleStatus::STATUS_CLOSED) { + $handle->getStatus() == PhabricatorObjectHandle::STATUS_CLOSED) { $token->setTokenType(self::TYPE_DISABLED); } else { $token->setColor($handle->getTagColor()); diff --git a/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php b/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php index 8f776716ea..f5c936539e 100644 --- a/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php +++ b/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php @@ -86,7 +86,7 @@ abstract class PhabricatorObjectRemarkupRule extends PhutilRemarkupRule { $href = $this->getObjectHref($object, $handle, $id); $text = $this->getObjectNamePrefix().$id; - $status_closed = PhabricatorObjectHandleStatus::STATUS_CLOSED; + $status_closed = PhabricatorObjectHandle::STATUS_CLOSED; if ($anchor) { $href = $href.'#'.$anchor; @@ -126,7 +126,7 @@ abstract class PhabricatorObjectRemarkupRule extends PhutilRemarkupRule { $name = $handle->getFullName(); $href = $handle->getURI(); - $status_closed = PhabricatorObjectHandleStatus::STATUS_CLOSED; + $status_closed = PhabricatorObjectHandle::STATUS_CLOSED; $attr = array( 'phid' => $handle->getPHID(), 'closed' => ($handle->getStatus() == $status_closed), @@ -140,7 +140,7 @@ abstract class PhabricatorObjectRemarkupRule extends PhutilRemarkupRule { $href, PhabricatorObjectHandle $handle) { - $status_closed = PhabricatorObjectHandleStatus::STATUS_CLOSED; + $status_closed = PhabricatorObjectHandle::STATUS_CLOSED; $strikethrough = $handle->getStatus() == $status_closed ? 'text-decoration: line-through;' : 'text-decoration: none;'; diff --git a/webroot/rsrc/css/application/base/standard-page-view.css b/webroot/rsrc/css/application/base/standard-page-view.css index 69725e14e6..5c33af7bcb 100644 --- a/webroot/rsrc/css/application/base/standard-page-view.css +++ b/webroot/rsrc/css/application/base/standard-page-view.css @@ -80,23 +80,23 @@ a.handle-status-closed:hover { color: #19558D; } -a.handle-disabled, -a.handle-status-away, -a.handle-status-sporadic { +a.handle-availability-disabled, +a.handle-availability-none, +a.handle-availability-partial { padding-left: 11px; background-repeat: no-repeat; background-position: -4px center; } -a.handle-status-away { +a.handle-availability-none { background-image: url(/rsrc/image/icon/fatcow/bullet_red.png); } -a.handle-status-sporadic { +a.handle-availability-partial { background-image: url(/rsrc/image/icon/fatcow/bullet_orange.png); } -a.handle-disabled { +a.handle-availability-disabled { background-image: url(/rsrc/image/icon/fatcow/bullet_black.png); } From fef3c778fd4560275787551ceeab8e61aa4ebe58 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 14 May 2015 11:15:04 -0700 Subject: [PATCH 04/86] Replace user "status" with "availability" Summary: Ref T7707. Ref T8183. - Currently, user status is derived by looking at events they //created//. Instead, look at non-cancelled invites they are attending. - Prepare for on-user caching. - Mostly remove "Sporradic" as a status, although I left room for adding more information later. Test Plan: - Called user.query. - Viewed profile. - Viewed hovercard. - Used mentions. - Saw status immediately update when attending/leaving/cancelling a current event. - Created an event ending at 6 PM and an event from 6:10PM - 7PM, saw "Away until 7PM". Reviewers: chad, btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8183, T7707 Differential Revision: https://secure.phabricator.com/D12833 --- resources/celerity/map.php | 4 +- .../storage/PhabricatorCalendarEvent.php | 12 --- .../PhabricatorCalendarEventInvitee.php | 4 + .../people/conduit/UserConduitAPIMethod.php | 13 +-- .../conduit/UserQueryConduitAPIMethod.php | 10 +- .../PhabricatorPeopleProfileController.php | 1 + .../PhabricatorUserStatusField.php | 11 +-- ...habricatorPeopleHovercardEventListener.php | 38 +++----- .../markup/PhabricatorMentionRemarkupRule.php | 19 +--- .../phid/PhabricatorPeopleUserPHIDType.php | 17 +--- .../people/query/PhabricatorPeopleQuery.php | 97 ++++++++++++++++--- .../people/storage/PhabricatorUser.php | 63 +++++++++--- .../css/layout/phabricator-hovercard-view.css | 1 + 13 files changed, 173 insertions(+), 117 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 0372651ba5..36b773434a 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -117,7 +117,7 @@ return array( 'rsrc/css/font/font-source-sans-pro.css' => '8906c07b', 'rsrc/css/font/phui-font-icon-base.css' => '3dad2ae3', 'rsrc/css/layout/phabricator-filetree-view.css' => 'fccf9f82', - 'rsrc/css/layout/phabricator-hovercard-view.css' => '44394670', + 'rsrc/css/layout/phabricator-hovercard-view.css' => 'dd9121a9', 'rsrc/css/layout/phabricator-side-menu-view.css' => 'c1db9e9c', 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/phui/calendar/phui-calendar-day.css' => '38891735', @@ -713,7 +713,7 @@ return array( 'phabricator-filetree-view-css' => 'fccf9f82', 'phabricator-flag-css' => '5337623f', 'phabricator-hovercard' => '14ac66f5', - 'phabricator-hovercard-view-css' => '44394670', + 'phabricator-hovercard-view-css' => 'dd9121a9', 'phabricator-keyboard-shortcut' => '1ae869f2', 'phabricator-keyboard-shortcut-manager' => 'c1700f6f', 'phabricator-main-menu-view' => '663e3810', diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php index 3dd984ef7d..c476911ff3 100644 --- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php @@ -218,18 +218,6 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO } } - public function loadCurrentStatuses($user_phids) { - if (!$user_phids) { - return array(); - } - - $statuses = $this->loadAllWhere( - 'userPHID IN (%Ls) AND UNIX_TIMESTAMP() BETWEEN dateFrom AND dateTo', - $user_phids); - - return mpull($statuses, null, 'getUserPHID'); - } - public function getInvitees() { return $this->assertAttached($this->invitees); } diff --git a/src/applications/calendar/storage/PhabricatorCalendarEventInvitee.php b/src/applications/calendar/storage/PhabricatorCalendarEventInvitee.php index 9701a782e7..b1d2b2d34c 100644 --- a/src/applications/calendar/storage/PhabricatorCalendarEventInvitee.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEventInvitee.php @@ -38,6 +38,10 @@ final class PhabricatorCalendarEventInvitee extends PhabricatorCalendarDAO ) + parent::getConfiguration(); } + public function isAttending() { + return ($this->getStatus() == self::STATUS_ATTENDING); + } + public function isUninvited() { if ($this->getStatus() == self::STATUS_UNINVITED) { return true; diff --git a/src/applications/people/conduit/UserConduitAPIMethod.php b/src/applications/people/conduit/UserConduitAPIMethod.php index 7a30ee84dd..82da171f43 100644 --- a/src/applications/people/conduit/UserConduitAPIMethod.php +++ b/src/applications/people/conduit/UserConduitAPIMethod.php @@ -6,9 +6,7 @@ abstract class UserConduitAPIMethod extends ConduitAPIMethod { return PhabricatorApplication::getByClass('PhabricatorPeopleApplication'); } - protected function buildUserInformationDictionary( - PhabricatorUser $user, - PhabricatorCalendarEvent $current_status = null) { + protected function buildUserInformationDictionary(PhabricatorUser $user) { $roles = array(); if ($user->getIsDisabled()) { @@ -48,9 +46,12 @@ abstract class UserConduitAPIMethod extends ConduitAPIMethod { 'roles' => $roles, ); - if ($current_status) { - $return['currentStatus'] = $current_status->getTextStatus(); - $return['currentStatusUntil'] = $current_status->getDateTo(); + // TODO: Modernize this once we have a more long-term view of what the + // data looks like. + $until = $user->getAwayUntil(); + if ($until) { + $return['currentStatus'] = 'away'; + $return['currentStatusUntil'] = $until; } return $return; diff --git a/src/applications/people/conduit/UserQueryConduitAPIMethod.php b/src/applications/people/conduit/UserQueryConduitAPIMethod.php index 5c81fd5d4f..c480ae0c73 100644 --- a/src/applications/people/conduit/UserQueryConduitAPIMethod.php +++ b/src/applications/people/conduit/UserQueryConduitAPIMethod.php @@ -43,7 +43,8 @@ final class UserQueryConduitAPIMethod extends UserConduitAPIMethod { $query = id(new PhabricatorPeopleQuery()) ->setViewer($request->getUser()) - ->needProfileImage(true); + ->needProfileImage(true) + ->needAvailability(true); if ($usernames) { $query->withUsernames($usernames); @@ -68,14 +69,9 @@ final class UserQueryConduitAPIMethod extends UserConduitAPIMethod { } $users = $query->execute(); - $statuses = id(new PhabricatorCalendarEvent())->loadCurrentStatuses( - mpull($users, 'getPHID')); - $results = array(); foreach ($users as $user) { - $results[] = $this->buildUserInformationDictionary( - $user, - idx($statuses, $user->getPHID())); + $results[] = $this->buildUserInformationDictionary($user); } return $results; } diff --git a/src/applications/people/controller/PhabricatorPeopleProfileController.php b/src/applications/people/controller/PhabricatorPeopleProfileController.php index 688d798fbf..8404e56d91 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileController.php @@ -20,6 +20,7 @@ final class PhabricatorPeopleProfileController ->setViewer($viewer) ->withUsernames(array($this->username)) ->needProfileImage(true) + ->needAvailability(true) ->executeOne(); if (!$user) { return new Aphront404Response(); diff --git a/src/applications/people/customfield/PhabricatorUserStatusField.php b/src/applications/people/customfield/PhabricatorUserStatusField.php index 9ff97054c3..69e16d83db 100644 --- a/src/applications/people/customfield/PhabricatorUserStatusField.php +++ b/src/applications/people/customfield/PhabricatorUserStatusField.php @@ -29,16 +29,7 @@ final class PhabricatorUserStatusField public function renderPropertyViewValue(array $handles) { $user = $this->getObject(); $viewer = $this->requireViewer(); - - $statuses = id(new PhabricatorCalendarEvent()) - ->loadCurrentStatuses(array($user->getPHID())); - if (!$statuses) { - return pht('Available'); - } - - $status = head($statuses); - - return $status->getTerseSummary($viewer); + return $user->getAvailabilityDescription($viewer); } } diff --git a/src/applications/people/event/PhabricatorPeopleHovercardEventListener.php b/src/applications/people/event/PhabricatorPeopleHovercardEventListener.php index 3bb955cf42..f2b957f363 100644 --- a/src/applications/people/event/PhabricatorPeopleHovercardEventListener.php +++ b/src/applications/people/event/PhabricatorPeopleHovercardEventListener.php @@ -26,12 +26,15 @@ final class PhabricatorPeopleHovercardEventListener return; } - $profile = $user->loadUserProfile(); + // Reload to get availability. + $user = id(new PhabricatorPeopleQuery()) + ->setViewer($viewer) + ->withIDs(array($user->getID())) + ->needAvailability(true) + ->executeOne(); $hovercard->setTitle($user->getUsername()); - $hovercard->setDetail(pht('%s - %s.', $user->getRealname(), - nonempty($profile->getTitle(), - pht('No title was found befitting of this rare specimen')))); + $hovercard->setDetail($user->getRealName()); if ($user->getIsDisabled()) { $hovercard->addField(pht('Account'), pht('Disabled')); @@ -40,29 +43,14 @@ final class PhabricatorPeopleHovercardEventListener } else if (PhabricatorApplication::isClassInstalledForViewer( 'PhabricatorCalendarApplication', $viewer)) { - $statuses = id(new PhabricatorCalendarEvent())->loadCurrentStatuses( - array($user->getPHID())); - if ($statuses) { - $current_status = reset($statuses); - $dateto = phabricator_datetime($current_status->getDateTo(), $user); - $hovercard->addField(pht('Status'), - $current_status->getDescription()); - $hovercard->addField(pht('Until'), - $dateto); - } else { - $hovercard->addField(pht('Status'), pht('Available')); - } + $hovercard->addField( + pht('Status'), + $user->getAvailabilityDescription($viewer)); } - $hovercard->addField(pht('User since'), - phabricator_date($user->getDateCreated(), $user)); - - if ($profile->getBlurb()) { - $hovercard->addField(pht('Blurb'), - id(new PhutilUTF8StringTruncator()) - ->setMaximumGlyphs(120) - ->truncateString($profile->getBlurb())); - } + $hovercard->addField( + pht('User Since'), + phabricator_date($user->getDateCreated(), $viewer)); $event->setValue('hovercard', $hovercard); } diff --git a/src/applications/people/markup/PhabricatorMentionRemarkupRule.php b/src/applications/people/markup/PhabricatorMentionRemarkupRule.php index 0451e29312..eb224aae48 100644 --- a/src/applications/people/markup/PhabricatorMentionRemarkupRule.php +++ b/src/applications/people/markup/PhabricatorMentionRemarkupRule.php @@ -72,16 +72,9 @@ final class PhabricatorMentionRemarkupRule extends PhutilRemarkupRule { $users = id(new PhabricatorPeopleQuery()) ->setViewer($this->getEngine()->getConfig('viewer')) ->withUsernames($usernames) + ->needAvailability(true) ->execute(); - if ($users) { - $user_statuses = id(new PhabricatorCalendarEvent()) - ->loadCurrentStatuses(mpull($users, 'getPHID')); - $user_statuses = mpull($user_statuses, null, 'getUserPHID'); - } else { - $user_statuses = array(); - } - $actual_users = array(); $mentioned_key = self::KEY_MENTIONED; @@ -156,14 +149,8 @@ final class PhabricatorMentionRemarkupRule extends PhutilRemarkupRule { if (!$user->isUserActivated()) { $tag->setDotColor(PHUITagView::COLOR_GREY); } else { - $status = idx($user_statuses, $user->getPHID()); - if ($status) { - $status = $status->getStatus(); - if ($status == PhabricatorCalendarEvent::STATUS_AWAY) { - $tag->setDotColor(PHUITagView::COLOR_RED); - } else if ($status == PhabricatorCalendarEvent::STATUS_AWAY) { - $tag->setDotColor(PHUITagView::COLOR_ORANGE); - } + if ($user->getAwayUntil()) { + $tag->setDotColor(PHUITagView::COLOR_RED); } } } diff --git a/src/applications/people/phid/PhabricatorPeopleUserPHIDType.php b/src/applications/people/phid/PhabricatorPeopleUserPHIDType.php index 16453987c9..ba271e6d92 100644 --- a/src/applications/people/phid/PhabricatorPeopleUserPHIDType.php +++ b/src/applications/people/phid/PhabricatorPeopleUserPHIDType.php @@ -27,7 +27,7 @@ final class PhabricatorPeopleUserPHIDType extends PhabricatorPHIDType { return id(new PhabricatorPeopleQuery()) ->withPHIDs($phids) ->needProfileImage(true) - ->needStatus(true); + ->needAvailability(true); } public function loadHandles( @@ -48,18 +48,9 @@ final class PhabricatorPeopleUserPHIDType extends PhabricatorPHIDType { if (!$user->isUserActivated()) { $availability = PhabricatorObjectHandle::AVAILABILITY_DISABLED; } else { - if ($user->hasStatus()) { - // NOTE: This first call returns an event; then we get the event - // status. - $status = $user->getStatus()->getStatus(); - switch ($status) { - case PhabricatorCalendarEvent::STATUS_AWAY: - $availability = PhabricatorObjectHandle::AVAILABILITY_NONE; - break; - case PhabricatorCalendarEvent::STATUS_SPORADIC: - $availability = PhabricatorObjectHandle::AVAILABILITY_PARTIAL; - break; - } + $until = $user->getAwayUntil(); + if ($until) { + $availability = PhabricatorObjectHandle::AVAILABILITY_NONE; } } diff --git a/src/applications/people/query/PhabricatorPeopleQuery.php b/src/applications/people/query/PhabricatorPeopleQuery.php index b8b7ad1e29..2bcb62c2bb 100644 --- a/src/applications/people/query/PhabricatorPeopleQuery.php +++ b/src/applications/people/query/PhabricatorPeopleQuery.php @@ -20,7 +20,7 @@ final class PhabricatorPeopleQuery private $needPrimaryEmail; private $needProfile; private $needProfileImage; - private $needStatus; + private $needAvailability; public function withIDs(array $ids) { $this->ids = $ids; @@ -102,8 +102,8 @@ final class PhabricatorPeopleQuery return $this; } - public function needStatus($need) { - $this->needStatus = $need; + public function needAvailability($need) { + $this->needAvailability = $need; return $this; } @@ -200,15 +200,11 @@ final class PhabricatorPeopleQuery } } - if ($this->needStatus) { - $user_list = mpull($users, null, 'getPHID'); - $statuses = id(new PhabricatorCalendarEvent())->loadCurrentStatuses( - array_keys($user_list)); - foreach ($user_list as $phid => $user) { - $status = idx($statuses, $phid); - if ($status) { - $user->attachStatus($status); - } + if ($this->needAvailability) { + // TODO: Add caching. + $rebuild = $users; + if ($rebuild) { + $this->rebuildAvailabilityCache($rebuild); } } @@ -375,5 +371,82 @@ final class PhabricatorPeopleQuery ); } + private function rebuildAvailabilityCache(array $rebuild) { + $rebuild = mpull($rebuild, null, 'getPHID'); + + // Limit the window we look at because far-future events are largely + // irrelevant and this makes the cache cheaper to build and allows it to + // self-heal over time. + $min_range = PhabricatorTime::getNow(); + $max_range = $min_range + phutil_units('72 hours in seconds'); + + $events = id(new PhabricatorCalendarEventQuery()) + ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->withInvitedPHIDs(array_keys($rebuild)) + ->withIsCancelled(false) + ->withDateRange($min_range, $max_range) + ->execute(); + + // Group all the events by invited user. Only examine events that users + // are actually attending. + $map = array(); + foreach ($events as $event) { + foreach ($event->getInvitees() as $invitee) { + if (!$invitee->isAttending()) { + continue; + } + + $invitee_phid = $invitee->getInviteePHID(); + if (!isset($rebuild[$invitee_phid])) { + continue; + } + + $map[$invitee_phid][] = $event; + } + } + + // Margin between meetings: pretend meetings start earlier than they do + // so we mark you away for the entire time if you have a series of + // back-to-back meetings, even if they don't strictly overlap. + $margin = phutil_units('15 minutes in seconds'); + + foreach ($rebuild as $phid => $user) { + $events = idx($map, $phid, array()); + + $cursor = $min_range; + if ($events) { + // Find the next time when the user has no meetings. If we move forward + // because of an event, we check again for events after that one ends. + while (true) { + foreach ($events as $event) { + $from = ($event->getDateFrom() - $margin); + $to = $event->getDateTo(); + if (($from <= $cursor) && ($to > $cursor)) { + $cursor = $to; + continue 2; + } + } + break; + } + } + + if ($cursor > $min_range) { + $availability = array( + 'until' => $cursor, + ); + $availability_ttl = $cursor; + } else { + $availability = null; + $availability_ttl = $max_range; + } + + // Never TTL the cache to longer than the maximum range we examined. + $availability_ttl = min($availability_ttl, $max_range); + + // TODO: Write the cache. + + $user->attachAvailability($availability); + } + } } diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php index 3fbfac062f..89de29747b 100644 --- a/src/applications/people/storage/PhabricatorUser.php +++ b/src/applications/people/storage/PhabricatorUser.php @@ -1,6 +1,7 @@ status = $status; - return $this; - } - - public function getStatus() { - return $this->assertAttached($this->status); - } - - public function hasStatus() { - return $this->status !== self::ATTACHABLE; - } - public function attachProfileImageURI($uri) { $this->profileImage = $uri; return $this; @@ -727,6 +715,53 @@ EOBODY; } +/* -( Availability )------------------------------------------------------- */ + + + /** + * @task availability + */ + public function attachAvailability($availability) { + $this->availability = $availability; + return $this; + } + + + /** + * Get the timestamp the user is away until, if they are currently away. + * + * @return int|null Epoch timestamp, or `null` if the user is not away. + * @task availability + */ + public function getAwayUntil() { + $availability = $this->availability; + + $this->assertAttached($availability); + if (!$availability) { + return null; + } + + return idx($availability, 'until'); + } + + + /** + * Describe the user's availability. + * + * @param PhabricatorUser Viewing user. + * @return string Human-readable description of away status. + * @task availability + */ + public function getAvailabilityDescription(PhabricatorUser $viewer) { + $until = $this->getAwayUntil(); + if ($until) { + return pht('Away until %s', phabricator_datetime($until, $viewer)); + } else { + return pht('Available'); + } + } + + /* -( Profile Image Cache )------------------------------------------------ */ diff --git a/webroot/rsrc/css/layout/phabricator-hovercard-view.css b/webroot/rsrc/css/layout/phabricator-hovercard-view.css index 05d520fb97..54cd365019 100644 --- a/webroot/rsrc/css/layout/phabricator-hovercard-view.css +++ b/webroot/rsrc/css/layout/phabricator-hovercard-view.css @@ -77,6 +77,7 @@ height: 50px; background-position: center; background-repeat: no-repeat; + background-size: 100%; } .phabricator-hovercard-tail { width: 396px; From aa550189c7886faeae87fd244b8c485511a15a6d Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 14 May 2015 11:15:22 -0700 Subject: [PATCH 05/86] Add an availability cache for users Summary: Ref T7707. Caches availability on users to reduce the cost of loading handles. This cache is very slightly tricky to dirty properly. Test Plan: - Use DarkConsole to examine queries; saw cache hits, miss+fill, dirty. - Saw availability change correctly after canceling, joining, declining events. - Saw no queries to Calendar for pages with only availability data. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7707 Differential Revision: https://secure.phabricator.com/D12838 --- .../sql/autopatches/20150514.user.cache.2.sql | 5 ++ .../editor/PhabricatorCalendarEventEditor.php | 58 +++++++++++++++---- .../storage/PhabricatorCalendarEvent.php | 13 +++++ .../people/query/PhabricatorPeopleQuery.php | 26 +++++---- .../people/storage/PhabricatorUser.php | 52 ++++++++++++++++- 5 files changed, 132 insertions(+), 22 deletions(-) create mode 100644 resources/sql/autopatches/20150514.user.cache.2.sql diff --git a/resources/sql/autopatches/20150514.user.cache.2.sql b/resources/sql/autopatches/20150514.user.cache.2.sql new file mode 100644 index 0000000000..fc53324dc3 --- /dev/null +++ b/resources/sql/autopatches/20150514.user.cache.2.sql @@ -0,0 +1,5 @@ +ALTER TABLE {$NAMESPACE}_user.user + ADD availabilityCache VARCHAR(255) COLLATE {$COLLATE_TEXT}; + +ALTER TABLE {$NAMESPACE}_user.user + ADD availabilityCacheTTL INT UNSIGNED; diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php index 6e80d19236..947098ff28 100644 --- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php +++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php @@ -55,16 +55,7 @@ final class PhabricatorCalendarEventEditor case PhabricatorCalendarEventTransaction::TYPE_INVITE: $map = $xaction->getNewValue(); $phids = array_keys($map); - $invitees = array(); - - if ($map && !$this->getIsNewObject()) { - $invitees = id(new PhabricatorCalendarEventInviteeQuery()) - ->setViewer($this->getActor()) - ->withEventPHIDs(array($object->getPHID())) - ->withInviteePHIDs($phids) - ->execute(); - $invitees = mpull($invitees, null, 'getInviteePHID'); - } + $invitees = mpull($object->getInvitees(), null, 'getInviteePHID'); $old = array(); foreach ($phids as $phid) { @@ -193,6 +184,53 @@ final class PhabricatorCalendarEventEditor return $xactions; } + protected function applyFinalEffects($object, array $xactions) { + + // Clear the availability caches for users whose availability is affected + // by this edit. + + $invalidate_all = false; + $invalidate_phids = array(); + foreach ($xactions as $xaction) { + switch ($xaction->getTransactionType()) { + case PhabricatorCalendarEventTransaction::TYPE_START_DATE: + case PhabricatorCalendarEventTransaction::TYPE_END_DATE: + case PhabricatorCalendarEventTransaction::TYPE_CANCEL: + case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY: + // For these kinds of changes, we need to invalidate the availabilty + // caches for all attendees. + $invalidate_all = true; + break; + case PhabricatorCalendarEventTransaction::TYPE_INVITE: + foreach ($xaction->getNewValue() as $phid => $ignored) { + $invalidate_phids[$phid] = $phid; + } + break; + } + } + + $phids = mpull($object->getInvitees(), 'getInviteePHID'); + $phids = array_fuse($phids); + + if (!$invalidate_all) { + $phids = array_select_keys($phids, $invalidate_phids); + } + + if ($phids) { + $user = new PhabricatorUser(); + $conn_w = $user->establishConnection('w'); + queryfx( + $conn_w, + 'UPDATE %T SET availabilityCacheTTL = NULL + WHERE phid IN (%Ls) AND availabilityCacheTTL >= %d', + $user->getTableName(), + $phids, + $object->getDateFromForCache()); + } + + return $xactions; + } + protected function validateAllTransactions( PhabricatorLiskDAO $object, diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php index c476911ff3..d68c207371 100644 --- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php @@ -147,6 +147,19 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO return parent::save(); } + /** + * Get the event start epoch for evaluating invitee availability. + * + * When assessing availability, we pretend events start earlier than they + * really. This allows us to mark users away for the entire duration of a + * series of back-to-back meetings, even if they don't strictly overlap. + * + * @return int Event start date for availability caches. + */ + public function getDateFromForCache() { + return ($this->getDateFrom() - phutil_units('15 minutes in seconds')); + } + private static $statusTexts = array( self::STATUS_AWAY => 'away', self::STATUS_SPORADIC => 'sporadic', diff --git a/src/applications/people/query/PhabricatorPeopleQuery.php b/src/applications/people/query/PhabricatorPeopleQuery.php index 2bcb62c2bb..1b4c7c5450 100644 --- a/src/applications/people/query/PhabricatorPeopleQuery.php +++ b/src/applications/people/query/PhabricatorPeopleQuery.php @@ -201,8 +201,16 @@ final class PhabricatorPeopleQuery } if ($this->needAvailability) { - // TODO: Add caching. - $rebuild = $users; + $rebuild = array(); + foreach ($users as $user) { + $cache = $user->getAvailabilityCache(); + if ($cache !== null) { + $user->attachAvailability($cache); + } else { + $rebuild[] = $user; + } + } + if ($rebuild) { $this->rebuildAvailabilityCache($rebuild); } @@ -405,11 +413,6 @@ final class PhabricatorPeopleQuery } } - // Margin between meetings: pretend meetings start earlier than they do - // so we mark you away for the entire time if you have a series of - // back-to-back meetings, even if they don't strictly overlap. - $margin = phutil_units('15 minutes in seconds'); - foreach ($rebuild as $phid => $user) { $events = idx($map, $phid, array()); @@ -419,7 +422,7 @@ final class PhabricatorPeopleQuery // because of an event, we check again for events after that one ends. while (true) { foreach ($events as $event) { - $from = ($event->getDateFrom() - $margin); + $from = $event->getDateFromForCache(); $to = $event->getDateTo(); if (($from <= $cursor) && ($to > $cursor)) { $cursor = $to; @@ -436,15 +439,16 @@ final class PhabricatorPeopleQuery ); $availability_ttl = $cursor; } else { - $availability = null; + $availability = array( + 'until' => null, + ); $availability_ttl = $max_range; } // Never TTL the cache to longer than the maximum range we examined. $availability_ttl = min($availability_ttl, $max_range); - // TODO: Write the cache. - + $user->writeAvailabilityCache($availability, $availability_ttl); $user->attachAvailability($availability); } } diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php index 89de29747b..0c7ef73b0e 100644 --- a/src/applications/people/storage/PhabricatorUser.php +++ b/src/applications/people/storage/PhabricatorUser.php @@ -27,6 +27,8 @@ final class PhabricatorUser protected $passwordHash; protected $profileImagePHID; protected $profileImageCache; + protected $availabilityCache; + protected $availabilityCacheTTL; protected $timezoneIdentifier = ''; protected $consoleEnabled = 0; @@ -146,6 +148,8 @@ final class PhabricatorUser 'accountSecret' => 'bytes64', 'isEnrolledInMultiFactor' => 'bool', 'profileImageCache' => 'text255?', + 'availabilityCache' => 'text255?', + 'availabilityCacheTTL' => 'uint32?', ), self::CONFIG_KEY_SCHEMA => array( 'key_phid' => null, @@ -166,6 +170,8 @@ final class PhabricatorUser ), self::CONFIG_NO_MUTATE => array( 'profileImageCache' => true, + 'availabilityCache' => true, + 'availabilityCacheTTL' => true, ), ) + parent::getConfiguration(); } @@ -721,7 +727,7 @@ EOBODY; /** * @task availability */ - public function attachAvailability($availability) { + public function attachAvailability(array $availability) { $this->availability = $availability; return $this; } @@ -762,6 +768,50 @@ EOBODY; } + /** + * Get cached availability, if present. + * + * @return wild|null Cache data, or null if no cache is available. + * @task availability + */ + public function getAvailabilityCache() { + $now = PhabricatorTime::getNow(); + if ($this->availabilityCacheTTL <= $now) { + return null; + } + + try { + return phutil_json_decode($this->availabilityCache); + } catch (Exception $ex) { + return null; + } + } + + + /** + * Write to the availability cache. + * + * @param wild Availability cache data. + * @param int|null Cache TTL. + * @return this + * @task availability + */ + public function writeAvailabilityCache(array $availability, $ttl) { + $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); + queryfx( + $this->establishConnection('w'), + 'UPDATE %T SET availabilityCache = %s, availabilityCacheTTL = %nd + WHERE id = %d', + $this->getTableName(), + json_encode($availability), + $ttl, + $this->getID()); + unset($unguarded); + + return $this; + } + + /* -( Profile Image Cache )------------------------------------------------ */ From 2bc9dec85f038c99788eb2a2c23de0285441505d Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 14 May 2015 11:15:44 -0700 Subject: [PATCH 06/86] Remove "status" field from events Summary: Ref T8183. See that task for discussion. - For now, events always mark users as "Away". - In the future, we may reintroduce "sporradic" or other more complicated availability states, but they would be properties of the invitee, not of the event itself. - This also removes the long-deprecated `user.addstatus` and `user.removestatus` Conduit calls. Test Plan: - Created, edited, viewed events. - Grepped for removed symbols. - Viewed profile calendar. - Viewed Conpherence calendar. - Load Conduit console. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8183 Differential Revision: https://secure.phabricator.com/D12840 --- .../autopatches/20150514.calendar.status.sql | 2 + src/__phutil_library_map__.php | 4 - ...PhabricatorCalendarEventEditController.php | 14 --- .../editor/PhabricatorCalendarEventEditor.php | 17 +--- .../storage/PhabricatorCalendarEvent.php | 46 ---------- .../PhabricatorCalendarEventTransaction.php | 23 ----- .../ConpherenceWidgetController.php | 14 +-- .../query/ConpherenceThreadQuery.php | 41 ++++++--- .../conduit/UserAddStatusConduitAPIMethod.php | 62 -------------- .../UserRemoveStatusConduitAPIMethod.php | 85 ------------------- 10 files changed, 43 insertions(+), 265 deletions(-) create mode 100644 resources/sql/autopatches/20150514.calendar.status.sql delete mode 100644 src/applications/people/conduit/UserAddStatusConduitAPIMethod.php delete mode 100644 src/applications/people/conduit/UserRemoveStatusConduitAPIMethod.php diff --git a/resources/sql/autopatches/20150514.calendar.status.sql b/resources/sql/autopatches/20150514.calendar.status.sql new file mode 100644 index 0000000000..984205d99e --- /dev/null +++ b/resources/sql/autopatches/20150514.calendar.status.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_calendar.calendar_event + DROP status; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 638674126b..903aaf8a44 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -3200,13 +3200,11 @@ phutil_register_library_map(array( 'TokenGiveConduitAPIMethod' => 'applications/tokens/conduit/TokenGiveConduitAPIMethod.php', 'TokenGivenConduitAPIMethod' => 'applications/tokens/conduit/TokenGivenConduitAPIMethod.php', 'TokenQueryConduitAPIMethod' => 'applications/tokens/conduit/TokenQueryConduitAPIMethod.php', - 'UserAddStatusConduitAPIMethod' => 'applications/people/conduit/UserAddStatusConduitAPIMethod.php', 'UserConduitAPIMethod' => 'applications/people/conduit/UserConduitAPIMethod.php', 'UserDisableConduitAPIMethod' => 'applications/people/conduit/UserDisableConduitAPIMethod.php', 'UserEnableConduitAPIMethod' => 'applications/people/conduit/UserEnableConduitAPIMethod.php', 'UserFindConduitAPIMethod' => 'applications/people/conduit/UserFindConduitAPIMethod.php', 'UserQueryConduitAPIMethod' => 'applications/people/conduit/UserQueryConduitAPIMethod.php', - 'UserRemoveStatusConduitAPIMethod' => 'applications/people/conduit/UserRemoveStatusConduitAPIMethod.php', 'UserWhoAmIConduitAPIMethod' => 'applications/people/conduit/UserWhoAmIConduitAPIMethod.php', ), 'function' => array( @@ -6781,13 +6779,11 @@ phutil_register_library_map(array( 'TokenGiveConduitAPIMethod' => 'TokenConduitAPIMethod', 'TokenGivenConduitAPIMethod' => 'TokenConduitAPIMethod', 'TokenQueryConduitAPIMethod' => 'TokenConduitAPIMethod', - 'UserAddStatusConduitAPIMethod' => 'UserConduitAPIMethod', 'UserConduitAPIMethod' => 'ConduitAPIMethod', 'UserDisableConduitAPIMethod' => 'UserConduitAPIMethod', 'UserEnableConduitAPIMethod' => 'UserConduitAPIMethod', 'UserFindConduitAPIMethod' => 'UserConduitAPIMethod', 'UserQueryConduitAPIMethod' => 'UserConduitAPIMethod', - 'UserRemoveStatusConduitAPIMethod' => 'UserConduitAPIMethod', 'UserWhoAmIConduitAPIMethod' => 'UserConduitAPIMethod', ), )); diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php index e31b9bdf0e..900b3ad56b 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php @@ -73,7 +73,6 @@ final class PhabricatorCalendarEventEditController $name = $event->getName(); $description = $event->getDescription(); - $type = $event->getStatus(); $is_all_day = $event->getIsAllDay(); $current_policies = id(new PhabricatorPolicyQuery()) @@ -84,7 +83,6 @@ final class PhabricatorCalendarEventEditController if ($request->isFormPost()) { $xactions = array(); $name = $request->getStr('name'); - $type = $request->getInt('status'); $start_value = AphrontFormDateControlValue::newFromRequest( $request, @@ -128,11 +126,6 @@ final class PhabricatorCalendarEventEditController PhabricatorCalendarEventTransaction::TYPE_END_DATE) ->setNewValue($end_value); - $xactions[] = id(new PhabricatorCalendarEventTransaction()) - ->setTransactionType( - PhabricatorCalendarEventTransaction::TYPE_STATUS) - ->setNewValue($type); - $xactions[] = id(new PhabricatorCalendarEventTransaction()) ->setTransactionType( PhabricatorTransactions::TYPE_SUBSCRIBERS) @@ -195,12 +188,6 @@ final class PhabricatorCalendarEventEditController ->setValue($name) ->setError($error_name); - $status_select = id(new AphrontFormSelectControl()) - ->setLabel(pht('Status')) - ->setName('status') - ->setValue($type) - ->setOptions($event->getStatusOptions()); - $all_day_checkbox = id(new AphrontFormCheckboxControl()) ->addCheckbox( 'isAllDay', @@ -262,7 +249,6 @@ final class PhabricatorCalendarEventEditController $form = id(new AphrontFormView()) ->setUser($user) ->appendChild($name) - ->appendChild($status_select) ->appendChild($all_day_checkbox) ->appendChild($start_control) ->appendChild($end_control) diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php index 947098ff28..727c33958f 100644 --- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php +++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php @@ -17,7 +17,6 @@ final class PhabricatorCalendarEventEditor $types[] = PhabricatorCalendarEventTransaction::TYPE_NAME; $types[] = PhabricatorCalendarEventTransaction::TYPE_START_DATE; $types[] = PhabricatorCalendarEventTransaction::TYPE_END_DATE; - $types[] = PhabricatorCalendarEventTransaction::TYPE_STATUS; $types[] = PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION; $types[] = PhabricatorCalendarEventTransaction::TYPE_CANCEL; $types[] = PhabricatorCalendarEventTransaction::TYPE_INVITE; @@ -40,12 +39,6 @@ final class PhabricatorCalendarEventEditor return $object->getDateFrom(); case PhabricatorCalendarEventTransaction::TYPE_END_DATE: return $object->getDateTo(); - case PhabricatorCalendarEventTransaction::TYPE_STATUS: - $status = $object->getStatus(); - if ($status === null) { - return null; - } - return (int)$status; case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION: return $object->getDescription(); case PhabricatorCalendarEventTransaction::TYPE_CANCEL: @@ -83,8 +76,6 @@ final class PhabricatorCalendarEventEditor return $xaction->getNewValue(); case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY: return (int)$xaction->getNewValue(); - case PhabricatorCalendarEventTransaction::TYPE_STATUS: - return (int)$xaction->getNewValue(); case PhabricatorCalendarEventTransaction::TYPE_START_DATE: case PhabricatorCalendarEventTransaction::TYPE_END_DATE: return $xaction->getNewValue()->getEpoch(); @@ -107,9 +98,6 @@ final class PhabricatorCalendarEventEditor case PhabricatorCalendarEventTransaction::TYPE_END_DATE: $object->setDateTo($xaction->getNewValue()); return; - case PhabricatorCalendarEventTransaction::TYPE_STATUS: - $object->setStatus($xaction->getNewValue()); - return; case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION: $object->setDescription($xaction->getNewValue()); return; @@ -139,7 +127,6 @@ final class PhabricatorCalendarEventEditor case PhabricatorCalendarEventTransaction::TYPE_NAME: case PhabricatorCalendarEventTransaction::TYPE_START_DATE: case PhabricatorCalendarEventTransaction::TYPE_END_DATE: - case PhabricatorCalendarEventTransaction::TYPE_STATUS: case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION: case PhabricatorCalendarEventTransaction::TYPE_CANCEL: case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY: @@ -184,7 +171,9 @@ final class PhabricatorCalendarEventEditor return $xactions; } - protected function applyFinalEffects($object, array $xactions) { + protected function applyFinalEffects( + PhabricatorLiskDAO $object, + array $xactions) { // Clear the availability caches for users whose availability is affected // by this edit. diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php index d68c207371..044bc9fc78 100644 --- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php @@ -14,7 +14,6 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO protected $userPHID; protected $dateFrom; protected $dateTo; - protected $status; protected $description; protected $isCancelled; protected $isAllDay; @@ -26,9 +25,6 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO private $invitees = self::ATTACHABLE; private $appliedViewer; - const STATUS_AWAY = 1; - const STATUS_SPORADIC = 2; - public static function initializeNewCalendarEvent(PhabricatorUser $actor) { $app = id(new PhabricatorApplicationQuery()) ->setViewer($actor) @@ -160,27 +156,6 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO return ($this->getDateFrom() - phutil_units('15 minutes in seconds')); } - private static $statusTexts = array( - self::STATUS_AWAY => 'away', - self::STATUS_SPORADIC => 'sporadic', - ); - - public function setTextStatus($status) { - $statuses = array_flip(self::$statusTexts); - return $this->setStatus($statuses[$status]); - } - - public function getTextStatus() { - return self::$statusTexts[$this->status]; - } - - public function getStatusOptions() { - return array( - self::STATUS_AWAY => pht('Away'), - self::STATUS_SPORADIC => pht('Sporadic'), - ); - } - protected function getConfiguration() { return array( self::CONFIG_AUX_PHID => true, @@ -188,7 +163,6 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO 'name' => 'text', 'dateFrom' => 'epoch', 'dateTo' => 'epoch', - 'status' => 'uint32', 'description' => 'text', 'isCancelled' => 'bool', 'isAllDay' => 'bool', @@ -211,26 +185,6 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO return 'E'.$this->getID(); } - public function getTerseSummary(PhabricatorUser $viewer) { - $until = phabricator_date($this->dateTo, $viewer); - if ($this->status == self::STATUS_SPORADIC) { - return pht('Sporadic until %s', $until); - } else { - return pht('Away until %s', $until); - } - } - - public static function getNameForStatus($value) { - switch ($value) { - case self::STATUS_AWAY: - return pht('Away'); - case self::STATUS_SPORADIC: - return pht('Sporadic'); - default: - return pht('Unknown'); - } - } - public function getInvitees() { return $this->assertAttached($this->invitees); } diff --git a/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php b/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php index d3e7a25efd..91b5d5231f 100644 --- a/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php @@ -6,7 +6,6 @@ final class PhabricatorCalendarEventTransaction const TYPE_NAME = 'calendar.name'; const TYPE_START_DATE = 'calendar.startdate'; const TYPE_END_DATE = 'calendar.enddate'; - const TYPE_STATUS = 'calendar.status'; const TYPE_DESCRIPTION = 'calendar.description'; const TYPE_CANCEL = 'calendar.cancel'; const TYPE_ALL_DAY = 'calendar.allday'; @@ -35,7 +34,6 @@ final class PhabricatorCalendarEventTransaction case self::TYPE_NAME: case self::TYPE_START_DATE: case self::TYPE_END_DATE: - case self::TYPE_STATUS: case self::TYPE_DESCRIPTION: case self::TYPE_CANCEL: case self::TYPE_ALL_DAY: @@ -57,7 +55,6 @@ final class PhabricatorCalendarEventTransaction switch ($this->getTransactionType()) { case self::TYPE_START_DATE: case self::TYPE_END_DATE: - case self::TYPE_STATUS: case self::TYPE_DESCRIPTION: case self::TYPE_CANCEL: case self::TYPE_ALL_DAY: @@ -72,7 +69,6 @@ final class PhabricatorCalendarEventTransaction case self::TYPE_NAME: case self::TYPE_START_DATE: case self::TYPE_END_DATE: - case self::TYPE_STATUS: case self::TYPE_DESCRIPTION: case self::TYPE_ALL_DAY: case self::TYPE_CANCEL: @@ -120,14 +116,6 @@ final class PhabricatorCalendarEventTransaction $this->renderHandleLink($author_phid)); } break; - case self::TYPE_STATUS: - $old_name = PhabricatorCalendarEvent::getNameForStatus($old); - $new_name = PhabricatorCalendarEvent::getNameForStatus($new); - return pht( - '%s updated the event status from %s to %s.', - $this->renderHandleLink($author_phid), - $old_name, - $new_name); case self::TYPE_DESCRIPTION: return pht( "%s updated the event's description.", @@ -287,15 +275,6 @@ final class PhabricatorCalendarEventTransaction $new); } break; - case self::TYPE_STATUS: - $old_name = PhabricatorCalendarEvent::getNameForStatus($old); - $new_name = PhabricatorCalendarEvent::getNameForStatus($new); - return pht( - '%s updated the status of %s from %s to %s.', - $this->renderHandleLink($author_phid), - $this->renderHandleLink($object_phid), - $old_name, - $new_name); case self::TYPE_DESCRIPTION: return pht( '%s updated the description of %s.', @@ -430,7 +409,6 @@ final class PhabricatorCalendarEventTransaction case self::TYPE_NAME: case self::TYPE_START_DATE: case self::TYPE_END_DATE: - case self::TYPE_STATUS: case self::TYPE_DESCRIPTION: case self::TYPE_CANCEL: case self::TYPE_INVITE: @@ -469,7 +447,6 @@ final class PhabricatorCalendarEventTransaction $tags = array(); switch ($this->getTransactionType()) { case self::TYPE_NAME: - case self::TYPE_STATUS: case self::TYPE_DESCRIPTION: case self::TYPE_INVITE: $tags[] = self::MAILTAG_CONTENT; diff --git a/src/applications/conpherence/controller/ConpherenceWidgetController.php b/src/applications/conpherence/controller/ConpherenceWidgetController.php index 9a06f0dcf9..01a36f6ea1 100644 --- a/src/applications/conpherence/controller/ConpherenceWidgetController.php +++ b/src/applications/conpherence/controller/ConpherenceWidgetController.php @@ -218,7 +218,11 @@ final class ConpherenceWidgetController extends ConpherenceController { $conpherence = $this->getConpherence(); $participants = $conpherence->getParticipants(); $widget_data = $conpherence->getWidgetData(); - $statuses = $widget_data['statuses']; + + // TODO: This panel is built around an outdated notion of events and isn't + // invitee-aware. + + $statuses = $widget_data['events']; $handles = $conpherence->getHandles(); $content = array(); $layout = id(new AphrontMultiColumnView()) @@ -312,7 +316,7 @@ final class ConpherenceWidgetController extends ConpherenceController { $content[] = phutil_tag( 'div', array( - 'class' => 'user-status '.$status->getTextStatus().$top_border, + 'class' => 'user-status '.$top_border, ), array( phutil_tag( @@ -327,7 +331,7 @@ final class ConpherenceWidgetController extends ConpherenceController { 'class' => 'description', ), array( - $status->getTerseSummary($user), + $status->getName(), phutil_tag( 'div', array( @@ -359,9 +363,7 @@ final class ConpherenceWidgetController extends ConpherenceController { if ($status) { $inner_layout[] = phutil_tag( 'div', - array( - 'class' => $status->getTextStatus(), - ), + array(), ''); } else { $inner_layout[] = phutil_tag( diff --git a/src/applications/conpherence/query/ConpherenceThreadQuery.php b/src/applications/conpherence/query/ConpherenceThreadQuery.php index b17044ead0..1b311516f8 100644 --- a/src/applications/conpherence/query/ConpherenceThreadQuery.php +++ b/src/applications/conpherence/query/ConpherenceThreadQuery.php @@ -354,13 +354,25 @@ final class ConpherenceThreadQuery $this->getViewer()); $start_epoch = $epochs['start_epoch']; $end_epoch = $epochs['end_epoch']; - $statuses = id(new PhabricatorCalendarEventQuery()) - ->setViewer($this->getViewer()) - ->withInvitedPHIDs($participant_phids) - ->withDateRange($start_epoch, $end_epoch) - ->execute(); - $statuses = mgroup($statuses, 'getUserPHID'); + if ($participant_phids) { + $events = id(new PhabricatorCalendarEventQuery()) + ->setViewer($this->getViewer()) + ->withInvitedPHIDs($participant_phids) + ->withIsCancelled(false) + ->withDateRange($start_epoch, $end_epoch) + ->execute(); + $events = mpull($events, null, 'getPHID'); + } else { + $events = null; + } + + $invitees = array(); + foreach ($events as $event_phid => $event) { + foreach ($event->getInvitees() as $invitee) { + $invitees[$invitee->getInviteePHID()][$event_phid] = true; + } + } // attached files $files = array(); @@ -382,9 +394,16 @@ final class ConpherenceThreadQuery foreach ($conpherences as $phid => $conpherence) { $participant_phids = array_keys($conpherence->getParticipants()); - $statuses = array_select_keys($statuses, $participant_phids); - $statuses = array_mergev($statuses); - $statuses = msort($statuses, 'getDateFrom'); + $widget_data = array(); + + $event_phids = array(); + $participant_invites = array_select_keys($invitees, $participant_phids); + foreach ($participant_invites as $invite_set) { + $event_phids += $invite_set; + } + $thread_events = array_select_keys($events, array_keys($event_phids)); + $thread_events = msort($thread_events, 'getDateFrom'); + $widget_data['events'] = $thread_events; $conpherence_files = array(); $files_authors = array(); @@ -404,11 +423,11 @@ final class ConpherenceThreadQuery } $files_authors[$curr_phid] = $current_author; } - $widget_data = array( - 'statuses' => $statuses, + $widget_data += array( 'files' => $conpherence_files, 'files_authors' => $files_authors, ); + $conpherence->attachWidgetData($widget_data); } diff --git a/src/applications/people/conduit/UserAddStatusConduitAPIMethod.php b/src/applications/people/conduit/UserAddStatusConduitAPIMethod.php deleted file mode 100644 index 39403d9503..0000000000 --- a/src/applications/people/conduit/UserAddStatusConduitAPIMethod.php +++ /dev/null @@ -1,62 +0,0 @@ -formatStringConstants(array('away', 'sporadic')); - - return array( - 'fromEpoch' => 'required int', - 'toEpoch' => 'required int', - 'status' => 'required '.$status_const, - 'description' => 'optional string', - ); - } - - protected function defineReturnType() { - return 'void'; - } - - protected function defineErrorTypes() { - return array( - 'ERR-BAD-EPOCH' => "'toEpoch' must be bigger than 'fromEpoch'.", - 'ERR-OVERLAP' => - 'There must be no status in any part of the specified epoch.', - ); - } - - protected function execute(ConduitAPIRequest $request) { - $user_phid = $request->getUser()->getPHID(); - $from = $request->getValue('fromEpoch'); - $to = $request->getValue('toEpoch'); - $status = $request->getValue('status'); - $description = $request->getValue('description', ''); - - id(new PhabricatorCalendarEvent()) - ->setUserPHID($user_phid) - ->setDateFrom($from) - ->setDateTo($to) - ->setTextStatus($status) - ->setDescription($description) - ->save(); - } - -} diff --git a/src/applications/people/conduit/UserRemoveStatusConduitAPIMethod.php b/src/applications/people/conduit/UserRemoveStatusConduitAPIMethod.php deleted file mode 100644 index 9cb83db1c1..0000000000 --- a/src/applications/people/conduit/UserRemoveStatusConduitAPIMethod.php +++ /dev/null @@ -1,85 +0,0 @@ - 'required int', - 'toEpoch' => 'required int', - ); - } - - protected function defineReturnType() { - return 'int'; - } - - protected function defineErrorTypes() { - return array( - 'ERR-BAD-EPOCH' => "'toEpoch' must be bigger than 'fromEpoch'.", - ); - } - - protected function execute(ConduitAPIRequest $request) { - $user_phid = $request->getUser()->getPHID(); - $from = $request->getValue('fromEpoch'); - $to = $request->getValue('toEpoch'); - - if ($to <= $from) { - throw new ConduitException('ERR-BAD-EPOCH'); - } - - $table = new PhabricatorCalendarEvent(); - $table->openTransaction(); - $table->beginReadLocking(); - - $overlap = $table->loadAllWhere( - 'userPHID = %s AND dateFrom < %d AND dateTo > %d', - $user_phid, - $to, - $from); - foreach ($overlap as $status) { - if ($status->getDateFrom() < $from) { - if ($status->getDateTo() > $to) { - // Split the interval. - id(new PhabricatorCalendarEvent()) - ->setUserPHID($user_phid) - ->setDateFrom($to) - ->setDateTo($status->getDateTo()) - ->setStatus($status->getStatus()) - ->setDescription($status->getDescription()) - ->save(); - } - $status->setDateTo($from); - $status->save(); - } else if ($status->getDateTo() > $to) { - $status->setDateFrom($to); - $status->save(); - } else { - $status->delete(); - } - } - - $table->endReadLocking(); - $table->saveTransaction(); - return count($overlap); - } - -} From 87bf532c4146f7bd8c51a73712290f370993616d Mon Sep 17 00:00:00 2001 From: lkassianik Date: Thu, 14 May 2015 12:35:34 -0700 Subject: [PATCH 07/86] Calendar tooltips should always show start and end time of events. Summary: Closes T8191, Calendar tooltips should always show start and end time of events. Test Plan: Open month view, hover over, All day events, multi-day all day events, multi-day non-all-day events, and regular events. Tooltips should be "All day", "All day, - ", "-", and "-", respectively. Reviewers: epriestley, #blessed_reviewers, chad Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T8191 Differential Revision: https://secure.phabricator.com/D12846 --- resources/celerity/map.php | 4 +-- .../control/AphrontFormDateControlValue.php | 7 ++++ .../phui/calendar/PHUICalendarListView.php | 34 ++++++++++++++++--- .../css/phui/calendar/phui-calendar-month.css | 4 --- 4 files changed, 38 insertions(+), 11 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 36b773434a..2c92f74300 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -122,7 +122,7 @@ return array( 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/phui/calendar/phui-calendar-day.css' => '38891735', 'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1d0ca59', - 'rsrc/css/phui/calendar/phui-calendar-month.css' => '75e6a2ee', + 'rsrc/css/phui/calendar/phui-calendar-month.css' => 'e7ee38c6', 'rsrc/css/phui/calendar/phui-calendar.css' => '8675968e', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', @@ -763,7 +763,7 @@ return array( 'phui-calendar-css' => '8675968e', 'phui-calendar-day-css' => '38891735', 'phui-calendar-list-css' => 'c1d0ca59', - 'phui-calendar-month-css' => '75e6a2ee', + 'phui-calendar-month-css' => 'e7ee38c6', 'phui-crumbs-view-css' => '594d719e', 'phui-document-view-css' => '94d5dcd8', 'phui-feed-story-css' => 'c9f3a0b5', diff --git a/src/view/form/control/AphrontFormDateControlValue.php b/src/view/form/control/AphrontFormDateControlValue.php index 58a7b754b1..3fb6a07fb4 100644 --- a/src/view/form/control/AphrontFormDateControlValue.php +++ b/src/view/form/control/AphrontFormDateControlValue.php @@ -157,6 +157,13 @@ final class AphrontFormDateControlValue extends Phobject { ); } + public function getValueAsFormat($format) { + return phabricator_format_local_time( + $this->getEpoch(), + $this->viewer, + $format); + } + private function formatTime($epoch, $format) { return phabricator_format_local_time( $epoch, diff --git a/src/view/phui/calendar/PHUICalendarListView.php b/src/view/phui/calendar/PHUICalendarListView.php index fc40d87745..c2d33b8469 100644 --- a/src/view/phui/calendar/PHUICalendarListView.php +++ b/src/view/phui/calendar/PHUICalendarListView.php @@ -105,12 +105,36 @@ final class PHUICalendarListView extends AphrontTagView { Javelin::initBehavior('phabricator-tooltips'); - if ($event->getMultiDay()) { - $tip = pht('%s, Until: %s', $event->getName(), - phabricator_date($event->getEpochEnd(), $this->getUser())); + $start = id(AphrontFormDateControlValue::newFromEpoch( + $this->getUser(), + $event->getEpochStart())); + $end = id(AphrontFormDateControlValue::newFromEpoch( + $this->getUser(), + $event->getEpochEnd())); + + if ($event->getIsAllDay()) { + if ($start->getValueDay() == $end->getValueDay()) { + $tip = pht('All day'); + } else { + $tip = pht( + 'All day, %s - %s', + $start->getValueAsFormat('M j, Y'), + $end->getValueAsFormat('M j, Y')); + } } else { - $tip = pht('%s, Until: %s', $event->getName(), - phabricator_time($event->getEpochEnd(), $this->getUser())); + if ($start->getValueDay() == $end->getValueDay() && + $start->getValueMonth() == $end->getValueMonth() && + $start->getValueYear() == $end->getValueYear()) { + $tip = pht( + '%s - %s', + $start->getValueAsFormat('g:i A'), + $end->getValueAsFormat('g:i A')); + } else { + $tip = pht( + '%s - %s', + $start->getValueAsFormat('M j, Y, g:i A'), + $end->getValueAsFormat('M j, Y, g:i A')); + } } $description = $event->getDescription(); diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css index 3f53e89b25..284937f1a9 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css @@ -88,10 +88,6 @@ table.phui-calendar-view td.phui-calendar-date-number-container { text-align: right; } -.phui-calendar-not-work-day { - background-color: {$lightgreybackground}; -} - .phui-calendar-today-slot { display: block; width: 100%; From 0228cdb7e2122d962c27c3b16d6d928b1c5becd3 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Thu, 14 May 2015 13:02:19 -0700 Subject: [PATCH 08/86] Day min-height on mobile month calendar should be shorter. Summary: Closes T8190, Day min-height on mobile month calendar should be shorter. Test Plan: Mobile view of month view should fit on a mobile screen. Reviewers: chad, #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8190 Differential Revision: https://secure.phabricator.com/D12847 --- resources/celerity/map.php | 4 ++-- webroot/rsrc/css/phui/calendar/phui-calendar-month.css | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 2c92f74300..27c94b3b30 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -122,7 +122,7 @@ return array( 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/phui/calendar/phui-calendar-day.css' => '38891735', 'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1d0ca59', - 'rsrc/css/phui/calendar/phui-calendar-month.css' => 'e7ee38c6', + 'rsrc/css/phui/calendar/phui-calendar-month.css' => '3150cfbf', 'rsrc/css/phui/calendar/phui-calendar.css' => '8675968e', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', @@ -763,7 +763,7 @@ return array( 'phui-calendar-css' => '8675968e', 'phui-calendar-day-css' => '38891735', 'phui-calendar-list-css' => 'c1d0ca59', - 'phui-calendar-month-css' => 'e7ee38c6', + 'phui-calendar-month-css' => '3150cfbf', 'phui-crumbs-view-css' => '594d719e', 'phui-document-view-css' => '94d5dcd8', 'phui-feed-story-css' => 'c9f3a0b5', diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css index 284937f1a9..a231b452a2 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css @@ -31,7 +31,7 @@ table.phui-calendar-view td { } .device .phui-calendar-month-event-list .phui-calendar-month-cell-div { - min-height: 60px; + min-height: 32px; } a.phui-calendar-month-secret-link { @@ -58,7 +58,7 @@ table.phui-calendar-view tr td:first-child { .device .phui-calendar-month-event-count { display: block; text-align: center; - padding-top: 12px; + padding-top: 8px; } .phui-calendar-month-event-count .phui-calendar-month-count-badge { @@ -69,7 +69,7 @@ table.phui-calendar-view tr td:first-child { border-radius: 50%; text-align: center; vertical-align: middle; - padding: 5px 3px 0px 3px; + padding: 4px 2px 0px 2px; margin: 0 auto; } From b34d5bf44ba96b7b11d7a72e1056a979406b3e93 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 14 May 2015 13:04:44 -0700 Subject: [PATCH 09/86] Strip GMail French quote header Summary: Ref T8199. Add pattern matching for GMail French. Test Plan: - Switched Gmail to french. - Replied to some mail. - Extracted quoted text header. - Added and executed unit test. Reviewers: btrahan Reviewed By: btrahan Subscribers: tycho.tatitscheff, epriestley Maniphest Tasks: T8199 Differential Revision: https://secure.phabricator.com/D12845 --- .../metamta/parser/PhabricatorMetaMTAEmailBodyParser.php | 6 ++++++ .../PhabricatorMetaMTAEmailBodyParserTestCase.php | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php b/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php index 5138c1a2bd..07770600e6 100644 --- a/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php +++ b/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php @@ -123,6 +123,12 @@ final class PhabricatorMetaMTAEmailBodyParser { '', $body); + // French GMail quoted text. See T8199. + $body = preg_replace( + '/^\s*\d{4}-\d{2}-\d{2} \d+:\d+ GMT.*:.*?/imsU', + '', + $body); + return rtrim($body); } diff --git a/src/applications/metamta/parser/__tests__/PhabricatorMetaMTAEmailBodyParserTestCase.php b/src/applications/metamta/parser/__tests__/PhabricatorMetaMTAEmailBodyParserTestCase.php index 6a124e30f4..d8ad49956d 100644 --- a/src/applications/metamta/parser/__tests__/PhabricatorMetaMTAEmailBodyParserTestCase.php +++ b/src/applications/metamta/parser/__tests__/PhabricatorMetaMTAEmailBodyParserTestCase.php @@ -253,6 +253,13 @@ OKAY {$emdash} Sent from Mailbox +EOMAIL +, +<<: +> ... EOMAIL ); } From 705c1e6498725c19d9817b3450e644023dbbe126 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 14 May 2015 16:48:45 -0700 Subject: [PATCH 10/86] Fix an issue with user.whoami Summary: Both user.whoami and user.query call the same wire formatting code, but expect different data. Don't try to add availability data to user.whoami. Stop adding email data to user.query. We've added it since D11791, but my intent was for it to be exposed //only// via user.whoami (i.e., expose your address, not others'). Test Plan: - Called both methods. - Saw emails on user.whoami. - Saw availability on user.query. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D12848 --- .../people/conduit/UserConduitAPIMethod.php | 24 ++++++++++++------- .../conduit/UserQueryConduitAPIMethod.php | 5 +++- .../conduit/UserWhoAmIConduitAPIMethod.php | 5 +++- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/applications/people/conduit/UserConduitAPIMethod.php b/src/applications/people/conduit/UserConduitAPIMethod.php index 82da171f43..187e28b9b3 100644 --- a/src/applications/people/conduit/UserConduitAPIMethod.php +++ b/src/applications/people/conduit/UserConduitAPIMethod.php @@ -6,7 +6,10 @@ abstract class UserConduitAPIMethod extends ConduitAPIMethod { return PhabricatorApplication::getByClass('PhabricatorPeopleApplication'); } - protected function buildUserInformationDictionary(PhabricatorUser $user) { + protected function buildUserInformationDictionary( + PhabricatorUser $user, + $with_email = false, + $with_availability = false) { $roles = array(); if ($user->getIsDisabled()) { @@ -40,18 +43,23 @@ abstract class UserConduitAPIMethod extends ConduitAPIMethod { 'phid' => $user->getPHID(), 'userName' => $user->getUserName(), 'realName' => $user->getRealName(), - 'primaryEmail' => $email, 'image' => $user->getProfileImageURI(), 'uri' => PhabricatorEnv::getURI('/p/'.$user->getUsername().'/'), 'roles' => $roles, ); - // TODO: Modernize this once we have a more long-term view of what the - // data looks like. - $until = $user->getAwayUntil(); - if ($until) { - $return['currentStatus'] = 'away'; - $return['currentStatusUntil'] = $until; + if ($with_email) { + $return['primaryEmail'] = $email; + } + + if ($with_availability) { + // TODO: Modernize this once we have a more long-term view of what the + // data looks like. + $until = $user->getAwayUntil(); + if ($until) { + $return['currentStatus'] = 'away'; + $return['currentStatusUntil'] = $until; + } } return $return; diff --git a/src/applications/people/conduit/UserQueryConduitAPIMethod.php b/src/applications/people/conduit/UserQueryConduitAPIMethod.php index c480ae0c73..4a567a0158 100644 --- a/src/applications/people/conduit/UserQueryConduitAPIMethod.php +++ b/src/applications/people/conduit/UserQueryConduitAPIMethod.php @@ -71,7 +71,10 @@ final class UserQueryConduitAPIMethod extends UserConduitAPIMethod { $results = array(); foreach ($users as $user) { - $results[] = $this->buildUserInformationDictionary($user); + $results[] = $this->buildUserInformationDictionary( + $user, + $with_email = false, + $with_availability = true); } return $results; } diff --git a/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php b/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php index aa7e3e7f26..b646246c5d 100644 --- a/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php +++ b/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php @@ -29,7 +29,10 @@ final class UserWhoAmIConduitAPIMethod extends UserConduitAPIMethod { ->withPHIDs(array($request->getUser()->getPHID())) ->executeOne(); - return $this->buildUserInformationDictionary($person); + return $this->buildUserInformationDictionary( + $person, + $with_email = true, + $with_availability = false); } } From f16dda288d0cfb2214ec710270944d26c13fc03f Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Thu, 14 May 2015 17:05:58 -0700 Subject: [PATCH 11/86] Phame - move over blog create + edit to transactions + editor Summary: Ref T7626. Modernizes the code a bit here so we can eventually make progress on T7626 and other stuff. Test Plan: made a blog, edited a blog, made errors - stuff looked good Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7626 Differential Revision: https://secure.phabricator.com/D12849 --- .../20150514.phame.blog.xaction.sql | 19 ++ src/__phutil_library_map__.php | 4 + .../blog/PhameBlogDeleteController.php | 12 +- .../blog/PhameBlogEditController.php | 141 +++++++------ .../blog/PhameBlogFeedController.php | 12 +- .../blog/PhameBlogListController.php | 12 +- .../blog/PhameBlogLiveController.php | 17 +- .../blog/PhameBlogViewController.php | 12 +- .../phame/editor/PhameBlogEditor.php | 189 ++++++++++++++++++ src/applications/phame/storage/PhameBlog.php | 28 +-- .../phame/storage/PhameBlogTransaction.php | 174 ++++++++++++++++ 11 files changed, 481 insertions(+), 139 deletions(-) create mode 100644 resources/sql/autopatches/20150514.phame.blog.xaction.sql create mode 100644 src/applications/phame/editor/PhameBlogEditor.php create mode 100644 src/applications/phame/storage/PhameBlogTransaction.php diff --git a/resources/sql/autopatches/20150514.phame.blog.xaction.sql b/resources/sql/autopatches/20150514.phame.blog.xaction.sql new file mode 100644 index 0000000000..7d85c98082 --- /dev/null +++ b/resources/sql/autopatches/20150514.phame.blog.xaction.sql @@ -0,0 +1,19 @@ +CREATE TABLE {$NAMESPACE}_phame.phame_blogtransaction ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + phid VARBINARY(64) NOT NULL, + authorPHID VARBINARY(64) NOT NULL, + objectPHID VARBINARY(64) NOT NULL, + viewPolicy VARBINARY(64) NOT NULL, + editPolicy VARBINARY(64) NOT NULL, + commentPHID VARBINARY(64) DEFAULT NULL, + commentVersion INT UNSIGNED NOT NULL, + transactionType VARCHAR(32) COLLATE {$COLLATE_TEXT} NOT NULL, + oldValue LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL, + newValue LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL, + contentSource LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL, + metadata LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL, + dateCreated INT UNSIGNED NOT NULL, + dateModified INT UNSIGNED NOT NULL, + UNIQUE KEY `key_phid` (`phid`), + KEY `key_object` (`objectPHID`) +) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT}; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 903aaf8a44..f574caf682 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2775,11 +2775,13 @@ phutil_register_library_map(array( 'PhameBlog' => 'applications/phame/storage/PhameBlog.php', 'PhameBlogDeleteController' => 'applications/phame/controller/blog/PhameBlogDeleteController.php', 'PhameBlogEditController' => 'applications/phame/controller/blog/PhameBlogEditController.php', + 'PhameBlogEditor' => 'applications/phame/editor/PhameBlogEditor.php', 'PhameBlogFeedController' => 'applications/phame/controller/blog/PhameBlogFeedController.php', 'PhameBlogListController' => 'applications/phame/controller/blog/PhameBlogListController.php', 'PhameBlogLiveController' => 'applications/phame/controller/blog/PhameBlogLiveController.php', 'PhameBlogQuery' => 'applications/phame/query/PhameBlogQuery.php', 'PhameBlogSkin' => 'applications/phame/skins/PhameBlogSkin.php', + 'PhameBlogTransaction' => 'applications/phame/storage/PhameBlogTransaction.php', 'PhameBlogViewController' => 'applications/phame/controller/blog/PhameBlogViewController.php', 'PhameCelerityResources' => 'applications/phame/celerity/PhameCelerityResources.php', 'PhameConduitAPIMethod' => 'applications/phame/conduit/PhameConduitAPIMethod.php', @@ -6250,11 +6252,13 @@ phutil_register_library_map(array( ), 'PhameBlogDeleteController' => 'PhameController', 'PhameBlogEditController' => 'PhameController', + 'PhameBlogEditor' => 'PhabricatorApplicationTransactionEditor', 'PhameBlogFeedController' => 'PhameController', 'PhameBlogListController' => 'PhameController', 'PhameBlogLiveController' => 'PhameController', 'PhameBlogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhameBlogSkin' => 'PhabricatorController', + 'PhameBlogTransaction' => 'PhabricatorApplicationTransaction', 'PhameBlogViewController' => 'PhameController', 'PhameCelerityResources' => 'CelerityResources', 'PhameConduitAPIMethod' => 'ConduitAPIMethod', diff --git a/src/applications/phame/controller/blog/PhameBlogDeleteController.php b/src/applications/phame/controller/blog/PhameBlogDeleteController.php index 82770b2877..33282582ae 100644 --- a/src/applications/phame/controller/blog/PhameBlogDeleteController.php +++ b/src/applications/phame/controller/blog/PhameBlogDeleteController.php @@ -2,19 +2,13 @@ final class PhameBlogDeleteController extends PhameController { - private $id; - - public function willProcessRequest(array $data) { - $this->id = $data['id']; - } - - public function processRequest() { - $request = $this->getRequest(); + public function handleRequest(AphrontRequest $request) { $user = $request->getUser(); + $id = $request->getURIData('id'); $blog = id(new PhameBlogQuery()) ->setViewer($user) - ->withIDs(array($this->id)) + ->withIDs(array($id)) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_EDIT, diff --git a/src/applications/phame/controller/blog/PhameBlogEditController.php b/src/applications/phame/controller/blog/PhameBlogEditController.php index 1363cf8343..8b1b3b81e1 100644 --- a/src/applications/phame/controller/blog/PhameBlogEditController.php +++ b/src/applications/phame/controller/blog/PhameBlogEditController.php @@ -3,20 +3,14 @@ final class PhameBlogEditController extends PhameController { - private $id; - - public function willProcessRequest(array $data) { - $this->id = idx($data, 'id'); - } - - public function processRequest() { - $request = $this->getRequest(); + public function handleRequest(AphrontRequest $request) { $user = $request->getUser(); - if ($this->id) { + $id = $request->getURIData('id'); + if ($id) { $blog = id(new PhameBlogQuery()) ->setViewer($user) - ->withIDs(array($this->id)) + ->withIDs(array($id)) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_EDIT, @@ -30,76 +24,75 @@ final class PhameBlogEditController $page_title = pht('Edit Blog'); $cancel_uri = $this->getApplicationURI('blog/view/'.$blog->getID().'/'); } else { - $blog = id(new PhameBlog()) - ->setCreatorPHID($user->getPHID()); - - $blog->setViewPolicy(PhabricatorPolicies::POLICY_USER); - $blog->setEditPolicy(PhabricatorPolicies::POLICY_USER); - $blog->setJoinPolicy(PhabricatorPolicies::POLICY_USER); + $blog = PhameBlog::initializeNewBlog($user); $submit_button = pht('Create Blog'); $page_title = pht('Create Blog'); $cancel_uri = $this->getApplicationURI(); } + $name = $blog->getName(); + $description = $blog->getDescription(); + $custom_domain = $blog->getDomain(); + $skin = $blog->getSkin(); + $can_view = $blog->getViewPolicy(); + $can_edit = $blog->getEditPolicy(); + $can_join = $blog->getJoinPolicy(); - $e_name = true; - $e_custom_domain = null; - $errors = array(); - + $e_name = true; + $e_custom_domain = null; + $e_view_policy = null; + $validation_exception = null; if ($request->isFormPost()) { $name = $request->getStr('name'); $description = $request->getStr('description'); - $custom_domain = $request->getStr('custom_domain'); + $custom_domain = nonempty($request->getStr('custom_domain'), null); $skin = $request->getStr('skin'); + $can_view = $request->getStr('can_view'); + $can_edit = $request->getStr('can_edit'); + $can_join = $request->getStr('can_join'); - if (empty($name)) { - $errors[] = pht('You must give the blog a name.'); - $e_name = pht('Required'); - } else { - $e_name = null; - } + $xactions = array( + id(new PhameBlogTransaction()) + ->setTransactionType(PhameBlogTransaction::TYPE_NAME) + ->setNewValue($name), + id(new PhameBlogTransaction()) + ->setTransactionType(PhameBlogTransaction::TYPE_DESCRIPTION) + ->setNewValue($description), + id(new PhameBlogTransaction()) + ->setTransactionType(PhameBlogTransaction::TYPE_DOMAIN) + ->setNewValue($custom_domain), + id(new PhameBlogTransaction()) + ->setTransactionType(PhameBlogTransaction::TYPE_SKIN) + ->setNewValue($skin), + id(new PhameBlogTransaction()) + ->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY) + ->setNewValue($can_view), + id(new PhameBlogTransaction()) + ->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY) + ->setNewValue($can_edit), + id(new PhameBlogTransaction()) + ->setTransactionType(PhabricatorTransactions::TYPE_JOIN_POLICY) + ->setNewValue($can_join), + ); - $blog->setName($name); - $blog->setDescription($description); - $blog->setDomain(nonempty($custom_domain, null)); - $blog->setSkin($skin); - $blog->setViewPolicy($request->getStr('can_view')); - $blog->setEditPolicy($request->getStr('can_edit')); - $blog->setJoinPolicy($request->getStr('can_join')); + $editor = id(new PhameBlogEditor()) + ->setActor($user) + ->setContentSourceFromRequest($request) + ->setContinueOnNoEffect(true); - if (!empty($custom_domain)) { - list($error_label, $error_text) = - $blog->validateCustomDomain($custom_domain); - if ($error_label) { - $errors[] = $error_text; - $e_custom_domain = $error_label; - } - if ($blog->getViewPolicy() != PhabricatorPolicies::POLICY_PUBLIC) { - $errors[] = pht( - 'For custom domains to work, the blog must have a view policy of '. - 'public.'); - // Prefer earlier labels for the multiple error scenario. - if (!$e_custom_domain) { - $e_custom_domain = pht('Invalid Policy'); - } - } - } + try { + $editor->applyTransactions($blog, $xactions); + return id(new AphrontRedirectResponse()) + ->setURI($this->getApplicationURI('blog/view/'.$blog->getID().'/')); + } catch (PhabricatorApplicationTransactionValidationException $ex) { + $validation_exception = $ex; - // Don't let users remove their ability to edit blogs. - PhabricatorPolicyFilter::mustRetainCapability( - $user, - $blog, - PhabricatorPolicyCapability::CAN_EDIT); - - if (!$errors) { - try { - $blog->save(); - return id(new AphrontRedirectResponse()) - ->setURI($this->getApplicationURI('blog/view/'.$blog->getID().'/')); - } catch (AphrontDuplicateKeyQueryException $ex) { - $errors[] = pht('Domain must be unique.'); - $e_custom_domain = pht('Not Unique'); - } + $e_name = $validation_exception->getShortMessage( + PhameBlogTransaction::TYPE_NAME); + $e_custom_domain = $validation_exception->getShortMessage( + PhameBlogTransaction::TYPE_DOMAIN); + $e_view_policy = $validation_exception->getShortMessage( + PhabricatorTransactions::TYPE_VIEW_POLICY); } } @@ -117,7 +110,7 @@ final class PhameBlogEditController id(new AphrontFormTextControl()) ->setLabel(pht('Name')) ->setName('name') - ->setValue($blog->getName()) + ->setValue($name) ->setID('blog-name') ->setError($e_name)) ->appendChild( @@ -125,7 +118,7 @@ final class PhameBlogEditController ->setUser($user) ->setLabel(pht('Description')) ->setName('description') - ->setValue($blog->getDescription()) + ->setValue($description) ->setID('blog-description') ->setUser($user) ->setDisableMacros(true)) @@ -135,6 +128,8 @@ final class PhameBlogEditController ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) ->setPolicyObject($blog) ->setPolicies($policies) + ->setError($e_view_policy) + ->setValue($can_view) ->setName('can_view')) ->appendChild( id(new AphrontFormPolicyControl()) @@ -142,6 +137,7 @@ final class PhameBlogEditController ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) ->setPolicyObject($blog) ->setPolicies($policies) + ->setValue($can_edit) ->setName('can_edit')) ->appendChild( id(new AphrontFormPolicyControl()) @@ -149,12 +145,13 @@ final class PhameBlogEditController ->setCapability(PhabricatorPolicyCapability::CAN_JOIN) ->setPolicyObject($blog) ->setPolicies($policies) + ->setValue($can_join) ->setName('can_join')) ->appendChild( id(new AphrontFormTextControl()) ->setLabel(pht('Custom Domain')) ->setName('custom_domain') - ->setValue($blog->getDomain()) + ->setValue($custom_domain) ->setCaption( pht('Must include at least one dot (.), e.g. blog.example.com')) ->setError($e_custom_domain)) @@ -162,7 +159,7 @@ final class PhameBlogEditController id(new AphrontFormSelectControl()) ->setLabel(pht('Skin')) ->setName('skin') - ->setValue($blog->getSkin()) + ->setValue($skin) ->setOptions($skins)) ->appendChild( id(new AphrontFormSubmitControl()) @@ -171,14 +168,14 @@ final class PhameBlogEditController $form_box = id(new PHUIObjectBoxView()) ->setHeaderText($page_title) - ->setFormErrors($errors) + ->setValidationException($validation_exception) ->setForm($form); $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb($page_title, $this->getApplicationURI('blog/new')); $nav = $this->renderSideNavFilterView(); - $nav->selectFilter($this->id ? null : 'blog/new'); + $nav->selectFilter($id ? null : 'blog/new'); $nav->appendChild( array( $crumbs, diff --git a/src/applications/phame/controller/blog/PhameBlogFeedController.php b/src/applications/phame/controller/blog/PhameBlogFeedController.php index 68b197a17b..fc8c1c48da 100644 --- a/src/applications/phame/controller/blog/PhameBlogFeedController.php +++ b/src/applications/phame/controller/blog/PhameBlogFeedController.php @@ -2,23 +2,17 @@ final class PhameBlogFeedController extends PhameController { - private $id; - public function shouldRequireLogin() { return false; } - public function willProcessRequest(array $data) { - $this->id = $data['id']; - } - - public function processRequest() { - $request = $this->getRequest(); + public function handleRequest(AphrontRequest $request) { $user = $request->getUser(); + $id = $request->getURIData('id'); $blog = id(new PhameBlogQuery()) ->setViewer($user) - ->withIDs(array($this->id)) + ->withIDs(array($id)) ->executeOne(); if (!$blog) { return new Aphront404Response(); diff --git a/src/applications/phame/controller/blog/PhameBlogListController.php b/src/applications/phame/controller/blog/PhameBlogListController.php index 70fc5307a3..f9a4aeb2d9 100644 --- a/src/applications/phame/controller/blog/PhameBlogListController.php +++ b/src/applications/phame/controller/blog/PhameBlogListController.php @@ -2,18 +2,12 @@ final class PhameBlogListController extends PhameController { - private $filter; - - public function willProcessRequest(array $data) { - $this->filter = idx($data, 'filter'); - } - - public function processRequest() { - $request = $this->getRequest(); + public function handleRequest(AphrontRequest $request) { $user = $request->getUser(); $nav = $this->renderSideNavFilterView(null); - $filter = $nav->selectFilter('blog/'.$this->filter, 'blog/user'); + $filter = $request->getURIData('filter'); + $filter = $nav->selectFilter('blog/'.$filter, 'blog/user'); $query = id(new PhameBlogQuery()) ->setViewer($user); diff --git a/src/applications/phame/controller/blog/PhameBlogLiveController.php b/src/applications/phame/controller/blog/PhameBlogLiveController.php index e55b2e0f35..1ac4486183 100644 --- a/src/applications/phame/controller/blog/PhameBlogLiveController.php +++ b/src/applications/phame/controller/blog/PhameBlogLiveController.php @@ -2,25 +2,17 @@ final class PhameBlogLiveController extends PhameController { - private $id; - private $more; - public function shouldAllowPublic() { return true; } - public function willProcessRequest(array $data) { - $this->id = idx($data, 'id'); - $this->more = idx($data, 'more', ''); - } - - public function processRequest() { - $request = $this->getRequest(); + public function handleRequest(AphrontRequest $request) { $user = $request->getUser(); + $id = $request->getURIData('id'); $blog = id(new PhameBlogQuery()) ->setViewer($user) - ->withIDs(array($this->id)) + ->withIDs(array($id)) ->executeOne(); if (!$blog) { return new Aphront404Response(); @@ -55,7 +47,8 @@ final class PhameBlogLiveController extends PhameController { } $phame_request = clone $request; - $phame_request->setPath('/'.ltrim($this->more, '/')); + $more = $phame_request->getURIData('more', ''); + $phame_request->setPath('/'.ltrim($more, '/')); $uri = $blog->getLiveURI(); diff --git a/src/applications/phame/controller/blog/PhameBlogViewController.php b/src/applications/phame/controller/blog/PhameBlogViewController.php index b8399f2513..76491278b5 100644 --- a/src/applications/phame/controller/blog/PhameBlogViewController.php +++ b/src/applications/phame/controller/blog/PhameBlogViewController.php @@ -2,19 +2,13 @@ final class PhameBlogViewController extends PhameController { - private $id; - - public function willProcessRequest(array $data) { - $this->id = $data['id']; - } - - public function processRequest() { - $request = $this->getRequest(); + public function handleRequest(AphrontRequest $request) { $user = $request->getUser(); + $id = $request->getURIData('id'); $blog = id(new PhameBlogQuery()) ->setViewer($user) - ->withIDs(array($this->id)) + ->withIDs(array($id)) ->executeOne(); if (!$blog) { return new Aphront404Response(); diff --git a/src/applications/phame/editor/PhameBlogEditor.php b/src/applications/phame/editor/PhameBlogEditor.php new file mode 100644 index 0000000000..5b837038b7 --- /dev/null +++ b/src/applications/phame/editor/PhameBlogEditor.php @@ -0,0 +1,189 @@ +getTransactionType()) { + case PhameBlogTransaction::TYPE_NAME: + return $object->getName(); + case PhameBlogTransaction::TYPE_DESCRIPTION: + return $object->getDescription(); + case PhameBlogTransaction::TYPE_DOMAIN: + return $object->getDomain(); + case PhameBlogTransaction::TYPE_SKIN: + return $object->getSkin(); + } + } + + protected function getCustomTransactionNewValue( + PhabricatorLiskDAO $object, + PhabricatorApplicationTransaction $xaction) { + + switch ($xaction->getTransactionType()) { + case PhameBlogTransaction::TYPE_NAME: + case PhameBlogTransaction::TYPE_DESCRIPTION: + case PhameBlogTransaction::TYPE_DOMAIN: + case PhameBlogTransaction::TYPE_SKIN: + return $xaction->getNewValue(); + } + } + + protected function applyCustomInternalTransaction( + PhabricatorLiskDAO $object, + PhabricatorApplicationTransaction $xaction) { + + switch ($xaction->getTransactionType()) { + case PhameBlogTransaction::TYPE_NAME: + return $object->setName($xaction->getNewValue()); + case PhameBlogTransaction::TYPE_DESCRIPTION: + return $object->setDescription($xaction->getNewValue()); + case PhameBlogTransaction::TYPE_DOMAIN: + return $object->setDomain($xaction->getNewValue()); + case PhameBlogTransaction::TYPE_SKIN: + return $object->setSkin($xaction->getNewValue()); + case PhabricatorTransactions::TYPE_VIEW_POLICY: + $object->setViewPolicy($xaction->getNewValue()); + return; + case PhabricatorTransactions::TYPE_EDIT_POLICY: + $object->setEditPolicy($xaction->getNewValue()); + return; + case PhabricatorTransactions::TYPE_JOIN_POLICY: + $object->setJoinPolicy($xaction->getNewValue()); + return; + case PhabricatorTransactions::TYPE_COMMENT: + return; + } + + return parent::applyCustomInternalTransaction($object, $xaction); + } + + protected function applyCustomExternalTransaction( + PhabricatorLiskDAO $object, + PhabricatorApplicationTransaction $xaction) { + + switch ($xaction->getTransactionType()) { + case PhameBlogTransaction::TYPE_NAME: + case PhameBlogTransaction::TYPE_DESCRIPTION: + case PhameBlogTransaction::TYPE_DOMAIN: + case PhameBlogTransaction::TYPE_SKIN: + case PhabricatorTransactions::TYPE_VIEW_POLICY: + case PhabricatorTransactions::TYPE_EDIT_POLICY: + case PhabricatorTransactions::TYPE_JOIN_POLICY: + case PhabricatorTransactions::TYPE_COMMENT: + return; + } + + return parent::applyCustomExternalTransaction($object, $xaction); + } + + protected function validateTransaction( + PhabricatorLiskDAO $object, + $type, + array $xactions) { + + $errors = parent::validateTransaction($object, $type, $xactions); + + switch ($type) { + case PhameBlogTransaction::TYPE_NAME: + $missing = $this->validateIsEmptyTextField( + $object->getName(), + $xactions); + + if ($missing) { + $error = new PhabricatorApplicationTransactionValidationError( + $type, + pht('Required'), + pht('Name is required.'), + nonempty(last($xactions), null)); + + $error->setIsMissingFieldError(true); + $errors[] = $error; + } + break; + case PhameBlogTransaction::TYPE_DOMAIN: + $custom_domain = last($xactions)->getNewValue(); + if (empty($custom_domain)) { + continue; + } + list($error_label, $error_text) = + $object->validateCustomDomain($custom_domain); + if ($error_label) { + $error = new PhabricatorApplicationTransactionValidationError( + $type, + $error_label, + $error_text, + nonempty(last($xactions), null)); + $errors[] = $error; + } + if ($object->getViewPolicy() != PhabricatorPolicies::POLICY_PUBLIC) { + $error_text = pht( + 'For custom domains to work, the blog must have a view policy of '. + 'public.'); + $error = new PhabricatorApplicationTransactionValidationError( + PhabricatorTransactions::TYPE_VIEW_POLICY, + pht('Invalid Policy'), + $error_text, + nonempty(last($xactions), null)); + $errors[] = $error; + } + $duplicate_blog = id(new PhameBlogQuery()) + ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->withDomain($custom_domain) + ->executeOne(); + if ($duplicate_blog && $duplicate_blog->getID() != $object->getID()) { + $error = new PhabricatorApplicationTransactionValidationError( + $type, + pht('Not Unique'), + pht('Domain must be unique; another blog already has this domain.'), + nonempty(last($xactions), null)); + $errors[] = $error; + } + + break; + } + return $errors; + } + + protected function shouldSendMail( + PhabricatorLiskDAO $object, + array $xactions) { + return false; + } + + protected function shouldPublishFeedStory( + PhabricatorLiskDAO $object, + array $xactions) { + return false; + } + + protected function supportsSearch() { + return false; + } + +} diff --git a/src/applications/phame/storage/PhameBlog.php b/src/applications/phame/storage/PhameBlog.php index e8eba5582b..1c4017fbd1 100644 --- a/src/applications/phame/storage/PhameBlog.php +++ b/src/applications/phame/storage/PhameBlog.php @@ -16,9 +16,6 @@ final class PhameBlog extends PhameDAO protected $editPolicy; protected $joinPolicy; - private $bloggerPHIDs = self::ATTACHABLE; - private $bloggers = self::ATTACHABLE; - static private $requestBlog; protected function getConfiguration() { @@ -57,6 +54,15 @@ final class PhameBlog extends PhameDAO PhabricatorPhameBlogPHIDType::TYPECONST); } + public static function initializeNewBlog(PhabricatorUser $actor) { + $blog = id(new PhameBlog()) + ->setCreatorPHID($actor->getPHID()) + ->setViewPolicy(PhabricatorPolicies::getMostOpenPolicy()) + ->setEditPolicy(PhabricatorPolicies::POLICY_USER) + ->setJoinPolicy(PhabricatorPolicies::POLICY_USER); + return $blog; + } + public function getSkinRenderer(AphrontRequest $request) { $spec = PhameSkinSpecification::loadOneSkinSpecification( $this->getSkin()); @@ -157,22 +163,6 @@ final class PhameBlog extends PhameDAO return null; } - public function getBloggerPHIDs() { - return $this->assertAttached($this->bloggerPHIDs); - } - - public function attachBloggers(array $bloggers) { - assert_instances_of($bloggers, 'PhabricatorObjectHandle'); - - $this->bloggers = $bloggers; - - return $this; - } - - public function getBloggers() { - return $this->assertAttached($this->bloggers); - } - public function getSkin() { $config = coalesce($this->getConfigData(), array()); return idx($config, 'skin', self::SKIN_DEFAULT); diff --git a/src/applications/phame/storage/PhameBlogTransaction.php b/src/applications/phame/storage/PhameBlogTransaction.php new file mode 100644 index 0000000000..f1e558e240 --- /dev/null +++ b/src/applications/phame/storage/PhameBlogTransaction.php @@ -0,0 +1,174 @@ +getOldValue(); + switch ($this->getTransactionType()) { + case self::TYPE_DESCRIPTION: + return ($old === null); + } + return parent::shouldHide(); + } + + public function getIcon() { + $old = $this->getOldValue(); + switch ($this->getTransactionType()) { + case self::TYPE_NAME: + if ($old === null) { + return 'fa-plus'; + } else { + return 'fa-pencil'; + } + break; + case self::TYPE_DESCRIPTION: + case self::TYPE_DOMAIN: + case self::TYPE_SKIN: + return 'fa-pencil'; + break; + } + return parent::getIcon(); + } + + public function getTitle() { + $author_phid = $this->getAuthorPHID(); + $object_phid = $this->getObjectPHID(); + + $old = $this->getOldValue(); + $new = $this->getNewValue(); + + $type = $this->getTransactionType(); + switch ($type) { + case self:TYPE_NAME: + if ($old === null) { + return pht( + '%s created this blog.', + $this->renderHandleLink($author_phid)); + } else { + return pht( + '%s updated the blog\'s name to "%s".', + $this->renderHandleLink($author_phid), + $new); + } + break; + case self::TYPE_DESCRIPTION: + return pht( + '%s updated the blog\'s description.', + $this->renderHandleLink($author_phid)); + break; + case self::TYPE_DOMAIN: + return pht( + '%s updated the blog\'s domain to "%s".', + $this->renderHandleLink($author_phid), + $new); + break; + case self::TYPE_SKIN: + return pht( + '%s updated the blog\'s skin to "%s".', + $this->renderHandleLink($author_phid), + $new); + break; + } + + return parent::getTitle(); + } + + public function getTitleForFeed() { + $author_phid = $this->getAuthorPHID(); + $object_phid = $this->getObjectPHID(); + + $old = $this->getOldValue(); + $new = $this->getNewValue(); + + $type = $this->getTransactionType(); + switch ($type) { + case self::TYPE_NAME: + if ($old === null) { + return pht( + '%s created %s.', + $this->renderHandleLink($author_phid), + $this->renderHandleLink($object_phid)); + } else { + return pht( + '%s updated the name for %s.', + $this->renderHandleLink($author_phid), + $this->renderHandleLink($object_phid)); + } + break; + case self::TYPE_DESCRIPTION: + return pht( + '%s updated the description for %s.', + $this->renderHandleLink($author_phid), + $this->renderHandleLink($object_phid)); + break; + case self::TYPE_DOMAIN: + return pht( + '%s updated the domain for %s.', + $this->renderHandleLink($author_phid), + $this->renderHandleLink($object_phid)); + break; + case self::TYPE_SKIN: + return pht( + '%s updated the skin for %s.', + $this->renderHandleLink($author_phid), + $this->renderHandleLink($object_phid)); + break; + } + + return parent::getTitleForFeed(); + } + + public function getColor() { + $old = $this->getOldValue(); + + switch ($this->getTransactionType()) { + case self::TYPE_NAME: + if ($old === null) { + return PhabricatorTransactions::COLOR_GREEN; + } + break; + } + + return parent::getColor(); + } + + + public function hasChangeDetails() { + switch ($this->getTransactionType()) { + case self::TYPE_DESCRIPTION: + return ($this->getOldValue() !== null); + } + + return parent::hasChangeDetails(); + } + + public function renderChangeDetails(PhabricatorUser $viewer) { + switch ($this->getTransactionType()) { + case self::TYPE_DESCRIPTION: + $old = $this->getOldValue(); + $new = $this->getNewValue(); + + return $this->renderTextCorpusChangeDetails( + $viewer, + $old, + $new); + } + + return parent::renderChangeDetails($viewer); + } + +} From 4016107411c12d8658a2cfeefeef19b7c12fa6cb Mon Sep 17 00:00:00 2001 From: lkassianik Date: Thu, 14 May 2015 19:20:44 -0700 Subject: [PATCH 12/86] Calendar events should be green if viewer is invited, and grey if not. Summary: Closes T8189, Calendar events should be green if viewer is invited, and grey if not. Test Plan: Check that month and day views display events that viewer is invited to as green and grey otherwise, including month day badges on mobile monthly view. Reviewers: chad, #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8189 Differential Revision: https://secure.phabricator.com/D12850 --- resources/celerity/map.php | 12 +++--- .../calendar/constants/CalendarColors.php | 2 + .../PhabricatorCalendarEventSearchEngine.php | 25 +++--------- .../storage/PhabricatorCalendarEvent.php | 10 +++++ .../view/AphrontCalendarEventView.php | 22 +++++------ .../phui/calendar/PHUICalendarDayView.php | 15 +++++++- .../phui/calendar/PHUICalendarListView.php | 17 +++++++-- .../phui/calendar/PHUICalendarMonthView.php | 14 +++++-- .../css/phui/calendar/phui-calendar-day.css | 20 ++++++++-- .../css/phui/calendar/phui-calendar-month.css | 21 ++++++++-- .../rsrc/css/phui/calendar/phui-calendar.css | 38 ++++++++++++++++++- 11 files changed, 142 insertions(+), 54 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 27c94b3b30..4572955492 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -120,10 +120,10 @@ return array( 'rsrc/css/layout/phabricator-hovercard-view.css' => 'dd9121a9', 'rsrc/css/layout/phabricator-side-menu-view.css' => 'c1db9e9c', 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', - 'rsrc/css/phui/calendar/phui-calendar-day.css' => '38891735', + 'rsrc/css/phui/calendar/phui-calendar-day.css' => '3b4a65d8', 'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1d0ca59', - 'rsrc/css/phui/calendar/phui-calendar-month.css' => '3150cfbf', - 'rsrc/css/phui/calendar/phui-calendar.css' => '8675968e', + 'rsrc/css/phui/calendar/phui-calendar-month.css' => '3e42c803', + 'rsrc/css/phui/calendar/phui-calendar.css' => '8345be98', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', 'rsrc/css/phui/phui-action-panel.css' => '3ee9afd5', @@ -760,10 +760,10 @@ return array( 'phui-action-panel-css' => '3ee9afd5', 'phui-box-css' => '7b3a2eed', 'phui-button-css' => 'de610129', - 'phui-calendar-css' => '8675968e', - 'phui-calendar-day-css' => '38891735', + 'phui-calendar-css' => '8345be98', + 'phui-calendar-day-css' => '3b4a65d8', 'phui-calendar-list-css' => 'c1d0ca59', - 'phui-calendar-month-css' => '3150cfbf', + 'phui-calendar-month-css' => '3e42c803', 'phui-crumbs-view-css' => '594d719e', 'phui-document-view-css' => '94d5dcd8', 'phui-feed-story-css' => 'c9f3a0b5', diff --git a/src/applications/calendar/constants/CalendarColors.php b/src/applications/calendar/constants/CalendarColors.php index d5f4f7501c..e7bd792e0b 100644 --- a/src/applications/calendar/constants/CalendarColors.php +++ b/src/applications/calendar/constants/CalendarColors.php @@ -10,6 +10,7 @@ final class CalendarColors extends CalendarConstants { const COLOR_SKY = 'sky'; const COLOR_INDIGO = 'indigo'; const COLOR_VIOLET = 'violet'; + const COLOR_GREY = 'grey'; public static function getColors() { return array( @@ -21,6 +22,7 @@ final class CalendarColors extends CalendarConstants { self::COLOR_INDIGO, self::COLOR_RED, self::COLOR_YELLOW, + self::COLOR_GREY, ); } diff --git a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php index c8a788adb8..3e020895f3 100644 --- a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php +++ b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php @@ -359,25 +359,9 @@ final class PhabricatorCalendarEventSearchEngine $phids = mpull($statuses, 'getUserPHID'); - /* Assign Colors */ - $unique = array_unique($phids); - $allblue = false; - $calcolors = CalendarColors::getColors(); - if (count($unique) > count($calcolors)) { - $allblue = true; - } - $i = 0; - $eventcolor = array(); - foreach ($unique as $phid) { - if ($allblue) { - $eventcolor[$phid] = CalendarColors::COLOR_SKY; - } else { - $eventcolor[$phid] = $calcolors[$i]; - } - $i++; - } - foreach ($statuses as $status) { + $viewer_is_invited = $status->getIsUserInvited($viewer->getPHID()); + $event = new AphrontCalendarEventView(); $event->setEpochRange($status->getDateFrom(), $status->getDateTo()); $event->setIsAllDay($status->getIsAllDay()); @@ -388,7 +372,7 @@ final class PhabricatorCalendarEventSearchEngine $event->setDescription(pht('%s (%s)', $name_text, $status_text)); $event->setName($status_text); $event->setEventID($status->getID()); - $event->setColor($eventcolor[$status->getUserPHID()]); + $event->setViewerIsInvited($viewer_is_invited); $month_view->addEvent($event); } @@ -422,10 +406,13 @@ final class PhabricatorCalendarEventSearchEngine continue; } + $viewer_is_invited = $status->getIsUserInvited($viewer->getPHID()); + $event = new AphrontCalendarEventView(); $event->setEventID($status->getID()); $event->setEpochRange($status->getDateFrom(), $status->getDateTo()); $event->setIsAllDay($status->getIsAllDay()); + $event->setViewerIsInvited($viewer_is_invited); $event->setName($status->getName()); $event->setURI('/'.$status->getMonogram()); diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php index 044bc9fc78..42bf5f9e05 100644 --- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php @@ -215,6 +215,16 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO return $is_attending; } + public function getIsUserInvited($phid) { + $uninvited_status = PhabricatorCalendarEventInvitee::STATUS_UNINVITED; + $declined_status = PhabricatorCalendarEventInvitee::STATUS_DECLINED; + $status = $this->getUserInviteStatus($phid); + if ($status == $uninvited_status || $status == $declined_status) { + return false; + } + return true; + } + /* -( Markup Interface )--------------------------------------------------- */ diff --git a/src/applications/calendar/view/AphrontCalendarEventView.php b/src/applications/calendar/view/AphrontCalendarEventView.php index 11dbff3847..669844290f 100644 --- a/src/applications/calendar/view/AphrontCalendarEventView.php +++ b/src/applications/calendar/view/AphrontCalendarEventView.php @@ -8,7 +8,7 @@ final class AphrontCalendarEventView extends AphrontView { private $epochEnd; private $description; private $eventID; - private $color; + private $viewerIsInvited; private $uri; private $isAllDay; @@ -29,6 +29,14 @@ final class AphrontCalendarEventView extends AphrontView { return $this->eventID; } + public function setViewerIsInvited($viewer_is_invited) { + $this->viewerIsInvited = $viewer_is_invited; + return $this; + } + public function getViewerIsInvited() { + return $this->viewerIsInvited; + } + public function setUserPHID($user_phid) { $this->userPHID = $user_phid; return $this; @@ -70,18 +78,6 @@ final class AphrontCalendarEventView extends AphrontView { return $this->description; } - public function setColor($color) { - $this->color = $color; - return $this; - } - public function getColor() { - if ($this->color) { - return $this->color; - } else { - return CalendarColors::COLOR_SKY; - } - } - public function setIsAllDay($is_all_day) { $this->isAllDay = $is_all_day; return $this; diff --git a/src/view/phui/calendar/PHUICalendarDayView.php b/src/view/phui/calendar/PHUICalendarDayView.php index 21c893125d..5afff57d3b 100644 --- a/src/view/phui/calendar/PHUICalendarDayView.php +++ b/src/view/phui/calendar/PHUICalendarDayView.php @@ -391,10 +391,15 @@ final class PHUICalendarDayView extends AphrontView { } private function drawAllDayEvent(AphrontCalendarEventView $event) { + $class = 'day-view-all-day'; + if ($event->getViewerIsInvited()) { + $class = $class.' viewer-invited-day-event'; + } + $name = phutil_tag( 'a', array( - 'class' => 'day-view-all-day', + 'class' => $class, 'href' => $event->getURI(), ), $event->getName()); @@ -425,10 +430,16 @@ final class PHUICalendarDayView extends AphrontView { $width, $top, $height) { + + $class = 'phui-calendar-day-event-link'; + if ($event->getViewerIsInvited()) { + $class = $class.' viewer-invited-day-event'; + } + $name = phutil_tag( 'a', array( - 'class' => 'phui-calendar-day-event-link', + 'class' => $class, 'href' => $event->getURI(), ), $event->getName()); diff --git a/src/view/phui/calendar/PHUICalendarListView.php b/src/view/phui/calendar/PHUICalendarListView.php index c2d33b8469..e315aa93d1 100644 --- a/src/view/phui/calendar/PHUICalendarListView.php +++ b/src/view/phui/calendar/PHUICalendarListView.php @@ -33,7 +33,6 @@ final class PHUICalendarListView extends AphrontTagView { $singletons = array(); $allday = false; foreach ($this->events as $event) { - $color = $event->getColor(); $start_epoch = $event->getEpochStart(); if ($event->getIsAllDay()) { @@ -65,7 +64,10 @@ final class PHUICalendarListView extends AphrontTagView { ), $timelabel); - $class = 'phui-calendar-list-item phui-calendar-'.$color; + $class = 'phui-calendar-list-item'; + if ($event->getViewerIsInvited()) { + $class = $class.' phui-calendar-viewer-invited'; + } if ($event->getIsAllDay()) { $class = $class.' all-day'; } @@ -142,7 +144,7 @@ final class PHUICalendarListView extends AphrontTagView { $description = pht('(%s)', $event->getName()); } - $class = 'phui-calendar-item-link'; + $class = 'phui-calendar-item'; $anchor = javelin_tag( 'a', @@ -159,4 +161,13 @@ final class PHUICalendarListView extends AphrontTagView { return $anchor; } + + public function getIsViewerInvitedOnList() { + foreach ($this->events as $event) { + if ($event->getViewerIsInvited()) { + return true; + } + } + return false; + } } diff --git a/src/view/phui/calendar/PHUICalendarMonthView.php b/src/view/phui/calendar/PHUICalendarMonthView.php index 7eb35f76a5..08a4731598 100644 --- a/src/view/phui/calendar/PHUICalendarMonthView.php +++ b/src/view/phui/calendar/PHUICalendarMonthView.php @@ -178,7 +178,9 @@ final class PHUICalendarMonthView extends AphrontView { $uri = $event_list['uri']; $count = $event_list['count']; - $event_count_badge = $this->getEventCountBadge($count); + $viewer_is_invited = $list->getIsViewerInvitedOnList(); + + $event_count_badge = $this->getEventCountBadge($count, $viewer_is_invited); $cell_day_secret_link = $this->getHiddenDayLink($uri); $cell_data_div = phutil_tag( @@ -252,13 +254,19 @@ final class PHUICalendarMonthView extends AphrontView { $cell_div); } - private function getEventCountBadge($count) { + private function getEventCountBadge($count, $viewer_is_invited) { + $class = 'phui-calendar-month-count-badge'; + + if ($viewer_is_invited) { + $class = $class.' viewer-invited-day-badge'; + } + $event_count = null; if ($count > 0) { $event_count = phutil_tag( 'div', array( - 'class' => 'phui-calendar-month-count-badge', + 'class' => $class, ), $count); } diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-day.css b/webroot/rsrc/css/phui/calendar/phui-calendar-day.css index 11f4045fe1..4f2c8a9e3d 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-day.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-day.css @@ -37,8 +37,8 @@ .phui-calendar-day-event-link { padding: 8px; - border: 1px solid {$blueborder}; - background-color: {$bluebackground}; + border: 1px solid {$greyborder}; + background-color: {$darkgreybackground}; margin: 0 4px; position: absolute; left: 0; @@ -49,17 +49,29 @@ color: {$greytext}; } +.phui-calendar-day-event-link.viewer-invited-day-event { + border-color: {$green}; + background-color: {$lightgreen}; + color: {$green}; +} + .day-view-all-day { - border: 1px solid {$blueborder}; + border: 1px solid {$greyborder}; height: 12px; margin: 0; display: block; padding: 8px; - background-color: {$bluebackground}; + background-color: {$darkgreybackground}; text-decoration: none; color: {$greytext}; } +.day-view-all-day.viewer-invited-day-event { + border-color: {$green}; + background-color: {$lightgreen}; + color: {$green}; +} + .phui-calendar-day-event + .phui-calendar-day-event .day-view-all-day { border-top-style: none; border-top-width: 0; diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css index a231b452a2..9fc1e8c52d 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css @@ -73,6 +73,11 @@ table.phui-calendar-view tr td:first-child { margin: 0 auto; } +.phui-calendar-month-count-badge.viewer-invited-day-badge { + border-color: {$green}; + color: {$green}; +} + table.phui-calendar-view a.phui-calendar-date-number { color: {$lightgreytext}; padding: 0 4px; @@ -116,12 +121,18 @@ table.phui-calendar-view td.phui-calendar-date-number-container { .phui-calendar-view .phui-calendar-list li.phui-calendar-list-item.all-day { margin: 0; - padding: 4px 8px; - background-color: {$lightpink}; + padding: 4px 4px 0px 4px; + background-color: {$darkgreybackground}; display: block; float: none; } +.phui-calendar-view +.phui-calendar-list +li.phui-calendar-viewer-invited.all-day { + background-color: {$lightgreen}; +} + li.phui-calendar-list-item.all-day:first-child { margin-top: 0; } @@ -155,7 +166,11 @@ li.phui-calendar-list-item.all-day:first-child { } li.phui-calendar-list-item.all-day .phui-calendar-list-title a{ - color: {$pink}; + color: {$greytext}; +} + +li.phui-calendar-viewer-invited.all-day .phui-calendar-list-title a{ + color: {$green}; } .phui-calendar-view .phui-calendar-list-time { diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar.css b/webroot/rsrc/css/phui/calendar/phui-calendar.css index e338366b3d..e3f67c2162 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar.css @@ -2,6 +2,15 @@ * @provides phui-calendar-css */ + .phui-calendar-list a { + color: {$lightgreytext}; + } + +.phui-calendar-viewer-invited a { + color: {$green}; + font-weight: bold; +} + .phui-calendar-red a { color: {$red}; } @@ -34,6 +43,14 @@ color: {$violet}; } +.phui-calendar-grey a { + color: {$lightgreytext}; +} + +.phui-calendar-bg-viewer-invited { + background-color: {$lightgreen}; +} + .phui-calendar-bg-red { background-color: {$lightred}; } @@ -47,7 +64,7 @@ } .phui-calendar-bg-green { - background-color: {$lightgreen} + background-color: {$lightgreen}; } .phui-calendar-bg-blue { @@ -66,6 +83,20 @@ background-color: {$lightviolet}; } +.phui-calendar-bg-grey { + background-color: {$darkgreybackground}; +} + +.phui-calendar-list-dot { + background-color: {$lightgreytext}; + border-color: {$lightgreytext}; +} + +.phui-calendar-viewer-invited .phui-calendar-list-dot { + background-color: {$green}; + border-color: {$green}; +} + .phui-calendar-red .phui-calendar-list-dot { background-color: {$red}; border-color: {$red}; @@ -105,3 +136,8 @@ background-color: {$violet}; border-color: {$violet}; } + +.phui-calendar-grey .phui-calendar-list-dot { + background-color: {$lightgreytext}; + border-color: {$lightgreytext}; +} From e185d8fe0234726c38d1d2e1808472ebc389ddc6 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Thu, 14 May 2015 20:51:41 -0700 Subject: [PATCH 13/86] Event lists in days of month view should also specify the time of the event. Summary: Ref T8188, Event lists in days of month view should also specify the time of the event. Test Plan: Time start should be display on event links in month view. Note: not handling the case where an event starts on a previous day - always displaying just start time, with no disgression. Reviewers: chad, #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8188 Differential Revision: https://secure.phabricator.com/D12852 --- resources/celerity/map.php | 8 +++--- .../css/phui/calendar/phui-calendar-list.css | 1 + .../css/phui/calendar/phui-calendar-month.css | 28 +++++++++++++++---- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 4572955492..cf96220e2e 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -121,8 +121,8 @@ return array( 'rsrc/css/layout/phabricator-side-menu-view.css' => 'c1db9e9c', 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/phui/calendar/phui-calendar-day.css' => '3b4a65d8', - 'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1d0ca59', - 'rsrc/css/phui/calendar/phui-calendar-month.css' => '3e42c803', + 'rsrc/css/phui/calendar/phui-calendar-list.css' => '840baa8d', + 'rsrc/css/phui/calendar/phui-calendar-month.css' => '450c37ea', 'rsrc/css/phui/calendar/phui-calendar.css' => '8345be98', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', @@ -762,8 +762,8 @@ return array( 'phui-button-css' => 'de610129', 'phui-calendar-css' => '8345be98', 'phui-calendar-day-css' => '3b4a65d8', - 'phui-calendar-list-css' => 'c1d0ca59', - 'phui-calendar-month-css' => '3e42c803', + 'phui-calendar-list-css' => '840baa8d', + 'phui-calendar-month-css' => '450c37ea', 'phui-crumbs-view-css' => '594d719e', 'phui-document-view-css' => '94d5dcd8', 'phui-feed-story-css' => 'c9f3a0b5', diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-list.css b/webroot/rsrc/css/phui/calendar/phui-calendar-list.css index bf92ee4b09..db69c78d03 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-list.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-list.css @@ -52,6 +52,7 @@ .phui-calendar-list-item .phui-calendar-list-time { position: absolute; + top: 0; width: 60px; right: 0; top: 0; diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css index 9fc1e8c52d..2e9f30a4c1 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css @@ -139,9 +139,6 @@ li.phui-calendar-list-item.all-day:first-child { .phui-calendar-view .phui-calendar-list li { margin: 0 8px; - display: inline-block; - float: left; - clear: both; } .phui-calendar-view .phui-calendar-list li:first-child { @@ -160,11 +157,18 @@ li.phui-calendar-list-item.all-day:first-child { .phui-calendar-view .phui-calendar-list-title { width: auto; - margin-left: 10px; white-space: normal; word-break: break-word; } +li.phui-calendar-list-item .phui-calendar-list-title a { + text-align: left; + padding-left: 8px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + li.phui-calendar-list-item.all-day .phui-calendar-list-title a{ color: {$greytext}; } @@ -173,6 +177,18 @@ li.phui-calendar-viewer-invited.all-day .phui-calendar-list-title a{ color: {$green}; } -.phui-calendar-view .phui-calendar-list-time { - display: none; +.phui-calendar-view li.phui-calendar-list-item .phui-calendar-list-time { + position: absolute; + width: 60px; + right: 0; + top: 1px; + color: {$lightgreytext}; + text-align: right; +} + +.phui-calendar-view +li.phui-calendar-list-item.all-day +.phui-calendar-list-time { + top: 4px; + right: 8px; } From 6620ebe553a0ca803311e56ec9eb72262235838a Mon Sep 17 00:00:00 2001 From: lkassianik Date: Fri, 15 May 2015 10:32:47 -0700 Subject: [PATCH 14/86] Week day names in Calendar month view should be full names on desktop and short names on device Summary: Ref T8186, Week day names in Calendar month view should be full names on desktop and short names on device Test Plan: Open month view, desktop view should display Monday, Tuesday, etc. Shrink browser, days should be Mon, Tue, etc. Reviewers: chad, epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T8186 Differential Revision: https://secure.phabricator.com/D12859 --- resources/celerity/map.php | 4 +-- .../phui/calendar/PHUICalendarMonthView.php | 34 +++++++++++++++---- .../css/phui/calendar/phui-calendar-month.css | 14 +++++++- 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index cf96220e2e..4c3c1b87ac 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -122,7 +122,7 @@ return array( 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/phui/calendar/phui-calendar-day.css' => '3b4a65d8', 'rsrc/css/phui/calendar/phui-calendar-list.css' => '840baa8d', - 'rsrc/css/phui/calendar/phui-calendar-month.css' => '450c37ea', + 'rsrc/css/phui/calendar/phui-calendar-month.css' => '9fde32d1', 'rsrc/css/phui/calendar/phui-calendar.css' => '8345be98', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', @@ -763,7 +763,7 @@ return array( 'phui-calendar-css' => '8345be98', 'phui-calendar-day-css' => '3b4a65d8', 'phui-calendar-list-css' => '840baa8d', - 'phui-calendar-month-css' => '450c37ea', + 'phui-calendar-month-css' => '9fde32d1', 'phui-crumbs-view-css' => '594d719e', 'phui-document-view-css' => '94d5dcd8', 'phui-feed-story-css' => 'c9f3a0b5', diff --git a/src/view/phui/calendar/PHUICalendarMonthView.php b/src/view/phui/calendar/PHUICalendarMonthView.php index 08a4731598..80fe049dc3 100644 --- a/src/view/phui/calendar/PHUICalendarMonthView.php +++ b/src/view/phui/calendar/PHUICalendarMonthView.php @@ -294,16 +294,36 @@ final class PHUICalendarMonthView extends AphrontView { 'tr', array('class' => 'phui-calendar-day-of-week-header'), array( - phutil_tag('th', array(), pht('Sun')), - phutil_tag('th', array(), pht('Mon')), - phutil_tag('th', array(), pht('Tue')), - phutil_tag('th', array(), pht('Wed')), - phutil_tag('th', array(), pht('Thu')), - phutil_tag('th', array(), pht('Fri')), - phutil_tag('th', array(), pht('Sat')), + $this->getDayHeader(pht('Sun'), pht('Sunday')), + $this->getDayHeader(pht('Mon'), pht('Monday')), + $this->getDayHeader(pht('Tue'), pht('Tuesday')), + $this->getDayHeader(pht('Wed'), pht('Wednesday')), + $this->getDayHeader(pht('Thu'), pht('Thursday')), + $this->getDayHeader(pht('Fri'), pht('Friday')), + $this->getDayHeader(pht('Sat'), pht('Saturday')), )); } + private function getDayHeader($short, $long) { + $day = array(); + $day[] = phutil_tag( + 'span', + array( + 'class' => 'long-weekday-name', + ), + $long); + $day[] = phutil_tag( + 'span', + array( + 'class' => 'short-weekday-name', + ), + $short); + return phutil_tag( + 'th', + array(), + $day); + } + private function renderCalendarHeader(DateTime $date) { $button_bar = null; diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css index 2e9f30a4c1..cd7a0e4712 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css @@ -10,12 +10,24 @@ tr.phui-calendar-day-of-week-header th { text-align: center; - font-size: 11px; + font-size: 13px; padding: 3px; color: {$lightbluetext}; background: {$lightgreybackground}; } +.device tr.phui-calendar-day-of-week-header th .long-weekday-name { + display: none; +} + +tr.phui-calendar-day-of-week-header th .short-weekday-name { + display: none; +} + +.device tr.phui-calendar-day-of-week-header th .short-weekday-name { + display: inline; +} + table.phui-calendar-view td { border: solid #dfdfdf; border-width: 1px 1px 0 1px; From 27c75357be847496f548522eebbeb02ffbebeb34 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Fri, 15 May 2015 10:42:54 -0700 Subject: [PATCH 15/86] Weekend header labels in month view should have darker backgrounds instead of dark actual weekend days. Summary: Closes T8186, Weekend header labels in month view should have darker backgrounds instead of dark actual weekend days. Test Plan: open month view, observe weekend labels having a darker background. Reviewers: chad, epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T8186 Differential Revision: https://secure.phabricator.com/D12860 --- resources/celerity/map.php | 4 ++-- src/view/phui/calendar/PHUICalendarMonthView.php | 14 ++++++++++---- .../rsrc/css/phui/calendar/phui-calendar-month.css | 4 ++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 4c3c1b87ac..1b82da2ae9 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -122,7 +122,7 @@ return array( 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/phui/calendar/phui-calendar-day.css' => '3b4a65d8', 'rsrc/css/phui/calendar/phui-calendar-list.css' => '840baa8d', - 'rsrc/css/phui/calendar/phui-calendar-month.css' => '9fde32d1', + 'rsrc/css/phui/calendar/phui-calendar-month.css' => '7819a8b1', 'rsrc/css/phui/calendar/phui-calendar.css' => '8345be98', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', @@ -763,7 +763,7 @@ return array( 'phui-calendar-css' => '8345be98', 'phui-calendar-day-css' => '3b4a65d8', 'phui-calendar-list-css' => '840baa8d', - 'phui-calendar-month-css' => '9fde32d1', + 'phui-calendar-month-css' => '7819a8b1', 'phui-crumbs-view-css' => '594d719e', 'phui-document-view-css' => '94d5dcd8', 'phui-feed-story-css' => 'c9f3a0b5', diff --git a/src/view/phui/calendar/PHUICalendarMonthView.php b/src/view/phui/calendar/PHUICalendarMonthView.php index 80fe049dc3..16e58e3203 100644 --- a/src/view/phui/calendar/PHUICalendarMonthView.php +++ b/src/view/phui/calendar/PHUICalendarMonthView.php @@ -294,17 +294,21 @@ final class PHUICalendarMonthView extends AphrontView { 'tr', array('class' => 'phui-calendar-day-of-week-header'), array( - $this->getDayHeader(pht('Sun'), pht('Sunday')), + $this->getDayHeader(pht('Sun'), pht('Sunday'), true), $this->getDayHeader(pht('Mon'), pht('Monday')), $this->getDayHeader(pht('Tue'), pht('Tuesday')), $this->getDayHeader(pht('Wed'), pht('Wednesday')), $this->getDayHeader(pht('Thu'), pht('Thursday')), $this->getDayHeader(pht('Fri'), pht('Friday')), - $this->getDayHeader(pht('Sat'), pht('Saturday')), + $this->getDayHeader(pht('Sat'), pht('Saturday'), true), )); } - private function getDayHeader($short, $long) { + private function getDayHeader($short, $long, $is_weekend = false) { + $class = null; + if ($is_weekend) { + $class = 'weekend-day-header'; + } $day = array(); $day[] = phutil_tag( 'span', @@ -320,7 +324,9 @@ final class PHUICalendarMonthView extends AphrontView { $short); return phutil_tag( 'th', - array(), + array( + 'class' => $class, + ), $day); } diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css index cd7a0e4712..ba268f332f 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css @@ -16,6 +16,10 @@ tr.phui-calendar-day-of-week-header th { background: {$lightgreybackground}; } +tr.phui-calendar-day-of-week-header th.weekend-day-header { + background: {$greybackground}; +} + .device tr.phui-calendar-day-of-week-header th .long-weekday-name { display: none; } From 7179def064a3881cb42f79e1ec2e0b8155b55f7b Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 15 May 2015 11:54:51 -0700 Subject: [PATCH 16/86] Clean up a missed access to Calendar status Summary: Ref T8183. The list view still used this field to choose a red/orange bar color. Test Plan: Viewed event list view. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8183 Differential Revision: https://secure.phabricator.com/D12857 --- .../query/PhabricatorCalendarEventSearchEngine.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php index 3e020895f3..7added162f 100644 --- a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php +++ b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php @@ -303,17 +303,12 @@ final class PhabricatorCalendarEventSearchEngine foreach ($events as $event) { $href = '/E'.$event->getID(); $from = phabricator_datetime($event->getDateFrom(), $viewer); - $to = phabricator_datetime($event->getDateTo(), $viewer); + $to = phabricator_datetime($event->getDateTo(), $viewer); $creator_handle = $handles[$event->getUserPHID()]; - $color = ($event->getStatus() == PhabricatorCalendarEvent::STATUS_AWAY) - ? 'red' - : 'yellow'; - $item = id(new PHUIObjectItemView()) ->setHeader($event->getName()) ->setHref($href) - ->setBarColor($color) ->addByline(pht('Creator: %s', $creator_handle->renderLink())) ->addAttribute(pht('From %s to %s', $from, $to)) ->addAttribute(id(new PhutilUTF8StringTruncator()) From 27b78d2147900f8b6406ff3c04c20e61f92bb210 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 15 May 2015 11:55:04 -0700 Subject: [PATCH 17/86] Don't use handles in the Calendar event name migration Summary: Fixes T8209. Using handles can now cause cache fills as a side effect of T7707. Use a raw query instead. I'll follow up on T8209 with some context and ideas for longer-term fixes. Test Plan: - Set event names to `''`. - Reran migration with `--apply ... --trace`. - Saw migration work correctly without executing cache fills. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8209 Differential Revision: https://secure.phabricator.com/D12858 --- .../autopatches/20150506.calendarunnamedevents.1.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/resources/sql/autopatches/20150506.calendarunnamedevents.1.php b/resources/sql/autopatches/20150506.calendarunnamedevents.1.php index d6bdb1ab48..0b8c029584 100644 --- a/resources/sql/autopatches/20150506.calendarunnamedevents.1.php +++ b/resources/sql/autopatches/20150506.calendarunnamedevents.1.php @@ -11,12 +11,17 @@ foreach ($iterator as $event) { if (strlen($event->getName()) == 0) { echo "Renaming event {$id}...\n"; $viewer = PhabricatorUser::getOmnipotentUser(); - $handle = id(new PhabricatorHandleQuery()) + + // NOTE: This uses PeopleQuery directly, instead of HandleQuery, to avoid + // performing cache fills as a side effect; the caches were added by a + // later patch. See T8209. + $user = id(new PhabricatorPeopleQuery()) ->setViewer($viewer) ->withPHIDs(array($event->getUserPHID())) ->executeOne(); - if ($handle->isComplete()) { - $new_name = $handle->getName(); + + if ($user) { + $new_name = $user->getUsername(); } else { $new_name = pht('Unnamed Event'); } From e3134a1d478e649df86761acb53a3822fb9409bd Mon Sep 17 00:00:00 2001 From: lkassianik Date: Fri, 15 May 2015 12:17:34 -0700 Subject: [PATCH 18/86] This week should be marked with a bottom blue horizontal bar in Calendar month view. Summary: Closes T8185, This week should be marked with a bottom blue horizontal bar in Calendar month view. Test Plan: Open calendar month view, "this week" should show a dark blue bar under it and a lighter blue bar on "today". Reviewers: chad, #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8185 Differential Revision: https://secure.phabricator.com/D12862 --- resources/celerity/map.php | 4 +- .../phui/calendar/PHUICalendarMonthView.php | 47 +++++++++++++++++++ .../css/phui/calendar/phui-calendar-month.css | 17 +++++-- 3 files changed, 62 insertions(+), 6 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 1b82da2ae9..a6a4fecbae 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -122,7 +122,7 @@ return array( 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/phui/calendar/phui-calendar-day.css' => '3b4a65d8', 'rsrc/css/phui/calendar/phui-calendar-list.css' => '840baa8d', - 'rsrc/css/phui/calendar/phui-calendar-month.css' => '7819a8b1', + 'rsrc/css/phui/calendar/phui-calendar-month.css' => '4fba442e', 'rsrc/css/phui/calendar/phui-calendar.css' => '8345be98', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', @@ -763,7 +763,7 @@ return array( 'phui-calendar-css' => '8345be98', 'phui-calendar-day-css' => '3b4a65d8', 'phui-calendar-list-css' => '840baa8d', - 'phui-calendar-month-css' => '7819a8b1', + 'phui-calendar-month-css' => '4fba442e', 'phui-crumbs-view-css' => '594d719e', 'phui-document-view-css' => '94d5dcd8', 'phui-feed-story-css' => 'c9f3a0b5', diff --git a/src/view/phui/calendar/PHUICalendarMonthView.php b/src/view/phui/calendar/PHUICalendarMonthView.php index 16e58e3203..fd2ca4e458 100644 --- a/src/view/phui/calendar/PHUICalendarMonthView.php +++ b/src/view/phui/calendar/PHUICalendarMonthView.php @@ -228,6 +228,15 @@ final class PHUICalendarMonthView extends AphrontView { $today_class = 'phui-calendar-today-slot'; } + if ($this->isDateInCurrentWeek($date)) { + $today_class .= ' phui-calendar-this-week'; + } + + $last_week_day = 6; + if ($date->format('w') == $last_week_day) { + $today_class .= ' last-weekday'; + } + $today_slot = phutil_tag ( 'div', array( @@ -254,6 +263,16 @@ final class PHUICalendarMonthView extends AphrontView { $cell_div); } + private function isDateInCurrentWeek($date) { + list($week_start_date, $week_end_date) = $this->getThisWeekRange(); + + if ($date->format('U') < $week_end_date->format('U') && + $date->format('U') >= $week_start_date->format('U')) { + return true; + } + return false; + } + private function getEventCountBadge($count, $viewer_is_invited) { $class = 'phui-calendar-month-count-badge'; @@ -484,6 +503,34 @@ final class PHUICalendarMonthView extends AphrontView { return $days; } + private function getTodayMidnight() { + $viewer = $this->getUser(); + $today = new DateTime('@'.time()); + $today->setTimeZone($viewer->getTimeZone()); + $today->setTime(0, 0, 0); + + return $today; + } + + private function getThisWeekRange() { + $week_start = 0; + $week_end = 6; + + $today = $this->getTodayMidnight(); + $date_weekday = $today->format('w'); + + $days_from_week_start = $date_weekday - $week_start; + $days_to_week_end = $week_end - $date_weekday + 1; + + $modify = '-'.$days_from_week_start.' days'; + $week_start_date = id(clone $today)->modify($modify); + + $modify = '+'.$days_to_week_end.' days'; + $week_end_date = id(clone $today)->modify($modify); + + return array($week_start_date, $week_end_date); + } + private function getDateTime() { $user = $this->user; $timezone = new DateTimeZone($user->getTimezoneIdentifier()); diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css index ba268f332f..14d25e7f67 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css @@ -96,7 +96,7 @@ table.phui-calendar-view tr td:first-child { table.phui-calendar-view a.phui-calendar-date-number { color: {$lightgreytext}; - padding: 0 4px; + padding: 4px; display: inline-block; min-width: 16px; text-align: center; @@ -111,10 +111,19 @@ table.phui-calendar-view td.phui-calendar-date-number-container { .phui-calendar-today-slot { display: block; - width: 100%; height: 4px; - padding: 0; - margin: 0; + position: absolute; + left: 0; + right: -1px; + bottom: 0; +} + +.phui-calendar-today-slot.last-weekday { + right: 0px; +} + +.phui-calendar-today-slot.phui-calendar-this-week { + background-color: {$blueborder}; } .phui-calendar-today-slot.phui-calendar-today { From b6733e4a8643dd755c5d4ca5d32f805fecb43408 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Fri, 15 May 2015 13:07:45 -0700 Subject: [PATCH 19/86] Phame - move over post creation and edit to use an editor Summary: This adds the bare minimum transaction set for editing posts. Fixes T7626 because now files will be correctly attached to phame posts on subsequent edits. Future work here should be adding transaction types like `TYPE_BLOG` for when posts are moved between blogs, `TYPE_VISIBILITY` for when posts are moved to published, etc. Nothing too tricky there but keeping this diff relatively small seems prudent. Test Plan: made posts successfully. also made errors like no title, no phame title, and duplicate phame title and got correct errors. added a file to a post and verified file has phame post in "attached" tab, which should fix T7626. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7626 Differential Revision: https://secure.phabricator.com/D12864 --- resources/celerity/map.php | 4 +- .../20150515.phame.post.xaction.sql | 19 ++ src/__phutil_library_map__.php | 7 + .../post/PhamePostDeleteController.php | 11 +- .../post/PhamePostEditController.php | 102 +++++----- .../post/PhamePostNewController.php | 14 +- .../post/PhamePostViewController.php | 24 +-- .../phame/editor/PhameBlogEditor.php | 3 - .../phame/editor/PhamePostEditor.php | 165 ++++++++++++++++ .../phame/query/PhamePostTransactionQuery.php | 10 + src/applications/phame/storage/PhamePost.php | 38 +++- .../phame/storage/PhamePostTransaction.php | 187 ++++++++++++++++++ 12 files changed, 490 insertions(+), 94 deletions(-) create mode 100644 resources/sql/autopatches/20150515.phame.post.xaction.sql create mode 100644 src/applications/phame/editor/PhamePostEditor.php create mode 100644 src/applications/phame/query/PhamePostTransactionQuery.php create mode 100644 src/applications/phame/storage/PhamePostTransaction.php diff --git a/resources/celerity/map.php b/resources/celerity/map.php index a6a4fecbae..9d0c4f7014 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -122,7 +122,7 @@ return array( 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/phui/calendar/phui-calendar-day.css' => '3b4a65d8', 'rsrc/css/phui/calendar/phui-calendar-list.css' => '840baa8d', - 'rsrc/css/phui/calendar/phui-calendar-month.css' => '4fba442e', + 'rsrc/css/phui/calendar/phui-calendar-month.css' => 'a6993b38', 'rsrc/css/phui/calendar/phui-calendar.css' => '8345be98', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', @@ -763,7 +763,7 @@ return array( 'phui-calendar-css' => '8345be98', 'phui-calendar-day-css' => '3b4a65d8', 'phui-calendar-list-css' => '840baa8d', - 'phui-calendar-month-css' => '4fba442e', + 'phui-calendar-month-css' => 'a6993b38', 'phui-crumbs-view-css' => '594d719e', 'phui-document-view-css' => '94d5dcd8', 'phui-feed-story-css' => 'c9f3a0b5', diff --git a/resources/sql/autopatches/20150515.phame.post.xaction.sql b/resources/sql/autopatches/20150515.phame.post.xaction.sql new file mode 100644 index 0000000000..a39bf52fb7 --- /dev/null +++ b/resources/sql/autopatches/20150515.phame.post.xaction.sql @@ -0,0 +1,19 @@ +CREATE TABLE {$NAMESPACE}_phame.phame_posttransaction ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + phid VARBINARY(64) NOT NULL, + authorPHID VARBINARY(64) NOT NULL, + objectPHID VARBINARY(64) NOT NULL, + viewPolicy VARBINARY(64) NOT NULL, + editPolicy VARBINARY(64) NOT NULL, + commentPHID VARBINARY(64) DEFAULT NULL, + commentVersion INT UNSIGNED NOT NULL, + transactionType VARCHAR(32) COLLATE {$COLLATE_TEXT} NOT NULL, + oldValue LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL, + newValue LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL, + contentSource LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL, + metadata LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL, + dateCreated INT UNSIGNED NOT NULL, + dateModified INT UNSIGNED NOT NULL, + UNIQUE KEY `key_phid` (`phid`), + KEY `key_object` (`objectPHID`) +) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT}; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index f574caf682..94512f3abd 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2791,6 +2791,7 @@ phutil_register_library_map(array( 'PhamePost' => 'applications/phame/storage/PhamePost.php', 'PhamePostDeleteController' => 'applications/phame/controller/post/PhamePostDeleteController.php', 'PhamePostEditController' => 'applications/phame/controller/post/PhamePostEditController.php', + 'PhamePostEditor' => 'applications/phame/editor/PhamePostEditor.php', 'PhamePostFramedController' => 'applications/phame/controller/post/PhamePostFramedController.php', 'PhamePostListController' => 'applications/phame/controller/post/PhamePostListController.php', 'PhamePostNewController' => 'applications/phame/controller/post/PhamePostNewController.php', @@ -2798,6 +2799,8 @@ phutil_register_library_map(array( 'PhamePostPreviewController' => 'applications/phame/controller/post/PhamePostPreviewController.php', 'PhamePostPublishController' => 'applications/phame/controller/post/PhamePostPublishController.php', 'PhamePostQuery' => 'applications/phame/query/PhamePostQuery.php', + 'PhamePostTransaction' => 'applications/phame/storage/PhamePostTransaction.php', + 'PhamePostTransactionQuery' => 'applications/phame/query/PhamePostTransactionQuery.php', 'PhamePostUnpublishController' => 'applications/phame/controller/post/PhamePostUnpublishController.php', 'PhamePostView' => 'applications/phame/view/PhamePostView.php', 'PhamePostViewController' => 'applications/phame/controller/post/PhamePostViewController.php', @@ -6269,10 +6272,12 @@ phutil_register_library_map(array( 'PhameDAO', 'PhabricatorPolicyInterface', 'PhabricatorMarkupInterface', + 'PhabricatorApplicationTransactionInterface', 'PhabricatorTokenReceiverInterface', ), 'PhamePostDeleteController' => 'PhameController', 'PhamePostEditController' => 'PhameController', + 'PhamePostEditor' => 'PhabricatorApplicationTransactionEditor', 'PhamePostFramedController' => 'PhameController', 'PhamePostListController' => 'PhameController', 'PhamePostNewController' => 'PhameController', @@ -6280,6 +6285,8 @@ phutil_register_library_map(array( 'PhamePostPreviewController' => 'PhameController', 'PhamePostPublishController' => 'PhameController', 'PhamePostQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', + 'PhamePostTransaction' => 'PhabricatorApplicationTransaction', + 'PhamePostTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'PhamePostUnpublishController' => 'PhameController', 'PhamePostView' => 'AphrontView', 'PhamePostViewController' => 'PhameController', diff --git a/src/applications/phame/controller/post/PhamePostDeleteController.php b/src/applications/phame/controller/post/PhamePostDeleteController.php index a02c0e1cff..80038edd1d 100644 --- a/src/applications/phame/controller/post/PhamePostDeleteController.php +++ b/src/applications/phame/controller/post/PhamePostDeleteController.php @@ -2,19 +2,12 @@ final class PhamePostDeleteController extends PhameController { - private $id; - - public function willProcessRequest(array $data) { - $this->id = $data['id']; - } - - public function processRequest() { - $request = $this->getRequest(); + public function handleRequest(AphrontRequest $request) { $user = $request->getUser(); $post = id(new PhamePostQuery()) ->setViewer($user) - ->withIDs(array($this->id)) + ->withIDs(array($request->getURIData('id'))) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_EDIT, diff --git a/src/applications/phame/controller/post/PhamePostEditController.php b/src/applications/phame/controller/post/PhamePostEditController.php index 6483ae6136..80735f0ad5 100644 --- a/src/applications/phame/controller/post/PhamePostEditController.php +++ b/src/applications/phame/controller/post/PhamePostEditController.php @@ -2,20 +2,14 @@ final class PhamePostEditController extends PhameController { - private $id; + public function handleRequest(AphrontRequest $request) { + $user = $request->getUser(); + $id = $request->getURIData('id'); - public function willProcessRequest(array $data) { - $this->id = idx($data, 'id'); - } - - public function processRequest() { - $request = $this->getRequest(); - $user = $request->getUser(); - - if ($this->id) { + if ($id) { $post = id(new PhamePostQuery()) ->setViewer($user) - ->withIDs(array($this->id)) + ->withIDs(array($id)) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_EDIT, @@ -25,7 +19,7 @@ final class PhamePostEditController extends PhameController { return new Aphront404Response(); } - $cancel_uri = $this->getApplicationURI('/post/view/'.$this->id.'/'); + $cancel_uri = $this->getApplicationURI('/post/view/'.$id.'/'); $submit_button = pht('Save Changes'); $page_title = pht('Edit Post'); } else { @@ -49,44 +43,52 @@ final class PhamePostEditController extends PhameController { $page_title = pht('Create Post'); } - $e_phame_title = null; + $title = $post->getTitle(); + $phame_title = $post->getPhameTitle(); + $body = $post->getBody(); + $comments_widget = $post->getCommentsWidget(); + $e_title = true; - $errors = array(); - + $e_phame_title = true; + $validation_exception = null; if ($request->isFormPost()) { - $comments = $request->getStr('comments_widget'); - $data = array('comments_widget' => $comments); - $phame_title = $request->getStr('phame_title'); - $phame_title = PhabricatorSlug::normalize($phame_title); - $title = $request->getStr('title'); - $post->setTitle($title); - $post->setPhameTitle($phame_title); - $post->setBody($request->getStr('body')); - $post->setConfigData($data); + $title = $request->getStr('title'); + $phame_title = $request->getStr('phame_title'); + $phame_title = PhabricatorSlug::normalize($phame_title); + $body = $request->getStr('body'); + $comments_widget = $request->getStr('comments_widget'); - if ($phame_title == '/') { - $errors[] = pht('Phame title must be nonempty.'); - $e_phame_title = pht('Required'); - } + $xactions = array( + id(new PhamePostTransaction()) + ->setTransactionType(PhamePostTransaction::TYPE_TITLE) + ->setNewValue($title), + id(new PhamePostTransaction()) + ->setTransactionType(PhamePostTransaction::TYPE_PHAME_TITLE) + ->setNewValue($phame_title), + id(new PhamePostTransaction()) + ->setTransactionType(PhamePostTransaction::TYPE_BODY) + ->setNewValue($body), + id(new PhamePostTransaction()) + ->setTransactionType(PhamePostTransaction::TYPE_COMMENTS_WIDGET) + ->setNewValue($comments_widget), + ); - if (!strlen($title)) { - $errors[] = pht('Title must be nonempty.'); - $e_title = pht('Required'); - } else { - $e_title = null; - } + $editor = id(new PhamePostEditor()) + ->setActor($user) + ->setContentSourceFromRequest($request) + ->setContinueOnNoEffect(true); - if (!$errors) { - try { - $post->save(); + try { + $editor->applyTransactions($post, $xactions); - $uri = $this->getApplicationURI('/post/view/'.$post->getID().'/'); - return id(new AphrontRedirectResponse())->setURI($uri); - } catch (AphrontDuplicateKeyQueryException $e) { - $e_phame_title = pht('Not Unique'); - $errors[] = pht('Another post already uses this slug. '. - 'Each post must have a unique slug.'); - } + $uri = $this->getApplicationURI('/post/view/'.$post->getID().'/'); + return id(new AphrontRedirectResponse())->setURI($uri); + } catch (PhabricatorApplicationTransactionValidationException $ex) { + $validation_exception = $ex; + $e_title = $validation_exception->getShortMessage( + PhamePostTransaction::TYPE_TITLE); + $e_phame_title = $validation_exception->getShortMessage( + PhamePostTransaction::TYPE_PHAME_TITLE); } } @@ -106,14 +108,14 @@ final class PhamePostEditController extends PhameController { id(new AphrontFormTextControl()) ->setLabel(pht('Title')) ->setName('title') - ->setValue($post->getTitle()) + ->setValue($title) ->setID('post-title') ->setError($e_title)) ->appendChild( id(new AphrontFormTextControl()) ->setLabel(pht('Phame Title')) ->setName('phame_title') - ->setValue(rtrim($post->getPhameTitle(), '/')) + ->setValue(rtrim($phame_title, '/')) ->setID('post-phame-title') ->setCaption(pht('Up to 64 alphanumeric characters '. 'with underscores for spaces. '. @@ -123,7 +125,7 @@ final class PhamePostEditController extends PhameController { id(new PhabricatorRemarkupControl()) ->setLabel(pht('Body')) ->setName('body') - ->setValue($post->getBody()) + ->setValue($body) ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL) ->setID('post-body') ->setUser($user) @@ -132,7 +134,7 @@ final class PhamePostEditController extends PhameController { id(new AphrontFormSelectControl()) ->setLabel(pht('Comments Widget')) ->setName('comments_widget') - ->setvalue($post->getCommentsWidget()) + ->setvalue($comments_widget) ->setOptions($post->getCommentsWidgetOptionsForSelect())) ->appendChild( id(new AphrontFormSubmitControl()) @@ -161,13 +163,13 @@ final class PhamePostEditController extends PhameController { $form_box = id(new PHUIObjectBoxView()) ->setHeaderText($page_title) - ->setFormErrors($errors) + ->setValidationException($validation_exception) ->setForm($form); $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb( $page_title, - $this->getApplicationURI('/post/view/'.$this->id.'/')); + $this->getApplicationURI('/post/view/'.$id.'/')); $nav = $this->renderSideNavFilterView(null); $nav->appendChild( diff --git a/src/applications/phame/controller/post/PhamePostNewController.php b/src/applications/phame/controller/post/PhamePostNewController.php index fd1ae47e89..94d8651f27 100644 --- a/src/applications/phame/controller/post/PhamePostNewController.php +++ b/src/applications/phame/controller/post/PhamePostNewController.php @@ -2,22 +2,16 @@ final class PhamePostNewController extends PhameController { - private $id; - - public function willProcessRequest(array $data) { - $this->id = idx($data, 'id'); - } - - public function processRequest() { - $request = $this->getRequest(); + public function handleRequest(AphrontRequest $request) { $user = $request->getUser(); + $id = $request->getURIData('id'); $post = null; $view_uri = null; - if ($this->id) { + if ($id) { $post = id(new PhamePostQuery()) ->setViewer($user) - ->withIDs(array($this->id)) + ->withIDs(array($id)) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_EDIT, diff --git a/src/applications/phame/controller/post/PhamePostViewController.php b/src/applications/phame/controller/post/PhamePostViewController.php index c451167e3b..c1f6405377 100644 --- a/src/applications/phame/controller/post/PhamePostViewController.php +++ b/src/applications/phame/controller/post/PhamePostViewController.php @@ -2,19 +2,12 @@ final class PhamePostViewController extends PhameController { - private $id; - - public function willProcessRequest(array $data) { - $this->id = $data['id']; - } - - public function processRequest() { - $request = $this->getRequest(); + public function handleRequest(AphrontRequest $request) { $user = $request->getUser(); $post = id(new PhamePostQuery()) ->setViewer($user) - ->withIDs(array($this->id)) + ->withIDs(array($request->getURIData('id'))) ->executeOne(); if (!$post) { @@ -65,7 +58,10 @@ final class PhamePostViewController extends PhameController { $nav->appendChild( array( $object_box, - )); + $this->buildTransactionTimeline( + $post, + new PhamePostTransactionQuery()), + )); return $this->buildApplicationPage( $nav, @@ -78,10 +74,10 @@ final class PhamePostViewController extends PhameController { PhamePost $post, PhabricatorUser $user) { - $actions = id(new PhabricatorActionListView()) - ->setObject($post) - ->setObjectURI($this->getRequest()->getRequestURI()) - ->setUser($user); + $actions = id(new PhabricatorActionListView()) + ->setObject($post) + ->setObjectURI($this->getRequest()->getRequestURI()) + ->setUser($user); $can_edit = PhabricatorPolicyFilter::hasCapability( $user, diff --git a/src/applications/phame/editor/PhameBlogEditor.php b/src/applications/phame/editor/PhameBlogEditor.php index 5b837038b7..f44be159c8 100644 --- a/src/applications/phame/editor/PhameBlogEditor.php +++ b/src/applications/phame/editor/PhameBlogEditor.php @@ -76,8 +76,6 @@ final class PhameBlogEditor case PhabricatorTransactions::TYPE_JOIN_POLICY: $object->setJoinPolicy($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_COMMENT: - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -95,7 +93,6 @@ final class PhameBlogEditor case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_JOIN_POLICY: - case PhabricatorTransactions::TYPE_COMMENT: return; } diff --git a/src/applications/phame/editor/PhamePostEditor.php b/src/applications/phame/editor/PhamePostEditor.php new file mode 100644 index 0000000000..ef6cd21307 --- /dev/null +++ b/src/applications/phame/editor/PhamePostEditor.php @@ -0,0 +1,165 @@ +getTransactionType()) { + case PhamePostTransaction::TYPE_TITLE: + return $object->getTitle(); + case PhamePostTransaction::TYPE_PHAME_TITLE: + return $object->getPhameTitle(); + case PhamePostTransaction::TYPE_BODY: + return $object->getBody(); + case PhamePostTransaction::TYPE_COMMENTS_WIDGET: + return $object->getCommentsWidget(); + } + } + + protected function getCustomTransactionNewValue( + PhabricatorLiskDAO $object, + PhabricatorApplicationTransaction $xaction) { + + switch ($xaction->getTransactionType()) { + case PhamePostTransaction::TYPE_TITLE: + case PhamePostTransaction::TYPE_PHAME_TITLE: + case PhamePostTransaction::TYPE_BODY: + case PhamePostTransaction::TYPE_COMMENTS_WIDGET: + return $xaction->getNewValue(); + } + } + + protected function applyCustomInternalTransaction( + PhabricatorLiskDAO $object, + PhabricatorApplicationTransaction $xaction) { + + switch ($xaction->getTransactionType()) { + case PhamePostTransaction::TYPE_TITLE: + return $object->setTitle($xaction->getNewValue()); + case PhamePostTransaction::TYPE_PHAME_TITLE: + return $object->setPhameTitle($xaction->getNewValue()); + case PhamePostTransaction::TYPE_BODY: + return $object->setBody($xaction->getNewValue()); + case PhamePostTransaction::TYPE_COMMENTS_WIDGET: + return $object->setCommentsWidget($xaction->getNewValue()); + } + + return parent::applyCustomInternalTransaction($object, $xaction); + } + + protected function applyCustomExternalTransaction( + PhabricatorLiskDAO $object, + PhabricatorApplicationTransaction $xaction) { + + switch ($xaction->getTransactionType()) { + case PhamePostTransaction::TYPE_TITLE: + case PhamePostTransaction::TYPE_PHAME_TITLE: + case PhamePostTransaction::TYPE_BODY: + case PhamePostTransaction::TYPE_COMMENTS_WIDGET: + return; + } + + return parent::applyCustomExternalTransaction($object, $xaction); + } + + protected function validateTransaction( + PhabricatorLiskDAO $object, + $type, + array $xactions) { + + $errors = parent::validateTransaction($object, $type, $xactions); + + switch ($type) { + case PhamePostTransaction::TYPE_TITLE: + $missing = $this->validateIsEmptyTextField( + $object->getTitle(), + $xactions); + + if ($missing) { + $error = new PhabricatorApplicationTransactionValidationError( + $type, + pht('Required'), + pht('Title is required.'), + nonempty(last($xactions), null)); + + $error->setIsMissingFieldError(true); + $errors[] = $error; + } + break; + case PhamePostTransaction::TYPE_PHAME_TITLE: + $missing = $this->validateIsEmptyTextField( + $object->getPhameTitle(), + $xactions); + $phame_title = last($xactions)->getNewValue(); + + if ($missing || $phame_title == '/') { + $error = new PhabricatorApplicationTransactionValidationError( + $type, + pht('Required'), + pht('Phame title is required.'), + nonempty(last($xactions), null)); + + $error->setIsMissingFieldError(true); + $errors[] = $error; + } + + $duplicate_post = id(new PhamePostQuery()) + ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->withPhameTitles(array($phame_title)) + ->executeOne(); + if ($duplicate_post && $duplicate_post->getID() != $object->getID()) { + $error_text = pht( + 'Phame title must be unique; another post already has this phame '. + 'title.'); + $error = new PhabricatorApplicationTransactionValidationError( + $type, + pht('Not Unique'), + $error_text, + nonempty(last($xactions), null)); + $errors[] = $error; + } + + break; + } + return $errors; + } + + protected function shouldSendMail( + PhabricatorLiskDAO $object, + array $xactions) { + return false; + } + + protected function shouldPublishFeedStory( + PhabricatorLiskDAO $object, + array $xactions) { + return false; + } + + protected function supportsSearch() { + return false; + } + +} diff --git a/src/applications/phame/query/PhamePostTransactionQuery.php b/src/applications/phame/query/PhamePostTransactionQuery.php new file mode 100644 index 0000000000..879b6363e3 --- /dev/null +++ b/src/applications/phame/query/PhamePostTransactionQuery.php @@ -0,0 +1,10 @@ +getConfigData(); + $config_data['comments_widget'] = $widget; + return $this; + } + public function getCommentsWidget() { $config_data = $this->getConfigData(); if (empty($config_data)) { @@ -181,7 +188,6 @@ final class PhamePost extends PhameDAO ); } - public function getPolicy($capability) { // Draft posts are visible only to the author. Published posts are visible // to whoever the blog is visible to. @@ -199,7 +205,6 @@ final class PhamePost extends PhameDAO } } - public function hasAutomaticCapability($capability, PhabricatorUser $user) { // A blog post's author can always view it, and is the only user allowed // to edit it. @@ -211,7 +216,6 @@ final class PhamePost extends PhameDAO } } - public function describeAutomaticCapability($capability) { return pht( 'The author of a blog post can always view and edit it.'); @@ -226,12 +230,10 @@ final class PhamePost extends PhameDAO return $this->getPHID().':'.$field.':'.$hash; } - public function newMarkupEngine($field) { return PhabricatorMarkupEngine::newPhameMarkupEngine(); } - public function getMarkupText($field) { switch ($field) { case self::MARKUP_FIELD_BODY: @@ -248,13 +250,37 @@ final class PhamePost extends PhameDAO return $output; } - public function shouldUseMarkupCache($field) { return (bool)$this->getPHID(); } + +/* -( PhabricatorApplicationTransactionInterface )------------------------- */ + + + public function getApplicationTransactionEditor() { + return new PhamePostEditor(); + } + + public function getApplicationTransactionObject() { + return $this; + } + + public function getApplicationTransactionTemplate() { + return new PhamePostTransaction(); + } + + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + + /* -( PhabricatorTokenReceiverInterface )---------------------------------- */ + public function getUsersToNotifyOfTokenGiven() { return array( $this->getBloggerPHID(), diff --git a/src/applications/phame/storage/PhamePostTransaction.php b/src/applications/phame/storage/PhamePostTransaction.php new file mode 100644 index 0000000000..04841cda9f --- /dev/null +++ b/src/applications/phame/storage/PhamePostTransaction.php @@ -0,0 +1,187 @@ +getTransactionType()) { + case self::TYPE_BODY: + $blocks[] = $this->getNewValue(); + break; + } + + return $blocks; + } + + public function shouldHide() { + $old = $this->getOldValue(); + switch ($this->getTransactionType()) { + case self::TYPE_PHAME_TITLE: + case self::TYPE_BODY: + return ($old === null); + } + return parent::shouldHide(); + } + + public function getIcon() { + $old = $this->getOldValue(); + switch ($this->getTransactionType()) { + case self::TYPE_TITLE: + if ($old === null) { + return 'fa-plus'; + } else { + return 'fa-pencil'; + } + break; + case self::TYPE_PHAME_TITLE: + case self::TYPE_BODY: + case self::TYPE_COMMENTS_WIDGET: + return 'fa-pencil'; + break; + } + return parent::getIcon(); + } + + public function getTitle() { + $author_phid = $this->getAuthorPHID(); + $object_phid = $this->getObjectPHID(); + + $old = $this->getOldValue(); + $new = $this->getNewValue(); + + $type = $this->getTransactionType(); + switch ($type) { + case self::TYPE_TITLE: + if ($old === null) { + return pht( + '%s created this post.', + $this->renderHandleLink($author_phid)); + } else { + return pht( + '%s updated the post\'s name to "%s".', + $this->renderHandleLink($author_phid), + $new); + } + break; + case self::TYPE_BODY: + return pht( + '%s updated the post\'s body.', + $this->renderHandleLink($author_phid)); + break; + case self::TYPE_PHAME_TITLE: + return pht( + '%s updated the post\'s phame title to "%s".', + $this->renderHandleLink($author_phid), + rtrim($new, '/')); + break; + case self::TYPE_COMMENTS_WIDGET: + return pht( + '%s updated the post\'s comment widget to "%s".', + $this->renderHandleLink($author_phid), + $new); + break; + } + + return parent::getTitle(); + } + + public function getTitleForFeed() { + $author_phid = $this->getAuthorPHID(); + $object_phid = $this->getObjectPHID(); + + $old = $this->getOldValue(); + $new = $this->getNewValue(); + + $type = $this->getTransactionType(); + switch ($type) { + case self::TYPE_TITLE: + if ($old === null) { + return pht( + '%s created %s.', + $this->renderHandleLink($author_phid), + $this->renderHandleLink($object_phid)); + } else { + return pht( + '%s updated the name for %s.', + $this->renderHandleLink($author_phid), + $this->renderHandleLink($object_phid)); + } + break; + case self::TYPE_BODY: + return pht( + '%s updated the body for %s.', + $this->renderHandleLink($author_phid), + $this->renderHandleLink($object_phid)); + break; + case self::TYPE_PHAME_TITLE: + return pht( + '%s updated the phame title for %s.', + $this->renderHandleLink($author_phid), + $this->renderHandleLink($object_phid)); + break; + case self::TYPE_COMMENTS_WIDGET: + return pht( + '%s updated the comments widget for %s.', + $this->renderHandleLink($author_phid), + $this->renderHandleLink($object_phid)); + break; + } + + return parent::getTitleForFeed(); + } + + public function getColor() { + $old = $this->getOldValue(); + + switch ($this->getTransactionType()) { + case self::TYPE_TITLE: + if ($old === null) { + return PhabricatorTransactions::COLOR_GREEN; + } + break; + } + + return parent::getColor(); + } + + + public function hasChangeDetails() { + switch ($this->getTransactionType()) { + case self::TYPE_BODY: + return ($this->getOldValue() !== null); + } + + return parent::hasChangeDetails(); + } + + public function renderChangeDetails(PhabricatorUser $viewer) { + switch ($this->getTransactionType()) { + case self::TYPE_BODY: + $old = $this->getOldValue(); + $new = $this->getNewValue(); + + return $this->renderTextCorpusChangeDetails( + $viewer, + $old, + $new); + } + + return parent::renderChangeDetails($viewer); + } + +} From 3ef0721adacce6e94eb855bb2a97b70733a6a3b2 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Fri, 15 May 2015 14:07:17 -0700 Subject: [PATCH 20/86] Reduce PhabricatorUser::getOmnipotentUser calls by adding a getViewer method to PhbaricatorDestructionEngine Summary: Fixes T6956. Before this change, we called PhabricatorUser::getOmnipotentUser in the various delete methods to query the data. Now, we use $engine->getViewer(), since its always a good thing to have less calls to PhabricatorUser::getOmnipotentUser thrown around the codebase. I used the "codemod" tool to audit the existing calls to PhabricatorDestructorEngine (all of them) so ostensibly this gets all the spots. If I missed something though, its still going to work, so this change is very low risk. Test Plan: ./bin/remove destroy P1; visit P1 and get a 404 Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6956 Differential Revision: https://secure.phabricator.com/D12866 --- src/applications/almanac/storage/AlmanacDevice.php | 2 +- src/applications/almanac/storage/AlmanacInterface.php | 2 +- src/applications/almanac/storage/AlmanacNetwork.php | 2 +- src/applications/almanac/storage/AlmanacService.php | 2 +- .../differential/storage/DifferentialRevision.php | 2 +- src/applications/diviner/storage/DivinerLiveBook.php | 2 +- .../files/controller/PhabricatorFileTransformController.php | 4 ++-- src/applications/files/storage/PhabricatorFileChunk.php | 2 +- src/applications/paste/storage/PhabricatorPaste.php | 2 +- .../system/engine/PhabricatorDestructionEngine.php | 4 ++++ 10 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/applications/almanac/storage/AlmanacDevice.php b/src/applications/almanac/storage/AlmanacDevice.php index 19ee3f89ff..d0994174b3 100644 --- a/src/applications/almanac/storage/AlmanacDevice.php +++ b/src/applications/almanac/storage/AlmanacDevice.php @@ -240,7 +240,7 @@ final class AlmanacDevice PhabricatorDestructionEngine $engine) { $interfaces = id(new AlmanacInterfaceQuery()) - ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->setViewer($engine->getViewer()) ->withDevicePHIDs(array($this->getPHID())) ->execute(); foreach ($interfaces as $interface) { diff --git a/src/applications/almanac/storage/AlmanacInterface.php b/src/applications/almanac/storage/AlmanacInterface.php index 5ab892cef7..729e95aa9a 100644 --- a/src/applications/almanac/storage/AlmanacInterface.php +++ b/src/applications/almanac/storage/AlmanacInterface.php @@ -119,7 +119,7 @@ final class AlmanacInterface PhabricatorDestructionEngine $engine) { $bindings = id(new AlmanacBindingQuery()) - ->setViewer($this->getViewer()) + ->setViewer($engine->getViewer()) ->withInterfacePHIDs(array($this->getPHID())) ->execute(); foreach ($bindings as $binding) { diff --git a/src/applications/almanac/storage/AlmanacNetwork.php b/src/applications/almanac/storage/AlmanacNetwork.php index 92d4b8fa47..a623248fd9 100644 --- a/src/applications/almanac/storage/AlmanacNetwork.php +++ b/src/applications/almanac/storage/AlmanacNetwork.php @@ -103,7 +103,7 @@ final class AlmanacNetwork PhabricatorDestructionEngine $engine) { $interfaces = id(new AlmanacInterfaceQuery()) - ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->setViewer($engine->getViewer()) ->withNetworkPHIDs(array($this->getPHID())) ->execute(); diff --git a/src/applications/almanac/storage/AlmanacService.php b/src/applications/almanac/storage/AlmanacService.php index 36c7761e22..b351f0d3fc 100644 --- a/src/applications/almanac/storage/AlmanacService.php +++ b/src/applications/almanac/storage/AlmanacService.php @@ -221,7 +221,7 @@ final class AlmanacService PhabricatorDestructionEngine $engine) { $bindings = id(new AlmanacBindingQuery()) - ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->setViewer($engine->getViewer()) ->withServicePHIDs(array($this->getPHID())) ->execute(); foreach ($bindings as $binding) { diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php index 74f3ff34d7..e6baa678e9 100644 --- a/src/applications/differential/storage/DifferentialRevision.php +++ b/src/applications/differential/storage/DifferentialRevision.php @@ -550,7 +550,7 @@ final class DifferentialRevision extends DifferentialDAO $this->openTransaction(); $diffs = id(new DifferentialDiffQuery()) - ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->setViewer($engine->getViewer()) ->withRevisionIDs(array($this->getID())) ->execute(); foreach ($diffs as $diff) { diff --git a/src/applications/diviner/storage/DivinerLiveBook.php b/src/applications/diviner/storage/DivinerLiveBook.php index 68a6f8a0ec..ef7a9bb277 100644 --- a/src/applications/diviner/storage/DivinerLiveBook.php +++ b/src/applications/diviner/storage/DivinerLiveBook.php @@ -91,7 +91,7 @@ final class DivinerLiveBook extends DivinerDAO $this->openTransaction(); $atoms = id(new DivinerAtomQuery()) - ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->setViewer($engine->getViewer()) ->withBookPHIDs(array($this->getPHID())) ->withIncludeGhosts(true) ->withIncludeUndocumentable(true) diff --git a/src/applications/files/controller/PhabricatorFileTransformController.php b/src/applications/files/controller/PhabricatorFileTransformController.php index 5062fe76fc..0e7e2b73d7 100644 --- a/src/applications/files/controller/PhabricatorFileTransformController.php +++ b/src/applications/files/controller/PhabricatorFileTransformController.php @@ -104,8 +104,9 @@ final class PhabricatorFileTransformController } private function destroyTransform(PhabricatorTransformedFile $xform) { + $engine = new PhabricatorDestructionEngine(); $file = id(new PhabricatorFileQuery()) - ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->setViewer($engine->getViewer()) ->withPHIDs(array($xform->getTransformedPHID())) ->executeOne(); @@ -114,7 +115,6 @@ final class PhabricatorFileTransformController if (!$file) { $xform->delete(); } else { - $engine = new PhabricatorDestructionEngine(); $engine->destroyObject($file); } diff --git a/src/applications/files/storage/PhabricatorFileChunk.php b/src/applications/files/storage/PhabricatorFileChunk.php index b69a421fed..eaa10acd63 100644 --- a/src/applications/files/storage/PhabricatorFileChunk.php +++ b/src/applications/files/storage/PhabricatorFileChunk.php @@ -91,7 +91,7 @@ final class PhabricatorFileChunk extends PhabricatorFileDAO $data_phid = $this->getDataFilePHID(); if ($data_phid) { $data_file = id(new PhabricatorFileQuery()) - ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->setViewer($engine->getViewer()) ->withPHIDs(array($data_phid)) ->executeOne(); if ($data_file) { diff --git a/src/applications/paste/storage/PhabricatorPaste.php b/src/applications/paste/storage/PhabricatorPaste.php index 9eb88a77b4..3a0ae754e7 100644 --- a/src/applications/paste/storage/PhabricatorPaste.php +++ b/src/applications/paste/storage/PhabricatorPaste.php @@ -172,7 +172,7 @@ final class PhabricatorPaste extends PhabricatorPasteDAO if ($this->filePHID) { $file = id(new PhabricatorFileQuery()) - ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->setViewer($engine->getViewer()) ->withPHIDs(array($this->filePHID)) ->executeOne(); if ($file) { diff --git a/src/applications/system/engine/PhabricatorDestructionEngine.php b/src/applications/system/engine/PhabricatorDestructionEngine.php index b55b336052..c5b813169c 100644 --- a/src/applications/system/engine/PhabricatorDestructionEngine.php +++ b/src/applications/system/engine/PhabricatorDestructionEngine.php @@ -4,6 +4,10 @@ final class PhabricatorDestructionEngine extends Phobject { private $rootLogID; + public function getViewer() { + return PhabricatorUser::getOmnipotentUser(); + } + public function destroyObject(PhabricatorDestructibleInterface $object) { $log = id(new PhabricatorSystemDestructionLog()) ->setEpoch(time()) From fa82c17079de3639e438643ffb85485edd2643e5 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Fri, 15 May 2015 16:33:31 -0700 Subject: [PATCH 21/86] Projects - add mail to project updates Summary: ...which lets all the fancy settings for Email | Notify | Off be possible. Fixes T8164. Wasn't too sure the best way to break things up but members vs watchers felt meaningful to break out to me. Also fixes a small bug where we were generating bad slug updated stories by messing with the signature of the slug data. Perhaps this fix isn't even good enough (the array_keys()) call and instead we'll need to implement transaction has effect and do a sort? Test Plan: used ./bin/mail list-outbound and ./bin/mail show-outbound --id XX to verify reasonable emails were being generated. saw new preferences in settings. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8164 Differential Revision: https://secure.phabricator.com/D12868 --- src/__phutil_library_map__.php | 2 + .../PhabricatorProjectTransactionEditor.php | 73 +++++++++++++++++-- .../project/mail/ProjectReplyHandler.php | 20 +++++ .../storage/PhabricatorProjectTransaction.php | 48 +++++++++++- ...habricatorApplicationTransactionEditor.php | 8 ++ 5 files changed, 145 insertions(+), 6 deletions(-) create mode 100644 src/applications/project/mail/ProjectReplyHandler.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 94512f3abd..3ccb046634 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -3101,6 +3101,7 @@ phutil_register_library_map(array( 'ProjectQueryConduitAPIMethod' => 'applications/project/conduit/ProjectQueryConduitAPIMethod.php', 'ProjectRemarkupRule' => 'applications/project/remarkup/ProjectRemarkupRule.php', 'ProjectRemarkupRuleTestCase' => 'applications/project/remarkup/__tests__/ProjectRemarkupRuleTestCase.php', + 'ProjectReplyHandler' => 'applications/project/mail/ProjectReplyHandler.php', 'QueryFormattingTestCase' => 'infrastructure/storage/__tests__/QueryFormattingTestCase.php', 'ReleephAuthorFieldSpecification' => 'applications/releeph/field/specification/ReleephAuthorFieldSpecification.php', 'ReleephBranch' => 'applications/releeph/storage/ReleephBranch.php', @@ -6670,6 +6671,7 @@ phutil_register_library_map(array( 'ProjectQueryConduitAPIMethod' => 'ProjectConduitAPIMethod', 'ProjectRemarkupRule' => 'PhabricatorObjectRemarkupRule', 'ProjectRemarkupRuleTestCase' => 'PhabricatorTestCase', + 'ProjectReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler', 'QueryFormattingTestCase' => 'PhabricatorTestCase', 'ReleephAuthorFieldSpecification' => 'ReleephFieldSpecification', 'ReleephBranch' => array( diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php index 98c4ad1797..502623685c 100644 --- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php +++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php @@ -41,7 +41,7 @@ final class PhabricatorProjectTransactionEditor $slugs = $object->getSlugs(); $slugs = mpull($slugs, 'getSlug', 'getSlug'); unset($slugs[$object->getPrimarySlug()]); - return $slugs; + return array_keys($slugs); case PhabricatorProjectTransaction::TYPE_STATUS: return $object->getStatus(); case PhabricatorProjectTransaction::TYPE_IMAGE: @@ -403,11 +403,74 @@ final class PhabricatorProjectTransactionEditor return parent::requireCapabilities($object, $xaction); } - /** - * Note: this is implemented for Feed purposes. - */ + protected function loadEdges( + PhabricatorLiskDAO $object, + array $xactions) { + + $member_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( + $object->getPHID(), + PhabricatorProjectProjectHasMemberEdgeType::EDGECONST); + $object->attachMemberPHIDs($member_phids); + } + + protected function shouldSendMail( + PhabricatorLiskDAO $object, + array $xactions) { + return true; + } + + protected function getMailSubjectPrefix() { + return pht('[Project]'); + } + protected function getMailTo(PhabricatorLiskDAO $object) { - return array(); + return $object->getMemberPHIDs(); + } + + protected function getMailCC(PhabricatorLiskDAO $object) { + $all = parent::getMailCC($object); + return array_diff($all, $object->getMemberPHIDs()); + } + + public function getMailTagsMap() { + return array( + PhabricatorProjectTransaction::MAILTAG_METADATA => + pht('Project name, hashtags, icon, image, or color changes.'), + PhabricatorProjectTransaction::MAILTAG_MEMBERS => + pht('Project membership changes.'), + PhabricatorProjectTransaction::MAILTAG_WATCHERS => + pht('Project watcher list changes.'), + PhabricatorProjectTransaction::MAILTAG_OTHER => + pht('Other project activity not listed above occurs.'), + ); + } + + protected function buildReplyHandler(PhabricatorLiskDAO $object) { + return id(new ProjectReplyHandler()) + ->setMailReceiver($object); + } + + protected function buildMailTemplate(PhabricatorLiskDAO $object) { + $id = $object->getID(); + $name = $object->getName(); + + return id(new PhabricatorMetaMTAMail()) + ->setSubject("{$name}") + ->addHeader('Thread-Topic', "Project {$id}"); + } + + protected function buildMailBody( + PhabricatorLiskDAO $object, + array $xactions) { + + $body = parent::buildMailBody($object, $xactions); + + $uri = '/project/profile/'.$object->getID().'/'; + $body->addLinkSection( + pht('PROJECT DETAIL'), + PhabricatorEnv::getProductionURI($uri)); + + return $body; } protected function shouldPublishFeedStory( diff --git a/src/applications/project/mail/ProjectReplyHandler.php b/src/applications/project/mail/ProjectReplyHandler.php new file mode 100644 index 0000000000..ac2cf2b6eb --- /dev/null +++ b/src/applications/project/mail/ProjectReplyHandler.php @@ -0,0 +1,20 @@ +renderHandleLink($old), $this->renderHandleLink($new)); } + break; case self::TYPE_ICON: return pht( '%s set this project\'s icon to %s.', $author_handle, PhabricatorProjectIcon::getLabel($new)); + break; case self::TYPE_COLOR: return pht( '%s set this project\'s color to %s.', $author_handle, PHUITagView::getShadeName($new)); + break; case self::TYPE_LOCKED: if ($new) { @@ -157,6 +169,7 @@ final class PhabricatorProjectTransaction '%s unlocked this project\'s membership.', $author_handle); } + break; case self::TYPE_SLUGS: $add = array_diff($new, $old); @@ -183,6 +196,7 @@ final class PhabricatorProjectTransaction count($rem), $this->renderSlugList($rem)); } + break; case self::TYPE_MEMBERS: $add = array_diff($new, $old); @@ -221,6 +235,7 @@ final class PhabricatorProjectTransaction $this->renderHandleList($rem)); } } + break; } return parent::getTitle(); @@ -339,12 +354,43 @@ final class PhabricatorProjectTransaction $object_handle, $this->renderSlugList($rem)); } - } return parent::getTitleForFeed(); } + public function getMailTags() { + $tags = array(); + switch ($this->getTransactionType()) { + case self::TYPE_NAME: + case self::TYPE_SLUGS: + case self::TYPE_IMAGE: + case self::TYPE_ICON: + case self::TYPE_COLOR: + $tags[] = self::MAILTAG_METADATA; + break; + case PhabricatorTransactions::TYPE_EDGE: + $type = $this->getMetadata('edge:type'); + $type = head($type); + $type_member = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST; + $type_watcher = PhabricatorObjectHasWatcherEdgeType::EDGECONST; + if ($type == $type_member) { + $tags[] = self::MAILTAG_MEMBERS; + } else if ($type == $type_watcher) { + $tags[] = self::MAILTAG_WATCHERS; + } else { + $tags[] = self::MAILTAG_OTHER; + } + break; + case self::TYPE_STATUS: + case self::TYPE_LOCKED: + default: + $tags[] = self::MAILTAG_OTHER; + break; + } + return $tags; + } + private function renderSlugList($slugs) { return implode(', ', $slugs); } diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index dfd4bba286..6b070efaf9 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -840,6 +840,8 @@ abstract class PhabricatorApplicationTransactionEditor // subscribers to pick up changes caused by Herald (or by other side effects // in various transaction phases). $this->loadSubscribers($object); + // Hook for other edges that may need (re-)loading + $this->loadEdges($object, $xactions); $this->loadHandles($xactions); @@ -965,6 +967,12 @@ abstract class PhabricatorApplicationTransactionEditor } } + protected function loadEdges( + PhabricatorLiskDAO $object, + array $xactions) { + return; + } + private function validateEditParameters( PhabricatorLiskDAO $object, array $xactions) { From 72a896f772b7e925b08f8cc5a69bef38f358b2db Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 16 May 2015 06:13:27 -0700 Subject: [PATCH 22/86] Add missing mail keys to Projects Ref T8216. Auditors: btrahan --- .../autopatches/20150515.project.mailkey.1.sql | 2 ++ .../autopatches/20150515.project.mailkey.2.php | 18 ++++++++++++++++++ .../project/storage/PhabricatorProject.php | 2 ++ 3 files changed, 22 insertions(+) create mode 100644 resources/sql/autopatches/20150515.project.mailkey.1.sql create mode 100644 resources/sql/autopatches/20150515.project.mailkey.2.php diff --git a/resources/sql/autopatches/20150515.project.mailkey.1.sql b/resources/sql/autopatches/20150515.project.mailkey.1.sql new file mode 100644 index 0000000000..277fbdafda --- /dev/null +++ b/resources/sql/autopatches/20150515.project.mailkey.1.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_project.project + ADD mailKey binary(20) NOT NULL; diff --git a/resources/sql/autopatches/20150515.project.mailkey.2.php b/resources/sql/autopatches/20150515.project.mailkey.2.php new file mode 100644 index 0000000000..358c57d96d --- /dev/null +++ b/resources/sql/autopatches/20150515.project.mailkey.2.php @@ -0,0 +1,18 @@ +establishConnection('w'); +$iterator = new LiskMigrationIterator($table); +foreach ($iterator as $project) { + $id = $project->getID(); + + echo pht('Adding mail key for project %d...', $id); + echo "\n"; + + queryfx( + $conn_w, + 'UPDATE %T SET mailKey = %s WHERE id = %d', + $table->getTableName(), + Filesystem::readRandomCharacters(20), + $id); +} diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php index df013e1616..de3b00c4b6 100644 --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -17,6 +17,7 @@ final class PhabricatorProject extends PhabricatorProjectDAO protected $profileImagePHID; protected $icon; protected $color; + protected $mailKey; protected $viewPolicy; protected $editPolicy; @@ -142,6 +143,7 @@ final class PhabricatorProject extends PhabricatorProjectDAO 'profileImagePHID' => 'phid?', 'icon' => 'text32', 'color' => 'text32', + 'mailKey' => 'bytes20', // T6203/NULLABILITY // These are definitely wrong and should always exist. From dbac6580257094323056a8c48b9d02ee0dabb7e5 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Sat, 16 May 2015 17:21:37 -0700 Subject: [PATCH 23/86] Split up settings into "Date and Time Settings" and everything else. Summary: Ref T8176, Split up settings into "Date and Time Settings" and everything else. Test Plan: Open /settings, Account Settings should now have two tabs: "Account" and "Date and Time" Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8176 Differential Revision: https://secure.phabricator.com/D12881 --- src/__phutil_library_map__.php | 2 + .../panel/PhabricatorAccountSettingsPanel.php | 50 +---------- .../PhabricatorDateTimeSettingsPanel.php | 89 +++++++++++++++++++ 3 files changed, 95 insertions(+), 46 deletions(-) create mode 100644 src/applications/settings/panel/PhabricatorDateTimeSettingsPanel.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 3ccb046634..edadae1253 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1742,6 +1742,7 @@ phutil_register_library_map(array( 'PhabricatorDataCacheSpec' => 'applications/cache/spec/PhabricatorDataCacheSpec.php', 'PhabricatorDataNotAttachedException' => 'infrastructure/storage/lisk/PhabricatorDataNotAttachedException.php', 'PhabricatorDatabaseSetupCheck' => 'applications/config/check/PhabricatorDatabaseSetupCheck.php', + 'PhabricatorDateTimeSettingsPanel' => 'applications/settings/panel/PhabricatorDateTimeSettingsPanel.php', 'PhabricatorDebugController' => 'applications/system/controller/PhabricatorDebugController.php', 'PhabricatorDefaultSearchEngineSelector' => 'applications/search/selector/PhabricatorDefaultSearchEngineSelector.php', 'PhabricatorDestructibleInterface' => 'applications/system/interface/PhabricatorDestructibleInterface.php', @@ -5134,6 +5135,7 @@ phutil_register_library_map(array( 'PhabricatorDataCacheSpec' => 'PhabricatorCacheSpec', 'PhabricatorDataNotAttachedException' => 'Exception', 'PhabricatorDatabaseSetupCheck' => 'PhabricatorSetupCheck', + 'PhabricatorDateTimeSettingsPanel' => 'PhabricatorSettingsPanel', 'PhabricatorDebugController' => 'PhabricatorController', 'PhabricatorDefaultSearchEngineSelector' => 'PhabricatorSearchEngineSelector', 'PhabricatorDestructionEngine' => 'Phobject', diff --git a/src/applications/settings/panel/PhabricatorAccountSettingsPanel.php b/src/applications/settings/panel/PhabricatorAccountSettingsPanel.php index 9353d9523f..7acd5e0a54 100644 --- a/src/applications/settings/panel/PhabricatorAccountSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorAccountSettingsPanel.php @@ -18,18 +18,8 @@ final class PhabricatorAccountSettingsPanel extends PhabricatorSettingsPanel { $user = $request->getUser(); $username = $user->getUsername(); - $pref_time = PhabricatorUserPreferences::PREFERENCE_TIME_FORMAT; - $preferences = $user->loadPreferences(); - $errors = array(); if ($request->isFormPost()) { - $new_timezone = $request->getStr('timezone'); - if (in_array($new_timezone, DateTimeZone::listIdentifiers(), true)) { - $user->setTimezoneIdentifier($new_timezone); - } else { - $errors[] = pht('The selected timezone is not a valid timezone.'); - } - $sex = $request->getStr('sex'); $sexes = array(PhutilPerson::SEX_MALE, PhutilPerson::SEX_FEMALE); if (in_array($sex, $sexes)) { @@ -41,19 +31,13 @@ final class PhabricatorAccountSettingsPanel extends PhabricatorSettingsPanel { // Checked in runtime. $user->setTranslation($request->getStr('translation')); - $preferences->setPreference($pref_time, $request->getStr($pref_time)); - if (!$errors) { - $preferences->save(); $user->save(); return id(new AphrontRedirectResponse()) ->setURI($this->getPanelURI('?saved=true')); } } - $timezone_ids = DateTimeZone::listIdentifiers(); - $timezone_id_map = array_fuse($timezone_ids); - $label_unknown = pht('%s updated their profile', $username); $label_her = pht('%s updated her profile', $username); $label_his = pht('%s updated his profile', $username); @@ -93,10 +77,10 @@ final class PhabricatorAccountSettingsPanel extends PhabricatorSettingsPanel { ->setUser($user) ->appendChild( id(new AphrontFormSelectControl()) - ->setLabel(pht('Timezone')) - ->setName('timezone') - ->setOptions($timezone_id_map) - ->setValue($user->getTimezoneIdentifier())) + ->setOptions($translations) + ->setLabel(pht('Translation')) + ->setName('translation') + ->setValue($user->getTranslation())) ->appendRemarkupInstructions(pht('**Choose the pronoun you prefer:**')) ->appendChild( id(new AphrontFormSelectControl()) @@ -104,32 +88,6 @@ final class PhabricatorAccountSettingsPanel extends PhabricatorSettingsPanel { ->setLabel(pht('Pronoun')) ->setName('sex') ->setValue($user->getSex())) - ->appendChild( - id(new AphrontFormSelectControl()) - ->setOptions($translations) - ->setLabel(pht('Translation')) - ->setName('translation') - ->setValue($user->getTranslation())) - ->appendRemarkupInstructions( - pht( - "**Custom Date and Time Formats**\n\n". - "You can specify custom formats which will be used when ". - "rendering dates and times of day. Examples:\n\n". - "| Format | Example | Notes |\n". - "| ------ | -------- | ----- |\n". - "| `g:i A` | 2:34 PM | Default 12-hour time. |\n". - "| `G.i a` | 02.34 pm | Alternate 12-hour time. |\n". - "| `H:i` | 14:34 | 24-hour time. |\n". - "\n\n". - "You can find a [[%s | full reference in the PHP manual]].", - 'http://www.php.net/manual/en/function.date.php')) - ->appendChild( - id(new AphrontFormTextControl()) - ->setLabel(pht('Time-of-Day Format')) - ->setName($pref_time) - ->setCaption( - pht('Format used when rendering a time of day.')) - ->setValue($preferences->getPreference($pref_time))) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue(pht('Save Account Settings'))); diff --git a/src/applications/settings/panel/PhabricatorDateTimeSettingsPanel.php b/src/applications/settings/panel/PhabricatorDateTimeSettingsPanel.php new file mode 100644 index 0000000000..661a1172b7 --- /dev/null +++ b/src/applications/settings/panel/PhabricatorDateTimeSettingsPanel.php @@ -0,0 +1,89 @@ +getUser(); + $username = $user->getUsername(); + + $pref_time = PhabricatorUserPreferences::PREFERENCE_TIME_FORMAT; + $preferences = $user->loadPreferences(); + + $errors = array(); + if ($request->isFormPost()) { + $new_timezone = $request->getStr('timezone'); + if (in_array($new_timezone, DateTimeZone::listIdentifiers(), true)) { + $user->setTimezoneIdentifier($new_timezone); + } else { + $errors[] = pht('The selected timezone is not a valid timezone.'); + } + + $preferences->setPreference($pref_time, $request->getStr($pref_time)); + + if (!$errors) { + $preferences->save(); + $user->save(); + return id(new AphrontRedirectResponse()) + ->setURI($this->getPanelURI('?saved=true')); + } + } + + $timezone_ids = DateTimeZone::listIdentifiers(); + $timezone_id_map = array_fuse($timezone_ids); + + $form = new AphrontFormView(); + $form + ->setUser($user) + ->appendChild( + id(new AphrontFormSelectControl()) + ->setLabel(pht('Timezone')) + ->setName('timezone') + ->setOptions($timezone_id_map) + ->setValue($user->getTimezoneIdentifier())) + ->appendRemarkupInstructions( + pht( + "**Custom Date and Time Formats**\n\n". + "You can specify custom formats which will be used when ". + "rendering dates and times of day. Examples:\n\n". + "| Format | Example | Notes |\n". + "| ------ | -------- | ----- |\n". + "| `g:i A` | 2:34 PM | Default 12-hour time. |\n". + "| `G.i a` | 02.34 pm | Alternate 12-hour time. |\n". + "| `H:i` | 14:34 | 24-hour time. |\n". + "\n\n". + "You can find a [[%s | full reference in the PHP manual]].", + 'http://www.php.net/manual/en/function.date.php')) + ->appendChild( + id(new AphrontFormTextControl()) + ->setLabel(pht('Time-of-Day Format')) + ->setName($pref_time) + ->setCaption( + pht('Format used when rendering a time of day.')) + ->setValue($preferences->getPreference($pref_time))) + ->appendChild( + id(new AphrontFormSubmitControl()) + ->setValue(pht('Save Account Settings'))); + + $form_box = id(new PHUIObjectBoxView()) + ->setHeaderText(pht('Date and Time Settings')) + ->setFormSaved($request->getStr('saved')) + ->setFormErrors($errors) + ->setForm($form); + + return array( + $form_box, + ); + } +} From 1f6b53be0e0d25af16b25236e6ccb58cc7a645ac Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 16 May 2015 19:39:22 -0700 Subject: [PATCH 24/86] Populate mail keys for new projects Ref T8216. Auditors: btrahan --- src/applications/project/storage/PhabricatorProject.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php index de3b00c4b6..e5e6e19554 100644 --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -275,6 +275,10 @@ final class PhabricatorProject extends PhabricatorProjectDAO } public function save() { + if (!$this->getMailKey()) { + $this->setMailKey(Filesystem::readRandomCharacters(20)); + } + $this->openTransaction(); $result = parent::save(); $this->updateDatasourceTokens(); From 31988e74d1ff99dbf6e868358b4d2409ab4007f7 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Sat, 16 May 2015 20:13:25 -0700 Subject: [PATCH 25/86] Add a setting so user can choose when Calendar weeks start Summary: Closes T8176, Add a setting so user can choose when Calendar weeks start Test Plan: Open account settings, go to "Date and Time", change week start day, open Calendar, observe that month view responds to new week start day. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8176 Differential Revision: https://secure.phabricator.com/D12884 --- .../PhabricatorCalendarEventSearchEngine.php | 18 ++-- .../PhabricatorDateTimeSettingsPanel.php | 28 ++++++- .../storage/PhabricatorUserPreferences.php | 1 + .../phui/calendar/PHUICalendarMonthView.php | 82 ++++++++++--------- 4 files changed, 82 insertions(+), 47 deletions(-) diff --git a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php index 7added162f..4f65202a2c 100644 --- a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php +++ b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php @@ -76,9 +76,11 @@ final class PhabricatorCalendarEventSearchEngine $display_start = $start_day->format('U'); $display_end = $next->format('U'); - // 0 = Sunday is always the start of the week, for now - $start_of_week = 0; - $end_of_week = 6 - $start_of_week; + $preferences = $viewer->loadPreferences(); + $pref_week_day = PhabricatorUserPreferences::PREFERENCE_WEEK_START_DAY; + + $start_of_week = $preferences->getPreference($pref_week_day, 0); + $end_of_week = ($start_of_week + 6) % 7; $first_of_month = $start_day->format('w'); $last_of_month = id(clone $next)->modify('-1 day')->format('w'); @@ -87,9 +89,10 @@ final class PhabricatorCalendarEventSearchEngine $min_range = $display_start; if ($this->isMonthView($saved) && - $first_of_month > $start_of_week) { + $first_of_month !== $start_of_week) { + $interim_day_num = ($first_of_month + 7 - $start_of_week) % 7; $min_range = id(clone $start_day) - ->modify('-'.$first_of_month.' days') + ->modify('-'.$interim_day_num.' days') ->format('U'); } } @@ -97,9 +100,10 @@ final class PhabricatorCalendarEventSearchEngine $max_range = $display_end; if ($this->isMonthView($saved) && - $last_of_month < $end_of_week) { + $last_of_month !== $end_of_week) { + $interim_day_num = ($end_of_week + 7 - $last_of_month) % 7; $max_range = id(clone $next) - ->modify('+'.(6 - $first_of_month).' days') + ->modify('+'.$interim_day_num.' days') ->format('U'); } diff --git a/src/applications/settings/panel/PhabricatorDateTimeSettingsPanel.php b/src/applications/settings/panel/PhabricatorDateTimeSettingsPanel.php index 661a1172b7..5fbf825d22 100644 --- a/src/applications/settings/panel/PhabricatorDateTimeSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorDateTimeSettingsPanel.php @@ -19,6 +19,7 @@ final class PhabricatorDateTimeSettingsPanel extends PhabricatorSettingsPanel { $username = $user->getUsername(); $pref_time = PhabricatorUserPreferences::PREFERENCE_TIME_FORMAT; + $pref_week_start = PhabricatorUserPreferences::PREFERENCE_WEEK_START_DAY; $preferences = $user->loadPreferences(); $errors = array(); @@ -30,7 +31,12 @@ final class PhabricatorDateTimeSettingsPanel extends PhabricatorSettingsPanel { $errors[] = pht('The selected timezone is not a valid timezone.'); } - $preferences->setPreference($pref_time, $request->getStr($pref_time)); + $preferences->setPreference( + $pref_time, + $request->getStr($pref_time)); + $preferences->setPreference( + $pref_week_start, + $request->getStr($pref_week_start)); if (!$errors) { $preferences->save(); @@ -72,6 +78,14 @@ final class PhabricatorDateTimeSettingsPanel extends PhabricatorSettingsPanel { ->setCaption( pht('Format used when rendering a time of day.')) ->setValue($preferences->getPreference($pref_time))) + ->appendChild( + id(new AphrontFormSelectControl()) + ->setLabel(pht('Week Starts On')) + ->setOptions($this->getWeekDays()) + ->setName($pref_week_start) + ->setCaption( + pht('Calendar weeks will start with this day.')) + ->setValue($preferences->getPreference($pref_week_start, 0))) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue(pht('Save Account Settings'))); @@ -86,4 +100,16 @@ final class PhabricatorDateTimeSettingsPanel extends PhabricatorSettingsPanel { $form_box, ); } + + private function getWeekDays() { + return array( + pht('Sunday'), + pht('Monday'), + pht('Tuesday'), + pht('Wednesday'), + pht('Thursday'), + pht('Friday'), + pht('Saturday'), + ); + } } diff --git a/src/applications/settings/storage/PhabricatorUserPreferences.php b/src/applications/settings/storage/PhabricatorUserPreferences.php index 3248dc8b2a..7732df5568 100644 --- a/src/applications/settings/storage/PhabricatorUserPreferences.php +++ b/src/applications/settings/storage/PhabricatorUserPreferences.php @@ -9,6 +9,7 @@ final class PhabricatorUserPreferences extends PhabricatorUserDAO { const PREFERENCE_TITLES = 'titles'; const PREFERENCE_MONOSPACED_TEXTAREAS = 'monospaced-textareas'; const PREFERENCE_TIME_FORMAT = 'time-format'; + const PREFERENCE_WEEK_START_DAY = 'week-start-day'; const PREFERENCE_RE_PREFIX = 're-prefix'; const PREFERENCE_NO_SELF_MAIL = 'self-mail'; diff --git a/src/view/phui/calendar/PHUICalendarMonthView.php b/src/view/phui/calendar/PHUICalendarMonthView.php index fd2ca4e458..d6bb7d1a32 100644 --- a/src/view/phui/calendar/PHUICalendarMonthView.php +++ b/src/view/phui/calendar/PHUICalendarMonthView.php @@ -59,24 +59,10 @@ final class PHUICalendarMonthView extends AphrontView { $days = $this->getDatesInMonth(); $cell_lists = array(); - $empty_cell = array( - 'list' => null, - 'date' => null, - 'uri' => null, - 'count' => 0, - 'class' => null, - ); require_celerity_resource('phui-calendar-month-css'); $first = reset($days); - $start_of_week = 0; - - $empty = $first->format('w'); - - for ($ii = 0; $ii < $empty; $ii++) { - $cell_lists[] = $empty_cell; - } foreach ($days as $day) { $day_number = $day->format('j'); @@ -133,9 +119,6 @@ final class PHUICalendarMonthView extends AphrontView { foreach ($cell_lists_by_week as $week_of_cell_lists) { $cells = array(); - while (count($week_of_cell_lists) < 7) { - $week_of_cell_lists[] = $empty_cell; - } foreach ($week_of_cell_lists as $cell_list) { $cells[] = $this->getEventListCell($cell_list); } @@ -309,18 +292,28 @@ final class PHUICalendarMonthView extends AphrontView { } private function getDayNamesHeader() { + list($week_start, $week_end) = $this->getWeekStartAndEnd(); + + $weekday_names = array( + $this->getDayHeader(pht('Sun'), pht('Sunday'), true), + $this->getDayHeader(pht('Mon'), pht('Monday')), + $this->getDayHeader(pht('Tue'), pht('Tuesday')), + $this->getDayHeader(pht('Wed'), pht('Wednesday')), + $this->getDayHeader(pht('Thu'), pht('Thursday')), + $this->getDayHeader(pht('Fri'), pht('Friday')), + $this->getDayHeader(pht('Sat'), pht('Saturday'), true), + ); + + $sorted_weekday_names = array(); + + for ($i = $week_start; $i < ($week_start + 7); $i++) { + $sorted_weekday_names[] = $weekday_names[$i % 7]; + } + return phutil_tag( 'tr', array('class' => 'phui-calendar-day-of-week-header'), - array( - $this->getDayHeader(pht('Sun'), pht('Sunday'), true), - $this->getDayHeader(pht('Mon'), pht('Monday')), - $this->getDayHeader(pht('Tue'), pht('Tuesday')), - $this->getDayHeader(pht('Wed'), pht('Wednesday')), - $this->getDayHeader(pht('Thu'), pht('Thursday')), - $this->getDayHeader(pht('Fri'), pht('Friday')), - $this->getDayHeader(pht('Sat'), pht('Saturday'), true), - )); + $sorted_weekday_names); } private function getDayHeader($short, $long, $is_weekend = false) { @@ -466,8 +459,8 @@ final class PHUICalendarMonthView extends AphrontView { list($next_year, $next_month) = $this->getNextYearAndMonth(); $end_date = new DateTime("{$next_year}-{$next_month}-01", $timezone); - $start_of_week = 0; - $end_of_week = 6 - $start_of_week; + list($start_of_week, $end_of_week) = $this->getWeekStartAndEnd(); + $days_in_month = id(clone $end_date)->modify('-1 day')->format('d'); $first_month_day_date = new DateTime("{$year}-{$month}-01", $timezone); @@ -477,17 +470,19 @@ final class PHUICalendarMonthView extends AphrontView { $last_weekday_of_month = $last_month_day_date->format('w'); $num_days_display = $days_in_month; - if ($start_of_week < $first_weekday_of_month) { - $num_days_display += $first_weekday_of_month; + if ($start_of_week !== $first_weekday_of_month) { + $interim_start_num = ($first_weekday_of_month + 7 - $start_of_week) % 7; + $num_days_display += $interim_start_num; + $day_date = id(clone $first_month_day_date) + ->modify('-'.$interim_start_num.' days'); } - if ($end_of_week > $last_weekday_of_month) { - $num_days_display += (6 - $last_weekday_of_month); - $end_date->modify('+'.(6 - $last_weekday_of_month).' days'); + if ($end_of_week !== $last_weekday_of_month) { + $interim_end_day_num = ($end_of_week - $last_weekday_of_month + 7) % 7; + $num_days_display += $interim_end_day_num; + $end_date->modify('+'.$interim_end_day_num.' days'); } $days = array(); - $day_date = id(clone $first_month_day_date) - ->modify('-'.$first_weekday_of_month.' days'); for ($day = 1; $day <= $num_days_display; $day++) { $day_epoch = $day_date->format('U'); @@ -513,14 +508,13 @@ final class PHUICalendarMonthView extends AphrontView { } private function getThisWeekRange() { - $week_start = 0; - $week_end = 6; + list($week_start, $week_end) = $this->getWeekStartAndEnd(); $today = $this->getTodayMidnight(); $date_weekday = $today->format('w'); - $days_from_week_start = $date_weekday - $week_start; - $days_to_week_end = $week_end - $date_weekday + 1; + $days_from_week_start = ($date_weekday + 7 - $week_start) % 7; + $days_to_week_end = 7 - $days_from_week_start; $modify = '-'.$days_from_week_start.' days'; $week_start_date = id(clone $today)->modify($modify); @@ -531,6 +525,16 @@ final class PHUICalendarMonthView extends AphrontView { return array($week_start_date, $week_end_date); } + private function getWeekStartAndEnd() { + $preferences = $this->user->loadPreferences(); + $pref_week_start = PhabricatorUserPreferences::PREFERENCE_WEEK_START_DAY; + + $week_start = $preferences->getPreference($pref_week_start, 0); + $week_end = ($week_start + 6) % 7; + + return array($week_start, $week_end); + } + private function getDateTime() { $user = $this->user; $timezone = new DateTimeZone($user->getTimezoneIdentifier()); From 00136f05dd6d3e2bbc8772b12dacaa23ea805307 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 17 May 2015 07:18:44 -0700 Subject: [PATCH 26/86] Allow adding Auditors with the singular noun. Summary: Currently adding auditors in commit message only works with the plural. Make "Auditor: bla" work. Test Plan: Unit tests. I don't know if I am supposed to add a test. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: joshuaspence, epriestley Differential Revision: https://secure.phabricator.com/D10636 --- src/applications/audit/editor/PhabricatorAuditEditor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php index 587af71850..d30a4061b7 100644 --- a/src/applications/audit/editor/PhabricatorAuditEditor.php +++ b/src/applications/audit/editor/PhabricatorAuditEditor.php @@ -418,7 +418,7 @@ final class PhabricatorAuditEditor $message = $data->getCommitMessage(); $matches = null; - if (!preg_match('/^Auditors:\s*(.*)$/im', $message, $matches)) { + if (!preg_match('/^Auditors?:\s*(.*)$/im', $message, $matches)) { return array(); } From 5f797b4d478b6ab657f7e71d90cac4c611f8ae8f Mon Sep 17 00:00:00 2001 From: Arturas Moskvinas Date: Sun, 17 May 2015 07:25:03 -0700 Subject: [PATCH 27/86] Recover from repositories becoming unpullable Test Plan: If a repository's tracking flag is toggled while it's in queue, we may loop indefinitely. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11296 --- .../repository/daemon/PhabricatorRepositoryPullLocalDaemon.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php index 0dd2041316..ff96dced3c 100644 --- a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php +++ b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php @@ -150,7 +150,8 @@ final class PhabricatorRepositoryPullLocalDaemon if (!$repository) { $this->log( pht('Repository %s is no longer pullable; skipping.', $id)); - break; + unset($queue[$id]); + continue; } $monogram = $repository->getMonogram(); From f087d7c08a02348aa84c0aa0efbfe4a53ef77222 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Sun, 17 May 2015 12:31:26 -0700 Subject: [PATCH 28/86] Add week numbers to Calendar month view. Summary: Closes T8184, Add week numbers to Calendar month view. Test Plan: Calendar month view should now show week numbers, incrementing on Mondays, regardless of week start day. Reviewers: chad, #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8184 Differential Revision: https://secure.phabricator.com/D12886 --- resources/celerity/map.php | 4 ++-- src/view/phui/calendar/PHUICalendarMonthView.php | 12 ++++++++++++ .../rsrc/css/phui/calendar/phui-calendar-month.css | 9 +++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 9d0c4f7014..3aecd78dfc 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -122,7 +122,7 @@ return array( 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/phui/calendar/phui-calendar-day.css' => '3b4a65d8', 'rsrc/css/phui/calendar/phui-calendar-list.css' => '840baa8d', - 'rsrc/css/phui/calendar/phui-calendar-month.css' => 'a6993b38', + 'rsrc/css/phui/calendar/phui-calendar-month.css' => '5b213ea0', 'rsrc/css/phui/calendar/phui-calendar.css' => '8345be98', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', @@ -763,7 +763,7 @@ return array( 'phui-calendar-css' => '8345be98', 'phui-calendar-day-css' => '3b4a65d8', 'phui-calendar-list-css' => '840baa8d', - 'phui-calendar-month-css' => 'a6993b38', + 'phui-calendar-month-css' => '5b213ea0', 'phui-crumbs-view-css' => '594d719e', 'phui-document-view-css' => '94d5dcd8', 'phui-feed-story-css' => 'c9f3a0b5', diff --git a/src/view/phui/calendar/PHUICalendarMonthView.php b/src/view/phui/calendar/PHUICalendarMonthView.php index d6bb7d1a32..df692d271d 100644 --- a/src/view/phui/calendar/PHUICalendarMonthView.php +++ b/src/view/phui/calendar/PHUICalendarMonthView.php @@ -189,6 +189,7 @@ final class PHUICalendarMonthView extends AphrontView { $class = $event_list['class']; $date = $event_list['date']; $cell_day_secret_link = null; + $week_number = null; if ($date) { $uri = $event_list['uri']; @@ -201,6 +202,16 @@ final class PHUICalendarMonthView extends AphrontView { 'href' => $uri, ), $date->format('j')); + + if ($date->format('w') == 1) { + $week_number = phutil_tag( + 'a', + array( + 'class' => 'phui-calendar-week-number', + 'href' => $uri, + ), + $date->format('W')); + } } else { $cell_day = null; } @@ -234,6 +245,7 @@ final class PHUICalendarMonthView extends AphrontView { ), array( $cell_day_secret_link, + $week_number, $cell_day, $today_slot, )); diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css index 14d25e7f67..6b5c0aeb86 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css @@ -94,6 +94,15 @@ table.phui-calendar-view tr td:first-child { color: {$green}; } +table.phui-calendar-view a.phui-calendar-week-number { + color: {$lightgreyborder}; + padding: 4px; + display: inline-block; + min-width: 16px; + text-align: center; + float: left; +} + table.phui-calendar-view a.phui-calendar-date-number { color: {$lightgreytext}; padding: 4px; From 427cc221499d38807ab50d22bd4c927a24354c20 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Mon, 18 May 2015 08:20:11 +1000 Subject: [PATCH 29/86] Rename protocol adapter classes Summary: Ref T5655. Rename protocol adapter classes to remove `Base` from the class name. Test Plan: Unit tests still pass. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T5655 Differential Revision: https://secure.phabricator.com/D12563 --- src/__phutil_library_map__.php | 12 ++++++------ .../PhabricatorBotFlowdockProtocolAdapter.php | 2 +- .../adapter/PhabricatorCampfireProtocolAdapter.php | 2 +- .../bot/adapter/PhabricatorIRCProtocolAdapter.php | 3 +-- ...colAdapter.php => PhabricatorProtocolAdapter.php} | 2 +- ...r.php => PhabricatorStreamingProtocolAdapter.php} | 4 ++-- 6 files changed, 12 insertions(+), 13 deletions(-) rename src/infrastructure/daemon/bot/adapter/{PhabricatorBaseProtocolAdapter.php => PhabricatorProtocolAdapter.php} (97%) rename src/infrastructure/daemon/bot/adapter/{PhabricatorBotBaseStreamingProtocolAdapter.php => PhabricatorStreamingProtocolAdapter.php} (97%) diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index edadae1253..2f07a0670b 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1461,13 +1461,11 @@ phutil_register_library_map(array( 'PhabricatorAutoEventListener' => 'infrastructure/events/PhabricatorAutoEventListener.php', 'PhabricatorBarePageUIExample' => 'applications/uiexample/examples/PhabricatorBarePageUIExample.php', 'PhabricatorBarePageView' => 'view/page/PhabricatorBarePageView.php', - 'PhabricatorBaseProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorBaseProtocolAdapter.php', 'PhabricatorBaseURISetupCheck' => 'applications/config/check/PhabricatorBaseURISetupCheck.php', 'PhabricatorBcryptPasswordHasher' => 'infrastructure/util/password/PhabricatorBcryptPasswordHasher.php', 'PhabricatorBinariesSetupCheck' => 'applications/config/check/PhabricatorBinariesSetupCheck.php', 'PhabricatorBitbucketAuthProvider' => 'applications/auth/provider/PhabricatorBitbucketAuthProvider.php', 'PhabricatorBot' => 'infrastructure/daemon/bot/PhabricatorBot.php', - 'PhabricatorBotBaseStreamingProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorBotBaseStreamingProtocolAdapter.php', 'PhabricatorBotChannel' => 'infrastructure/daemon/bot/target/PhabricatorBotChannel.php', 'PhabricatorBotDebugLogHandler' => 'infrastructure/daemon/bot/handler/PhabricatorBotDebugLogHandler.php', 'PhabricatorBotFeedNotificationHandler' => 'infrastructure/daemon/bot/handler/PhabricatorBotFeedNotificationHandler.php', @@ -2369,6 +2367,7 @@ phutil_register_library_map(array( 'PhabricatorProjectViewController' => 'applications/project/controller/PhabricatorProjectViewController.php', 'PhabricatorProjectWatchController' => 'applications/project/controller/PhabricatorProjectWatchController.php', 'PhabricatorProjectsPolicyRule' => 'applications/policy/rule/PhabricatorProjectsPolicyRule.php', + 'PhabricatorProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorProtocolAdapter.php', 'PhabricatorPygmentSetupCheck' => 'applications/config/check/PhabricatorPygmentSetupCheck.php', 'PhabricatorQuery' => 'infrastructure/query/PhabricatorQuery.php', 'PhabricatorQueryConstraint' => 'infrastructure/query/constraint/PhabricatorQueryConstraint.php', @@ -2598,6 +2597,7 @@ phutil_register_library_map(array( 'PhabricatorStoragePatch' => 'infrastructure/storage/management/PhabricatorStoragePatch.php', 'PhabricatorStorageSchemaSpec' => 'infrastructure/storage/schema/PhabricatorStorageSchemaSpec.php', 'PhabricatorStorageSetupCheck' => 'applications/config/check/PhabricatorStorageSetupCheck.php', + 'PhabricatorStreamingProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorStreamingProtocolAdapter.php', 'PhabricatorSubscribableInterface' => 'applications/subscriptions/interface/PhabricatorSubscribableInterface.php', 'PhabricatorSubscribedToObjectEdgeType' => 'applications/transactions/edges/PhabricatorSubscribedToObjectEdgeType.php', 'PhabricatorSubscribersQuery' => 'applications/subscriptions/query/PhabricatorSubscribersQuery.php', @@ -4821,11 +4821,10 @@ phutil_register_library_map(array( 'PhabricatorBinariesSetupCheck' => 'PhabricatorSetupCheck', 'PhabricatorBitbucketAuthProvider' => 'PhabricatorOAuth1AuthProvider', 'PhabricatorBot' => 'PhabricatorDaemon', - 'PhabricatorBotBaseStreamingProtocolAdapter' => 'PhabricatorBaseProtocolAdapter', 'PhabricatorBotChannel' => 'PhabricatorBotTarget', 'PhabricatorBotDebugLogHandler' => 'PhabricatorBotHandler', 'PhabricatorBotFeedNotificationHandler' => 'PhabricatorBotHandler', - 'PhabricatorBotFlowdockProtocolAdapter' => 'PhabricatorBotBaseStreamingProtocolAdapter', + 'PhabricatorBotFlowdockProtocolAdapter' => 'PhabricatorStreamingProtocolAdapter', 'PhabricatorBotLogHandler' => 'PhabricatorBotHandler', 'PhabricatorBotMacroHandler' => 'PhabricatorBotHandler', 'PhabricatorBotObjectNameHandler' => 'PhabricatorBotHandler', @@ -4885,7 +4884,7 @@ phutil_register_library_map(array( 'PhabricatorCalendarRemarkupRule' => 'PhabricatorObjectRemarkupRule', 'PhabricatorCalendarReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler', 'PhabricatorCalendarSchemaSpec' => 'PhabricatorConfigSchemaSpec', - 'PhabricatorCampfireProtocolAdapter' => 'PhabricatorBotBaseStreamingProtocolAdapter', + 'PhabricatorCampfireProtocolAdapter' => 'PhabricatorStreamingProtocolAdapter', 'PhabricatorCelerityApplication' => 'PhabricatorApplication', 'PhabricatorCelerityTestCase' => 'PhabricatorTestCase', 'PhabricatorChangeParserTestCase' => 'PhabricatorWorkingCopyTestCase', @@ -5360,7 +5359,7 @@ phutil_register_library_map(array( 'PhabricatorHovercardView' => 'AphrontView', 'PhabricatorHunksManagementMigrateWorkflow' => 'PhabricatorHunksManagementWorkflow', 'PhabricatorHunksManagementWorkflow' => 'PhabricatorManagementWorkflow', - 'PhabricatorIRCProtocolAdapter' => 'PhabricatorBaseProtocolAdapter', + 'PhabricatorIRCProtocolAdapter' => 'PhabricatorProtocolAdapter', 'PhabricatorIconRemarkupRule' => 'PhutilRemarkupRule', 'PhabricatorImageMacroRemarkupRule' => 'PhutilRemarkupRule', 'PhabricatorImagemagickSetupCheck' => 'PhabricatorSetupCheck', @@ -6064,6 +6063,7 @@ phutil_register_library_map(array( 'PhabricatorStorageManagementWorkflow' => 'PhabricatorManagementWorkflow', 'PhabricatorStorageSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'PhabricatorStorageSetupCheck' => 'PhabricatorSetupCheck', + 'PhabricatorStreamingProtocolAdapter' => 'PhabricatorProtocolAdapter', 'PhabricatorSubscribedToObjectEdgeType' => 'PhabricatorEdgeType', 'PhabricatorSubscribersQuery' => 'PhabricatorQuery', 'PhabricatorSubscriptionTriggerClock' => 'PhabricatorTriggerClock', diff --git a/src/infrastructure/daemon/bot/adapter/PhabricatorBotFlowdockProtocolAdapter.php b/src/infrastructure/daemon/bot/adapter/PhabricatorBotFlowdockProtocolAdapter.php index 050377dc77..eede9d5142 100644 --- a/src/infrastructure/daemon/bot/adapter/PhabricatorBotFlowdockProtocolAdapter.php +++ b/src/infrastructure/daemon/bot/adapter/PhabricatorBotFlowdockProtocolAdapter.php @@ -1,7 +1,7 @@ Date: Sun, 17 May 2015 16:37:21 -0700 Subject: [PATCH 30/86] Month view header should display month name of the month completely shown, not leading or trailing month. Summary: Fixes T8229, Month view header should display month name of the month completely shown, not leading or trailing month. Test Plan: Open month view for May. Month view header should be May, not April. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8229 Differential Revision: https://secure.phabricator.com/D12887 --- src/view/phui/calendar/PHUICalendarMonthView.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/view/phui/calendar/PHUICalendarMonthView.php b/src/view/phui/calendar/PHUICalendarMonthView.php index df692d271d..806ecad719 100644 --- a/src/view/phui/calendar/PHUICalendarMonthView.php +++ b/src/view/phui/calendar/PHUICalendarMonthView.php @@ -62,8 +62,6 @@ final class PHUICalendarMonthView extends AphrontView { require_celerity_resource('phui-calendar-month-css'); - $first = reset($days); - foreach ($days as $day) { $day_number = $day->format('j'); @@ -144,7 +142,7 @@ final class PHUICalendarMonthView extends AphrontView { $warnings = $this->getQueryRangeWarning(); $box = id(new PHUIObjectBoxView()) - ->setHeader($this->renderCalendarHeader($first)) + ->setHeader($this->renderCalendarHeader($this->getDateTime())) ->appendChild($table) ->setFormErrors($warnings); if ($this->error) { @@ -469,6 +467,7 @@ final class PHUICalendarMonthView extends AphrontView { $year = $this->year; list($next_year, $next_month) = $this->getNextYearAndMonth(); + $end_date = new DateTime("{$next_year}-{$next_month}-01", $timezone); list($start_of_week, $end_of_week) = $this->getWeekStartAndEnd(); @@ -481,12 +480,14 @@ final class PHUICalendarMonthView extends AphrontView { $first_weekday_of_month = $first_month_day_date->format('w'); $last_weekday_of_month = $last_month_day_date->format('w'); + $day_date = id(clone $first_month_day_date); + $num_days_display = $days_in_month; if ($start_of_week !== $first_weekday_of_month) { $interim_start_num = ($first_weekday_of_month + 7 - $start_of_week) % 7; $num_days_display += $interim_start_num; - $day_date = id(clone $first_month_day_date) - ->modify('-'.$interim_start_num.' days'); + + $day_date->modify('-'.$interim_start_num.' days'); } if ($end_of_week !== $last_weekday_of_month) { $interim_end_day_num = ($end_of_week - $last_weekday_of_month + 7) % 7; From 79e8d9fc2db1e870fa8890a23a8f90ffa6a7f7b6 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Mon, 18 May 2015 09:09:44 +1000 Subject: [PATCH 31/86] Only revert commits in the same repository Summary: Fixes T8215. When adding a revert edge, only consider commits within the same repository. Test Plan: Imported the arcanist repository three times and inspected the reverts relationships on rARC490984936bb7ddfc589ef3d376ec2ac2365f070d. Reviewers: hach-que, epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T8215 Differential Revision: https://secure.phabricator.com/D12875 --- .../worker/PhabricatorRepositoryCommitHeraldWorker.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php b/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php index b1361c4b4a..0aa4dad187 100644 --- a/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php +++ b/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php @@ -68,6 +68,7 @@ final class PhabricatorRepositoryCommitHeraldWorker if ($reverts) { $reverted_commits = id(new DiffusionCommitQuery()) ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->withRepository($repository) ->withIdentifiers($reverts) ->execute(); $reverted_commit_phids = mpull($reverted_commits, 'getPHID', 'getPHID'); From 898ce6bace59dbe77dd28b190cdc540a32b411ad Mon Sep 17 00:00:00 2001 From: Aviv Eyal Date: Mon, 18 May 2015 06:29:47 -0700 Subject: [PATCH 32/86] Search Symbols by Repository, not Project Summary: Fixes T7977. - Move Indexed Languages and See Symbols From config to Repository - Make symbol search skip projects This also makes the default languages to Everything instead of Nothing. Test Plan: - Browse files, click symbols. - Use quick search to find symbols - Browse revision, click symbols Reviewers: joshuaspence, epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T7977 Differential Revision: https://secure.phabricator.com/D12687 --- .../autopatches/20150504.symbolsproject.1.php | 68 ++++++++++ .../autopatches/20150504.symbolsproject.2.sql | 3 + src/__phutil_library_map__.php | 2 + .../DifferentialRevisionViewController.php | 36 +++-- .../PhabricatorDiffusionApplication.php | 1 + .../DiffusionBrowseFileController.php | 26 +--- .../DiffusionRepositoryEditMainController.php | 55 ++++++++ .../DiffusionRepositorySymbolsController.php | 123 ++++++++++++++++++ .../controller/DiffusionSymbolController.php | 2 +- .../diffusion/query/DiffusionSymbolQuery.php | 11 +- ...epositoryArcanistProjectEditController.php | 34 ----- .../editor/PhabricatorRepositoryEditor.php | 16 +++ .../storage/PhabricatorRepository.php | 11 ++ .../PhabricatorRepositoryArcanistProject.php | 7 - .../PhabricatorRepositoryTransaction.php | 22 ++++ .../repository/repository-crossreference.js | 2 +- 16 files changed, 336 insertions(+), 83 deletions(-) create mode 100644 resources/sql/autopatches/20150504.symbolsproject.1.php create mode 100644 resources/sql/autopatches/20150504.symbolsproject.2.sql create mode 100644 src/applications/diffusion/controller/DiffusionRepositorySymbolsController.php diff --git a/resources/sql/autopatches/20150504.symbolsproject.1.php b/resources/sql/autopatches/20150504.symbolsproject.1.php new file mode 100644 index 0000000000..e3c3db66e1 --- /dev/null +++ b/resources/sql/autopatches/20150504.symbolsproject.1.php @@ -0,0 +1,68 @@ +establishConnection('w'); + +// Repository and Project share a database. +$conn_r = $table_w->establishConnection('r'); +$projects_table = 'repository_arcanistproject'; + +$raw_projects_data = queryfx_all($conn_r, 'SELECT * FROM %T', $projects_table); +$raw_projects_data = ipull($raw_projects_data, null, 'id'); + +$repository_ids = ipull($raw_projects_data, 'repositoryID'); +$repositories = id(new PhabricatorRepositoryQuery()) + ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->withIDs($repository_ids) + ->execute(); + +$projects_to_repo_ids_map = ipull($raw_projects_data, 'repositoryID', 'phid'); +$projects_to_repos_map = array(); +foreach ($projects_to_repo_ids_map as $projectPHID => $repositoryID) { + $repo = idx($repositories, $repositoryID); + if ($repo) { + $projects_to_repos_map[$projectPHID] = $repo->getPHID(); + } +} + +foreach ($raw_projects_data as $project_row) { + $repositoryID = idx($project_row, 'repositoryID'); + $repo = idx($repositories, $repositoryID); + + if (!$repo) { + continue; + } + + echo pht( + "Migrating symbols configuration for '%s' project...\n", + idx($project_row, 'name', '???')); + + $symbol_index_projects = $project_row['symbolIndexProjects']; + $symbol_index_projects = phutil_json_decode($symbol_index_projects); + + $sources = $repo->getDetail('symbol-sources', array()); + foreach ($symbol_index_projects as $index_project) { + $sources[] = idx($projects_to_repos_map, $index_project); + } + $sources = array_filter($sources); + $sources = array_unique($sources); + + $repo->setDetail('symbol-sources', $sources); + + $languages = $project_row['symbolIndexLanguages']; + $languages = phutil_json_decode($languages); + + $languages = array_merge( + $repo->getDetail('symbol-languages', array()), + $languages); + $languages = array_unique($languages); + + $repo->setDetail('symbol-languages', $languages); + + queryfx( + $conn_w, + 'UPDATE %T SET details = %s WHERE id = %d', + $table_w->getTableName(), + json_encode($repo->getDetails()), + $repo->getID()); +} diff --git a/resources/sql/autopatches/20150504.symbolsproject.2.sql b/resources/sql/autopatches/20150504.symbolsproject.2.sql new file mode 100644 index 0000000000..f963f46c77 --- /dev/null +++ b/resources/sql/autopatches/20150504.symbolsproject.2.sql @@ -0,0 +1,3 @@ +ALTER TABLE {$NAMESPACE}_repository.repository_arcanistproject + DROP COLUMN symbolIndexLanguages, + DROP COLUMN symbolIndexProjects; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 2f07a0670b..be579679c5 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -605,6 +605,7 @@ phutil_register_library_map(array( 'DiffusionRepositoryPath' => 'applications/diffusion/data/DiffusionRepositoryPath.php', 'DiffusionRepositoryRef' => 'applications/diffusion/data/DiffusionRepositoryRef.php', 'DiffusionRepositoryRemarkupRule' => 'applications/diffusion/remarkup/DiffusionRepositoryRemarkupRule.php', + 'DiffusionRepositorySymbolsController' => 'applications/diffusion/controller/DiffusionRepositorySymbolsController.php', 'DiffusionRepositoryTag' => 'applications/diffusion/data/DiffusionRepositoryTag.php', 'DiffusionRequest' => 'applications/diffusion/request/DiffusionRequest.php', 'DiffusionResolveRefsConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionResolveRefsConduitAPIMethod.php', @@ -3847,6 +3848,7 @@ phutil_register_library_map(array( 'DiffusionRepositoryNewController' => 'DiffusionController', 'DiffusionRepositoryRef' => 'Phobject', 'DiffusionRepositoryRemarkupRule' => 'PhabricatorObjectRemarkupRule', + 'DiffusionRepositorySymbolsController' => 'DiffusionRepositoryEditController', 'DiffusionResolveRefsConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod', 'DiffusionResolveUserQuery' => 'Phobject', 'DiffusionSSHWorkflow' => 'PhabricatorSSHWorkflow', diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index 5f93b1b0ad..d1b021b8d0 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -260,14 +260,14 @@ final class DifferentialRevisionViewController extends DifferentialController { 'whitespace', DifferentialChangesetParser::WHITESPACE_IGNORE_MOST); - $arc_project = $target->getArcanistProject(); - if ($arc_project) { - list($symbol_indexes, $project_phids) = $this->buildSymbolIndexes( - $arc_project, + $repository = $revision->getRepository(); + if ($repository) { + list($symbol_indexes, $repository_phids) = $this->buildSymbolIndexes( + $repository, $visible_changesets); } else { $symbol_indexes = array(); - $project_phids = null; + $repository_phids = null; } $revision_detail->setActions($actions); @@ -307,12 +307,12 @@ final class DifferentialRevisionViewController extends DifferentialController { ), $comment_view); - if ($arc_project) { + if ($repository) { Javelin::initBehavior( 'repository-crossreference', array( 'section' => $wrap_id, - 'projects' => $project_phids, + 'repositories' => $repository_phids, )); } @@ -750,35 +750,33 @@ final class DifferentialRevisionViewController extends DifferentialController { } private function buildSymbolIndexes( - PhabricatorRepositoryArcanistProject $arc_project, + PhabricatorRepository $repository, array $visible_changesets) { assert_instances_of($visible_changesets, 'DifferentialChangeset'); $engine = PhabricatorSyntaxHighlighter::newEngine(); - $langs = $arc_project->getSymbolIndexLanguages(); - if (!$langs) { - return array(array(), array()); - } + $langs = $repository->getSymbolLanguages(); + $langs = nonempty($langs, array()); $symbol_indexes = array(); - $project_phids = array_merge( - array($arc_project->getPHID()), - nonempty($arc_project->getSymbolIndexProjects(), array())); + $repository_phids = array_merge( + array($repository->getPHID()), + nonempty($repository->getSymbolSources(), array())); $indexed_langs = array_fill_keys($langs, true); foreach ($visible_changesets as $key => $changeset) { $lang = $engine->getLanguageFromFilename($changeset->getFilename()); - if (isset($indexed_langs[$lang])) { + if (empty($indexed_langs) || isset($indexed_langs[$lang])) { $symbol_indexes[$key] = array( - 'lang' => $lang, - 'projects' => $project_phids, + 'lang' => $lang, + 'repositories' => $repository_phids, ); } } - return array($symbol_indexes, $project_phids); + return array($symbol_indexes, $repository_phids); } private function loadOtherRevisions( diff --git a/src/applications/diffusion/application/PhabricatorDiffusionApplication.php b/src/applications/diffusion/application/PhabricatorDiffusionApplication.php index 7771b8a03d..14a3338f5e 100644 --- a/src/applications/diffusion/application/PhabricatorDiffusionApplication.php +++ b/src/applications/diffusion/application/PhabricatorDiffusionApplication.php @@ -100,6 +100,7 @@ final class PhabricatorDiffusionApplication extends PhabricatorApplication { 'hosting/' => 'DiffusionRepositoryEditHostingController', '(?Pserve)/' => 'DiffusionRepositoryEditHostingController', 'update/' => 'DiffusionRepositoryEditUpdateController', + 'symbol/' => 'DiffusionRepositorySymbolsController', ), 'pathtree/(?P.*)' => 'DiffusionPathTreeController', 'mirror/' => array( diff --git a/src/applications/diffusion/controller/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/DiffusionBrowseFileController.php index 46f3af59cc..731906943c 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseFileController.php @@ -266,32 +266,20 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController { $id = celerity_generate_unique_node_id(); - $projects = $drequest->loadArcanistProjects(); - $langs = array(); - foreach ($projects as $project) { - $ls = $project->getSymbolIndexLanguages(); - if (!$ls) { - continue; - } - $dep_projects = $project->getSymbolIndexProjects(); - $dep_projects[] = $project->getPHID(); - foreach ($ls as $lang) { - if (!isset($langs[$lang])) { - $langs[$lang] = array(); - } - $langs[$lang] += $dep_projects + array($project); - } - } + $repo = $drequest->getRepository(); + $symbol_repos = $repo->getSymbolSources(); + $symbol_repos[] = $repo; $lang = last(explode('.', $drequest->getPath())); - - if (isset($langs[$lang])) { + $repo_languages = $repo->getSymbolLanguages(); + $repo_languages = array_fill_keys($repo_languages, true); + if (empty($repo_languages) || isset($repo_languages[$lang])) { Javelin::initBehavior( 'repository-crossreference', array( 'container' => $id, 'lang' => $lang, - 'projects' => $langs[$lang], + 'repositories' => $symbol_repos, )); } diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php index d19a7ebeb8..a5ad77f87e 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php @@ -62,6 +62,10 @@ final class DiffusionRepositoryEditMainController $encoding_properties = $this->buildEncodingProperties($repository, $encoding_actions); + $symbols_actions = $this->buildSymbolsActions($repository); + $symbols_properties = + $this->buildSymbolsProperties($repository, $symbols_actions); + $hosting_properties = $this->buildHostingProperties( $repository, $this->buildHostingActions($repository)); @@ -157,6 +161,10 @@ final class DiffusionRepositoryEditMainController ->setHeaderText(pht('Text Encoding')) ->addPropertyList($encoding_properties); + $boxes[] = id(new PHUIObjectBoxView()) + ->setHeaderText(pht('Symbols')) + ->addPropertyList($symbols_properties); + if ($branches_properties) { $boxes[] = id(new PHUIObjectBoxView()) ->setHeaderText(pht('Branches')) @@ -1187,6 +1195,53 @@ final class DiffusionRepositoryEditMainController return $mirror_list; } + private function buildSymbolsActions(PhabricatorRepository $repository) { + $viewer = $this->getRequest()->getUser(); + + $view = id(new PhabricatorActionListView()) + ->setObjectURI($this->getRequest()->getRequestURI()) + ->setUser($viewer); + + $edit = id(new PhabricatorActionView()) + ->setIcon('fa-pencil') + ->setName(pht('Edit Symbols')) + ->setHref( + $this->getRepositoryControllerURI($repository, 'edit/symbol/')); + $view->addAction($edit); + + return $view; + } + + private function buildSymbolsProperties( + PhabricatorRepository $repository, + PhabricatorActionListView $actions) { + + $viewer = $this->getRequest()->getUser(); + + $view = id(new PHUIPropertyListView()) + ->setUser($viewer) + ->setActionList($actions); + + $languages = $repository->getSymbolLanguages(); + + if ($languages) { + $languages = implode(', ', $languages); + } else { + $languages = phutil_tag('em', array(), pht('Any')); + } + $view->addProperty(pht('Languages'), $languages); + + $sources = $repository->getSymbolSources(); + if ($sources) { + $handles = $viewer->loadHandles($sources); + $sources = $handles->renderList(); + } else { + $sources = phutil_tag('em', array(), pht('This Repository Only')); + } + $view->addProperty(pht('Use Symbols From'), $sources); + return $view; + } + private function getEnvConfigLink() { $config_href = '/config/edit/environment.append-paths/'; return phutil_tag( diff --git a/src/applications/diffusion/controller/DiffusionRepositorySymbolsController.php b/src/applications/diffusion/controller/DiffusionRepositorySymbolsController.php new file mode 100644 index 0000000000..133ee38813 --- /dev/null +++ b/src/applications/diffusion/controller/DiffusionRepositorySymbolsController.php @@ -0,0 +1,123 @@ +getUser(); + $drequest = $this->diffusionRequest; + $repository = $drequest->getRepository(); + + $repository = id(new PhabricatorRepositoryQuery()) + ->setViewer($user) + ->requireCapabilities( + array( + PhabricatorPolicyCapability::CAN_VIEW, + PhabricatorPolicyCapability::CAN_EDIT, + )) + ->withIDs(array($repository->getID())) + ->executeOne(); + + if (!$repository) { + return new Aphront404Response(); + } + + $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/'); + + $v_sources = $repository->getSymbolSources(); + $v_languages = $repository->getSymbolLanguages(); + if ($v_languages) { + $v_languages = implode(', ', $v_languages); + } + $errors = array(); + + if ($request->isFormPost()) { + $v_sources = $request->getArr('sources'); + $v_languages = $request->getStrList('languages'); + $v_languages = array_map('phutil_utf8_strtolower', $v_languages); + + if (!$errors) { + $xactions = array(); + $template = id(new PhabricatorRepositoryTransaction()); + + $type_sources = PhabricatorRepositoryTransaction::TYPE_SYMBOLS_SOURCES; + $type_lang = PhabricatorRepositoryTransaction::TYPE_SYMBOLS_LANGUAGE; + + $xactions[] = id(clone $template) + ->setTransactionType($type_sources) + ->setNewValue($v_sources); + + $xactions[] = id(clone $template) + ->setTransactionType($type_lang) + ->setNewValue($v_languages); + + try { + id(new PhabricatorRepositoryEditor()) + ->setContinueOnNoEffect(true) + ->setContentSourceFromRequest($request) + ->setActor($user) + ->applyTransactions($repository, $xactions); + + return id(new AphrontRedirectResponse())->setURI($edit_uri); + } catch (Exception $ex) { + $errors[] = $ex->getMessage(); + } + } + } + + $crumbs = $this->buildApplicationCrumbs(); + $crumbs->addTextCrumb(pht('Edit Symbols')); + + $title = pht('Edit %s', $repository->getName()); + + $form = id(new AphrontFormView()) + ->setUser($user) + ->appendRemarkupInstructions($this->getInstructions()) + ->appendChild( + id(new AphrontFormTextControl()) + ->setName('languages') + ->setLabel(pht('Indexed Languages')) + ->setCaption(pht( + 'File extensions, separate with commas, for example: php, py. '. + 'Leave blank for "any".')) + ->setValue($v_languages)) + + ->appendControl( + id(new AphrontFormTokenizerControl()) + ->setName('sources') + ->setLabel(pht('Uses Symbols From')) + ->setDatasource(new DiffusionRepositoryDatasource()) + ->setValue($v_sources)) + + ->appendChild( + id(new AphrontFormSubmitControl()) + ->setValue(pht('Save')) + ->addCancelButton($edit_uri)); + + $object_box = id(new PHUIObjectBoxView()) + ->setHeaderText($title) + ->setForm($form) + ->setFormErrors($errors); + + return $this->buildApplicationPage( + array( + $crumbs, + $object_box, + ), + array( + 'title' => $title, + )); + } + + private function getInstructions() { + return pht(<<setNoDataString( - pht('No matching symbol could be found in any indexed project.')); + pht('No matching symbol could be found in any indexed repository.')); $panel = new PHUIObjectBoxView(); $panel->setHeaderText(pht('Similar Symbols')); diff --git a/src/applications/diffusion/query/DiffusionSymbolQuery.php b/src/applications/diffusion/query/DiffusionSymbolQuery.php index 2748639360..6017c45f6f 100644 --- a/src/applications/diffusion/query/DiffusionSymbolQuery.php +++ b/src/applications/diffusion/query/DiffusionSymbolQuery.php @@ -146,11 +146,12 @@ final class DiffusionSymbolQuery extends PhabricatorOffsetPagedQuery { $this->loadPaths($symbols); } if ($this->needRepositories) { - $this->loadRepositories($symbols); + $symbols = $this->loadRepositories($symbols); } } + return $symbols; } @@ -249,10 +250,16 @@ final class DiffusionSymbolQuery extends PhabricatorOffsetPagedQuery { ->execute(); $repos = mpull($repos, null, 'getPHID'); + $visible = array(); foreach ($symbols as $symbol) { $repository = idx($repos, $symbol->getRepositoryPHID()); - $symbol->attachRepository($repository); + // repository is null mean "user can't view repo", so hide the symbol + if ($repository) { + $symbol->attachRepository($repository); + $visible[] = $symbol; + } } + return $visible; } } diff --git a/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectEditController.php b/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectEditController.php index b3928b94ef..a439179034 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectEditController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectEditController.php @@ -34,13 +34,6 @@ final class PhabricatorRepositoryArcanistProjectEditController asort($repos); if ($request->isFormPost()) { - - $indexed = $request->getStrList('symbolIndexLanguages'); - $indexed = array_map('strtolower', $indexed); - $project->setSymbolIndexLanguages($indexed); - - $project->setSymbolIndexProjects($request->getArr('symbolIndexProjects')); - $repo_id = $request->getInt('repository', 0); if (isset($repos[$repo_id])) { $project->setRepositoryID($repo_id); @@ -51,19 +44,6 @@ final class PhabricatorRepositoryArcanistProjectEditController } } - $langs = $project->getSymbolIndexLanguages(); - if ($langs) { - $langs = implode(', ', $langs); - } else { - $langs = null; - } - - if ($project->getSymbolIndexProjects()) { - $uses = $project->getSymbolIndexProjects(); - } else { - $uses = array(); - } - $form = id(new AphrontFormView()) ->setUser($user) ->appendChild( @@ -80,20 +60,6 @@ final class PhabricatorRepositoryArcanistProjectEditController ->setOptions($repos) ->setName('repository') ->setValue($project->getRepositoryID())) - ->appendChild( - id(new AphrontFormTextControl()) - ->setLabel(pht('Indexed Languages')) - ->setName('symbolIndexLanguages') - ->setCaption(pht( - 'Separate with commas, for example: %s', - phutil_tag('tt', array(), 'php, py'))) - ->setValue($langs)) - ->appendControl( - id(new AphrontFormTokenizerControl()) - ->setLabel(pht('Uses Symbols From')) - ->setName('symbolIndexProjects') - ->setDatasource(new DiffusionArcanistProjectDatasource()) - ->setValue($uses)) ->appendChild( id(new AphrontFormSubmitControl()) ->addCancelButton('/repository/') diff --git a/src/applications/repository/editor/PhabricatorRepositoryEditor.php b/src/applications/repository/editor/PhabricatorRepositoryEditor.php index 49c57d81b4..69012bdcd2 100644 --- a/src/applications/repository/editor/PhabricatorRepositoryEditor.php +++ b/src/applications/repository/editor/PhabricatorRepositoryEditor.php @@ -41,6 +41,8 @@ final class PhabricatorRepositoryEditor $types[] = PhabricatorRepositoryTransaction::TYPE_DANGEROUS; $types[] = PhabricatorRepositoryTransaction::TYPE_CLONE_NAME; $types[] = PhabricatorRepositoryTransaction::TYPE_SERVICE; + $types[] = PhabricatorRepositoryTransaction::TYPE_SYMBOLS_LANGUAGE; + $types[] = PhabricatorRepositoryTransaction::TYPE_SYMBOLS_SOURCES; $types[] = PhabricatorTransactions::TYPE_EDGE; $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY; @@ -98,6 +100,10 @@ final class PhabricatorRepositoryEditor return $object->getDetail('clone-name'); case PhabricatorRepositoryTransaction::TYPE_SERVICE: return $object->getAlmanacServicePHID(); + case PhabricatorRepositoryTransaction::TYPE_SYMBOLS_LANGUAGE: + return $object->getSymbolLanguages(); + case PhabricatorRepositoryTransaction::TYPE_SYMBOLS_SOURCES: + return $object->getSymbolSources(); } } @@ -131,6 +137,8 @@ final class PhabricatorRepositoryEditor case PhabricatorRepositoryTransaction::TYPE_DANGEROUS: case PhabricatorRepositoryTransaction::TYPE_CLONE_NAME: case PhabricatorRepositoryTransaction::TYPE_SERVICE: + case PhabricatorRepositoryTransaction::TYPE_SYMBOLS_LANGUAGE: + case PhabricatorRepositoryTransaction::TYPE_SYMBOLS_SOURCES: return $xaction->getNewValue(); case PhabricatorRepositoryTransaction::TYPE_NOTIFY: case PhabricatorRepositoryTransaction::TYPE_AUTOCLOSE: @@ -205,6 +213,12 @@ final class PhabricatorRepositoryEditor case PhabricatorRepositoryTransaction::TYPE_SERVICE: $object->setAlmanacServicePHID($xaction->getNewValue()); return; + case PhabricatorRepositoryTransaction::TYPE_SYMBOLS_LANGUAGE: + $object->setDetail('symbol-languages', $xaction->getNewValue()); + return; + case PhabricatorRepositoryTransaction::TYPE_SYMBOLS_SOURCES: + $object->setDetail('symbol-sources', $xaction->getNewValue()); + return; case PhabricatorRepositoryTransaction::TYPE_ENCODING: // Make sure the encoding is valid by converting to UTF-8. This tests // that the user has mbstring installed, and also that they didn't type @@ -314,6 +328,8 @@ final class PhabricatorRepositoryEditor case PhabricatorRepositoryTransaction::TYPE_DANGEROUS: case PhabricatorRepositoryTransaction::TYPE_CLONE_NAME: case PhabricatorRepositoryTransaction::TYPE_SERVICE: + case PhabricatorRepositoryTransaction::TYPE_SYMBOLS_SOURCES: + case PhabricatorRepositoryTransaction::TYPE_SYMBOLS_LANGUAGE: PhabricatorPolicyFilter::requireCapability( $this->requireActor(), $object, diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php index 4ab2828949..8108051282 100644 --- a/src/applications/repository/storage/PhabricatorRepository.php +++ b/src/applications/repository/storage/PhabricatorRepository.php @@ -1778,6 +1778,17 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO } +/* -( Symbols )-------------------------------------------------------------*/ + + public function getSymbolSources() { + return $this->getDetail('symbol-sources'); + } + + public function getSymbolLanguages() { + return $this->getDetail('symbol-languages'); + } + + /* -( PhabricatorApplicationTransactionInterface )------------------------- */ diff --git a/src/applications/repository/storage/PhabricatorRepositoryArcanistProject.php b/src/applications/repository/storage/PhabricatorRepositoryArcanistProject.php index 2c7f403a37..a1ac747bbf 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryArcanistProject.php +++ b/src/applications/repository/storage/PhabricatorRepositoryArcanistProject.php @@ -9,19 +9,12 @@ final class PhabricatorRepositoryArcanistProject protected $name; protected $repositoryID; - protected $symbolIndexLanguages = array(); - protected $symbolIndexProjects = array(); - private $repository = self::ATTACHABLE; protected function getConfiguration() { return array( self::CONFIG_AUX_PHID => true, self::CONFIG_TIMESTAMPS => false, - self::CONFIG_SERIALIZATION => array( - 'symbolIndexLanguages' => self::SERIALIZATION_JSON, - 'symbolIndexProjects' => self::SERIALIZATION_JSON, - ), self::CONFIG_COLUMN_SCHEMA => array( 'name' => 'text128', 'repositoryID' => 'id?', diff --git a/src/applications/repository/storage/PhabricatorRepositoryTransaction.php b/src/applications/repository/storage/PhabricatorRepositoryTransaction.php index ff162a4ad0..9907cb0a01 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryTransaction.php +++ b/src/applications/repository/storage/PhabricatorRepositoryTransaction.php @@ -25,6 +25,8 @@ final class PhabricatorRepositoryTransaction const TYPE_DANGEROUS = 'repo:dangerous'; const TYPE_CLONE_NAME = 'repo:clone-name'; const TYPE_SERVICE = 'repo:service'; + const TYPE_SYMBOLS_SOURCES = 'repo:symbol-source'; + const TYPE_SYMBOLS_LANGUAGE = 'repo:symbol-language'; // TODO: Clean up these legacy transaction types. const TYPE_SSH_LOGIN = 'repo:ssh-login'; @@ -61,6 +63,14 @@ final class PhabricatorRepositoryTransaction $phids[] = $new; } break; + case self::TYPE_SYMBOLS_SOURCES: + if ($old) { + $phids = array_merge($phids, $old); + } + if ($new) { + $phids = array_merge($phids, $new); + } + break; } return $phids; @@ -393,6 +403,18 @@ final class PhabricatorRepositoryTransaction $this->renderHandleLink($old), $this->renderHandleLink($new)); } + case self::TYPE_SYMBOLS_SOURCES: + return pht( + '%s changed symbol sources from %s to %s.', + $this->renderHandleLink($author_phid), + empty($old) ? pht('None') : $this->renderHandleList($old), + empty($new) ? pht('None') : $this->renderHandleList($new)); + + case self::TYPE_SYMBOLS_LANGUAGE: + return pht('%s changed indexed languages from %s to %s.', + $this->renderHandleLink($author_phid), + $old ? implode(', ', $old) : pht('Any'), + $new ? implode(', ', $new) : pht('Any')); } return parent::getTitle(); diff --git a/webroot/rsrc/js/application/repository/repository-crossreference.js b/webroot/rsrc/js/application/repository/repository-crossreference.js index 1cb9b347ef..d2339dc131 100644 --- a/webroot/rsrc/js/application/repository/repository-crossreference.js +++ b/webroot/rsrc/js/application/repository/repository-crossreference.js @@ -29,7 +29,7 @@ JX.behavior('repository-crossreference', function(config) { var symbol = target.textContent || target.innerText; var query = { lang : lang, - projects : config.projects.join(','), + repositories : config.repositories.join(','), jump : true }; if (map[target.className]) { From f8b7f031459851145ffe2111b0b63587e8d7ad66 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Tue, 19 May 2015 00:07:46 +1000 Subject: [PATCH 33/86] Change "lint save" to not use Arcanist Projects Summary: Ref T7604. Change `DiffusionLintSaveRunner` to use repositories instead of Arcanist Projects. Test Plan: Ran the `save_lint.php` script and queried results using the `diffusion.getlintmessages` Conduit endpoint. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T7604 Differential Revision: https://secure.phabricator.com/D12893 --- scripts/repository/save_lint.php | 19 +++++++----- .../diffusion/DiffusionLintSaveRunner.php | 26 ++++++++++++---- ...ffusionGetLintMessagesConduitAPIMethod.php | 30 +++++++++++-------- 3 files changed, 49 insertions(+), 26 deletions(-) diff --git a/scripts/repository/save_lint.php b/scripts/repository/save_lint.php index 6cd0664133..d9bf921e9c 100755 --- a/scripts/repository/save_lint.php +++ b/scripts/repository/save_lint.php @@ -17,35 +17,38 @@ $args = id(new PhutilArgumentParser($argv)) ->parse(array( array( 'name' => 'all', - 'help' => + 'help' => pht( 'Discover problems in the whole repository instead of just changes '. - 'since the last run.', + 'since the last run.'), ), array( 'name' => 'arc', 'param' => 'path', 'default' => 'arc', - 'help' => 'Path to Arcanist executable.', + 'help' => pht('Path to Arcanist executable.'), ), array( 'name' => 'severity', 'param' => 'string', 'default' => ArcanistLintSeverity::SEVERITY_ADVICE, - 'help' => 'Minimum severity, one of ArcanistLintSeverity constants.', + 'help' => pht( + 'Minimum severity, one of %s constants.', + 'ArcanistLintSeverity'), ), array( 'name' => 'chunk-size', 'param' => 'number', 'default' => 256, - 'help' => 'Number of paths passed to `arc` at once.', + 'help' => pht('Number of paths passed to `%s` at once.', 'arc'), ), array( 'name' => 'blame', - 'help' => 'Assign lint errors to authors who last modified the line.', + 'help' => pht( + 'Assign lint errors to authors who last modified the line.'), ), )); -echo "Saving lint errors to database...\n"; +echo pht('Saving lint errors to database...')."\n"; $count = id(new DiffusionLintSaveRunner()) ->setAll($args->getArg('all', false)) @@ -55,4 +58,4 @@ $count = id(new DiffusionLintSaveRunner()) ->setNeedsBlame($args->getArg('blame')) ->run('.'); -echo "\nProcessed {$count} files.\n"; +echo "\n".pht('Processed %d files.', $count)."\n"; diff --git a/src/applications/diffusion/DiffusionLintSaveRunner.php b/src/applications/diffusion/DiffusionLintSaveRunner.php index 26a98a0232..629c887924 100644 --- a/src/applications/diffusion/DiffusionLintSaveRunner.php +++ b/src/applications/diffusion/DiffusionLintSaveRunner.php @@ -58,17 +58,31 @@ final class DiffusionLintSaveRunner { } } - $project_id = $working_copy->getProjectID(); - $project = id(new PhabricatorRepositoryArcanistProject()) - ->loadOneWhere('name = %s', $project_id); - if (!$project || !$project->getRepositoryID()) { - throw new Exception("Couldn't find repository for {$project_id}."); + $callsign = $configuration_manager->getConfigFromAnySource( + 'repository.callsign'); + $uuid = $api->getRepositoryUUID(); + $remote_uri = $api->getRemoteURI(); + + $repository_query = id(new PhabricatorRepositoryQuery()) + ->setViewer(PhabricatorUser::getOmnipotentUser()); + + if ($callsign) { + $repository_query->withCallsigns(array($callsign)); + } else if ($uuid) { + $repository_query->withUUIDs(array($uuid)); + } else if ($remote_uri) { + $repository_query->withRemoteURIs(array($remote_uri)); } + $repository = $repository_query->executeOne(); $branch_name = $api->getBranchName(); + if (!$repository) { + throw new Exception(pht('No repository was found.')); + } + $this->branch = PhabricatorRepositoryBranch::loadOrCreateBranch( - $project->getRepositoryID(), + $repository->getID(), $branch_name); $this->conn = $this->branch->establishConnection('w'); diff --git a/src/applications/diffusion/conduit/DiffusionGetLintMessagesConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionGetLintMessagesConduitAPIMethod.php index d73213b148..cc7cb4a095 100644 --- a/src/applications/diffusion/conduit/DiffusionGetLintMessagesConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionGetLintMessagesConduitAPIMethod.php @@ -12,15 +12,15 @@ final class DiffusionGetLintMessagesConduitAPIMethod } public function getMethodDescription() { - return 'Get lint messages for existing code.'; + return pht('Get lint messages for existing code.'); } protected function defineParamTypes() { return array( - 'arcanistProject' => 'required string', - 'branch' => 'optional string', - 'commit' => 'optional string', - 'files' => 'required list', + 'repositoryPHID' => 'required phid', + 'branch' => 'required string', + 'commit' => 'optional string', + 'files' => 'required list', ); } @@ -29,25 +29,31 @@ final class DiffusionGetLintMessagesConduitAPIMethod } protected function execute(ConduitAPIRequest $request) { - $project = id(new PhabricatorRepositoryArcanistProject())->loadOneWhere( - 'name = %s', - $request->getValue('arcanistProject')); - if (!$project || !$project->getRepositoryID()) { - return array(); + $viewer = $request->getUser(); + + $repository_phid = $request->getValue('repositoryPHID'); + $repository = id(new PhabricatorRepositoryQuery()) + ->setViewer($viewer) + ->withPHIDs(array($repository_phid)) + ->executeOne(); + + if (!$repository) { + throw new Exception( + pht('No repository exists with PHID "%s".', $repository_phid)); } $branch_name = $request->getValue('branch'); if ($branch_name == '') { $repository = id(new PhabricatorRepositoryQuery()) ->setViewer($request->getUser()) - ->withIDs(array($project->getRepositoryID())) + ->withIDs(array($repository->getID())) ->executeOne(); $branch_name = $repository->getDefaultArcanistBranch(); } $branch = id(new PhabricatorRepositoryBranch())->loadOneWhere( 'repositoryID = %d AND name = %s', - $project->getRepositoryID(), + $repository->getID(), $branch_name); if (!$branch || !$branch->getLintCommit()) { return array(); From 021223907dfd267f6d4f08d2dfc01597afb8d341 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Tue, 19 May 2015 00:36:52 +1000 Subject: [PATCH 34/86] Remove arcanist projects from differential Summary: Ref T7604. Remove arcanist projects from differential. Depends on D12687 and D12893. Test Plan: Submitted a diff. Patched the diff with `arc patch`. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T7604 Differential Revision: https://secure.phabricator.com/D12894 --- resources/celerity/map.php | 18 ++++---- src/__phutil_library_map__.php | 2 - ...DifferentialCreateDiffConduitAPIMethod.php | 19 +-------- .../DifferentialGetDiffConduitAPIMethod.php | 9 ++-- ...ifferentialGetRevisionConduitAPIMethod.php | 7 ++-- .../DifferentialQueryConduitAPIMethod.php | 16 ------- ...DifferentialQueryDiffsConduitAPIMethod.php | 1 - .../DifferentialRevisionViewController.php | 1 - .../DifferentialArcanistProjectField.php | 42 ------------------- .../editor/DifferentialDiffEditor.php | 3 +- .../editor/DifferentialTransactionEditor.php | 1 - .../query/DifferentialDiffQuery.php | 33 --------------- .../query/DifferentialRepositoryLookup.php | 16 ------- .../query/DifferentialRevisionQuery.php | 21 ---------- .../differential/storage/DifferentialDiff.php | 1 - ...torRepositoryCommitMessageParserWorker.php | 8 ---- 16 files changed, 19 insertions(+), 179 deletions(-) delete mode 100644 src/applications/differential/customfield/DifferentialArcanistProjectField.php diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 3aecd78dfc..5b985f4de7 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -11,7 +11,7 @@ return array( 'core.pkg.js' => 'a2f2598e', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => 'bb338e4b', - 'differential.pkg.js' => '895b8d62', + 'differential.pkg.js' => '45b3b51d', 'diffusion.pkg.css' => '591664fa', 'diffusion.pkg.js' => '0115b37c', 'maniphest.pkg.css' => '68d4dd3d', @@ -397,7 +397,7 @@ return array( 'rsrc/js/application/releeph/releeph-preview-branch.js' => 'b2b4fbaf', 'rsrc/js/application/releeph/releeph-request-state-change.js' => 'a0b57eb8', 'rsrc/js/application/releeph/releeph-request-typeahead.js' => 'de2e896f', - 'rsrc/js/application/repository/repository-crossreference.js' => 'f9539603', + 'rsrc/js/application/repository/repository-crossreference.js' => '3975b470', 'rsrc/js/application/search/behavior-reorder-queries.js' => 'e9581f08', 'rsrc/js/application/slowvote/behavior-slowvote-embed.js' => '887ad43f', 'rsrc/js/application/transactions/behavior-show-older-transactions.js' => 'dbbf48b6', @@ -631,7 +631,7 @@ return array( 'javelin-behavior-remarkup-preview' => 'f7379f45', 'javelin-behavior-reorder-applications' => '76b9fc3e', 'javelin-behavior-reorder-columns' => 'e1d25dfb', - 'javelin-behavior-repository-crossreference' => 'f9539603', + 'javelin-behavior-repository-crossreference' => '3975b470', 'javelin-behavior-scrollbar' => '834a1173', 'javelin-behavior-search-reorder-queries' => 'e9581f08', 'javelin-behavior-select-on-click' => '4e3e79a6', @@ -1041,6 +1041,12 @@ return array( '331b1611' => array( 'javelin-install', ), + '3975b470' => array( + 'javelin-behavior', + 'javelin-dom', + 'javelin-stratcom', + 'javelin-uri', + ), '3ab51e2c' => array( 'javelin-behavior', 'javelin-behavior-device', @@ -1986,12 +1992,6 @@ return array( 'javelin-util', 'phabricator-busy', ), - 'f9539603' => array( - 'javelin-behavior', - 'javelin-dom', - 'javelin-stratcom', - 'javelin-uri', - ), 'fa0f4fc2' => array( 'javelin-behavior', 'javelin-dom', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index be579679c5..96d2502491 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -296,7 +296,6 @@ phutil_register_library_map(array( 'DifferentialAdjustmentMapTestCase' => 'applications/differential/storage/__tests__/DifferentialAdjustmentMapTestCase.php', 'DifferentialAffectedPath' => 'applications/differential/storage/DifferentialAffectedPath.php', 'DifferentialApplyPatchField' => 'applications/differential/customfield/DifferentialApplyPatchField.php', - 'DifferentialArcanistProjectField' => 'applications/differential/customfield/DifferentialArcanistProjectField.php', 'DifferentialAsanaRepresentationField' => 'applications/differential/customfield/DifferentialAsanaRepresentationField.php', 'DifferentialAuditorsField' => 'applications/differential/customfield/DifferentialAuditorsField.php', 'DifferentialAuthorField' => 'applications/differential/customfield/DifferentialAuthorField.php', @@ -3542,7 +3541,6 @@ phutil_register_library_map(array( 'DifferentialAdjustmentMapTestCase' => 'ArcanistPhutilTestCase', 'DifferentialAffectedPath' => 'DifferentialDAO', 'DifferentialApplyPatchField' => 'DifferentialCustomField', - 'DifferentialArcanistProjectField' => 'DifferentialCustomField', 'DifferentialAsanaRepresentationField' => 'DifferentialCustomField', 'DifferentialAuditorsField' => 'DifferentialStoredCustomField', 'DifferentialAuthorField' => 'DifferentialCustomField', diff --git a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php index 6db5bc6cb4..8839eee6d7 100644 --- a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php @@ -12,7 +12,6 @@ final class DifferentialCreateDiffConduitAPIMethod } protected function defineParamTypes() { - $vcs_const = $this->formatStringConstants( array( 'svn', @@ -40,7 +39,7 @@ final class DifferentialCreateDiffConduitAPIMethod 'sourceControlPath' => 'required string', 'sourceControlBaseRevision' => 'required string', 'creationMethod' => 'optional string', - 'arcanistProject' => 'optional string', + 'arcanistProject' => 'deprecated', 'lintStatus' => 'required '.$status_const, 'unitStatus' => 'required '.$status_const, 'repositoryPHID' => 'optional phid', @@ -84,21 +83,6 @@ final class DifferentialCreateDiffConduitAPIMethod } } - $project_name = $request->getValue('arcanistProject'); - $project_phid = null; - if ($project_name) { - $arcanist_project = id(new PhabricatorRepositoryArcanistProject()) - ->loadOneWhere( - 'name = %s', - $project_name); - if (!$arcanist_project) { - $arcanist_project = new PhabricatorRepositoryArcanistProject(); - $arcanist_project->setName($project_name); - $arcanist_project->save(); - } - $project_phid = $arcanist_project->getPHID(); - } - switch ($request->getValue('lintStatus')) { case 'skip': $lint_status = DifferentialLintStatus::LINT_SKIP; @@ -156,7 +140,6 @@ final class DifferentialCreateDiffConduitAPIMethod 'sourceControlPath' => $request->getValue('sourceControlPath'), 'sourceControlBaseRevision' => $request->getValue('sourceControlBaseRevision'), - 'arcanistProjectPHID' => $project_phid, 'lintStatus' => $lint_status, 'unitStatus' => $unit_status, ); diff --git a/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php index 4770821f78..92d9807dda 100644 --- a/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php @@ -17,13 +17,15 @@ final class DifferentialGetDiffConduitAPIMethod public function getMethodStatusDescription() { return pht( - 'This method has been deprecated in favor of differential.querydiffs.'); + 'This method has been deprecated in favor of %s.', + 'differential.querydiffs'); } public function getMethodDescription() { - return pht('Load the content of a diff from Differential by revision id '. - 'or diff id.'); + return pht( + 'Load the content of a diff from Differential by revision id '. + 'or diff id.'); } protected function defineParamTypes() { @@ -67,7 +69,6 @@ final class DifferentialGetDiffConduitAPIMethod ->setViewer($request->getUser()) ->withIDs(array($diff_id)) ->needChangesets(true) - ->needArcanistProjects(true) ->executeOne(); } diff --git a/src/applications/differential/conduit/DifferentialGetRevisionConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetRevisionConduitAPIMethod.php index db0aeae83f..a158d86d9f 100644 --- a/src/applications/differential/conduit/DifferentialGetRevisionConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialGetRevisionConduitAPIMethod.php @@ -12,11 +12,11 @@ final class DifferentialGetRevisionConduitAPIMethod } public function getMethodStatusDescription() { - return "Replaced by 'differential.query'."; + return pht("Replaced by '%s'.", 'differential.query'); } public function getMethodDescription() { - return 'Load the content of a revision from Differential.'; + return pht('Load the content of a revision from Differential.'); } protected function defineParamTypes() { @@ -31,7 +31,7 @@ final class DifferentialGetRevisionConduitAPIMethod protected function defineErrorTypes() { return array( - 'ERR_BAD_REVISION' => 'No such revision exists.', + 'ERR_BAD_REVISION' => pht('No such revision exists.'), ); } @@ -56,7 +56,6 @@ final class DifferentialGetRevisionConduitAPIMethod ->setViewer($request->getUser()) ->withRevisionIDs(array($revision_id)) ->needChangesets(true) - ->needArcanistProjects(true) ->execute(); $diff_dicts = mpull($diffs, 'getDiffDict'); diff --git a/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php index 04af9ff234..305b071be8 100644 --- a/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php @@ -44,7 +44,6 @@ final class DifferentialQueryConduitAPIMethod 'subscribers' => 'optional list', 'responsibleUsers' => 'optional list', 'branches' => 'optional list', - 'arcanistProjects' => 'optional list', ); } @@ -73,7 +72,6 @@ final class DifferentialQueryConduitAPIMethod $subscribers = $request->getValue('subscribers'); $responsible_users = $request->getValue('responsibleUsers'); $branches = $request->getValue('branches'); - $arc_projects = $request->getValue('arcanistProjects'); $query = id(new DifferentialRevisionQuery()) ->setViewer($request->getUser()); @@ -169,19 +167,6 @@ final class DifferentialQueryConduitAPIMethod if ($branches) { $query->withBranches($branches); } - if ($arc_projects) { - // This is sort of special-cased, but don't make arc do an extra round - // trip. - $projects = id(new PhabricatorRepositoryArcanistProject()) - ->loadAllWhere( - 'name in (%Ls)', - $arc_projects); - if (!$projects) { - return array(); - } - - $query->withArcanistProjectPHIDs(mpull($projects, 'getPHID')); - } $query->needRelationships(true); $query->needCommitPHIDs(true); @@ -228,7 +213,6 @@ final class DifferentialQueryConduitAPIMethod 'ccs' => array_values($revision->getCCPHIDs()), 'hashes' => $revision->getHashes(), 'auxiliary' => idx($field_data, $phid, array()), - 'arcanistProjectPHID' => $diff->getArcanistProjectPHID(), 'repositoryPHID' => $diff->getRepositoryPHID(), ); diff --git a/src/applications/differential/conduit/DifferentialQueryDiffsConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialQueryDiffsConduitAPIMethod.php index 630f07da2b..836181d1df 100644 --- a/src/applications/differential/conduit/DifferentialQueryDiffsConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialQueryDiffsConduitAPIMethod.php @@ -33,7 +33,6 @@ final class DifferentialQueryDiffsConduitAPIMethod ->withIDs($ids) ->withRevisionIDs($revision_ids) ->needChangesets(true) - ->needArcanistProjects(true) ->execute(); } diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index d1b021b8d0..849ef056aa 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -33,7 +33,6 @@ final class DifferentialRevisionViewController extends DifferentialController { $diffs = id(new DifferentialDiffQuery()) ->setViewer($request->getUser()) ->withRevisionIDs(array($this->revisionID)) - ->needArcanistProjects(true) ->execute(); $diffs = array_reverse($diffs, $preserve_keys = true); diff --git a/src/applications/differential/customfield/DifferentialArcanistProjectField.php b/src/applications/differential/customfield/DifferentialArcanistProjectField.php deleted file mode 100644 index f884e701a6..0000000000 --- a/src/applications/differential/customfield/DifferentialArcanistProjectField.php +++ /dev/null @@ -1,42 +0,0 @@ -getFieldName(); - } - - public function getRequiredHandlePHIDsForPropertyView() { - $phid = $this->getArcanistProjectPHID(); - if ($phid) { - return array($phid); - } - return array(); - } - - public function renderPropertyViewValue(array $handles) { - return $this->renderHandleList($handles); - } - - private function getArcanistProjectPHID() { - return $this->getObject()->getActiveDiff()->getArcanistProjectPHID(); - } - -} diff --git a/src/applications/differential/editor/DifferentialDiffEditor.php b/src/applications/differential/editor/DifferentialDiffEditor.php index 9d4fa0767c..25385899b1 100644 --- a/src/applications/differential/editor/DifferentialDiffEditor.php +++ b/src/applications/differential/editor/DifferentialDiffEditor.php @@ -234,8 +234,7 @@ final class DifferentialDiffEditor ->setSourceControlPath(idx($dict, 'sourceControlPath')) ->setSourceControlBaseRevision(idx($dict, 'sourceControlBaseRevision')) ->setLintStatus(idx($dict, 'lintStatus')) - ->setUnitStatus(idx($dict, 'unitStatus')) - ->setArcanistProjectPHID(idx($dict, 'arcanistProjectPHID')); + ->setUnitStatus(idx($dict, 'unitStatus')); return $diff; } diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php index 113d6924f3..94889213ba 100644 --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -220,7 +220,6 @@ final class DifferentialTransactionEditor } else { $object->setRepositoryPHID($diff->getRepositoryPHID()); } - $object->setArcanistProjectPHID($diff->getArcanistProjectPHID()); $object->attachActiveDiff($diff); // TODO: Update the `diffPHID` once we add that. diff --git a/src/applications/differential/query/DifferentialDiffQuery.php b/src/applications/differential/query/DifferentialDiffQuery.php index 15ddc9c46b..1616d58ac8 100644 --- a/src/applications/differential/query/DifferentialDiffQuery.php +++ b/src/applications/differential/query/DifferentialDiffQuery.php @@ -7,7 +7,6 @@ final class DifferentialDiffQuery private $phids; private $revisionIDs; private $needChangesets = false; - private $needArcanistProjects = false; public function withIDs(array $ids) { $this->ids = $ids; @@ -29,11 +28,6 @@ final class DifferentialDiffQuery return $this; } - public function needArcanistProjects($bool) { - $this->needArcanistProjects = $bool; - return $this; - } - protected function loadPage() { $table = new DifferentialDiff(); $conn_r = $table->establishConnection('r'); @@ -79,10 +73,6 @@ final class DifferentialDiffQuery $diffs = $this->loadChangesets($diffs); } - if ($diffs && $this->needArcanistProjects) { - $diffs = $this->loadArcanistProjects($diffs); - } - return $diffs; } @@ -98,29 +88,6 @@ final class DifferentialDiffQuery return $diffs; } - private function loadArcanistProjects(array $diffs) { - $phids = array_filter(mpull($diffs, 'getArcanistProjectPHID')); - $projects = array(); - $project_map = array(); - if ($phids) { - $projects = id(new PhabricatorRepositoryArcanistProject()) - ->loadAllWhere( - 'phid IN (%Ls)', - $phids); - $project_map = mpull($projects, null, 'getPHID'); - } - - foreach ($diffs as $diff) { - $project = null; - if ($diff->getArcanistProjectPHID()) { - $project = idx($project_map, $diff->getArcanistProjectPHID()); - } - $diff->attachArcanistProject($project); - } - - return $diffs; - } - protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { $where = array(); diff --git a/src/applications/differential/query/DifferentialRepositoryLookup.php b/src/applications/differential/query/DifferentialRepositoryLookup.php index c964bf4580..4a498edb55 100644 --- a/src/applications/differential/query/DifferentialRepositoryLookup.php +++ b/src/applications/differential/query/DifferentialRepositoryLookup.php @@ -22,22 +22,6 @@ final class DifferentialRepositoryLookup extends Phobject { $viewer = $this->viewer; $diff = $this->diff; - // Look for an explicit Arcanist project. - if ($diff->getArcanistProjectPHID()) { - $project = id(new PhabricatorRepositoryArcanistProject())->loadOneWhere( - 'phid = %s', - $diff->getArcanistProjectPHID()); - if ($project && $project->getRepositoryID()) { - $repositories = id(new PhabricatorRepositoryQuery()) - ->setViewer($viewer) - ->withIDs(array($project->getRepositoryID())) - ->execute(); - if ($repositories) { - return head($repositories); - } - } - } - // Look for a repository UUID. if ($diff->getRepositoryUUID()) { $repositories = id(new PhabricatorRepositoryQuery()) diff --git a/src/applications/differential/query/DifferentialRevisionQuery.php b/src/applications/differential/query/DifferentialRevisionQuery.php index 2ac7289853..d49ef34887 100644 --- a/src/applications/differential/query/DifferentialRevisionQuery.php +++ b/src/applications/differential/query/DifferentialRevisionQuery.php @@ -36,7 +36,6 @@ final class DifferentialRevisionQuery private $phids = array(); private $responsibles = array(); private $branches = array(); - private $arcanistProjectPHIDs = array(); private $repositoryPHIDs; private $updatedEpochMin; private $updatedEpochMax; @@ -228,19 +227,6 @@ final class DifferentialRevisionQuery } - /** - * Filter results to only return revisions with a given set of arcanist - * projects. - * - * @param array List of project PHIDs. - * @return this - * @task config - */ - public function withArcanistProjectPHIDs(array $arc_project_phids) { - $this->arcanistProjectPHIDs = $arc_project_phids; - return $this; - } - public function withRepositoryPHIDs(array $repository_phids) { $this->repositoryPHIDs = $repository_phids; return $this; @@ -771,13 +757,6 @@ final class DifferentialRevisionQuery $this->branches); } - if ($this->arcanistProjectPHIDs) { - $where[] = qsprintf( - $conn_r, - 'r.arcanistProjectPHID in (%Ls)', - $this->arcanistProjectPHIDs); - } - if ($this->updatedEpochMin !== null) { $where[] = qsprintf( $conn_r, diff --git a/src/applications/differential/storage/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php index 9092f365bc..6c67cff51e 100644 --- a/src/applications/differential/storage/DifferentialDiff.php +++ b/src/applications/differential/storage/DifferentialDiff.php @@ -262,7 +262,6 @@ final class DifferentialDiff 'lintStatus' => $this->getLintStatus(), 'changes' => array(), 'properties' => array(), - 'projectName' => $this->getArcanistProjectName(), ); $dict['changes'] = $this->buildChangesList(); diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php index 25272ca940..89fa5f34f4 100644 --- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php @@ -321,14 +321,6 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker $this->repository->getCallsign(). $this->commit->getCommitIdentifier()); - // TODO: This is not correct in SVN where one repository can have multiple - // Arcanist projects. - $arcanist_project = id(new PhabricatorRepositoryArcanistProject()) - ->loadOneWhere('repositoryID = %d LIMIT 1', $this->repository->getID()); - if ($arcanist_project) { - $diff->setArcanistProjectPHID($arcanist_project->getPHID()); - } - $parents = DiffusionQuery::callConduitWithDiffusionRequest( $viewer, $drequest, From 44cf60dfd2f641008d0d3d26f141c5b7b75ee7c4 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 18 May 2015 10:26:53 -0700 Subject: [PATCH 35/86] Fail more softly on funky arcanist project / symbol data Summary: Fixes T8240, probably? Test Plan: This is hard to test locally post-migration -- @btrahan, does it fix things for you? Reviewers: btrahan Reviewed By: btrahan Subscribers: btrahan, epriestley Maniphest Tasks: T8240 Differential Revision: https://secure.phabricator.com/D12903 --- .../sql/autopatches/20150504.symbolsproject.1.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/resources/sql/autopatches/20150504.symbolsproject.1.php b/resources/sql/autopatches/20150504.symbolsproject.1.php index e3c3db66e1..8ab77bbef4 100644 --- a/resources/sql/autopatches/20150504.symbolsproject.1.php +++ b/resources/sql/autopatches/20150504.symbolsproject.1.php @@ -38,7 +38,12 @@ foreach ($raw_projects_data as $project_row) { idx($project_row, 'name', '???')); $symbol_index_projects = $project_row['symbolIndexProjects']; - $symbol_index_projects = phutil_json_decode($symbol_index_projects); + $symbol_index_projects = nonempty($symbol_index_projects, '[]'); + try { + $symbol_index_projects = phutil_json_decode($symbol_index_projects); + } catch (PhutilJSONParserException $ex) { + continue; + } $sources = $repo->getDetail('symbol-sources', array()); foreach ($symbol_index_projects as $index_project) { @@ -50,7 +55,12 @@ foreach ($raw_projects_data as $project_row) { $repo->setDetail('symbol-sources', $sources); $languages = $project_row['symbolIndexLanguages']; - $languages = phutil_json_decode($languages); + $languages = nonempty($languages, '[]'); + try { + $languages = phutil_json_decode($languages); + } catch (PhutilJSONParserException $ex) { + continue; + } $languages = array_merge( $repo->getDetail('symbol-languages', array()), From 1970ebcd7b732768eb81df7df9f875ea60ed47e7 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 18 May 2015 10:28:19 -0700 Subject: [PATCH 36/86] Never generate $0.00 invoices Summary: Ref T7769. It might possibly make sense to generate these some day, but for now they aren't payable and we have no use for them. Test Plan: - Generated $0.00 invoices, saw code decline to invoice. - Generated a $7.99 invoice, got an invoice. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7769 Differential Revision: https://secure.phabricator.com/D12878 --- .../phortune/worker/PhortuneSubscriptionWorker.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/applications/phortune/worker/PhortuneSubscriptionWorker.php b/src/applications/phortune/worker/PhortuneSubscriptionWorker.php index a3235d464f..747b4b3889 100644 --- a/src/applications/phortune/worker/PhortuneSubscriptionWorker.php +++ b/src/applications/phortune/worker/PhortuneSubscriptionWorker.php @@ -15,6 +15,13 @@ final class PhortuneSubscriptionWorker extends PhabricatorWorker { return; } + $currency = $subscription->getCostForBillingPeriodAsCurrency( + $last_epoch, + $next_epoch); + if (!$currency->isPositive()) { + return; + } + $account = $subscription->getAccount(); $merchant = $subscription->getMerchant(); @@ -48,10 +55,6 @@ final class PhortuneSubscriptionWorker extends PhabricatorWorker { $purchase = $cart->newPurchase($actor, $product); - $currency = $subscription->getCostForBillingPeriodAsCurrency( - $last_epoch, - $next_epoch); - $purchase ->setBasePriceAsCurrency($currency) ->setMetadataValue('subscriptionPHID', $subscription->getPHID()) From 107d6db1e8f638f40e3f7489a380480f1c9869ef Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 18 May 2015 12:18:10 -0700 Subject: [PATCH 37/86] Don't put a spacer line on the bottom of previews Summary: Fixes T8182. See screenshot in that task. We currently render a line to nowhere at the bottom of these previews. Instead, only render a line at the top. Test Plan: {F409078} Also looked at a couple other applications that use this and they looked correct. Reviewers: btrahan, lpriestley, chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T8182 Differential Revision: https://secure.phabricator.com/D12905 --- resources/celerity/map.php | 18 +++++++++--------- .../behavior-transaction-comment-form.js | 3 +-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 5b985f4de7..10b67a500e 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -401,7 +401,7 @@ return array( 'rsrc/js/application/search/behavior-reorder-queries.js' => 'e9581f08', 'rsrc/js/application/slowvote/behavior-slowvote-embed.js' => '887ad43f', 'rsrc/js/application/transactions/behavior-show-older-transactions.js' => 'dbbf48b6', - 'rsrc/js/application/transactions/behavior-transaction-comment-form.js' => '9f7309fb', + 'rsrc/js/application/transactions/behavior-transaction-comment-form.js' => 'b23b49e6', 'rsrc/js/application/transactions/behavior-transaction-list.js' => '13c739ea', 'rsrc/js/application/typeahead/behavior-typeahead-browse.js' => '635de1ec', 'rsrc/js/application/typeahead/behavior-typeahead-search.js' => '93d0c9e3', @@ -610,7 +610,7 @@ return array( 'javelin-behavior-phabricator-search-typeahead' => '048330fa', 'javelin-behavior-phabricator-show-older-transactions' => 'dbbf48b6', 'javelin-behavior-phabricator-tooltips' => '3ee3408b', - 'javelin-behavior-phabricator-transaction-comment-form' => '9f7309fb', + 'javelin-behavior-phabricator-transaction-comment-form' => 'b23b49e6', 'javelin-behavior-phabricator-transaction-list' => '13c739ea', 'javelin-behavior-phabricator-watch-anchor' => '9f36c42d', 'javelin-behavior-phame-post-preview' => 'be807912', @@ -1581,13 +1581,6 @@ return array( 'javelin-dom', 'javelin-vector', ), - '9f7309fb' => array( - 'javelin-behavior', - 'javelin-dom', - 'javelin-util', - 'javelin-request', - 'phabricator-shaped-request', - ), 'a0b57eb8' => array( 'javelin-behavior', 'javelin-dom', @@ -1677,6 +1670,13 @@ return array( 'javelin-dom', 'javelin-reactor-dom', ), + 'b23b49e6' => array( + 'javelin-behavior', + 'javelin-dom', + 'javelin-util', + 'javelin-request', + 'phabricator-shaped-request', + ), 'b2b4fbaf' => array( 'javelin-behavior', 'javelin-dom', diff --git a/webroot/rsrc/js/application/transactions/behavior-transaction-comment-form.js b/webroot/rsrc/js/application/transactions/behavior-transaction-comment-form.js index 119ec02d21..935116c3b3 100644 --- a/webroot/rsrc/js/application/transactions/behavior-transaction-comment-form.js +++ b/webroot/rsrc/js/application/transactions/behavior-transaction-comment-form.js @@ -26,8 +26,7 @@ JX.behavior('phabricator-transaction-comment-form', function(config) { JX.$(config.timelineID), [ JX.$H(response.spacer), - JX.$H(response.xactions.join(response.spacer)), - JX.$H(response.spacer) + JX.$H(response.xactions.join(response.spacer)) ]); JX.DOM.show(panel); } From 4250719d100814b996b9e0000f608005b1a4508b Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 18 May 2015 12:29:32 -0700 Subject: [PATCH 38/86] Destroy notifications properly from `bin/remove destroy` Summary: Fixes T8237. This table is unusual and doesn't have an `id` column, so `delete()` doesn't actually know how to delete records and fails. Test Plan: - Used `bin/remove destroy` to destroy an object with notifications, as per T8237. - Applied patch. - Used `bin/remove destroy` to get a clean delete. - Verified related notifications vanished from notification menu. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8237 Differential Revision: https://secure.phabricator.com/D12907 --- .../system/engine/PhabricatorDestructionEngine.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/applications/system/engine/PhabricatorDestructionEngine.php b/src/applications/system/engine/PhabricatorDestructionEngine.php index c5b813169c..eddc2f73fb 100644 --- a/src/applications/system/engine/PhabricatorDestructionEngine.php +++ b/src/applications/system/engine/PhabricatorDestructionEngine.php @@ -116,13 +116,14 @@ final class PhabricatorDestructionEngine extends Phobject { } private function destroyNotifications($object_phid) { - $notifications = id(new PhabricatorFeedStoryNotification())->loadAllWhere( - 'primaryObjectPHID = %s', - $object_phid); + $table = id(new PhabricatorFeedStoryNotification()); + $conn_w = $table->establishConnection('w'); - foreach ($notifications as $notification) { - $notification->delete(); - } + queryfx( + $conn_w, + 'DELETE FROM %T WHERE primaryObjectPHID = %s', + $table->getTableName(), + $object_phid); } } From 22ed02a549f78fb604e950af4bc87dde12174c1a Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 18 May 2015 12:51:06 -0700 Subject: [PATCH 39/86] Make workboard CSS aware of the durable column Summary: Fixes T8246. Workboards needed a tweak after the native-scrollbar compromise. Test Plan: Viewed workboards with column open/closed, saw workspace size correctly. Reviewers: chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T8246 Differential Revision: https://secure.phabricator.com/D12906 --- resources/celerity/map.php | 4 ++-- webroot/rsrc/css/phui/phui-workboard-view.css | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 10b67a500e..608cf808c6 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -151,7 +151,7 @@ return array( 'rsrc/css/phui/phui-tag-view.css' => '402691cc', 'rsrc/css/phui/phui-text.css' => 'cf019f54', 'rsrc/css/phui/phui-timeline-view.css' => 'a85542c8', - 'rsrc/css/phui/phui-workboard-view.css' => '3279cbbf', + 'rsrc/css/phui/phui-workboard-view.css' => '5c4c53e9', 'rsrc/css/phui/phui-workpanel-view.css' => 'e495a5cc', 'rsrc/css/sprite-gradient.css' => '4bdb98a7', 'rsrc/css/sprite-login.css' => 'a3526809', @@ -788,7 +788,7 @@ return array( 'phui-tag-view-css' => '402691cc', 'phui-text-css' => 'cf019f54', 'phui-timeline-view-css' => 'a85542c8', - 'phui-workboard-view-css' => '3279cbbf', + 'phui-workboard-view-css' => '5c4c53e9', 'phui-workpanel-view-css' => 'e495a5cc', 'phuix-action-list-view' => 'b5c256b8', 'phuix-action-view' => '8cf6d262', diff --git a/webroot/rsrc/css/phui/phui-workboard-view.css b/webroot/rsrc/css/phui/phui-workboard-view.css index 796fbc6fe5..40f3d0d2b9 100644 --- a/webroot/rsrc/css/phui/phui-workboard-view.css +++ b/webroot/rsrc/css/phui/phui-workboard-view.css @@ -19,6 +19,14 @@ top: 148px; } +.device-desktop.with-durable-column .phui-workboard-view-shadow { + right: 300px; +} + +.device-desktop.with-durable-margin .phui-workboard-view-shadow { + right: 312px; +} + .phui-workboard-view-shadow::-webkit-scrollbar { height: 12px; width: 12px; From 3167b5526470d2620e1ac82d252b53829b512dbf Mon Sep 17 00:00:00 2001 From: lkassianik Date: Mon, 18 May 2015 12:54:46 -0700 Subject: [PATCH 40/86] A temporary css cleanup to hold us over till a proper css overhaul. Summary: Ref T8187, A temporary css cleanup to hold us over till a proper css overhaul. Test Plan: Mostly, confirm that long event names don't break the calendar month view. Reviewers: chad, #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8187 Differential Revision: https://secure.phabricator.com/D12908 --- resources/celerity/map.php | 8 ++-- .../phui/calendar/PHUICalendarListView.php | 2 +- .../css/phui/calendar/phui-calendar-list.css | 1 - .../css/phui/calendar/phui-calendar-month.css | 46 ++++++++++++------- 4 files changed, 35 insertions(+), 22 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 608cf808c6..54000b66cf 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -121,8 +121,8 @@ return array( 'rsrc/css/layout/phabricator-side-menu-view.css' => 'c1db9e9c', 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/phui/calendar/phui-calendar-day.css' => '3b4a65d8', - 'rsrc/css/phui/calendar/phui-calendar-list.css' => '840baa8d', - 'rsrc/css/phui/calendar/phui-calendar-month.css' => '5b213ea0', + 'rsrc/css/phui/calendar/phui-calendar-list.css' => '3e713fc7', + 'rsrc/css/phui/calendar/phui-calendar-month.css' => '7cf00f61', 'rsrc/css/phui/calendar/phui-calendar.css' => '8345be98', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', @@ -762,8 +762,8 @@ return array( 'phui-button-css' => 'de610129', 'phui-calendar-css' => '8345be98', 'phui-calendar-day-css' => '3b4a65d8', - 'phui-calendar-list-css' => '840baa8d', - 'phui-calendar-month-css' => '5b213ea0', + 'phui-calendar-list-css' => '3e713fc7', + 'phui-calendar-month-css' => '7cf00f61', 'phui-crumbs-view-css' => '594d719e', 'phui-document-view-css' => '94d5dcd8', 'phui-feed-story-css' => 'c9f3a0b5', diff --git a/src/view/phui/calendar/PHUICalendarListView.php b/src/view/phui/calendar/PHUICalendarListView.php index e315aa93d1..3356d5d0fb 100644 --- a/src/view/phui/calendar/PHUICalendarListView.php +++ b/src/view/phui/calendar/PHUICalendarListView.php @@ -79,8 +79,8 @@ final class PHUICalendarListView extends AphrontTagView { ), array( $dot, - $title, $time, + $title, )); } diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-list.css b/webroot/rsrc/css/phui/calendar/phui-calendar-list.css index db69c78d03..80d34d2f5a 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-list.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-list.css @@ -55,7 +55,6 @@ top: 0; width: 60px; right: 0; - top: 0; color: {$lightgreytext}; text-align: right; } diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css index 6b5c0aeb86..bb02c4c54d 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css @@ -154,6 +154,7 @@ table.phui-calendar-view td.phui-calendar-date-number-container { } .phui-calendar-view .phui-calendar-list li.phui-calendar-list-item.all-day { + height: 20px; margin: 0; padding: 4px 4px 0px 4px; background-color: {$darkgreybackground}; @@ -180,24 +181,36 @@ li.phui-calendar-list-item.all-day:first-child { } .phui-calendar-view .phui-calendar-list-dot { + position: relative; + display: inline-block; + float: left; width: 3px; height: 3px; margin-right: 4px; border-radius: 10px; - position: absolute; top: 5px; left: 0; + display: none; } -.phui-calendar-view .phui-calendar-list-title { - width: auto; - white-space: normal; - word-break: break-word; +.phui-calendar-view li.phui-calendar-list-item { + padding: 0; +} + +.phui-calendar-view li.phui-calendar-list-item .phui-calendar-list-title { + position: relative; + /*float: right;*/ + display: inline-block; + width: 120px; + padding: 0; + line-height: 18px; + vertical-align: center; } li.phui-calendar-list-item .phui-calendar-list-title a { - text-align: left; - padding-left: 8px; + padding: 0; + vertical-align: top; + line-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; @@ -205,6 +218,8 @@ li.phui-calendar-list-item .phui-calendar-list-title a { li.phui-calendar-list-item.all-day .phui-calendar-list-title a{ color: {$greytext}; + margin: 0; + padding: 0; } li.phui-calendar-viewer-invited.all-day .phui-calendar-list-title a{ @@ -212,17 +227,16 @@ li.phui-calendar-viewer-invited.all-day .phui-calendar-list-title a{ } .phui-calendar-view li.phui-calendar-list-item .phui-calendar-list-time { - position: absolute; + position: relative; + display: inline-block; + float: left; + padding: 0; + line-height: 18px; width: 60px; - right: 0; - top: 1px; color: {$lightgreytext}; - text-align: right; + text-align: left; } -.phui-calendar-view -li.phui-calendar-list-item.all-day -.phui-calendar-list-time { - top: 4px; - right: 8px; +li.phui-calendar-list-item.all-day .phui-calendar-list-time{ + margin: 0 0 0 4px; } From 78dddf39ba7200cb71303b167278161747fb6d1a Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Mon, 18 May 2015 13:07:05 -0700 Subject: [PATCH 41/86] Maniphest - prevent uneditable tasks from being able to be closed as duplicates Summary: Fixes T7923. Prevent the user from finding tasks that they can't edit in merge workflows. Also ensure that we query properly on final merge action just in case. Test Plan: Tried to find a task I couldn't edit in various searches under the "merge" dialogue and couldn't find the task. Removed this big of code and tried to merge in a task and after hitting "merge" observed the page reloaded with no task merged in. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7923 Differential Revision: https://secure.phabricator.com/D12872 --- .../phid/query/PhabricatorHandleQuery.php | 14 +++++ .../PhabricatorSearchApplication.php | 2 +- .../PhabricatorSearchAttachController.php | 59 ++++++++----------- .../PhabricatorSearchBaseController.php | 6 ++ .../PhabricatorSearchSelectController.php | 35 ++++++----- .../query/PhabricatorSearchDocumentQuery.php | 14 +++++ 6 files changed, 80 insertions(+), 50 deletions(-) diff --git a/src/applications/phid/query/PhabricatorHandleQuery.php b/src/applications/phid/query/PhabricatorHandleQuery.php index 296116312b..2635b84298 100644 --- a/src/applications/phid/query/PhabricatorHandleQuery.php +++ b/src/applications/phid/query/PhabricatorHandleQuery.php @@ -3,6 +3,7 @@ final class PhabricatorHandleQuery extends PhabricatorCursorPagedPolicyAwareQuery { + private $objectCapabilities; private $phids = array(); public function withPHIDs(array $phids) { @@ -10,6 +11,18 @@ final class PhabricatorHandleQuery return $this; } + public function requireObjectCapabilities(array $capabilities) { + $this->objectCapabilities = $capabilities; + return $this; + } + + protected function getRequiredObjectCapabilities() { + if ($this->objectCapabilities) { + return $this->objectCapabilities; + } + return $this->getRequiredCapabilities(); + } + protected function loadPage() { $types = PhabricatorPHIDType::getAllTypes(); @@ -20,6 +33,7 @@ final class PhabricatorHandleQuery $object_query = id(new PhabricatorObjectQuery()) ->withPHIDs($phids) + ->requireCapabilities($this->getRequiredObjectCapabilities()) ->setViewer($this->getViewer()); $objects = $object_query->execute(); diff --git a/src/applications/search/application/PhabricatorSearchApplication.php b/src/applications/search/application/PhabricatorSearchApplication.php index 51d5e9780c..f350438616 100644 --- a/src/applications/search/application/PhabricatorSearchApplication.php +++ b/src/applications/search/application/PhabricatorSearchApplication.php @@ -32,7 +32,7 @@ final class PhabricatorSearchApplication extends PhabricatorApplication { '(?:query/(?P[^/]+)/)?' => 'PhabricatorSearchController', 'attach/(?P[^/]+)/(?P\w+)/(?:(?P\w+)/)?' => 'PhabricatorSearchAttachController', - 'select/(?P\w+)/' + 'select/(?P\w+)/(?:(?P\w+)/)?' => 'PhabricatorSearchSelectController', 'index/(?P[^/]+)/' => 'PhabricatorSearchIndexController', 'hovercard/(?Pretrieve|test)/' diff --git a/src/applications/search/controller/PhabricatorSearchAttachController.php b/src/applications/search/controller/PhabricatorSearchAttachController.php index e08fd7734c..b2e0a92b9d 100644 --- a/src/applications/search/controller/PhabricatorSearchAttachController.php +++ b/src/applications/search/controller/PhabricatorSearchAttachController.php @@ -3,38 +3,22 @@ final class PhabricatorSearchAttachController extends PhabricatorSearchBaseController { - private $phid; - private $type; - private $action; - - const ACTION_ATTACH = 'attach'; - const ACTION_MERGE = 'merge'; - const ACTION_DEPENDENCIES = 'dependencies'; - const ACTION_BLOCKS = 'blocks'; - const ACTION_EDGE = 'edge'; - - public function willProcessRequest(array $data) { - $this->phid = $data['phid']; - $this->type = $data['type']; - $this->action = idx($data, 'action', self::ACTION_ATTACH); - } - - public function processRequest() { - - $request = $this->getRequest(); - $user = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $user = $request->getUser(); + $phid = $request->getURIData('phid'); + $attach_type = $request->getURIData('type'); + $action = $request->getURIData('action', self::ACTION_ATTACH); $handle = id(new PhabricatorHandleQuery()) ->setViewer($user) - ->withPHIDs(array($this->phid)) + ->withPHIDs(array($phid)) ->executeOne(); $object_type = $handle->getType(); - $attach_type = $this->type; $object = id(new PhabricatorObjectQuery()) ->setViewer($user) - ->withPHIDs(array($this->phid)) + ->withPHIDs(array($phid)) ->executeOne(); if (!$object) { @@ -42,7 +26,7 @@ final class PhabricatorSearchAttachController } $edge_type = null; - switch ($this->action) { + switch ($action) { case self::ACTION_EDGE: case self::ACTION_DEPENDENCIES: case self::ACTION_BLOCKS: @@ -66,7 +50,7 @@ final class PhabricatorSearchAttachController } $old_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( - $this->phid, + $phid, $edge_type); $add_phids = $phids; $rem_phids = array_diff($old_phids, $add_phids); @@ -100,7 +84,7 @@ final class PhabricatorSearchAttachController } else { if ($edge_type) { $phids = PhabricatorEdgeQuery::loadDestinationPHIDs( - $this->phid, + $phid, $edge_type); } else { // This is a merge. @@ -108,7 +92,7 @@ final class PhabricatorSearchAttachController } } - $strings = $this->getStrings(); + $strings = $this->getStrings($attach_type, $action); $handles = $this->loadViewerHandles($phids); @@ -116,11 +100,11 @@ final class PhabricatorSearchAttachController $obj_dialog ->setUser($user) ->setHandles($handles) - ->setFilters($this->getFilters($strings)) + ->setFilters($this->getFilters($strings, $attach_type)) ->setSelectedFilter($strings['selected']) - ->setExcluded($this->phid) + ->setExcluded($phid) ->setCancelURI($handle->getURI()) - ->setSearchURI('/search/select/'.$attach_type.'/') + ->setSearchURI('/search/select/'.$attach_type.'/'.$action.'/') ->setTitle($strings['title']) ->setHeader($strings['header']) ->setButtonText($strings['button']) @@ -148,6 +132,11 @@ final class PhabricatorSearchAttachController $targets = id(new ManiphestTaskQuery()) ->setViewer($user) + ->requireCapabilities( + array( + PhabricatorPolicyCapability::CAN_VIEW, + PhabricatorPolicyCapability::CAN_EDIT, + )) ->withPHIDs(array_keys($phids)) ->needSubscriberPHIDs(true) ->needProjectPHIDs(true) @@ -208,8 +197,8 @@ final class PhabricatorSearchAttachController return $response; } - private function getStrings() { - switch ($this->type) { + private function getStrings($attach_type, $action) { + switch ($attach_type) { case DifferentialRevisionPHIDType::TYPECONST: $noun = 'Revisions'; $selected = 'created'; @@ -228,7 +217,7 @@ final class PhabricatorSearchAttachController break; } - switch ($this->action) { + switch ($action) { case self::ACTION_EDGE: case self::ACTION_ATTACH: $dialog_title = "Manage Attached {$noun}"; @@ -268,8 +257,8 @@ final class PhabricatorSearchAttachController ); } - private function getFilters(array $strings) { - if ($this->type == PholioMockPHIDType::TYPECONST) { + private function getFilters(array $strings, $attach_type) { + if ($attach_type == PholioMockPHIDType::TYPECONST) { $filters = array( 'created' => 'Created By Me', 'all' => 'All '.$strings['target_plural_noun'], diff --git a/src/applications/search/controller/PhabricatorSearchBaseController.php b/src/applications/search/controller/PhabricatorSearchBaseController.php index 446406dfea..86573b38bd 100644 --- a/src/applications/search/controller/PhabricatorSearchBaseController.php +++ b/src/applications/search/controller/PhabricatorSearchBaseController.php @@ -2,6 +2,12 @@ abstract class PhabricatorSearchBaseController extends PhabricatorController { + const ACTION_ATTACH = 'attach'; + const ACTION_MERGE = 'merge'; + const ACTION_DEPENDENCIES = 'dependencies'; + const ACTION_BLOCKS = 'blocks'; + const ACTION_EDGE = 'edge'; + public function buildStandardPageResponse($view, array $data) { $page = $this->buildStandardPageView(); diff --git a/src/applications/search/controller/PhabricatorSearchSelectController.php b/src/applications/search/controller/PhabricatorSearchSelectController.php index 03d3ca4c69..f663cd03d7 100644 --- a/src/applications/search/controller/PhabricatorSearchSelectController.php +++ b/src/applications/search/controller/PhabricatorSearchSelectController.php @@ -3,22 +3,17 @@ final class PhabricatorSearchSelectController extends PhabricatorSearchBaseController { - private $type; - - public function willProcessRequest(array $data) { - $this->type = $data['type']; - } - - public function processRequest() { - $request = $this->getRequest(); + public function handleRequest(AphrontRequest $request) { $user = $request->getUser(); + $type = $request->getURIData('type'); + $action = $request->getURIData('action'); $query = new PhabricatorSavedQuery(); $query_str = $request->getStr('query'); $query->setEngineClassName('PhabricatorSearchApplicationSearchEngine'); $query->setParameter('query', $query_str); - $query->setParameter('types', array($this->type)); + $query->setParameter('types', array($type)); $status_open = PhabricatorSearchRelationship::RELATIONSHIP_OPEN; @@ -31,7 +26,7 @@ final class PhabricatorSearchSelectController $query->setParameter('authorPHIDs', array($user->getPHID())); // TODO - if / when we allow pholio mocks to be archived, etc // update this - if ($this->type != PholioMockPHIDType::TYPECONST) { + if ($type != PholioMockPHIDType::TYPECONST) { $query->setParameter('statuses', array($status_open)); } break; @@ -42,15 +37,25 @@ final class PhabricatorSearchSelectController $query->setParameter('excludePHIDs', array($request->getStr('exclude'))); + $capabilities = array(PhabricatorPolicyCapability::CAN_VIEW); + switch ($action) { + case self::ACTION_MERGE: + $capabilities[] = PhabricatorPolicyCapability::CAN_EDIT; + break; + default: + break; + } + $results = id(new PhabricatorSearchDocumentQuery()) ->setViewer($user) + ->requireObjectCapabilities($capabilities) ->withSavedQuery($query) ->setOffset(0) ->setLimit(100) ->execute(); $phids = array_fill_keys(mpull($results, 'getPHID'), true); - $phids += $this->queryObjectNames($query_str); + $phids += $this->queryObjectNames($query_str, $capabilities); $phids = array_keys($phids); $handles = $this->loadViewerHandles($phids); @@ -64,12 +69,14 @@ final class PhabricatorSearchSelectController return id(new AphrontAjaxResponse())->setContent($data); } - private function queryObjectNames($query) { - $viewer = $this->getRequest()->getUser(); + private function queryObjectNames($query, $capabilities) { + $request = $this->getRequest(); + $viewer = $request->getUser(); $objects = id(new PhabricatorObjectQuery()) ->setViewer($viewer) - ->withTypes(array($this->type)) + ->requireCapabilities($capabilities) + ->withTypes(array($request->getURIData('type'))) ->withNames(array($query)) ->execute(); diff --git a/src/applications/search/query/PhabricatorSearchDocumentQuery.php b/src/applications/search/query/PhabricatorSearchDocumentQuery.php index b5591d8eca..903d40dd5a 100644 --- a/src/applications/search/query/PhabricatorSearchDocumentQuery.php +++ b/src/applications/search/query/PhabricatorSearchDocumentQuery.php @@ -4,17 +4,31 @@ final class PhabricatorSearchDocumentQuery extends PhabricatorCursorPagedPolicyAwareQuery { private $savedQuery; + private $objectCapabilities; public function withSavedQuery(PhabricatorSavedQuery $query) { $this->savedQuery = $query; return $this; } + public function requireObjectCapabilities(array $capabilities) { + $this->objectCapabilities = $capabilities; + return $this; + } + + protected function getRequiredObjectCapabilities() { + if ($this->objectCapabilities) { + return $this->objectCapabilities; + } + return $this->getRequiredCapabilities(); + } + protected function loadPage() { $phids = $this->loadDocumentPHIDsWithoutPolicyChecks(); $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getViewer()) + ->requireObjectCapabilities($this->getRequiredObjectCapabilities()) ->withPHIDs($phids) ->execute(); From b0862a81760d60d8de61545d65a4ce9efab2b90e Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 18 May 2015 13:57:20 -0700 Subject: [PATCH 42/86] Filter pastes at the query level if we're unable to load their content Summary: Fixes T8230. I think I broke this in D12354 since I missed the fact that this could filter results, because it's constructed in a sort of weird way. Try to make the logic a little more clear, while retaining the relevant properties: - Pastes with unloadable content should be discarded; - the input order should be retained in the result set. Test Plan: Faked content misses and saw things work instead of fatal. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8230 Differential Revision: https://secure.phabricator.com/D12909 --- .../paste/query/PhabricatorPasteQuery.php | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/applications/paste/query/PhabricatorPasteQuery.php b/src/applications/paste/query/PhabricatorPasteQuery.php index ae74978510..d5a5daf9e3 100644 --- a/src/applications/paste/query/PhabricatorPasteQuery.php +++ b/src/applications/paste/query/PhabricatorPasteQuery.php @@ -90,7 +90,7 @@ final class PhabricatorPasteQuery } if ($this->needContent) { - $this->loadContent($pastes); + $pastes = $this->loadContent($pastes); } return $pastes; @@ -205,29 +205,46 @@ final class PhabricatorPasteQuery $caches = $cache->getKeys($keys); $need_raw = array(); - foreach ($pastes as $key => $paste) { + $have_cache = array(); + foreach ($pastes as $paste) { $key = $this->getContentCacheKey($paste); if (isset($caches[$key])) { $paste->attachContent(phutil_safe_html($caches[$key])); + $have_cache[$paste->getPHID()] = true; } else { $need_raw[$key] = $paste; } } if (!$need_raw) { - return; + return $pastes; } $write_data = array(); - $need_raw = $this->loadRawContent($need_raw); - foreach ($need_raw as $key => $paste) { + $have_raw = $this->loadRawContent($need_raw); + $have_raw = mpull($have_raw, null, 'getPHID'); + foreach ($pastes as $key => $paste) { + $paste_phid = $paste->getPHID(); + if (isset($have_cache[$paste_phid])) { + continue; + } + + if (empty($have_raw[$paste_phid])) { + unset($pastes[$key]); + continue; + } + $content = $this->buildContent($paste); $paste->attachContent($content); $write_data[$this->getContentCacheKey($paste)] = (string)$content; } - $cache->setKeys($write_data); + if ($write_data) { + $cache->setKeys($write_data); + } + + return $pastes; } private function buildContent(PhabricatorPaste $paste) { From f3d382cec4d3cf1e9e5ca3ae681fbff17db8aaeb Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Tue, 19 May 2015 06:57:21 +1000 Subject: [PATCH 43/86] Fix some method signatures Summary: Fix some method signatures so that arguments with default values are at the end of the argument list (see D12418). Test Plan: Eyeballed the callsites. Reviewers: epriestley, #blessed_reviewers, hach-que Reviewed By: epriestley, #blessed_reviewers, hach-que Subscribers: hach-que, Korvin, epriestley Differential Revision: https://secure.phabricator.com/D12782 --- .../celerity/CelerityStaticResourceResponse.php | 10 ++++++---- .../blueprint/DrydockBlueprintImplementation.php | 2 +- src/applications/people/storage/PhabricatorUserLog.php | 4 ++-- .../phragment/storage/PhragmentFragment.php | 6 +++--- src/view/layout/AphrontSideNavFilterView.php | 7 +------ 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/applications/celerity/CelerityStaticResourceResponse.php b/src/applications/celerity/CelerityStaticResourceResponse.php index 3f34b7634f..7864515e11 100644 --- a/src/applications/celerity/CelerityStaticResourceResponse.php +++ b/src/applications/celerity/CelerityStaticResourceResponse.php @@ -33,14 +33,16 @@ final class CelerityStaticResourceResponse { } /** - * Register a behavior for initialization. NOTE: if $config is empty, - * a behavior will execute only once even if it is initialized multiple times. - * If $config is nonempty, the behavior will be invoked once for each config. + * Register a behavior for initialization. + * + * NOTE: If `$config` is empty, a behavior will execute only once even if it + * is initialized multiple times. If `$config` is nonempty, the behavior will + * be invoked once for each configuration. */ public function initBehavior( $behavior, array $config = array(), - $source_name) { + $source_name = null) { $this->requireResource('javelin-behavior-'.$behavior, $source_name); diff --git a/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php index 43891d0d07..223d974541 100644 --- a/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php +++ b/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php @@ -353,7 +353,7 @@ abstract class DrydockBlueprintImplementation { public static function writeLog( DrydockResource $resource = null, DrydockLease $lease = null, - $message) { + $message = null) { $log = id(new DrydockLog()) ->setEpoch(time()) diff --git a/src/applications/people/storage/PhabricatorUserLog.php b/src/applications/people/storage/PhabricatorUserLog.php index acdd7b1efe..1f14a27e4c 100644 --- a/src/applications/people/storage/PhabricatorUserLog.php +++ b/src/applications/people/storage/PhabricatorUserLog.php @@ -87,8 +87,8 @@ final class PhabricatorUserLog extends PhabricatorUserDAO public static function initializeNewLog( PhabricatorUser $actor = null, - $object_phid, - $action) { + $object_phid = null, + $action = null) { $log = new PhabricatorUserLog(); diff --git a/src/applications/phragment/storage/PhragmentFragment.php b/src/applications/phragment/storage/PhragmentFragment.php index 574283d7a7..d58be033c0 100644 --- a/src/applications/phragment/storage/PhragmentFragment.php +++ b/src/applications/phragment/storage/PhragmentFragment.php @@ -78,9 +78,9 @@ final class PhragmentFragment extends PhragmentDAO public static function createFromFile( PhabricatorUser $viewer, PhabricatorFile $file = null, - $path, - $view_policy, - $edit_policy) { + $path = null, + $view_policy = null, + $edit_policy = null) { $fragment = id(new PhragmentFragment()); $fragment->setPath($path); diff --git a/src/view/layout/AphrontSideNavFilterView.php b/src/view/layout/AphrontSideNavFilterView.php index 4f4c0803b8..fe8025026b 100644 --- a/src/view/layout/AphrontSideNavFilterView.php +++ b/src/view/layout/AphrontSideNavFilterView.php @@ -125,12 +125,7 @@ final class AphrontSideNavFilterView extends AphrontView { $key, $name, $uri, PHUIListItemView::TYPE_BUTTON); } - private function addThing( - $key, - $name, - $uri = null, - $type) { - + private function addThing($key, $name, $uri, $type) { $item = id(new PHUIListItemView()) ->setName($name) ->setType($type); From c006ef628948abbf2fedd9e2d78e737a479050f6 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Mon, 18 May 2015 13:59:23 -0700 Subject: [PATCH 44/86] Tweaking css to better accomodate month view week numbers on mobile. Summary: Fixes T8249, Tweaking css to better accomodate month view week numbers on mobile. Test Plan: Open month view on mobile and observe that week and day numbers are aligned. Reviewers: chad, epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T8249 Differential Revision: https://secure.phabricator.com/D12910 --- resources/celerity/map.php | 4 ++-- webroot/rsrc/css/phui/calendar/phui-calendar-month.css | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 54000b66cf..3f58140cad 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -122,7 +122,7 @@ return array( 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/phui/calendar/phui-calendar-day.css' => '3b4a65d8', 'rsrc/css/phui/calendar/phui-calendar-list.css' => '3e713fc7', - 'rsrc/css/phui/calendar/phui-calendar-month.css' => '7cf00f61', + 'rsrc/css/phui/calendar/phui-calendar-month.css' => '017a953b', 'rsrc/css/phui/calendar/phui-calendar.css' => '8345be98', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', @@ -763,7 +763,7 @@ return array( 'phui-calendar-css' => '8345be98', 'phui-calendar-day-css' => '3b4a65d8', 'phui-calendar-list-css' => '3e713fc7', - 'phui-calendar-month-css' => '7cf00f61', + 'phui-calendar-month-css' => '017a953b', 'phui-crumbs-view-css' => '594d719e', 'phui-document-view-css' => '94d5dcd8', 'phui-feed-story-css' => 'c9f3a0b5', diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css index bb02c4c54d..43c9af18cf 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css @@ -98,7 +98,7 @@ table.phui-calendar-view a.phui-calendar-week-number { color: {$lightgreyborder}; padding: 4px; display: inline-block; - min-width: 16px; + width: 16px; text-align: center; float: left; } @@ -107,10 +107,15 @@ table.phui-calendar-view a.phui-calendar-date-number { color: {$lightgreytext}; padding: 4px; display: inline-block; - min-width: 16px; + width: 16px; text-align: center; } +.device table.phui-calendar-view a.phui-calendar-week-number, +.device table.phui-calendar-view a.phui-calendar-date-number { + width: 12px; +} + table.phui-calendar-view td.phui-calendar-date-number-container { font-weight: normal; color: {$lightgreytext}; From da4617aabd3fde757335a5149eabcba8239724ae Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Mon, 18 May 2015 14:10:47 -0700 Subject: [PATCH 45/86] Conpherence - fix widget updates from main view Summary: Fixes T8217. Broken circa D12760. Some browsers rendered nothing while others rendered a ",". Test Plan: added folks to conpherences and saw people widget update correctly. added files to conpherence and saw file widget update correctly. Tested on Chrome and Firefox. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8217 Differential Revision: https://secure.phabricator.com/D12912 --- .../conpherence/controller/ConpherenceUpdateController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php index eea1d1dc8a..d37fefdf14 100644 --- a/src/applications/conpherence/controller/ConpherenceUpdateController.php +++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php @@ -528,14 +528,14 @@ final class ConpherenceUpdateController ->setUser($this->getRequest()->getUser()) ->setConpherence($conpherence) ->setUpdateURI($widget_uri); - $file_widget = $file_widget->render(); + $file_widget = hsprintf('%s', $file_widget->render()); break; case ConpherenceUpdateActions::ADD_PERSON: $people_widget = id(new ConpherencePeopleWidgetView()) ->setUser($user) ->setConpherence($conpherence) ->setUpdateURI($widget_uri); - $people_widget = $people_widget->render(); + $people_widget = hsprintf('%s', $people_widget->render()); break; case ConpherenceUpdateActions::REMOVE_PERSON: case ConpherenceUpdateActions::NOTIFICATIONS: From 189c55d1d332eeb805b4536f206bffe76111d6d6 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Mon, 18 May 2015 15:39:34 -0700 Subject: [PATCH 46/86] People - fix hovercards for people Summary: Fixes T8242. D12833 removed the title as well as the blurb from people hovercards. When re-adding the title don't bother throwing things through pht since that seems like not something you translate exactly and also lose the flavor text which most users end up having since title is rarely set (at least on this install). Test Plan: viewed hovercards and saw title and blurb again as appropos relative to the data being set Reviewers: chad, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8242 Differential Revision: https://secure.phabricator.com/D12915 --- .../PhabricatorPeopleHovercardEventListener.php | 15 ++++++++++++++- .../people/storage/PhabricatorUser.php | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/applications/people/event/PhabricatorPeopleHovercardEventListener.php b/src/applications/people/event/PhabricatorPeopleHovercardEventListener.php index f2b957f363..6ecf0a9bd9 100644 --- a/src/applications/people/event/PhabricatorPeopleHovercardEventListener.php +++ b/src/applications/people/event/PhabricatorPeopleHovercardEventListener.php @@ -31,10 +31,16 @@ final class PhabricatorPeopleHovercardEventListener ->setViewer($viewer) ->withIDs(array($user->getID())) ->needAvailability(true) + ->needProfile(true) ->executeOne(); $hovercard->setTitle($user->getUsername()); - $hovercard->setDetail($user->getRealName()); + $profile = $user->getUserProfile(); + $detail = $user->getRealName(); + if ($profile->getTitle()) { + $detail .= ' - '.$profile->getTitle().'.'; + } + $hovercard->setDetail($detail); if ($user->getIsDisabled()) { $hovercard->addField(pht('Account'), pht('Disabled')); @@ -52,6 +58,13 @@ final class PhabricatorPeopleHovercardEventListener pht('User Since'), phabricator_date($user->getDateCreated(), $viewer)); + if ($profile->getBlurb()) { + $hovercard->addField(pht('Blurb'), + id(new PhutilUTF8StringTruncator()) + ->setMaximumGlyphs(120) + ->truncateString($profile->getBlurb())); + } + $event->setValue('hovercard', $hovercard); } diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php index 0c7ef73b0e..e66a34d9a1 100644 --- a/src/applications/people/storage/PhabricatorUser.php +++ b/src/applications/people/storage/PhabricatorUser.php @@ -396,6 +396,10 @@ final class PhabricatorUser return substr(PhabricatorHash::digest($vec), 0, $len); } + public function getUserProfile() { + return $this->assertAttached($this->profile); + } + public function attachUserProfile(PhabricatorUserProfile $profile) { $this->profile = $profile; return $this; From ec759ef46f17d6f782808e3d32061e4c5368c45d Mon Sep 17 00:00:00 2001 From: lkassianik Date: Mon, 18 May 2015 16:04:35 -0700 Subject: [PATCH 47/86] Mobile day view should display event list, not day table Summary: Closes T8178, Mobile day view should display event list, not day table Test Plan: Open day view on a device, observe that day table is hidden. Reviewers: chad, #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8178 Differential Revision: https://secure.phabricator.com/D12916 --- resources/celerity/map.php | 4 ++-- src/view/phui/calendar/PHUICalendarDayView.php | 2 +- webroot/rsrc/css/phui/calendar/phui-calendar-day.css | 8 ++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 3f58140cad..a7670beff0 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -120,7 +120,7 @@ return array( 'rsrc/css/layout/phabricator-hovercard-view.css' => 'dd9121a9', 'rsrc/css/layout/phabricator-side-menu-view.css' => 'c1db9e9c', 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', - 'rsrc/css/phui/calendar/phui-calendar-day.css' => '3b4a65d8', + 'rsrc/css/phui/calendar/phui-calendar-day.css' => 'c0cf782a', 'rsrc/css/phui/calendar/phui-calendar-list.css' => '3e713fc7', 'rsrc/css/phui/calendar/phui-calendar-month.css' => '017a953b', 'rsrc/css/phui/calendar/phui-calendar.css' => '8345be98', @@ -761,7 +761,7 @@ return array( 'phui-box-css' => '7b3a2eed', 'phui-button-css' => 'de610129', 'phui-calendar-css' => '8345be98', - 'phui-calendar-day-css' => '3b4a65d8', + 'phui-calendar-day-css' => 'c0cf782a', 'phui-calendar-list-css' => '3e713fc7', 'phui-calendar-month-css' => '017a953b', 'phui-crumbs-view-css' => '594d719e', diff --git a/src/view/phui/calendar/PHUICalendarDayView.php b/src/view/phui/calendar/PHUICalendarDayView.php index 5afff57d3b..45a4f6d1bc 100644 --- a/src/view/phui/calendar/PHUICalendarDayView.php +++ b/src/view/phui/calendar/PHUICalendarDayView.php @@ -185,7 +185,7 @@ final class PHUICalendarDayView extends AphrontView { $layout = id(new AphrontMultiColumnView()) ->addColumn($sidebar, 'third') - ->addColumn($table_box, 'thirds') + ->addColumn($table_box, 'thirds phui-day-view-column') ->setFluidLayout(true) ->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM); diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-day.css b/webroot/rsrc/css/phui/calendar/phui-calendar-day.css index 4f2c8a9e3d..715bd6fd3b 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-day.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-day.css @@ -2,6 +2,14 @@ * @provides phui-calendar-day-css */ +.device .phui-day-view-column { + display: none; +} + +.device .phui-calendar-list-container { + width: 100%; +} + .phui-calendar-day-view { overflow: scroll; width: 100%; From 27930e8b25e1181c48cab9148974c5c9ece3555d Mon Sep 17 00:00:00 2001 From: lkassianik Date: Tue, 19 May 2015 09:57:14 -0700 Subject: [PATCH 48/86] Calendar list event items should be entirely clickable Summary: Ref T8248, Calendar list event items should be entirely clickable Test Plan: Open month view, verify that adjusting screen correctly adjust widths of event links, and that entire event row links are clickable. Reviewers: chad, epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T8248 Differential Revision: https://secure.phabricator.com/D12925 --- resources/celerity/map.php | 12 ++-- .../phui/calendar/PHUICalendarListView.php | 18 ++++-- .../css/phui/calendar/phui-calendar-list.css | 14 +++-- .../css/phui/calendar/phui-calendar-month.css | 59 ++++++------------- .../rsrc/css/phui/calendar/phui-calendar.css | 1 - 5 files changed, 46 insertions(+), 58 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index a7670beff0..00f7142bd8 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -121,9 +121,9 @@ return array( 'rsrc/css/layout/phabricator-side-menu-view.css' => 'c1db9e9c', 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/phui/calendar/phui-calendar-day.css' => 'c0cf782a', - 'rsrc/css/phui/calendar/phui-calendar-list.css' => '3e713fc7', - 'rsrc/css/phui/calendar/phui-calendar-month.css' => '017a953b', - 'rsrc/css/phui/calendar/phui-calendar.css' => '8345be98', + 'rsrc/css/phui/calendar/phui-calendar-list.css' => '857a0d83', + 'rsrc/css/phui/calendar/phui-calendar-month.css' => '32e3bee4', + 'rsrc/css/phui/calendar/phui-calendar.css' => 'ccabe893', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', 'rsrc/css/phui/phui-action-panel.css' => '3ee9afd5', @@ -760,10 +760,10 @@ return array( 'phui-action-panel-css' => '3ee9afd5', 'phui-box-css' => '7b3a2eed', 'phui-button-css' => 'de610129', - 'phui-calendar-css' => '8345be98', + 'phui-calendar-css' => 'ccabe893', 'phui-calendar-day-css' => 'c0cf782a', - 'phui-calendar-list-css' => '3e713fc7', - 'phui-calendar-month-css' => '017a953b', + 'phui-calendar-list-css' => '857a0d83', + 'phui-calendar-month-css' => '32e3bee4', 'phui-crumbs-view-css' => '594d719e', 'phui-document-view-css' => '94d5dcd8', 'phui-feed-story-css' => 'c9f3a0b5', diff --git a/src/view/phui/calendar/PHUICalendarListView.php b/src/view/phui/calendar/PHUICalendarListView.php index 3356d5d0fb..dd4bf34848 100644 --- a/src/view/phui/calendar/PHUICalendarListView.php +++ b/src/view/phui/calendar/PHUICalendarListView.php @@ -72,16 +72,23 @@ final class PHUICalendarListView extends AphrontTagView { $class = $class.' all-day'; } - $singletons[] = phutil_tag( - 'li', + $content = phutil_tag( + 'a', array( - 'class' => $class, - ), + 'href' => '/E'.$event->getEventID(), + ), array( $dot, $time, $title, )); + + $singletons[] = phutil_tag( + 'li', + array( + 'class' => $class, + ), + $content); } if (empty($singletons)) { @@ -147,11 +154,10 @@ final class PHUICalendarListView extends AphrontTagView { $class = 'phui-calendar-item'; $anchor = javelin_tag( - 'a', + 'span', array( 'sigil' => 'has-tooltip', 'class' => $class, - 'href' => '/E'.$event->getEventID(), 'meta' => array( 'tip' => $tip, 'size' => 200, diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-list.css b/webroot/rsrc/css/phui/calendar/phui-calendar-list.css index 80d34d2f5a..0155f730a4 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-list.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-list.css @@ -43,11 +43,15 @@ } .phui-calendar-list-title { - width: 200px; - display: inline-block; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; + width: 200px; + display: inline-block; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.phui-calendar-viewer-invited .phui-calendar-list-title { + font-weight: bold; } .phui-calendar-list-item .phui-calendar-list-time { diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css index 43c9af18cf..6c0e20a2f6 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css @@ -151,6 +151,7 @@ table.phui-calendar-view td.phui-calendar-date-number-container { .phui-calendar-view .phui-calendar-list { padding: 1px; + width: auto; } .phui-calendar-list-item.all-day span { @@ -160,8 +161,6 @@ table.phui-calendar-view td.phui-calendar-date-number-container { .phui-calendar-view .phui-calendar-list li.phui-calendar-list-item.all-day { height: 20px; - margin: 0; - padding: 4px 4px 0px 4px; background-color: {$darkgreybackground}; display: block; float: none; @@ -173,21 +172,24 @@ li.phui-calendar-viewer-invited.all-day { background-color: {$lightgreen}; } -li.phui-calendar-list-item.all-day:first-child { - margin-top: 0; -} - .phui-calendar-view .phui-calendar-list li { - margin: 0 8px; + padding: 0px 4px; } -.phui-calendar-view .phui-calendar-list li:first-child { - margin-top: 8px; +.phui-calendar-view .phui-calendar-list li a { + display: block; + overflow: hidden; + position: relative; +} + +.phui-calendar-view li.phui-calendar-list-item { + white-space: nowrap; + width: auto; } .phui-calendar-view .phui-calendar-list-dot { position: relative; - display: inline-block; + display: block; float: left; width: 3px; height: 3px; @@ -198,37 +200,18 @@ li.phui-calendar-list-item.all-day:first-child { display: none; } -.phui-calendar-view li.phui-calendar-list-item { - padding: 0; -} - .phui-calendar-view li.phui-calendar-list-item .phui-calendar-list-title { - position: relative; - /*float: right;*/ - display: inline-block; - width: 120px; - padding: 0; - line-height: 18px; - vertical-align: center; -} - -li.phui-calendar-list-item .phui-calendar-list-title a { - padding: 0; - vertical-align: top; - line-height: 16px; - overflow: hidden; + width: auto; + position: absolute; + right: 0; + left: 60px; text-overflow: ellipsis; + overflow: hidden; white-space: nowrap; } -li.phui-calendar-list-item.all-day .phui-calendar-list-title a{ - color: {$greytext}; - margin: 0; - padding: 0; -} - -li.phui-calendar-viewer-invited.all-day .phui-calendar-list-title a{ - color: {$green}; +li.all-day { + line-height: 18px; } .phui-calendar-view li.phui-calendar-list-item .phui-calendar-list-time { @@ -241,7 +224,3 @@ li.phui-calendar-viewer-invited.all-day .phui-calendar-list-title a{ color: {$lightgreytext}; text-align: left; } - -li.phui-calendar-list-item.all-day .phui-calendar-list-time{ - margin: 0 0 0 4px; -} diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar.css b/webroot/rsrc/css/phui/calendar/phui-calendar.css index e3f67c2162..d2a094c65a 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar.css @@ -8,7 +8,6 @@ .phui-calendar-viewer-invited a { color: {$green}; - font-weight: bold; } .phui-calendar-red a { From 1f54b95324ebb078ca0fc340745adfe1a22886dc Mon Sep 17 00:00:00 2001 From: CodeMouse92 Date: Tue, 19 May 2015 10:04:51 -0700 Subject: [PATCH 49/86] Fixed typo on Releeph product query dropdown. Summary: Changed "Active Prodcuts" to "Active Products" on Releeph Product Query dropdown. (Incidentally, this is my first diff on Phabricator proper, so I hope I got it right. I'm used to SVN, not Git.) Test Plan: Make sure the change is there and didn't bork anything else. Reviewers: chad, #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D12904 --- src/applications/releeph/query/ReleephProductSearchEngine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/releeph/query/ReleephProductSearchEngine.php b/src/applications/releeph/query/ReleephProductSearchEngine.php index 51f1bcb560..37aecea858 100644 --- a/src/applications/releeph/query/ReleephProductSearchEngine.php +++ b/src/applications/releeph/query/ReleephProductSearchEngine.php @@ -74,7 +74,7 @@ final class ReleephProductSearchEngine private function getActiveOptions() { return array( 'all' => pht('Active and Inactive Products'), - 'active' => pht('Active Prodcuts'), + 'active' => pht('Active Products'), 'inactive' => pht('Inactive Products'), ); } From 8ff7222d0e018ed66461b32764e9088787bb5585 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Tue, 19 May 2015 10:46:28 -0700 Subject: [PATCH 50/86] Phame - add edge transaction implementations. Summary: Fixes T8252. See T6403 for longer term fix. Test Plan: made a post with a task mention in it and it worked Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8252 Differential Revision: https://secure.phabricator.com/D12926 --- src/applications/phame/editor/PhamePostEditor.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/applications/phame/editor/PhamePostEditor.php b/src/applications/phame/editor/PhamePostEditor.php index ef6cd21307..c08ad2b155 100644 --- a/src/applications/phame/editor/PhamePostEditor.php +++ b/src/applications/phame/editor/PhamePostEditor.php @@ -64,6 +64,8 @@ final class PhamePostEditor return $object->setBody($xaction->getNewValue()); case PhamePostTransaction::TYPE_COMMENTS_WIDGET: return $object->setCommentsWidget($xaction->getNewValue()); + case PhabricatorTransactions::TYPE_EDGE: + return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -78,6 +80,7 @@ final class PhamePostEditor case PhamePostTransaction::TYPE_PHAME_TITLE: case PhamePostTransaction::TYPE_BODY: case PhamePostTransaction::TYPE_COMMENTS_WIDGET: + case PhabricatorTransactions::TYPE_EDGE: return; } From 1e128a24b84c78d9522ed84327a639ea8279efc9 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Tue, 19 May 2015 10:48:48 -0700 Subject: [PATCH 51/86] Conpherence - override some device specific styles so menu dropdown always present Summary: Fixes T7684. I am not sure if this is simple or not in CSS terms but I just blasted a bunch of css classes to make sure they have the proper "device-desktop" values for the conpherence durable column. One small visual oddity is the main menu dropdowns (for conpherence and the actual page) should have a hover state css, but we add device-tablet too early relative to the actual page width. This is no big deal probably. Test Plan: made the screen table sized. used the dropdown menu with great success! Reviewers: chad, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7684 Differential Revision: https://secure.phabricator.com/D12914 --- resources/celerity/map.php | 10 ++-- .../conpherence/durable-column.css | 58 +++++++++++++++++++ 2 files changed, 63 insertions(+), 5 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 00f7142bd8..90b615594b 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -7,7 +7,7 @@ */ return array( 'names' => array( - 'core.pkg.css' => '9990f46d', + 'core.pkg.css' => '65288546', 'core.pkg.js' => 'a2f2598e', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => 'bb338e4b', @@ -45,7 +45,7 @@ return array( 'rsrc/css/application/config/config-welcome.css' => '6abd79be', 'rsrc/css/application/config/setup-issue.css' => '22270af2', 'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2', - 'rsrc/css/application/conpherence/durable-column.css' => '8c43d6ac', + 'rsrc/css/application/conpherence/durable-column.css' => '4331cbe9', 'rsrc/css/application/conpherence/menu.css' => 'f389e048', 'rsrc/css/application/conpherence/message-pane.css' => '5bb4b76d', 'rsrc/css/application/conpherence/notification.css' => '919974b6', @@ -122,7 +122,7 @@ return array( 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/phui/calendar/phui-calendar-day.css' => 'c0cf782a', 'rsrc/css/phui/calendar/phui-calendar-list.css' => '857a0d83', - 'rsrc/css/phui/calendar/phui-calendar-month.css' => '32e3bee4', + 'rsrc/css/phui/calendar/phui-calendar-month.css' => '1d0e1e9b', 'rsrc/css/phui/calendar/phui-calendar.css' => 'ccabe893', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', @@ -496,7 +496,7 @@ return array( 'conduit-api-css' => '7bc725c4', 'config-options-css' => '7fedf08b', 'config-welcome-css' => '6abd79be', - 'conpherence-durable-column-view' => '8c43d6ac', + 'conpherence-durable-column-view' => '4331cbe9', 'conpherence-menu-css' => 'f389e048', 'conpherence-message-pane-css' => '5bb4b76d', 'conpherence-notification-css' => '919974b6', @@ -763,7 +763,7 @@ return array( 'phui-calendar-css' => 'ccabe893', 'phui-calendar-day-css' => 'c0cf782a', 'phui-calendar-list-css' => '857a0d83', - 'phui-calendar-month-css' => '32e3bee4', + 'phui-calendar-month-css' => '1d0e1e9b', 'phui-crumbs-view-css' => '594d719e', 'phui-document-view-css' => '94d5dcd8', 'phui-feed-story-css' => 'c9f3a0b5', diff --git a/webroot/rsrc/css/application/conpherence/durable-column.css b/webroot/rsrc/css/application/conpherence/durable-column.css index 1dbb829565..e0cdf7b5e9 100644 --- a/webroot/rsrc/css/application/conpherence/durable-column.css +++ b/webroot/rsrc/css/application/conpherence/durable-column.css @@ -75,7 +75,65 @@ } .conpherence-durable-column-header .phabricator-application-menu { + display: block; + float: right; padding-right: 4px; + width: 36px; +} +.conpherence-durable-column-header +.phabricator-application-menu .phui-list-item-view.core-menu-item { + display: block; +} +.conpherence-durable-column-header +.phabricator-application-menu .phui-list-item-name { + display: none; +} +.conpherence-durable-column-header +.phabricator-application-menu .phui-list-item-view { + float: left; + position: relative; + width: 36px; + height: 36px; + margin-top: 4px; +} +.conpherence-durable-column-header +.phabricator-application-menu .phui-list-item-href { + background: transparent; + border: none; + padding: 0; +} +.conpherence-durable-column-header +.phabricator-dark-menu .phui-list-item-type-link { + background: transparent; +} +.device-desktop +.conpherence-durable-column-header +.phabricator-application-menu +.core-menu-item.phui-list-item-view:hover +.phui-list-item-icon.phui-font-fa { + color: #fff; +} +.conpherence-durable-column-header +.phabricator-application-menu +.phui-list-item-view.core-menu-item { + display: block; +} +.device-desktop +.conpherence-durable-column-header +.phabricator-application-menu +.core-menu-item.phui-list-item-view:hover { + background-color: rgba(0,0,0,.33); + border-radius: 3px; +} +.conpherence-durable-column-header +.phabricator-application-menu .phui-list-item-icon.phui-font-fa { + font-size: 20px; + height: 20px; + width: 20px; + color: rgba(255,255,255,.8); + margin: 8px; + text-align: center; + vertical-align: middle; } .conpherence-durable-column-header-text { From e47b4f5b67e3f7f2fa92fcf80bb499e5460423e6 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 19 May 2015 11:08:07 -0700 Subject: [PATCH 52/86] Fix "size=full" issue for images in Firefox Summary: Fixes T8221. Test Plan: {F410522} Reviewers: chad, btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8221 Differential Revision: https://secure.phabricator.com/D12927 --- resources/celerity/map.php | 10 +++++----- webroot/rsrc/css/core/remarkup.css | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 90b615594b..c683052bae 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -7,7 +7,7 @@ */ return array( 'names' => array( - 'core.pkg.css' => '65288546', + 'core.pkg.css' => '79e995d7', 'core.pkg.js' => 'a2f2598e', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => 'bb338e4b', @@ -45,7 +45,7 @@ return array( 'rsrc/css/application/config/config-welcome.css' => '6abd79be', 'rsrc/css/application/config/setup-issue.css' => '22270af2', 'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2', - 'rsrc/css/application/conpherence/durable-column.css' => '4331cbe9', + 'rsrc/css/application/conpherence/durable-column.css' => '8c43d6ac', 'rsrc/css/application/conpherence/menu.css' => 'f389e048', 'rsrc/css/application/conpherence/message-pane.css' => '5bb4b76d', 'rsrc/css/application/conpherence/notification.css' => '919974b6', @@ -109,7 +109,7 @@ return array( 'rsrc/css/application/tokens/tokens.css' => '3d0f239e', 'rsrc/css/application/uiexample/example.css' => '528b19de', 'rsrc/css/core/core.css' => 'aaea7a7a', - 'rsrc/css/core/remarkup.css' => '0037bdbf', + 'rsrc/css/core/remarkup.css' => '07b7dc54', 'rsrc/css/core/syntax.css' => '6b7b24d9', 'rsrc/css/core/z-index.css' => '8414a09b', 'rsrc/css/diviner/diviner-shared.css' => '38813222', @@ -496,7 +496,7 @@ return array( 'conduit-api-css' => '7bc725c4', 'config-options-css' => '7fedf08b', 'config-welcome-css' => '6abd79be', - 'conpherence-durable-column-view' => '4331cbe9', + 'conpherence-durable-column-view' => '8c43d6ac', 'conpherence-menu-css' => 'f389e048', 'conpherence-message-pane-css' => '5bb4b76d', 'conpherence-notification-css' => '919974b6', @@ -725,7 +725,7 @@ return array( 'phabricator-phtize' => 'd254d646', 'phabricator-prefab' => '6920d200', 'phabricator-profile-css' => '1a20dcbf', - 'phabricator-remarkup-css' => '0037bdbf', + 'phabricator-remarkup-css' => '07b7dc54', 'phabricator-search-results-css' => '15c71110', 'phabricator-shaped-request' => '7cbe244b', 'phabricator-side-menu-view-css' => 'c1db9e9c', diff --git a/webroot/rsrc/css/core/remarkup.css b/webroot/rsrc/css/core/remarkup.css index 63e4224ba3..faf7bda893 100644 --- a/webroot/rsrc/css/core/remarkup.css +++ b/webroot/rsrc/css/core/remarkup.css @@ -317,6 +317,7 @@ .phabricator-remarkup-embed-image-full { display: inline-block; + max-width: 100%; } .phabricator-remarkup-embed-image-full img { From 7bc008d0e2cc6ce74f3d231dac14e79c00c3f215 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Tue, 19 May 2015 11:13:20 -0700 Subject: [PATCH 53/86] Skeleton of calendar icon infrastructure Summary: Ref T7936, Skeleton of calendar icon infrastructure Test Plan: Navigate to install/calendar/icon/, observe temporary calendar icons Reviewers: epriestley, #blessed_reviewers, chad Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T7936 Differential Revision: https://secure.phabricator.com/D12928 --- resources/celerity/map.php | 2 + src/__phutil_library_map__.php | 4 + .../PhabricatorCalendarApplication.php | 4 + ...ricatorCalendarEventEditIconController.php | 102 ++++++++++++++++++ .../calendar/icon/PhabricatorCalendarIcon.php | 49 +++++++++ .../application/calendar/calendar-icon.css | 28 +++++ 6 files changed, 189 insertions(+) create mode 100644 src/applications/calendar/controller/PhabricatorCalendarEventEditIconController.php create mode 100644 src/applications/calendar/icon/PhabricatorCalendarIcon.php create mode 100644 webroot/rsrc/css/application/calendar/calendar-icon.css diff --git a/resources/celerity/map.php b/resources/celerity/map.php index c683052bae..862bf22145 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -38,6 +38,7 @@ return array( 'rsrc/css/application/base/notification-menu.css' => '3c9d8aa1', 'rsrc/css/application/base/phabricator-application-launch-view.css' => '16ca323f', 'rsrc/css/application/base/standard-page-view.css' => '61e68a55', + 'rsrc/css/application/calendar/calendar-icon.css' => '98ce946d', 'rsrc/css/application/chatlog/chatlog.css' => '852140ff', 'rsrc/css/application/conduit/conduit-api.css' => '7bc725c4', 'rsrc/css/application/config/config-options.css' => '7fedf08b', @@ -492,6 +493,7 @@ return array( 'aphront-two-column-view-css' => '16ab3ad2', 'aphront-typeahead-control-css' => '0e403212', 'auth-css' => '44975d4b', + 'calendar-icon-css' => '98ce946d', 'changeset-view-manager' => '58562350', 'conduit-api-css' => '7bc725c4', 'config-options-css' => '7fedf08b', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 96d2502491..0c4b286fe7 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1499,6 +1499,7 @@ phutil_register_library_map(array( 'PhabricatorCalendarEventCancelController' => 'applications/calendar/controller/PhabricatorCalendarEventCancelController.php', 'PhabricatorCalendarEventCommentController' => 'applications/calendar/controller/PhabricatorCalendarEventCommentController.php', 'PhabricatorCalendarEventEditController' => 'applications/calendar/controller/PhabricatorCalendarEventEditController.php', + 'PhabricatorCalendarEventEditIconController' => 'applications/calendar/controller/PhabricatorCalendarEventEditIconController.php', 'PhabricatorCalendarEventEditor' => 'applications/calendar/editor/PhabricatorCalendarEventEditor.php', 'PhabricatorCalendarEventEmailCommand' => 'applications/calendar/command/PhabricatorCalendarEventEmailCommand.php', 'PhabricatorCalendarEventInvitee' => 'applications/calendar/storage/PhabricatorCalendarEventInvitee.php', @@ -1517,6 +1518,7 @@ phutil_register_library_map(array( 'PhabricatorCalendarEventViewController' => 'applications/calendar/controller/PhabricatorCalendarEventViewController.php', 'PhabricatorCalendarHoliday' => 'applications/calendar/storage/PhabricatorCalendarHoliday.php', 'PhabricatorCalendarHolidayTestCase' => 'applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php', + 'PhabricatorCalendarIcon' => 'applications/calendar/icon/PhabricatorCalendarIcon.php', 'PhabricatorCalendarRemarkupRule' => 'applications/calendar/remarkup/PhabricatorCalendarRemarkupRule.php', 'PhabricatorCalendarReplyHandler' => 'applications/calendar/mail/PhabricatorCalendarReplyHandler.php', 'PhabricatorCalendarSchemaSpec' => 'applications/calendar/storage/PhabricatorCalendarSchemaSpec.php', @@ -4860,6 +4862,7 @@ phutil_register_library_map(array( 'PhabricatorCalendarEventCancelController' => 'PhabricatorCalendarController', 'PhabricatorCalendarEventCommentController' => 'PhabricatorCalendarController', 'PhabricatorCalendarEventEditController' => 'PhabricatorCalendarController', + 'PhabricatorCalendarEventEditIconController' => 'PhabricatorCalendarController', 'PhabricatorCalendarEventEditor' => 'PhabricatorApplicationTransactionEditor', 'PhabricatorCalendarEventEmailCommand' => 'MetaMTAEmailTransactionCommand', 'PhabricatorCalendarEventInvitee' => array( @@ -4881,6 +4884,7 @@ phutil_register_library_map(array( 'PhabricatorCalendarEventViewController' => 'PhabricatorCalendarController', 'PhabricatorCalendarHoliday' => 'PhabricatorCalendarDAO', 'PhabricatorCalendarHolidayTestCase' => 'PhabricatorTestCase', + 'PhabricatorCalendarIcon' => 'Phobject', 'PhabricatorCalendarRemarkupRule' => 'PhabricatorObjectRemarkupRule', 'PhabricatorCalendarReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler', 'PhabricatorCalendarSchemaSpec' => 'PhabricatorConfigSchemaSpec', diff --git a/src/applications/calendar/application/PhabricatorCalendarApplication.php b/src/applications/calendar/application/PhabricatorCalendarApplication.php index aeeaa68d2b..534b11d2e8 100644 --- a/src/applications/calendar/application/PhabricatorCalendarApplication.php +++ b/src/applications/calendar/application/PhabricatorCalendarApplication.php @@ -45,6 +45,10 @@ final class PhabricatorCalendarApplication extends PhabricatorApplication { '(?:query/(?P[^/]+)/(?:(?P\d+)/'. '(?P\d+)/)?(?:(?P\d+)/)?)?' => 'PhabricatorCalendarEventListController', + 'icon/(?P[1-9]\d*)/' + => 'PhabricatorCalendarEventEditIconController', + 'icon/' + => 'PhabricatorCalendarEventEditIconController', 'event/' => array( 'create/' => 'PhabricatorCalendarEventEditController', diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventEditIconController.php b/src/applications/calendar/controller/PhabricatorCalendarEventEditIconController.php new file mode 100644 index 0000000000..a8c9af97fb --- /dev/null +++ b/src/applications/calendar/controller/PhabricatorCalendarEventEditIconController.php @@ -0,0 +1,102 @@ +id = idx($data, 'id'); + } + + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getUser(); + + if ($this->id) { + $event = id(new PhabricatorCalendarEventQuery()) + ->setViewer($viewer) + ->withIDs(array($this->id)) + ->requireCapabilities( + array( + PhabricatorPolicyCapability::CAN_VIEW, + PhabricatorPolicyCapability::CAN_EDIT, + )) + ->executeOne(); + if (!$event) { + return new Aphront404Response(); + } + $cancel_uri = $this->getApplicationURI('/E'.$event->getID()); + $event_icon = $event->getIcon(); + } else { + $cancel_uri = '/calendar/'; + $event_icon = $request->getStr('value'); + } + + require_celerity_resource('calendar-icon-css'); + Javelin::initBehavior('phabricator-tooltips'); + + $calendar_icons = PhabricatorCalendarIcon::getIconMap(); + + if ($request->isFormPost()) { + $v_icon = $request->getStr('icon'); + + return id(new AphrontAjaxResponse())->setContent( + array( + 'value' => $v_icon, + 'display' => PhabricatorCalendarIcon::renderIconForChooser($v_icon), + )); + } + + $ii = 0; + $buttons = array(); + foreach ($calendar_icons as $icon => $label) { + $view = id(new PHUIIconView()) + ->setIconFont($icon); + + $aural = javelin_tag( + 'span', + array( + 'aural' => true, + ), + pht('Choose "%s" Icon', $label)); + + if ($icon == $event_icon) { + $class_extra = ' selected'; + } else { + $class_extra = null; + } + + $buttons[] = javelin_tag( + 'button', + array( + 'class' => 'icon-button'.$class_extra, + 'name' => 'icon', + 'value' => $icon, + 'type' => 'submit', + 'sigil' => 'has-tooltip', + 'meta' => array( + 'tip' => $label, + ), + ), + array( + $aural, + $view, + )); + if ((++$ii % 4) == 0) { + $buttons[] = phutil_tag('br'); + } + } + + $buttons = phutil_tag( + 'div', + array( + 'class' => 'icon-grid', + ), + $buttons); + + return $this->newDialog() + ->setTitle(pht('Choose Calendar Event Icon')) + ->appendChild($buttons) + ->addCancelButton($cancel_uri); + } +} diff --git a/src/applications/calendar/icon/PhabricatorCalendarIcon.php b/src/applications/calendar/icon/PhabricatorCalendarIcon.php new file mode 100644 index 0000000000..904ffee761 --- /dev/null +++ b/src/applications/calendar/icon/PhabricatorCalendarIcon.php @@ -0,0 +1,49 @@ + pht('Briefcase'), + 'fa-tags' => pht('Tag'), + 'fa-folder' => pht('Folder'), + 'fa-users' => pht('Team'), + 'fa-bug' => pht('Bug'), + 'fa-trash-o' => pht('Garbage'), + 'fa-calendar' => pht('Deadline'), + 'fa-flag-checkered' => pht('Goal'), + 'fa-envelope' => pht('Communication'), + 'fa-truck' => pht('Release'), + 'fa-lock' => pht('Policy'), + 'fa-umbrella' => pht('An Umbrella'), + 'fa-cloud' => pht('The Cloud'), + 'fa-building' => pht('Company'), + 'fa-credit-card' => pht('Accounting'), + 'fa-flask' => pht('Experimental'), + ); + } + + public static function getLabel($key) { + $map = self::getIconMap(); + return $map[$key]; + } + + public static function getAPIName($key) { + return substr($key, 3); + } + + public static function renderIconForChooser($icon) { + $calendar_icons = self::getIconMap(); + + return phutil_tag( + 'span', + array(), + array( + id(new PHUIIconView())->setIconFont($icon), + ' ', + idx($calendar_icons, $icon, pht('Unknown Icon')), + )); + } + +} diff --git a/webroot/rsrc/css/application/calendar/calendar-icon.css b/webroot/rsrc/css/application/calendar/calendar-icon.css new file mode 100644 index 0000000000..96aa1c42e0 --- /dev/null +++ b/webroot/rsrc/css/application/calendar/calendar-icon.css @@ -0,0 +1,28 @@ +/** + * @provides calendar-icon-css + */ + +button.icon-button { + background: #f7f7f7; + border: 1px solid {$lightblueborder}; + position: relative; + width: 16px; + height: 16px; + padding: 12px; + margin: 4px; + text-shadow: none; + box-shadow: none; + box-sizing: content-box; +} + +.icon-grid { + text-align: center; +} + +.icon-icon + .icon-icon { + margin-left: 4px; +} + +button.icon-button.selected { + background: {$bluebackground}; +} From 16c8d44c37c964fcd4041aa08544385e2b4d234a Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Tue, 19 May 2015 11:26:53 -0700 Subject: [PATCH 54/86] Transactions - make customization of TYPE_EDGE optional Summary: Ref T6403. This does TYPE_EDGE since I just had to deal with T8252. Look like this fixes a few editors (maybe) that would have had fatals with mentions like slowvote and ponder. Test Plan: made a phame post mentioning a task and it worked! joined / left a project, watched / unwatched a project and that worked! blind faith for other sites. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6403 Differential Revision: https://secure.phabricator.com/D12929 --- .../almanac/editor/AlmanacDeviceEditor.php | 2 -- .../almanac/editor/AlmanacServiceEditor.php | 2 -- .../audit/editor/PhabricatorAuditEditor.php | 2 -- .../editor/PhabricatorCalendarEventEditor.php | 2 -- ...abricatorDashboardPanelTransactionEditor.php | 3 --- .../PhabricatorDashboardTransactionEditor.php | 4 ---- .../editor/DifferentialTransactionEditor.php | 3 --- .../fund/editor/FundInitiativeEditor.php | 2 -- .../paste/editor/PhabricatorPasteEditor.php | 2 -- .../phame/editor/PhamePostEditor.php | 3 --- .../pholio/editor/PholioMockEditor.php | 4 ---- .../phortune/editor/PhortuneAccountEditor.php | 4 ---- .../phortune/editor/PhortuneMerchantEditor.php | 2 -- .../ponder/editor/PonderQuestionEditor.php | 2 -- .../PhabricatorProjectTransactionEditor.php | 17 +++++++++++++++-- .../editor/PhabricatorSlowvoteEditor.php | 2 -- .../PhabricatorApplicationTransactionEditor.php | 3 ++- 17 files changed, 17 insertions(+), 42 deletions(-) diff --git a/src/applications/almanac/editor/AlmanacDeviceEditor.php b/src/applications/almanac/editor/AlmanacDeviceEditor.php index 98f7604fb4..211788e441 100644 --- a/src/applications/almanac/editor/AlmanacDeviceEditor.php +++ b/src/applications/almanac/editor/AlmanacDeviceEditor.php @@ -57,7 +57,6 @@ final class AlmanacDeviceEditor case AlmanacDeviceTransaction::TYPE_INTERFACE: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_EDGE: return; } @@ -72,7 +71,6 @@ final class AlmanacDeviceEditor case AlmanacDeviceTransaction::TYPE_NAME: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_EDGE: return; case AlmanacDeviceTransaction::TYPE_INTERFACE: $old = $xaction->getOldValue(); diff --git a/src/applications/almanac/editor/AlmanacServiceEditor.php b/src/applications/almanac/editor/AlmanacServiceEditor.php index 65d4d03c55..928696dbcd 100644 --- a/src/applications/almanac/editor/AlmanacServiceEditor.php +++ b/src/applications/almanac/editor/AlmanacServiceEditor.php @@ -63,7 +63,6 @@ final class AlmanacServiceEditor return; case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_EDGE: return; } @@ -78,7 +77,6 @@ final class AlmanacServiceEditor case AlmanacServiceTransaction::TYPE_NAME: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_EDGE: return; case AlmanacServiceTransaction::TYPE_LOCK: $service = id(new AlmanacServiceQuery()) diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php index d30a4061b7..77d1d0a23a 100644 --- a/src/applications/audit/editor/PhabricatorAuditEditor.php +++ b/src/applications/audit/editor/PhabricatorAuditEditor.php @@ -117,7 +117,6 @@ final class PhabricatorAuditEditor switch ($xaction->getTransactionType()) { case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_SUBSCRIBERS: - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorAuditActionConstants::ACTION: case PhabricatorAuditActionConstants::INLINE: case PhabricatorAuditActionConstants::ADD_AUDITORS: @@ -135,7 +134,6 @@ final class PhabricatorAuditEditor switch ($xaction->getTransactionType()) { case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_SUBSCRIBERS: - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorAuditActionConstants::ACTION: case PhabricatorAuditTransaction::TYPE_COMMIT: return; diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php index 727c33958f..cf6fc5936e 100644 --- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php +++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php @@ -111,7 +111,6 @@ final class PhabricatorCalendarEventEditor case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorTransactions::TYPE_SUBSCRIBERS: return; } @@ -154,7 +153,6 @@ final class PhabricatorCalendarEventEditor case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorTransactions::TYPE_SUBSCRIBERS: return; } diff --git a/src/applications/dashboard/editor/PhabricatorDashboardPanelTransactionEditor.php b/src/applications/dashboard/editor/PhabricatorDashboardPanelTransactionEditor.php index 4b1ddde899..6f76e2618e 100644 --- a/src/applications/dashboard/editor/PhabricatorDashboardPanelTransactionEditor.php +++ b/src/applications/dashboard/editor/PhabricatorDashboardPanelTransactionEditor.php @@ -68,8 +68,6 @@ final class PhabricatorDashboardPanelTransactionEditor case PhabricatorTransactions::TYPE_EDIT_POLICY: $object->setEditPolicy($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_EDGE: - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -84,7 +82,6 @@ final class PhabricatorDashboardPanelTransactionEditor case PhabricatorDashboardPanelTransaction::TYPE_ARCHIVE: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_EDGE: return; } diff --git a/src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php b/src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php index 6942a5f89e..ed16a22a9c 100644 --- a/src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php +++ b/src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php @@ -115,8 +115,6 @@ final class PhabricatorDashboardTransactionEditor case PhabricatorTransactions::TYPE_EDIT_POLICY: $object->setEditPolicy($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_EDGE: - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -132,8 +130,6 @@ final class PhabricatorDashboardTransactionEditor case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: return; - case PhabricatorTransactions::TYPE_EDGE: - return; } return parent::applyCustomExternalTransaction($object, $xaction); diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php index 94889213ba..a9084093f6 100644 --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -199,8 +199,6 @@ final class DifferentialTransactionEditor case PhabricatorTransactions::TYPE_COMMENT: case DifferentialTransaction::TYPE_INLINE: return; - case PhabricatorTransactions::TYPE_EDGE: - return; case DifferentialTransaction::TYPE_UPDATE: if (!$this->getIsCloseByCommit()) { switch ($object->getStatus()) { @@ -581,7 +579,6 @@ final class DifferentialTransactionEditor case PhabricatorTransactions::TYPE_EDIT_POLICY: return; case PhabricatorTransactions::TYPE_SUBSCRIBERS: - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorTransactions::TYPE_COMMENT: case DifferentialTransaction::TYPE_ACTION: return; diff --git a/src/applications/fund/editor/FundInitiativeEditor.php b/src/applications/fund/editor/FundInitiativeEditor.php index 05041ba119..33ad1017d0 100644 --- a/src/applications/fund/editor/FundInitiativeEditor.php +++ b/src/applications/fund/editor/FundInitiativeEditor.php @@ -103,7 +103,6 @@ final class FundInitiativeEditor $object->setTotalAsCurrency($total); return; case PhabricatorTransactions::TYPE_SUBSCRIBERS: - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: return; @@ -157,7 +156,6 @@ final class FundInitiativeEditor $editor->applyTransactions($backer, $subx); return; case PhabricatorTransactions::TYPE_SUBSCRIBERS: - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: return; diff --git a/src/applications/paste/editor/PhabricatorPasteEditor.php b/src/applications/paste/editor/PhabricatorPasteEditor.php index 45e4998d99..86f2eea393 100644 --- a/src/applications/paste/editor/PhabricatorPasteEditor.php +++ b/src/applications/paste/editor/PhabricatorPasteEditor.php @@ -90,7 +90,6 @@ final class PhabricatorPasteEditor return; case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_SUBSCRIBERS: - case PhabricatorTransactions::TYPE_EDGE: return; } @@ -109,7 +108,6 @@ final class PhabricatorPasteEditor case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_SUBSCRIBERS: - case PhabricatorTransactions::TYPE_EDGE: return; } diff --git a/src/applications/phame/editor/PhamePostEditor.php b/src/applications/phame/editor/PhamePostEditor.php index c08ad2b155..ef6cd21307 100644 --- a/src/applications/phame/editor/PhamePostEditor.php +++ b/src/applications/phame/editor/PhamePostEditor.php @@ -64,8 +64,6 @@ final class PhamePostEditor return $object->setBody($xaction->getNewValue()); case PhamePostTransaction::TYPE_COMMENTS_WIDGET: return $object->setCommentsWidget($xaction->getNewValue()); - case PhabricatorTransactions::TYPE_EDGE: - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -80,7 +78,6 @@ final class PhamePostEditor case PhamePostTransaction::TYPE_PHAME_TITLE: case PhamePostTransaction::TYPE_BODY: case PhamePostTransaction::TYPE_COMMENTS_WIDGET: - case PhabricatorTransactions::TYPE_EDGE: return; } diff --git a/src/applications/pholio/editor/PholioMockEditor.php b/src/applications/pholio/editor/PholioMockEditor.php index 7ba95455b5..cd36b563b3 100644 --- a/src/applications/pholio/editor/PholioMockEditor.php +++ b/src/applications/pholio/editor/PholioMockEditor.php @@ -209,8 +209,6 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor { case PholioTransactionType::TYPE_STATUS: $object->setStatus($xaction->getNewValue()); break; - case PhabricatorTransactions::TYPE_EDGE: - return; } } @@ -278,8 +276,6 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor { $image->setSequence($value); $image->save(); break; - case PhabricatorTransactions::TYPE_EDGE: - return; } } diff --git a/src/applications/phortune/editor/PhortuneAccountEditor.php b/src/applications/phortune/editor/PhortuneAccountEditor.php index 2c1186dafb..556df99fbf 100644 --- a/src/applications/phortune/editor/PhortuneAccountEditor.php +++ b/src/applications/phortune/editor/PhortuneAccountEditor.php @@ -49,8 +49,6 @@ final class PhortuneAccountEditor case PhortuneAccountTransaction::TYPE_NAME: $object->setName($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_EDGE: - return; } return parent::applyCustomInternalTransaction($object, $xaction); } @@ -61,8 +59,6 @@ final class PhortuneAccountEditor switch ($xaction->getTransactionType()) { case PhortuneAccountTransaction::TYPE_NAME: return; - case PhabricatorTransactions::TYPE_EDGE: - return; } return parent::applyCustomExternalTransaction($object, $xaction); } diff --git a/src/applications/phortune/editor/PhortuneMerchantEditor.php b/src/applications/phortune/editor/PhortuneMerchantEditor.php index 432efe0886..ae8c1fda54 100644 --- a/src/applications/phortune/editor/PhortuneMerchantEditor.php +++ b/src/applications/phortune/editor/PhortuneMerchantEditor.php @@ -59,7 +59,6 @@ final class PhortuneMerchantEditor case PhortuneMerchantTransaction::TYPE_DESCRIPTION: $object->setDescription($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorTransactions::TYPE_VIEW_POLICY: return; } @@ -74,7 +73,6 @@ final class PhortuneMerchantEditor switch ($xaction->getTransactionType()) { case PhortuneMerchantTransaction::TYPE_NAME: case PhortuneMerchantTransaction::TYPE_DESCRIPTION: - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorTransactions::TYPE_VIEW_POLICY: return; } diff --git a/src/applications/ponder/editor/PonderQuestionEditor.php b/src/applications/ponder/editor/PonderQuestionEditor.php index 5505e751de..9dbe58cb0e 100644 --- a/src/applications/ponder/editor/PonderQuestionEditor.php +++ b/src/applications/ponder/editor/PonderQuestionEditor.php @@ -145,8 +145,6 @@ final class PonderQuestionEditor $object->setAnswerCount($count); break; - case PhabricatorTransactions::TYPE_EDGE: - return; } } diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php index 502623685c..84ca63a358 100644 --- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php +++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php @@ -103,7 +103,6 @@ final class PhabricatorProjectTransactionEditor $object->setIsMembershipLocked($xaction->getNewValue()); return; case PhabricatorTransactions::TYPE_SUBSCRIBERS: - case PhabricatorTransactions::TYPE_EDGE: return; case PhabricatorTransactions::TYPE_VIEW_POLICY: $object->setViewPolicy($xaction->getNewValue()); @@ -170,6 +169,20 @@ final class PhabricatorProjectTransactionEditor case PhabricatorProjectTransaction::TYPE_COLOR: case PhabricatorProjectTransaction::TYPE_LOCKED: return; + } + + return parent::applyCustomExternalTransaction($object, $xaction); + } + + protected function applyBuiltinExternalTransaction( + PhabricatorLiskDAO $object, + PhabricatorApplicationTransaction $xaction) { + + $old = $xaction->getOldValue(); + $new = $xaction->getNewValue(); + + switch ($xaction->getTransactionType()) { + case PhabricatorTransactions::TYPE_EDGE: $edge_type = $xaction->getMetadataValue('edge:type'); switch ($edge_type) { @@ -225,7 +238,7 @@ final class PhabricatorProjectTransactionEditor return; } - return parent::applyCustomExternalTransaction($object, $xaction); + return parent::applyBuiltinExternalTransaction($object, $xaction); } protected function validateTransaction( diff --git a/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php b/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php index 1ca1361436..d1bd6c18f0 100644 --- a/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php +++ b/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php @@ -102,8 +102,6 @@ final class PhabricatorSlowvoteEditor case PhabricatorSlowvoteTransaction::TYPE_CLOSE: $object->setIsClosed((int)$xaction->getNewValue()); break; - case PhabricatorTransactions::TYPE_EDGE: - return; } } diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index 6b070efaf9..406aaeac4a 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -402,6 +402,7 @@ abstract class PhabricatorApplicationTransactionEditor $field = $this->getCustomFieldForTransaction($object, $xaction); return $field->applyApplicationTransactionInternalEffects($xaction); case PhabricatorTransactions::TYPE_INLINESTATE: + case PhabricatorTransactions::TYPE_EDGE: return $this->applyBuiltinInternalTransaction($object, $xaction); } @@ -493,7 +494,7 @@ abstract class PhabricatorApplicationTransactionEditor } $editor->save(); - break; + return $this->applyBuiltinExternalTransaction($object, $xaction); case PhabricatorTransactions::TYPE_CUSTOMFIELD: $field = $this->getCustomFieldForTransaction($object, $xaction); return $field->applyApplicationTransactionExternalEffects($xaction); From 18e0ee079132d1a63464db817109f17b1347ce5e Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Tue, 19 May 2015 11:48:02 -0700 Subject: [PATCH 55/86] Transactions - move TYPE_SUBSCRIBERS to require optional implementation Summary: Ref T6403. This one was pretty easy since no one does anything custom with subscribers. Test Plan: subscribed / unscribed to a random commit ("audit"). joined / left, watched / unwatched a project Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6403 Differential Revision: https://secure.phabricator.com/D12930 --- src/applications/audit/editor/PhabricatorAuditEditor.php | 2 -- .../calendar/editor/PhabricatorCalendarEventEditor.php | 2 -- .../differential/editor/DifferentialTransactionEditor.php | 2 -- src/applications/fund/editor/FundInitiativeEditor.php | 2 -- src/applications/paste/editor/PhabricatorPasteEditor.php | 2 -- .../project/editor/PhabricatorProjectTransactionEditor.php | 3 --- .../editor/PhabricatorApplicationTransactionEditor.php | 3 ++- 7 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php index 77d1d0a23a..f3e7bdebb0 100644 --- a/src/applications/audit/editor/PhabricatorAuditEditor.php +++ b/src/applications/audit/editor/PhabricatorAuditEditor.php @@ -116,7 +116,6 @@ final class PhabricatorAuditEditor switch ($xaction->getTransactionType()) { case PhabricatorTransactions::TYPE_COMMENT: - case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorAuditActionConstants::ACTION: case PhabricatorAuditActionConstants::INLINE: case PhabricatorAuditActionConstants::ADD_AUDITORS: @@ -133,7 +132,6 @@ final class PhabricatorAuditEditor switch ($xaction->getTransactionType()) { case PhabricatorTransactions::TYPE_COMMENT: - case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorAuditActionConstants::ACTION: case PhabricatorAuditTransaction::TYPE_COMMIT: return; diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php index cf6fc5936e..3e3b68d08f 100644 --- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php +++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php @@ -111,7 +111,6 @@ final class PhabricatorCalendarEventEditor case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_SUBSCRIBERS: return; } @@ -153,7 +152,6 @@ final class PhabricatorCalendarEventEditor case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_SUBSCRIBERS: return; } diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php index a9084093f6..24ffbb9031 100644 --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -195,7 +195,6 @@ final class DifferentialTransactionEditor case PhabricatorTransactions::TYPE_EDIT_POLICY: $object->setEditPolicy($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_COMMENT: case DifferentialTransaction::TYPE_INLINE: return; @@ -578,7 +577,6 @@ final class DifferentialTransactionEditor case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: return; - case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_COMMENT: case DifferentialTransaction::TYPE_ACTION: return; diff --git a/src/applications/fund/editor/FundInitiativeEditor.php b/src/applications/fund/editor/FundInitiativeEditor.php index 33ad1017d0..13296be13f 100644 --- a/src/applications/fund/editor/FundInitiativeEditor.php +++ b/src/applications/fund/editor/FundInitiativeEditor.php @@ -102,7 +102,6 @@ final class FundInitiativeEditor $object->setTotalAsCurrency($total); return; - case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: return; @@ -155,7 +154,6 @@ final class FundInitiativeEditor $editor->applyTransactions($backer, $subx); return; - case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: return; diff --git a/src/applications/paste/editor/PhabricatorPasteEditor.php b/src/applications/paste/editor/PhabricatorPasteEditor.php index 86f2eea393..0d64017421 100644 --- a/src/applications/paste/editor/PhabricatorPasteEditor.php +++ b/src/applications/paste/editor/PhabricatorPasteEditor.php @@ -89,7 +89,6 @@ final class PhabricatorPasteEditor $object->setEditPolicy($xaction->getNewValue()); return; case PhabricatorTransactions::TYPE_COMMENT: - case PhabricatorTransactions::TYPE_SUBSCRIBERS: return; } @@ -107,7 +106,6 @@ final class PhabricatorPasteEditor case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_COMMENT: - case PhabricatorTransactions::TYPE_SUBSCRIBERS: return; } diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php index 84ca63a358..348ba53c4d 100644 --- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php +++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php @@ -102,8 +102,6 @@ final class PhabricatorProjectTransactionEditor case PhabricatorProjectTransaction::TYPE_LOCKED: $object->setIsMembershipLocked($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_SUBSCRIBERS: - return; case PhabricatorTransactions::TYPE_VIEW_POLICY: $object->setViewPolicy($xaction->getNewValue()); return; @@ -159,7 +157,6 @@ final class PhabricatorProjectTransactionEditor } return; - case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_JOIN_POLICY: diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index 406aaeac4a..11c11e1cc9 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -401,6 +401,7 @@ abstract class PhabricatorApplicationTransactionEditor case PhabricatorTransactions::TYPE_CUSTOMFIELD: $field = $this->getCustomFieldForTransaction($object, $xaction); return $field->applyApplicationTransactionInternalEffects($xaction); + case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_INLINESTATE: case PhabricatorTransactions::TYPE_EDGE: return $this->applyBuiltinInternalTransaction($object, $xaction); @@ -441,8 +442,8 @@ abstract class PhabricatorApplicationTransactionEditor $xaction->getOldValue(), $xaction->getNewValue())); $this->subscribers = $subscribers; + return $this->applyBuiltinExternalTransaction($object, $xaction); - break; case PhabricatorTransactions::TYPE_EDGE: if ($this->getIsInverseEdgeEditor()) { // If we're writing an inverse edge transaction, don't actually From 4622993885666fab98e9cba881b123daf3461f16 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 19 May 2015 12:14:44 -0700 Subject: [PATCH 56/86] Give Phriction a real dropdown Summary: Fixes T8150. Small generalization: - Timeline has a dropdown with no special logic; make that generic. - Use it in Phriction. Test Plan: - Used Phriction dropdown on desktop and mobile. - Used timeline dropdown. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8150 Differential Revision: https://secure.phabricator.com/D12931 --- resources/celerity/map.php | 28 +++++++++---------- resources/celerity/packages.php | 2 +- .../PhrictionDocumentController.php | 15 ++++++---- src/view/phui/PHUIButtonView.php | 12 ++++++++ src/view/phui/PHUIDocumentView.php | 28 ------------------- src/view/phui/PHUITimelineEventView.php | 4 +-- ...menu.js => behavior-phui-dropdown-menu.js} | 10 +++---- 7 files changed, 43 insertions(+), 56 deletions(-) rename webroot/rsrc/js/phui/{behavior-phui-timeline-dropdown-menu.js => behavior-phui-dropdown-menu.js} (64%) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 862bf22145..1769c81f76 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -7,8 +7,8 @@ */ return array( 'names' => array( - 'core.pkg.css' => '79e995d7', - 'core.pkg.js' => 'a2f2598e', + 'core.pkg.css' => 'e3ba62e8', + 'core.pkg.js' => '328799d0', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => 'bb338e4b', 'differential.pkg.js' => '45b3b51d', @@ -38,7 +38,6 @@ return array( 'rsrc/css/application/base/notification-menu.css' => '3c9d8aa1', 'rsrc/css/application/base/phabricator-application-launch-view.css' => '16ca323f', 'rsrc/css/application/base/standard-page-view.css' => '61e68a55', - 'rsrc/css/application/calendar/calendar-icon.css' => '98ce946d', 'rsrc/css/application/chatlog/chatlog.css' => '852140ff', 'rsrc/css/application/conduit/conduit-api.css' => '7bc725c4', 'rsrc/css/application/config/config-options.css' => '7fedf08b', @@ -46,7 +45,7 @@ return array( 'rsrc/css/application/config/config-welcome.css' => '6abd79be', 'rsrc/css/application/config/setup-issue.css' => '22270af2', 'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2', - 'rsrc/css/application/conpherence/durable-column.css' => '8c43d6ac', + 'rsrc/css/application/conpherence/durable-column.css' => '4331cbe9', 'rsrc/css/application/conpherence/menu.css' => 'f389e048', 'rsrc/css/application/conpherence/message-pane.css' => '5bb4b76d', 'rsrc/css/application/conpherence/notification.css' => '919974b6', @@ -472,8 +471,8 @@ return array( 'rsrc/js/core/behavior-watch-anchor.js' => '9f36c42d', 'rsrc/js/core/behavior-workflow.js' => '0a3f3021', 'rsrc/js/core/phtize.js' => 'd254d646', + 'rsrc/js/phui/behavior-phui-dropdown-menu.js' => '54733475', 'rsrc/js/phui/behavior-phui-object-box-tabs.js' => '2bfa2836', - 'rsrc/js/phui/behavior-phui-timeline-dropdown-menu.js' => '4d94d9c3', 'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8', 'rsrc/js/phuix/PHUIXActionView.js' => '8cf6d262', 'rsrc/js/phuix/PHUIXDropdownMenu.js' => 'bd4c8dca', @@ -493,12 +492,11 @@ return array( 'aphront-two-column-view-css' => '16ab3ad2', 'aphront-typeahead-control-css' => '0e403212', 'auth-css' => '44975d4b', - 'calendar-icon-css' => '98ce946d', 'changeset-view-manager' => '58562350', 'conduit-api-css' => '7bc725c4', 'config-options-css' => '7fedf08b', 'config-welcome-css' => '6abd79be', - 'conpherence-durable-column-view' => '8c43d6ac', + 'conpherence-durable-column-view' => '4331cbe9', 'conpherence-menu-css' => 'f389e048', 'conpherence-message-pane-css' => '5bb4b76d', 'conpherence-notification-css' => '919974b6', @@ -618,8 +616,8 @@ return array( 'javelin-behavior-phame-post-preview' => 'be807912', 'javelin-behavior-pholio-mock-edit' => '246dc085', 'javelin-behavior-pholio-mock-view' => 'fbe497e7', + 'javelin-behavior-phui-dropdown-menu' => '54733475', 'javelin-behavior-phui-object-box-tabs' => '2bfa2836', - 'javelin-behavior-phui-timeline-dropdown-menu' => '4d94d9c3', 'javelin-behavior-policy-control' => '9a340b3d', 'javelin-behavior-policy-rule-editor' => '5e9f347c', 'javelin-behavior-ponder-votebox' => '4e9b766b', @@ -1135,12 +1133,6 @@ return array( '4cebc641' => array( 'javelin-install', ), - '4d94d9c3' => array( - 'javelin-behavior', - 'javelin-stratcom', - 'javelin-dom', - 'phuix-dropdown-menu', - ), '4e3e79a6' => array( 'javelin-behavior', 'javelin-stratcom', @@ -1175,6 +1167,12 @@ return array( 'javelin-leader', 'javelin-json', ), + 54733475 => array( + 'javelin-behavior', + 'javelin-stratcom', + 'javelin-dom', + 'phuix-dropdown-menu', + ), '54b612ba' => array( 'javelin-color', 'javelin-install', @@ -2147,7 +2145,7 @@ return array( 'phabricator-draggable-list', 'javelin-behavior-phabricator-transaction-list', 'javelin-behavior-phabricator-show-older-transactions', - 'javelin-behavior-phui-timeline-dropdown-menu', + 'javelin-behavior-phui-dropdown-menu', 'javelin-behavior-doorkeeper-tag', 'phabricator-title', 'javelin-leader', diff --git a/resources/celerity/packages.php b/resources/celerity/packages.php index 8e40e24b3d..7a7fc2a1bd 100644 --- a/resources/celerity/packages.php +++ b/resources/celerity/packages.php @@ -66,7 +66,7 @@ return array( 'phabricator-draggable-list', 'javelin-behavior-phabricator-transaction-list', 'javelin-behavior-phabricator-show-older-transactions', - 'javelin-behavior-phui-timeline-dropdown-menu', + 'javelin-behavior-phui-dropdown-menu', 'javelin-behavior-doorkeeper-tag', 'phabricator-title', 'javelin-leader', diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php index 95666874ef..1031a2a059 100644 --- a/src/applications/phriction/controller/PhrictionDocumentController.php +++ b/src/applications/phriction/controller/PhrictionDocumentController.php @@ -192,10 +192,19 @@ final class PhrictionDocumentController $crumbs->addCrumb($view); } + $action_button = id(new PHUIButtonView()) + ->setTag('a') + ->setText(pht('Actions')) + ->setHref('#') + ->setIconFont('fa-bars') + ->addClass('phui-mobile-menu') + ->setDropdownMenu($actions); + $header = id(new PHUIHeaderView()) ->setUser($user) ->setPolicyObject($document) - ->setHeader($page_title); + ->setHeader($page_title) + ->addActionLink($action_button); if ($content) { $header->setEpoch($content->getDateCreated()); @@ -206,16 +215,12 @@ final class PhrictionDocumentController $prop_list = new PHUIPropertyGroupView(); $prop_list->addPropertyList($properties); } - $action_id = celerity_generate_unique_node_id(); - $actions->setID($action_id); $page_content = id(new PHUIDocumentView()) ->setFontKit(PHUIDocumentView::FONT_SOURCE_SANS) ->setHeader($header) - ->setActionListID($action_id) ->appendChild( array( - $actions, $prop_list, $version_note, $move_notice, diff --git a/src/view/phui/PHUIButtonView.php b/src/view/phui/PHUIButtonView.php index 26d1c59f46..8dc5392966 100644 --- a/src/view/phui/PHUIButtonView.php +++ b/src/view/phui/PHUIButtonView.php @@ -103,6 +103,18 @@ final class PHUIButtonView extends AphrontTagView { return $this->tag; } + public function setDropdownMenu(PhabricatorActionListView $actions) { + Javelin::initBehavior('phui-dropdown-menu'); + + $this->addSigil('phui-dropdown-menu'); + $this->setMetadata( + array( + 'items' => $actions, + )); + + return $this; + } + protected function getTagAttributes() { require_celerity_resource('phui-button-css'); diff --git a/src/view/phui/PHUIDocumentView.php b/src/view/phui/PHUIDocumentView.php index a27805e1c7..50749f2bb9 100644 --- a/src/view/phui/PHUIDocumentView.php +++ b/src/view/phui/PHUIDocumentView.php @@ -16,7 +16,6 @@ final class PHUIDocumentView extends AphrontTagView { private $bookdescription; private $mobileview; private $fontKit; - private $actionListID; private $fluid; public function setOffset($offset) { @@ -59,11 +58,6 @@ final class PHUIDocumentView extends AphrontTagView { return $this; } - public function setActionListID($id) { - $this->actionListID = $id; - return $this; - } - public function setFluid($fluid) { $this->fluid = $fluid; return $this; @@ -166,28 +160,6 @@ final class PHUIDocumentView extends AphrontTagView { $main_content = $this->renderChildren(); } - if ($this->actionListID) { - $icon_id = celerity_generate_unique_node_id(); - $icon = id(new PHUIIconView()) - ->setIconFont('fa-bars'); - $meta = array( - 'map' => array( - $this->actionListID => 'phabricator-action-list-toggle', - $icon_id => 'phuix-dropdown-open', - ), - ); - $mobile_menu = id(new PHUIButtonView()) - ->setTag('a') - ->setText(pht('Actions')) - ->setHref('#') - ->setIcon($icon) - ->addClass('phui-mobile-menu') - ->setID($icon_id) - ->addSigil('jx-toggle-class') - ->setMetadata($meta); - $this->header->addActionLink($mobile_menu); - } - $content_inner = phutil_tag( 'div', array( diff --git a/src/view/phui/PHUITimelineEventView.php b/src/view/phui/PHUITimelineEventView.php index bc14f5776b..541f9098dd 100644 --- a/src/view/phui/PHUITimelineEventView.php +++ b/src/view/phui/PHUITimelineEventView.php @@ -290,8 +290,8 @@ final class PHUITimelineEventView extends AphrontView { pht('Comment Actions')); if ($items) { - $sigil = 'phui-timeline-menu'; - Javelin::initBehavior('phui-timeline-dropdown-menu'); + $sigil = 'phui-dropdown-menu'; + Javelin::initBehavior('phui-dropdown-menu'); } else { $sigil = null; } diff --git a/webroot/rsrc/js/phui/behavior-phui-timeline-dropdown-menu.js b/webroot/rsrc/js/phui/behavior-phui-dropdown-menu.js similarity index 64% rename from webroot/rsrc/js/phui/behavior-phui-timeline-dropdown-menu.js rename to webroot/rsrc/js/phui/behavior-phui-dropdown-menu.js index 2c3e3ded9b..d841c87670 100644 --- a/webroot/rsrc/js/phui/behavior-phui-timeline-dropdown-menu.js +++ b/webroot/rsrc/js/phui/behavior-phui-dropdown-menu.js @@ -1,15 +1,15 @@ /** - * @provides javelin-behavior-phui-timeline-dropdown-menu + * @provides javelin-behavior-phui-dropdown-menu * @requires javelin-behavior * javelin-stratcom * javelin-dom * phuix-dropdown-menu */ -JX.behavior('phui-timeline-dropdown-menu', function() { +JX.behavior('phui-dropdown-menu', function() { - JX.Stratcom.listen('click', 'phui-timeline-menu', function(e) { - var data = e.getNodeData('phui-timeline-menu'); + JX.Stratcom.listen('click', 'phui-dropdown-menu', function(e) { + var data = e.getNodeData('phui-dropdown-menu'); if (data.menu) { return; } @@ -18,7 +18,7 @@ JX.behavior('phui-timeline-dropdown-menu', function() { var list = JX.$H(data.items).getFragment().firstChild; - var icon = e.getNode('phui-timeline-menu'); + var icon = e.getNode('phui-dropdown-menu'); data.menu = new JX.PHUIXDropdownMenu(icon); data.menu.setContent(list); data.menu.open(); From 01a8ba5a9798fcf7f1136885da388e97b8653fdb Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Tue, 19 May 2015 12:33:55 -0700 Subject: [PATCH 57/86] Transactions - make TYPE_COMMENT implementation optional Summary: Ref T6403. Conpherence keeps track of comments for message counts so we needed some special attention there. Otherwise, straight-forward. Test Plan: left a comment on a diff with inline comments. sent messages in conpherence successfully. verified unread count incremented correctly for sent messages for users. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6403 Differential Revision: https://secure.phabricator.com/D12932 --- .../audit/editor/PhabricatorAuditEditor.php | 2 -- .../editor/PhabricatorCalendarEventEditor.php | 2 -- .../conpherence/editor/ConpherenceEditor.php | 16 +++++++++++++--- .../editor/DifferentialTransactionEditor.php | 2 -- .../paste/editor/PhabricatorPasteEditor.php | 3 --- .../PhabricatorApplicationTransactionEditor.php | 2 ++ 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php index f3e7bdebb0..c628286a92 100644 --- a/src/applications/audit/editor/PhabricatorAuditEditor.php +++ b/src/applications/audit/editor/PhabricatorAuditEditor.php @@ -115,7 +115,6 @@ final class PhabricatorAuditEditor PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { - case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorAuditActionConstants::ACTION: case PhabricatorAuditActionConstants::INLINE: case PhabricatorAuditActionConstants::ADD_AUDITORS: @@ -131,7 +130,6 @@ final class PhabricatorAuditEditor PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { - case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorAuditActionConstants::ACTION: case PhabricatorAuditTransaction::TYPE_COMMIT: return; diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php index 3e3b68d08f..bb4c772012 100644 --- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php +++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php @@ -108,7 +108,6 @@ final class PhabricatorCalendarEventEditor $object->setIsAllDay((int)$xaction->getNewValue()); return; case PhabricatorCalendarEventTransaction::TYPE_INVITE: - case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: return; @@ -149,7 +148,6 @@ final class PhabricatorCalendarEventEditor } $object->attachInvitees($invitees); return; - case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: return; diff --git a/src/applications/conpherence/editor/ConpherenceEditor.php b/src/applications/conpherence/editor/ConpherenceEditor.php index ef68c2cff8..d44ebf912b 100644 --- a/src/applications/conpherence/editor/ConpherenceEditor.php +++ b/src/applications/conpherence/editor/ConpherenceEditor.php @@ -247,9 +247,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor { $make_author_recent_participant = true; switch ($xaction->getTransactionType()) { - case PhabricatorTransactions::TYPE_COMMENT: - $object->setMessageCount((int)$object->getMessageCount() + 1); - break; case ConpherenceTransactionType::TYPE_TITLE: $object->setTitle($xaction->getNewValue()); break; @@ -296,6 +293,19 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor { } } + protected function applyBuiltinInternalTransaction( + PhabricatorLiskDAO $object, + PhabricatorApplicationTransaction $xaction) { + + switch ($xaction->getTransactionType()) { + case PhabricatorTransactions::TYPE_COMMENT: + $object->setMessageCount((int)$object->getMessageCount() + 1); + break; + } + + return parent::applyBuiltinInternalTransaction($object, $xaction); + } + private function makeAuthorMostRecentParticipant( PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php index 24ffbb9031..4534123b24 100644 --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -195,7 +195,6 @@ final class DifferentialTransactionEditor case PhabricatorTransactions::TYPE_EDIT_POLICY: $object->setEditPolicy($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_COMMENT: case DifferentialTransaction::TYPE_INLINE: return; case DifferentialTransaction::TYPE_UPDATE: @@ -577,7 +576,6 @@ final class DifferentialTransactionEditor case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: return; - case PhabricatorTransactions::TYPE_COMMENT: case DifferentialTransaction::TYPE_ACTION: return; case DifferentialTransaction::TYPE_INLINE: diff --git a/src/applications/paste/editor/PhabricatorPasteEditor.php b/src/applications/paste/editor/PhabricatorPasteEditor.php index 0d64017421..7e6a18db44 100644 --- a/src/applications/paste/editor/PhabricatorPasteEditor.php +++ b/src/applications/paste/editor/PhabricatorPasteEditor.php @@ -88,8 +88,6 @@ final class PhabricatorPasteEditor case PhabricatorTransactions::TYPE_EDIT_POLICY: $object->setEditPolicy($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_COMMENT: - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -105,7 +103,6 @@ final class PhabricatorPasteEditor case PhabricatorPasteTransaction::TYPE_LANGUAGE: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_COMMENT: return; } diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index 11c11e1cc9..486a20a918 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -404,6 +404,7 @@ abstract class PhabricatorApplicationTransactionEditor case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_INLINESTATE: case PhabricatorTransactions::TYPE_EDGE: + case PhabricatorTransactions::TYPE_COMMENT: return $this->applyBuiltinInternalTransaction($object, $xaction); } @@ -500,6 +501,7 @@ abstract class PhabricatorApplicationTransactionEditor $field = $this->getCustomFieldForTransaction($object, $xaction); return $field->applyApplicationTransactionExternalEffects($xaction); case PhabricatorTransactions::TYPE_INLINESTATE: + case PhabricatorTransactions::TYPE_COMMENT: return $this->applyBuiltinExternalTransaction($object, $xaction); } From 81a475d5a6b48661ee518d0c30ddeed4e78142a0 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Tue, 19 May 2015 12:58:18 -0700 Subject: [PATCH 58/86] Transactions - make implementing TYPE_XXXX_POLICY transactions optional Summary: Ref T6403. This was actually simple stuff. Test Plan: changed the edit policy of a paste. changed the edit and join policy of a phame blog. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6403 Differential Revision: https://secure.phabricator.com/D12933 --- .../almanac/editor/AlmanacDeviceEditor.php | 5 ---- .../almanac/editor/AlmanacNetworkEditor.php | 5 ---- .../almanac/editor/AlmanacServiceEditor.php | 5 ---- .../editor/PhabricatorCalendarEventEditor.php | 5 ---- ...ricatorDashboardPanelTransactionEditor.php | 8 ----- .../PhabricatorDashboardTransactionEditor.php | 8 ----- .../editor/DifferentialDiffEditor.php | 4 --- .../editor/DifferentialTransactionEditor.php | 15 ---------- .../files/editor/PhabricatorFileEditor.php | 3 -- .../fund/editor/FundInitiativeEditor.php | 6 ---- .../PassphraseCredentialTransactionEditor.php | 8 ----- .../paste/editor/PhabricatorPasteEditor.php | 8 ----- .../phame/editor/PhameBlogEditor.php | 12 -------- .../phlux/editor/PhluxVariableEditor.php | 8 ----- .../editor/PhortuneMerchantEditor.php | 3 -- .../PhabricatorProjectTransactionEditor.php | 12 -------- ...habricatorApplicationTransactionEditor.php | 29 ++++++++++++------- 17 files changed, 18 insertions(+), 126 deletions(-) diff --git a/src/applications/almanac/editor/AlmanacDeviceEditor.php b/src/applications/almanac/editor/AlmanacDeviceEditor.php index 211788e441..82263e66c4 100644 --- a/src/applications/almanac/editor/AlmanacDeviceEditor.php +++ b/src/applications/almanac/editor/AlmanacDeviceEditor.php @@ -55,8 +55,6 @@ final class AlmanacDeviceEditor $object->setName($xaction->getNewValue()); return; case AlmanacDeviceTransaction::TYPE_INTERFACE: - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: return; } @@ -69,9 +67,6 @@ final class AlmanacDeviceEditor switch ($xaction->getTransactionType()) { case AlmanacDeviceTransaction::TYPE_NAME: - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: - return; case AlmanacDeviceTransaction::TYPE_INTERFACE: $old = $xaction->getOldValue(); if ($old) { diff --git a/src/applications/almanac/editor/AlmanacNetworkEditor.php b/src/applications/almanac/editor/AlmanacNetworkEditor.php index 81f0e63d46..4e49cce163 100644 --- a/src/applications/almanac/editor/AlmanacNetworkEditor.php +++ b/src/applications/almanac/editor/AlmanacNetworkEditor.php @@ -52,9 +52,6 @@ final class AlmanacNetworkEditor case AlmanacNetworkTransaction::TYPE_NAME: $object->setName($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -66,8 +63,6 @@ final class AlmanacNetworkEditor switch ($xaction->getTransactionType()) { case AlmanacNetworkTransaction::TYPE_NAME: - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: return; } diff --git a/src/applications/almanac/editor/AlmanacServiceEditor.php b/src/applications/almanac/editor/AlmanacServiceEditor.php index 928696dbcd..868f31d026 100644 --- a/src/applications/almanac/editor/AlmanacServiceEditor.php +++ b/src/applications/almanac/editor/AlmanacServiceEditor.php @@ -61,9 +61,6 @@ final class AlmanacServiceEditor case AlmanacServiceTransaction::TYPE_LOCK: $object->setIsLocked((int)$xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -75,8 +72,6 @@ final class AlmanacServiceEditor switch ($xaction->getTransactionType()) { case AlmanacServiceTransaction::TYPE_NAME: - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: return; case AlmanacServiceTransaction::TYPE_LOCK: $service = id(new AlmanacServiceQuery()) diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php index bb4c772012..203f29222b 100644 --- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php +++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php @@ -108,8 +108,6 @@ final class PhabricatorCalendarEventEditor $object->setIsAllDay((int)$xaction->getNewValue()); return; case PhabricatorCalendarEventTransaction::TYPE_INVITE: - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: return; } @@ -148,9 +146,6 @@ final class PhabricatorCalendarEventEditor } $object->attachInvitees($invitees); return; - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: - return; } return parent::applyCustomExternalTransaction($object, $xaction); diff --git a/src/applications/dashboard/editor/PhabricatorDashboardPanelTransactionEditor.php b/src/applications/dashboard/editor/PhabricatorDashboardPanelTransactionEditor.php index 6f76e2618e..2a56721442 100644 --- a/src/applications/dashboard/editor/PhabricatorDashboardPanelTransactionEditor.php +++ b/src/applications/dashboard/editor/PhabricatorDashboardPanelTransactionEditor.php @@ -62,12 +62,6 @@ final class PhabricatorDashboardPanelTransactionEditor case PhabricatorDashboardPanelTransaction::TYPE_ARCHIVE: $object->setIsArchived((int)$xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_VIEW_POLICY: - $object->setViewPolicy($xaction->getNewValue()); - return; - case PhabricatorTransactions::TYPE_EDIT_POLICY: - $object->setEditPolicy($xaction->getNewValue()); - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -80,8 +74,6 @@ final class PhabricatorDashboardPanelTransactionEditor switch ($xaction->getTransactionType()) { case PhabricatorDashboardPanelTransaction::TYPE_NAME: case PhabricatorDashboardPanelTransaction::TYPE_ARCHIVE: - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: return; } diff --git a/src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php b/src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php index ed16a22a9c..4b1b6533d6 100644 --- a/src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php +++ b/src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php @@ -109,12 +109,6 @@ final class PhabricatorDashboardTransactionEditor } $object->setLayoutConfigFromObject($new_layout); return; - case PhabricatorTransactions::TYPE_VIEW_POLICY: - $object->setViewPolicy($xaction->getNewValue()); - return; - case PhabricatorTransactions::TYPE_EDIT_POLICY: - $object->setEditPolicy($xaction->getNewValue()); - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -127,8 +121,6 @@ final class PhabricatorDashboardTransactionEditor switch ($xaction->getTransactionType()) { case PhabricatorDashboardTransaction::TYPE_NAME: case PhabricatorDashboardTransaction::TYPE_LAYOUT_MODE: - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: return; } diff --git a/src/applications/differential/editor/DifferentialDiffEditor.php b/src/applications/differential/editor/DifferentialDiffEditor.php index 25385899b1..235ab84c21 100644 --- a/src/applications/differential/editor/DifferentialDiffEditor.php +++ b/src/applications/differential/editor/DifferentialDiffEditor.php @@ -62,9 +62,6 @@ final class DifferentialDiffEditor $dict = $this->diffDataDict; $this->updateDiffFromDict($object, $dict); return; - case PhabricatorTransactions::TYPE_VIEW_POLICY: - $object->setViewPolicy($xaction->getNewValue()); - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -76,7 +73,6 @@ final class DifferentialDiffEditor switch ($xaction->getTransactionType()) { case DifferentialDiffTransaction::TYPE_DIFF_CREATE: - case PhabricatorTransactions::TYPE_VIEW_POLICY: return; } diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php index 4534123b24..d195d91833 100644 --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -71,10 +71,6 @@ final class DifferentialTransactionEditor PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { - case PhabricatorTransactions::TYPE_VIEW_POLICY: - return $object->getViewPolicy(); - case PhabricatorTransactions::TYPE_EDIT_POLICY: - return $object->getEditPolicy(); case DifferentialTransaction::TYPE_ACTION: return null; case DifferentialTransaction::TYPE_INLINE: @@ -95,8 +91,6 @@ final class DifferentialTransactionEditor PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: case DifferentialTransaction::TYPE_ACTION: case DifferentialTransaction::TYPE_UPDATE: return $xaction->getNewValue(); @@ -189,12 +183,6 @@ final class DifferentialTransactionEditor $status_abandoned = ArcanistDifferentialRevisionStatus::ABANDONED; switch ($xaction->getTransactionType()) { - case PhabricatorTransactions::TYPE_VIEW_POLICY: - $object->setViewPolicy($xaction->getNewValue()); - return; - case PhabricatorTransactions::TYPE_EDIT_POLICY: - $object->setEditPolicy($xaction->getNewValue()); - return; case DifferentialTransaction::TYPE_INLINE: return; case DifferentialTransaction::TYPE_UPDATE: @@ -573,9 +561,6 @@ final class DifferentialTransactionEditor PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: - return; case DifferentialTransaction::TYPE_ACTION: return; case DifferentialTransaction::TYPE_INLINE: diff --git a/src/applications/files/editor/PhabricatorFileEditor.php b/src/applications/files/editor/PhabricatorFileEditor.php index a611e3da3f..9cd81a4c1e 100644 --- a/src/applications/files/editor/PhabricatorFileEditor.php +++ b/src/applications/files/editor/PhabricatorFileEditor.php @@ -47,9 +47,6 @@ final class PhabricatorFileEditor PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { - case PhabricatorTransactions::TYPE_VIEW_POLICY: - $object->setViewPolicy($xaction->getNewValue()); - break; case PhabricatorFileTransaction::TYPE_NAME: $object->setName($xaction->getNewValue()); break; diff --git a/src/applications/fund/editor/FundInitiativeEditor.php b/src/applications/fund/editor/FundInitiativeEditor.php index 13296be13f..679e1b5771 100644 --- a/src/applications/fund/editor/FundInitiativeEditor.php +++ b/src/applications/fund/editor/FundInitiativeEditor.php @@ -102,9 +102,6 @@ final class FundInitiativeEditor $object->setTotalAsCurrency($total); return; - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -154,9 +151,6 @@ final class FundInitiativeEditor $editor->applyTransactions($backer, $subx); return; - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: - return; } return parent::applyCustomExternalTransaction($object, $xaction); diff --git a/src/applications/passphrase/editor/PassphraseCredentialTransactionEditor.php b/src/applications/passphrase/editor/PassphraseCredentialTransactionEditor.php index 3fbe35c249..aacc89c027 100644 --- a/src/applications/passphrase/editor/PassphraseCredentialTransactionEditor.php +++ b/src/applications/passphrase/editor/PassphraseCredentialTransactionEditor.php @@ -108,12 +108,6 @@ final class PassphraseCredentialTransactionEditor } } return; - case PhabricatorTransactions::TYPE_VIEW_POLICY: - $object->setViewPolicy($xaction->getNewValue()); - return; - case PhabricatorTransactions::TYPE_EDIT_POLICY: - $object->setEditPolicy($xaction->getNewValue()); - return; case PassphraseCredentialTransaction::TYPE_LOOKEDATSECRET: return; case PassphraseCredentialTransaction::TYPE_LOCK: @@ -140,8 +134,6 @@ final class PassphraseCredentialTransactionEditor case PassphraseCredentialTransaction::TYPE_LOOKEDATSECRET: case PassphraseCredentialTransaction::TYPE_LOCK: case PassphraseCredentialTransaction::TYPE_CONDUIT: - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: return; } diff --git a/src/applications/paste/editor/PhabricatorPasteEditor.php b/src/applications/paste/editor/PhabricatorPasteEditor.php index 7e6a18db44..9c966bf724 100644 --- a/src/applications/paste/editor/PhabricatorPasteEditor.php +++ b/src/applications/paste/editor/PhabricatorPasteEditor.php @@ -82,12 +82,6 @@ final class PhabricatorPasteEditor case PhabricatorPasteTransaction::TYPE_LANGUAGE: $object->setLanguage($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_VIEW_POLICY: - $object->setViewPolicy($xaction->getNewValue()); - return; - case PhabricatorTransactions::TYPE_EDIT_POLICY: - $object->setEditPolicy($xaction->getNewValue()); - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -101,8 +95,6 @@ final class PhabricatorPasteEditor case PhabricatorPasteTransaction::TYPE_CONTENT: case PhabricatorPasteTransaction::TYPE_TITLE: case PhabricatorPasteTransaction::TYPE_LANGUAGE: - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: return; } diff --git a/src/applications/phame/editor/PhameBlogEditor.php b/src/applications/phame/editor/PhameBlogEditor.php index f44be159c8..289b55cf57 100644 --- a/src/applications/phame/editor/PhameBlogEditor.php +++ b/src/applications/phame/editor/PhameBlogEditor.php @@ -67,15 +67,6 @@ final class PhameBlogEditor return $object->setDomain($xaction->getNewValue()); case PhameBlogTransaction::TYPE_SKIN: return $object->setSkin($xaction->getNewValue()); - case PhabricatorTransactions::TYPE_VIEW_POLICY: - $object->setViewPolicy($xaction->getNewValue()); - return; - case PhabricatorTransactions::TYPE_EDIT_POLICY: - $object->setEditPolicy($xaction->getNewValue()); - return; - case PhabricatorTransactions::TYPE_JOIN_POLICY: - $object->setJoinPolicy($xaction->getNewValue()); - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -90,9 +81,6 @@ final class PhameBlogEditor case PhameBlogTransaction::TYPE_DESCRIPTION: case PhameBlogTransaction::TYPE_DOMAIN: case PhameBlogTransaction::TYPE_SKIN: - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_JOIN_POLICY: return; } diff --git a/src/applications/phlux/editor/PhluxVariableEditor.php b/src/applications/phlux/editor/PhluxVariableEditor.php index 9745ee50c8..2e36ba8162 100644 --- a/src/applications/phlux/editor/PhluxVariableEditor.php +++ b/src/applications/phlux/editor/PhluxVariableEditor.php @@ -54,12 +54,6 @@ final class PhluxVariableEditor case PhluxTransaction::TYPE_EDIT_VALUE: $object->setVariableValue($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_VIEW_POLICY: - $object->setViewPolicy($xaction->getNewValue()); - return; - case PhabricatorTransactions::TYPE_EDIT_POLICY: - $object->setEditPolicy($xaction->getNewValue()); - return; } return parent::applyCustomInternalTransaction($object, $xaction); } @@ -70,8 +64,6 @@ final class PhluxVariableEditor switch ($xaction->getTransactionType()) { case PhluxTransaction::TYPE_EDIT_KEY: case PhluxTransaction::TYPE_EDIT_VALUE: - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: return; } return parent::applyCustomExternalTransaction($object, $xaction); diff --git a/src/applications/phortune/editor/PhortuneMerchantEditor.php b/src/applications/phortune/editor/PhortuneMerchantEditor.php index ae8c1fda54..1c659c0d5f 100644 --- a/src/applications/phortune/editor/PhortuneMerchantEditor.php +++ b/src/applications/phortune/editor/PhortuneMerchantEditor.php @@ -59,8 +59,6 @@ final class PhortuneMerchantEditor case PhortuneMerchantTransaction::TYPE_DESCRIPTION: $object->setDescription($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_VIEW_POLICY: - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -73,7 +71,6 @@ final class PhortuneMerchantEditor switch ($xaction->getTransactionType()) { case PhortuneMerchantTransaction::TYPE_NAME: case PhortuneMerchantTransaction::TYPE_DESCRIPTION: - case PhabricatorTransactions::TYPE_VIEW_POLICY: return; } diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php index 348ba53c4d..307e186dbd 100644 --- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php +++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php @@ -102,15 +102,6 @@ final class PhabricatorProjectTransactionEditor case PhabricatorProjectTransaction::TYPE_LOCKED: $object->setIsMembershipLocked($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_VIEW_POLICY: - $object->setViewPolicy($xaction->getNewValue()); - return; - case PhabricatorTransactions::TYPE_EDIT_POLICY: - $object->setEditPolicy($xaction->getNewValue()); - return; - case PhabricatorTransactions::TYPE_JOIN_POLICY: - $object->setJoinPolicy($xaction->getNewValue()); - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -157,9 +148,6 @@ final class PhabricatorProjectTransactionEditor } return; - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_JOIN_POLICY: case PhabricatorProjectTransaction::TYPE_STATUS: case PhabricatorProjectTransaction::TYPE_IMAGE: case PhabricatorProjectTransaction::TYPE_ICON: diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index 486a20a918..0329613b0e 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -388,19 +388,12 @@ abstract class PhabricatorApplicationTransactionEditor case PhabricatorTransactions::TYPE_BUILDABLE: case PhabricatorTransactions::TYPE_TOKEN: return; - case PhabricatorTransactions::TYPE_VIEW_POLICY: - $object->setViewPolicy($xaction->getNewValue()); - break; - case PhabricatorTransactions::TYPE_EDIT_POLICY: - $object->setEditPolicy($xaction->getNewValue()); - break; - case PhabricatorTransactions::TYPE_JOIN_POLICY: - $object->setJoinPolicy($xaction->getNewValue()); - break; - case PhabricatorTransactions::TYPE_CUSTOMFIELD: $field = $this->getCustomFieldForTransaction($object, $xaction); return $field->applyApplicationTransactionInternalEffects($xaction); + case PhabricatorTransactions::TYPE_VIEW_POLICY: + case PhabricatorTransactions::TYPE_EDIT_POLICY: + case PhabricatorTransactions::TYPE_JOIN_POLICY: case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_INLINESTATE: case PhabricatorTransactions::TYPE_EDGE: @@ -500,6 +493,9 @@ abstract class PhabricatorApplicationTransactionEditor case PhabricatorTransactions::TYPE_CUSTOMFIELD: $field = $this->getCustomFieldForTransaction($object, $xaction); return $field->applyApplicationTransactionExternalEffects($xaction); + case PhabricatorTransactions::TYPE_VIEW_POLICY: + case PhabricatorTransactions::TYPE_EDIT_POLICY: + case PhabricatorTransactions::TYPE_JOIN_POLICY: case PhabricatorTransactions::TYPE_INLINESTATE: case PhabricatorTransactions::TYPE_COMMENT: return $this->applyBuiltinExternalTransaction($object, $xaction); @@ -534,7 +530,18 @@ abstract class PhabricatorApplicationTransactionEditor protected function applyBuiltinInternalTransaction( PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { - return; + + switch ($xaction->getTransactionType()) { + case PhabricatorTransactions::TYPE_VIEW_POLICY: + $object->setViewPolicy($xaction->getNewValue()); + break; + case PhabricatorTransactions::TYPE_EDIT_POLICY: + $object->setEditPolicy($xaction->getNewValue()); + break; + case PhabricatorTransactions::TYPE_JOIN_POLICY: + $object->setJoinPolicy($xaction->getNewValue()); + break; + } } protected function applyBuiltinExternalTransaction( From 3845057efb8b8e7edd5984e8ca525f6f592c3e0f Mon Sep 17 00:00:00 2001 From: lkassianik Date: Tue, 19 May 2015 13:09:28 -0700 Subject: [PATCH 59/86] Calendar events should actually have an icon now. Summary: Ref T7936, Calendar events should actually have an icon now. Test Plan: Edit event, edit icon, save, observe transaction feed. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T7936 Differential Revision: https://secure.phabricator.com/D12934 --- resources/celerity/map.php | 2 ++ .../20150519.calendar.calendaricon.sql | 5 +++ ...PhabricatorCalendarEventEditController.php | 27 ++++++++++++++-- ...PhabricatorCalendarEventViewController.php | 6 ++++ .../editor/PhabricatorCalendarEventEditor.php | 12 ++++++- .../calendar/icon/PhabricatorCalendarIcon.php | 32 +++++++++---------- .../storage/PhabricatorCalendarEvent.php | 5 +++ .../PhabricatorCalendarEventTransaction.php | 16 ++++++++++ 8 files changed, 85 insertions(+), 20 deletions(-) create mode 100644 resources/sql/autopatches/20150519.calendar.calendaricon.sql diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 1769c81f76..c2b79e7a10 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -38,6 +38,7 @@ return array( 'rsrc/css/application/base/notification-menu.css' => '3c9d8aa1', 'rsrc/css/application/base/phabricator-application-launch-view.css' => '16ca323f', 'rsrc/css/application/base/standard-page-view.css' => '61e68a55', + 'rsrc/css/application/calendar/calendar-icon.css' => '98ce946d', 'rsrc/css/application/chatlog/chatlog.css' => '852140ff', 'rsrc/css/application/conduit/conduit-api.css' => '7bc725c4', 'rsrc/css/application/config/config-options.css' => '7fedf08b', @@ -492,6 +493,7 @@ return array( 'aphront-two-column-view-css' => '16ab3ad2', 'aphront-typeahead-control-css' => '0e403212', 'auth-css' => '44975d4b', + 'calendar-icon-css' => '98ce946d', 'changeset-view-manager' => '58562350', 'conduit-api-css' => '7bc725c4', 'config-options-css' => '7fedf08b', diff --git a/resources/sql/autopatches/20150519.calendar.calendaricon.sql b/resources/sql/autopatches/20150519.calendar.calendaricon.sql new file mode 100644 index 0000000000..d91520df0a --- /dev/null +++ b/resources/sql/autopatches/20150519.calendar.calendaricon.sql @@ -0,0 +1,5 @@ +ALTER TABLE {$NAMESPACE}_calendar.calendar_event + ADD COLUMN icon VARCHAR(32) COLLATE {$COLLATE_TEXT} NOT NULL; + +UPDATE {$NAMESPACE}_calendar.calendar_event + SET icon = "fa-calendar" WHERE icon = ""; diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php index 900b3ad56b..cf9797da45 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php @@ -13,8 +13,7 @@ final class PhabricatorCalendarEventEditController return !$this->id; } - public function processRequest() { - $request = $this->getRequest(); + public function handleRequest(AphrontRequest $request) { $user = $request->getUser(); $user_phid = $user->getPHID(); $error_name = true; @@ -74,6 +73,7 @@ final class PhabricatorCalendarEventEditController $name = $event->getName(); $description = $event->getDescription(); $is_all_day = $event->getIsAllDay(); + $icon = $event->getIcon(); $current_policies = id(new PhabricatorPolicyQuery()) ->setViewer($user) @@ -95,6 +95,7 @@ final class PhabricatorCalendarEventEditController $edit_policy = $request->getStr('editPolicy'); $view_policy = $request->getStr('viewPolicy'); $is_all_day = $request->getStr('isAllDay'); + $icon = $request->getStr('icon'); $invitees = $request->getArr('invitees'); $new_invitees = $this->getNewInviteeList($invitees, $event); @@ -116,6 +117,11 @@ final class PhabricatorCalendarEventEditController PhabricatorCalendarEventTransaction::TYPE_ALL_DAY) ->setNewValue($is_all_day); + $xactions[] = id(new PhabricatorCalendarEventTransaction()) + ->setTransactionType( + PhabricatorCalendarEventTransaction::TYPE_ICON) + ->setNewValue($icon); + $xactions[] = id(new PhabricatorCalendarEventTransaction()) ->setTransactionType( PhabricatorCalendarEventTransaction::TYPE_START_DATE) @@ -246,6 +252,20 @@ final class PhabricatorCalendarEventEditController ->setUser($user) ->setDatasource(new PhabricatorMetaMTAMailableDatasource()); + if ($this->isCreate()) { + $icon_uri = $this->getApplicationURI('icon/'); + } else { + $icon_uri = $this->getApplicationURI('icon/'.$event->getID().'/'); + } + $icon_display = PhabricatorCalendarIcon::renderIconForChooser($icon); + $icon = id(new AphrontFormChooseButtonControl()) + ->setLabel(pht('Icon')) + ->setName('icon') + ->setDisplayValue($icon_display) + ->setButtonText(pht('Choose Icon...')) + ->setChooseURI($icon_uri) + ->setValue($icon); + $form = id(new AphrontFormView()) ->setUser($user) ->appendChild($name) @@ -256,7 +276,8 @@ final class PhabricatorCalendarEventEditController ->appendControl($edit_policies) ->appendControl($subscribers) ->appendControl($invitees) - ->appendChild($description); + ->appendChild($description) + ->appendChild($icon); if ($request->isAjax()) { diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php index 742ec95e3f..656446c2a3 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php @@ -264,6 +264,12 @@ final class PhabricatorCalendarEventViewController $properties->invokeWillRenderEvent(); + $icon_display = PhabricatorCalendarIcon::renderIconForChooser( + $event->getIcon()); + $properties->addProperty( + pht('Icon'), + $icon_display); + $properties->addSectionHeader( pht('Description'), PHUIPropertyListView::ICON_SUMMARY); diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php index 203f29222b..291f6c1865 100644 --- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php +++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php @@ -21,6 +21,7 @@ final class PhabricatorCalendarEventEditor $types[] = PhabricatorCalendarEventTransaction::TYPE_CANCEL; $types[] = PhabricatorCalendarEventTransaction::TYPE_INVITE; $types[] = PhabricatorCalendarEventTransaction::TYPE_ALL_DAY; + $types[] = PhabricatorCalendarEventTransaction::TYPE_ICON; $types[] = PhabricatorTransactions::TYPE_COMMENT; $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY; @@ -45,6 +46,8 @@ final class PhabricatorCalendarEventEditor return $object->getIsCancelled(); case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY: return (int)$object->getIsAllDay(); + case PhabricatorCalendarEventTransaction::TYPE_ICON: + return $object->getIcon(); case PhabricatorCalendarEventTransaction::TYPE_INVITE: $map = $xaction->getNewValue(); $phids = array_keys($map); @@ -73,6 +76,7 @@ final class PhabricatorCalendarEventEditor case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION: case PhabricatorCalendarEventTransaction::TYPE_CANCEL: case PhabricatorCalendarEventTransaction::TYPE_INVITE: + case PhabricatorCalendarEventTransaction::TYPE_ICON: return $xaction->getNewValue(); case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY: return (int)$xaction->getNewValue(); @@ -107,6 +111,9 @@ final class PhabricatorCalendarEventEditor case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY: $object->setIsAllDay((int)$xaction->getNewValue()); return; + case PhabricatorCalendarEventTransaction::TYPE_ICON: + $object->setIcon($xaction->getNewValue()); + return; case PhabricatorCalendarEventTransaction::TYPE_INVITE: return; } @@ -125,6 +132,7 @@ final class PhabricatorCalendarEventEditor case PhabricatorCalendarEventTransaction::TYPE_DESCRIPTION: case PhabricatorCalendarEventTransaction::TYPE_CANCEL: case PhabricatorCalendarEventTransaction::TYPE_ALL_DAY: + case PhabricatorCalendarEventTransaction::TYPE_ICON: return; case PhabricatorCalendarEventTransaction::TYPE_INVITE: $map = $xaction->getNewValue(); @@ -171,6 +179,8 @@ final class PhabricatorCalendarEventEditor $invalidate_phids = array(); foreach ($xactions as $xaction) { switch ($xaction->getTransactionType()) { + case PhabricatorCalendarEventTransaction::TYPE_ICON: + break; case PhabricatorCalendarEventTransaction::TYPE_START_DATE: case PhabricatorCalendarEventTransaction::TYPE_END_DATE: case PhabricatorCalendarEventTransaction::TYPE_CANCEL: @@ -329,7 +339,7 @@ final class PhabricatorCalendarEventEditor PhabricatorCalendarEventTransaction::MAILTAG_CONTENT => pht( "An event's name, status, invite list, ". - "and description changes."), + "icon, and description changes."), PhabricatorCalendarEventTransaction::MAILTAG_RESCHEDULE => pht( "An event's start and end date ". diff --git a/src/applications/calendar/icon/PhabricatorCalendarIcon.php b/src/applications/calendar/icon/PhabricatorCalendarIcon.php index 904ffee761..9ba4b00c01 100644 --- a/src/applications/calendar/icon/PhabricatorCalendarIcon.php +++ b/src/applications/calendar/icon/PhabricatorCalendarIcon.php @@ -5,22 +5,22 @@ final class PhabricatorCalendarIcon extends Phobject { public static function getIconMap() { return array( - 'fa-briefcase' => pht('Briefcase'), - 'fa-tags' => pht('Tag'), - 'fa-folder' => pht('Folder'), - 'fa-users' => pht('Team'), - 'fa-bug' => pht('Bug'), - 'fa-trash-o' => pht('Garbage'), - 'fa-calendar' => pht('Deadline'), - 'fa-flag-checkered' => pht('Goal'), - 'fa-envelope' => pht('Communication'), - 'fa-truck' => pht('Release'), - 'fa-lock' => pht('Policy'), - 'fa-umbrella' => pht('An Umbrella'), - 'fa-cloud' => pht('The Cloud'), - 'fa-building' => pht('Company'), - 'fa-credit-card' => pht('Accounting'), - 'fa-flask' => pht('Experimental'), + 'fa-calendar' => pht('Default'), + 'fa-glass' => pht('Party'), + 'fa-plane' => pht('Travel'), + 'fa-plus-square' => pht('Health / Appointment'), + 'fa-rocket' => pht('Sabatical / Leave'), + 'fa-home' => pht('Working From Home'), + 'fa-tree' => pht('Holiday'), + 'fa-gamepad' => pht('Staycation'), + 'fa-coffee' => pht('Coffee Meeting'), + 'fa-film' => pht('Movie'), + 'fa-users' => pht('Meeting'), + 'fa-cutlery' => pht('Meal'), + 'fa-paw' => pht('Pet Activity'), + 'fa-institution' => pht('Official Business'), + 'fa-bus' => pht('Field Trip'), + 'fa-microphone' => pht('Conference'), ); } diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php index 42bf5f9e05..3055e5e4e6 100644 --- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php @@ -17,11 +17,14 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO protected $description; protected $isCancelled; protected $isAllDay; + protected $icon; protected $mailKey; protected $viewPolicy; protected $editPolicy; + const DEFAULT_ICON = 'fa-calendar'; + private $invitees = self::ATTACHABLE; private $appliedViewer; @@ -35,6 +38,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO ->setUserPHID($actor->getPHID()) ->setIsCancelled(0) ->setIsAllDay(0) + ->setIcon(self::DEFAULT_ICON) ->setViewPolicy($actor->getPHID()) ->setEditPolicy($actor->getPHID()) ->attachInvitees(array()) @@ -166,6 +170,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO 'description' => 'text', 'isCancelled' => 'bool', 'isAllDay' => 'bool', + 'icon' => 'text32', 'mailKey' => 'bytes20', ), self::CONFIG_KEY_SCHEMA => array( diff --git a/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php b/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php index 91b5d5231f..767208648e 100644 --- a/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php @@ -9,6 +9,7 @@ final class PhabricatorCalendarEventTransaction const TYPE_DESCRIPTION = 'calendar.description'; const TYPE_CANCEL = 'calendar.cancel'; const TYPE_ALL_DAY = 'calendar.allday'; + const TYPE_ICON = 'calendar.icon'; const TYPE_INVITE = 'calendar.invite'; const MAILTAG_RESCHEDULE = 'calendar-reschedule'; @@ -66,6 +67,8 @@ final class PhabricatorCalendarEventTransaction public function getIcon() { switch ($this->getTransactionType()) { + case self::TYPE_ICON: + return $this->getNewValue(); case self::TYPE_NAME: case self::TYPE_START_DATE: case self::TYPE_END_DATE: @@ -130,6 +133,12 @@ final class PhabricatorCalendarEventTransaction '%s converted this from an all day event.', $this->renderHandleLink($author_phid)); } + case self::TYPE_ICON: + return pht( + '%s set this event\'s icon to %s.', + $this->renderHandleLink($author_phid), + PhabricatorCalendarIcon::getLabel($new)); + break; case self::TYPE_CANCEL: if ($new) { return pht( @@ -292,6 +301,12 @@ final class PhabricatorCalendarEventTransaction $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid)); } + case self::TYPE_ICON: + return pht( + '%s set the icon for %s to %s.', + $this->renderHandleLink($author_phid), + $this->renderHandleLink($object_phid), + PhabricatorCalendarIcon::getLabel($new)); case self::TYPE_CANCEL: if ($new) { return pht( @@ -449,6 +464,7 @@ final class PhabricatorCalendarEventTransaction case self::TYPE_NAME: case self::TYPE_DESCRIPTION: case self::TYPE_INVITE: + case self::TYPE_ICON: $tags[] = self::MAILTAG_CONTENT; break; case self::TYPE_START_DATE: From 596db64ee62c645af77270ac8e95ecbe565e5eac Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Tue, 19 May 2015 13:20:04 -0700 Subject: [PATCH 60/86] Conpherence - make solo conversations be titled with viewer's name Summary: Fixes T8251. I think this used to be "lucky handle" when it was all one giant terrible function, so restore previous functionality and have the title be the viewer's name in this case. Test Plan: rocked a solo conpherence and saw my username as the title Reviewers: chad, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8251 Differential Revision: https://secure.phabricator.com/D12935 --- .../conpherence/storage/ConpherenceThread.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/applications/conpherence/storage/ConpherenceThread.php b/src/applications/conpherence/storage/ConpherenceThread.php index 8ed0e4fd18..36654713d5 100644 --- a/src/applications/conpherence/storage/ConpherenceThread.php +++ b/src/applications/conpherence/storage/ConpherenceThread.php @@ -231,9 +231,14 @@ final class ConpherenceThread extends ConpherenceDAO $handles = $this->getHandles(); $phids = $this->getOtherRecentParticipantPHIDs($viewer); - $limit = 3; - $more = (count($phids) > $limit); - $phids = array_slice($phids, 0, $limit); + if (count($phids) == 0) { + $phids[] = $viewer->getPHID(); + $more = false; + } else { + $limit = 3; + $more = (count($phids) > $limit); + $phids = array_slice($phids, 0, $limit); + } $names = array_select_keys($handles, $phids); $names = mpull($names, 'getName'); From 2f80c01236726b9266b180cde75b70206ea8751c Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Wed, 20 May 2015 06:58:25 +1000 Subject: [PATCH 61/86] Remove arcanist projects from DiffusionRequest Summary: Ref T7604. This data is no longer used. Depends on D12894. Test Plan: `grep` Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7604 Differential Revision: https://secure.phabricator.com/D12895 --- .../diffusion/request/DiffusionRequest.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/applications/diffusion/request/DiffusionRequest.php b/src/applications/diffusion/request/DiffusionRequest.php index 69ea4938af..e7296e9cc1 100644 --- a/src/applications/diffusion/request/DiffusionRequest.php +++ b/src/applications/diffusion/request/DiffusionRequest.php @@ -22,7 +22,6 @@ abstract class DiffusionRequest { protected $repository; protected $repositoryCommit; protected $repositoryCommitData; - protected $arcanistProjects; private $isClusterRequest = false; private $initFromConduit = true; @@ -401,16 +400,6 @@ abstract class DiffusionRequest { return $this->repositoryCommit; } - public function loadArcanistProjects() { - if (empty($this->arcanistProjects)) { - $projects = id(new PhabricatorRepositoryArcanistProject())->loadAllWhere( - 'repositoryID = %d', - $this->getRepository()->getID()); - $this->arcanistProjects = $projects; - } - return $this->arcanistProjects; - } - public function loadCommitData() { if (empty($this->repositoryCommitData)) { $commit = $this->loadCommit(); From 16a8ed72bddaf459a02ee7cd95f232ad0045c05c Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Wed, 20 May 2015 06:59:58 +1000 Subject: [PATCH 62/86] Modernize search engine selection Summary: Remove the `PhabricatorDefaultSearchEngineSelector` class. This is quite similar to D12053. Test Plan: Went to `/view/PhabricatorSearchApplication/` and saw the storage engine configuration. Set `search.elastic.host` and saw the highlighted storage engine change. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D12670 --- src/__phutil_library_map__.php | 9 +- ...=> PhabricatorElasticSearchSetupCheck.php} | 13 ++- .../PhabricatorExtraConfigSetupCheck.php | 4 + .../check/PhabricatorMySQLSetupCheck.php | 13 ++- ...atorFilesApplicationStorageEnginePanel.php | 2 - .../maniphest/query/ManiphestTaskQuery.php | 2 +- ...torSearchApplicationStorageEnginePanel.php | 82 +++++++++++++ .../config/PhabricatorSearchConfigOptions.php | 15 --- .../engine/PhabricatorElasticSearchEngine.php | 30 ++++- .../engine/PhabricatorMySQLSearchEngine.php | 22 +++- .../search/engine/PhabricatorSearchEngine.php | 109 +++++++++++++++++- .../PhabricatorSearchDocumentIndexer.php | 2 +- ...habricatorSearchManagementInitWorkflow.php | 2 +- .../query/PhabricatorSearchDocumentQuery.php | 2 +- ...PhabricatorDefaultSearchEngineSelector.php | 19 --- .../PhabricatorSearchEngineSelector.php | 15 --- 16 files changed, 263 insertions(+), 78 deletions(-) rename src/applications/config/check/{PhabricatorElasticSetupCheck.php => PhabricatorElasticSearchSetupCheck.php} (76%) create mode 100644 src/applications/search/applicationpanel/PhabricatorSearchApplicationStorageEnginePanel.php delete mode 100644 src/applications/search/selector/PhabricatorDefaultSearchEngineSelector.php delete mode 100644 src/applications/search/selector/PhabricatorSearchEngineSelector.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 0c4b286fe7..79e98ed18a 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1744,7 +1744,6 @@ phutil_register_library_map(array( 'PhabricatorDatabaseSetupCheck' => 'applications/config/check/PhabricatorDatabaseSetupCheck.php', 'PhabricatorDateTimeSettingsPanel' => 'applications/settings/panel/PhabricatorDateTimeSettingsPanel.php', 'PhabricatorDebugController' => 'applications/system/controller/PhabricatorDebugController.php', - 'PhabricatorDefaultSearchEngineSelector' => 'applications/search/selector/PhabricatorDefaultSearchEngineSelector.php', 'PhabricatorDestructibleInterface' => 'applications/system/interface/PhabricatorDestructibleInterface.php', 'PhabricatorDestructionEngine' => 'applications/system/engine/PhabricatorDestructionEngine.php', 'PhabricatorDeveloperConfigOptions' => 'applications/config/option/PhabricatorDeveloperConfigOptions.php', @@ -1776,7 +1775,7 @@ phutil_register_library_map(array( 'PhabricatorEdgeType' => 'infrastructure/edges/type/PhabricatorEdgeType.php', 'PhabricatorEditor' => 'infrastructure/PhabricatorEditor.php', 'PhabricatorElasticSearchEngine' => 'applications/search/engine/PhabricatorElasticSearchEngine.php', - 'PhabricatorElasticSetupCheck' => 'applications/config/check/PhabricatorElasticSetupCheck.php', + 'PhabricatorElasticSearchSetupCheck' => 'applications/config/check/PhabricatorElasticSearchSetupCheck.php', 'PhabricatorEmailAddressesSettingsPanel' => 'applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php', 'PhabricatorEmailFormatSettingsPanel' => 'applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php', 'PhabricatorEmailLoginController' => 'applications/auth/controller/PhabricatorEmailLoginController.php', @@ -2501,6 +2500,7 @@ phutil_register_library_map(array( 'PhabricatorSearchAbstractDocument' => 'applications/search/index/PhabricatorSearchAbstractDocument.php', 'PhabricatorSearchApplication' => 'applications/search/application/PhabricatorSearchApplication.php', 'PhabricatorSearchApplicationSearchEngine' => 'applications/search/query/PhabricatorSearchApplicationSearchEngine.php', + 'PhabricatorSearchApplicationStorageEnginePanel' => 'applications/search/applicationpanel/PhabricatorSearchApplicationStorageEnginePanel.php', 'PhabricatorSearchAttachController' => 'applications/search/controller/PhabricatorSearchAttachController.php', 'PhabricatorSearchBaseController' => 'applications/search/controller/PhabricatorSearchBaseController.php', 'PhabricatorSearchConfigOptions' => 'applications/search/config/PhabricatorSearchConfigOptions.php', @@ -2516,7 +2516,6 @@ phutil_register_library_map(array( 'PhabricatorSearchDocumentTypeDatasource' => 'applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php', 'PhabricatorSearchEditController' => 'applications/search/controller/PhabricatorSearchEditController.php', 'PhabricatorSearchEngine' => 'applications/search/engine/PhabricatorSearchEngine.php', - 'PhabricatorSearchEngineSelector' => 'applications/search/selector/PhabricatorSearchEngineSelector.php', 'PhabricatorSearchField' => 'applications/search/constants/PhabricatorSearchField.php', 'PhabricatorSearchHovercardController' => 'applications/search/controller/PhabricatorSearchHovercardController.php', 'PhabricatorSearchIndexer' => 'applications/search/index/PhabricatorSearchIndexer.php', @@ -5140,7 +5139,6 @@ phutil_register_library_map(array( 'PhabricatorDatabaseSetupCheck' => 'PhabricatorSetupCheck', 'PhabricatorDateTimeSettingsPanel' => 'PhabricatorSettingsPanel', 'PhabricatorDebugController' => 'PhabricatorController', - 'PhabricatorDefaultSearchEngineSelector' => 'PhabricatorSearchEngineSelector', 'PhabricatorDestructionEngine' => 'Phobject', 'PhabricatorDeveloperConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorDeveloperPreferencesSettingsPanel' => 'PhabricatorSettingsPanel', @@ -5169,7 +5167,7 @@ phutil_register_library_map(array( 'PhabricatorEdgeType' => 'Phobject', 'PhabricatorEditor' => 'Phobject', 'PhabricatorElasticSearchEngine' => 'PhabricatorSearchEngine', - 'PhabricatorElasticSetupCheck' => 'PhabricatorSetupCheck', + 'PhabricatorElasticSearchSetupCheck' => 'PhabricatorSetupCheck', 'PhabricatorEmailAddressesSettingsPanel' => 'PhabricatorSettingsPanel', 'PhabricatorEmailFormatSettingsPanel' => 'PhabricatorSettingsPanel', 'PhabricatorEmailLoginController' => 'PhabricatorAuthController', @@ -5973,6 +5971,7 @@ phutil_register_library_map(array( 'PhabricatorScheduleTaskTriggerAction' => 'PhabricatorTriggerAction', 'PhabricatorSearchApplication' => 'PhabricatorApplication', 'PhabricatorSearchApplicationSearchEngine' => 'PhabricatorApplicationSearchEngine', + 'PhabricatorSearchApplicationStorageEnginePanel' => 'PhabricatorApplicationConfigurationPanel', 'PhabricatorSearchAttachController' => 'PhabricatorSearchBaseController', 'PhabricatorSearchBaseController' => 'PhabricatorController', 'PhabricatorSearchConfigOptions' => 'PhabricatorApplicationConfigOptions', diff --git a/src/applications/config/check/PhabricatorElasticSetupCheck.php b/src/applications/config/check/PhabricatorElasticSearchSetupCheck.php similarity index 76% rename from src/applications/config/check/PhabricatorElasticSetupCheck.php rename to src/applications/config/check/PhabricatorElasticSearchSetupCheck.php index 7b60444a88..a573c14490 100644 --- a/src/applications/config/check/PhabricatorElasticSetupCheck.php +++ b/src/applications/config/check/PhabricatorElasticSearchSetupCheck.php @@ -1,14 +1,15 @@ newEngine(); + if ($this->shouldUseElasticSearchEngine()) { + $engine = new PhabricatorElasticSearchEngine(); + if (!$engine->indexExists()) { $summary = pht( 'You enabled Elasticsearch but the index does not exist.'); @@ -40,4 +41,10 @@ final class PhabricatorElasticSetupCheck extends PhabricatorSetupCheck { } } } + + protected function shouldUseElasticSearchEngine() { + $search_engine = PhabricatorSearchEngine::loadEngine(); + return $search_engine instanceof PhabricatorElasticSearchEngine; + } + } diff --git a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php index a95ec0e1c9..2d69334c47 100644 --- a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php +++ b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php @@ -252,6 +252,10 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck { 'style.monospace' => $monospace_reason, 'style.monospace.windows' => $monospace_reason, + + 'search.engine-selector' => pht( + 'Phabricator now automatically discovers available search engines '. + 'at runtime.'), ); return $ancient_config; diff --git a/src/applications/config/check/PhabricatorMySQLSetupCheck.php b/src/applications/config/check/PhabricatorMySQLSetupCheck.php index 6747158b85..a5178cc9ed 100644 --- a/src/applications/config/check/PhabricatorMySQLSetupCheck.php +++ b/src/applications/config/check/PhabricatorMySQLSetupCheck.php @@ -116,7 +116,8 @@ final class PhabricatorMySQLSetupCheck extends PhabricatorSetupCheck { } $stopword_file = self::loadRawConfigValue('ft_stopword_file'); - if (!PhabricatorDefaultSearchEngineSelector::shouldUseElasticSearch()) { + + if ($this->shouldUseMySQLSearchEngine()) { if ($stopword_file === null) { $summary = pht( 'Your version of MySQL does not support configuration of a '. @@ -190,7 +191,7 @@ final class PhabricatorMySQLSetupCheck extends PhabricatorSetupCheck { $min_len = self::loadRawConfigValue('ft_min_word_len'); if ($min_len >= 4) { - if (!PhabricatorDefaultSearchEngineSelector::shouldUseElasticSearch()) { + if ($this->shouldUseMySQLSearchEngine()) { $namespace = PhabricatorEnv::getEnvConfig('storage.default-namespace'); $summary = pht( @@ -235,8 +236,7 @@ final class PhabricatorMySQLSetupCheck extends PhabricatorSetupCheck { $bool_syntax = self::loadRawConfigValue('ft_boolean_syntax'); if ($bool_syntax != ' |-><()~*:""&^') { - if (!PhabricatorDefaultSearchEngineSelector::shouldUseElasticSearch()) { - + if ($this->shouldUseMySQLSearchEngine()) { $summary = pht( 'MySQL is configured to search on fulltext indexes using "OR" by '. 'default. Using "AND" is usually the desired behaviour.'); @@ -340,4 +340,9 @@ final class PhabricatorMySQLSetupCheck extends PhabricatorSetupCheck { } + protected function shouldUseMySQLSearchEngine() { + $search_engine = PhabricatorSearchEngine::loadEngine(); + return $search_engine instanceof PhabricatorMySQLSearchEngine; + } + } diff --git a/src/applications/files/applicationpanel/PhabricatorFilesApplicationStorageEnginePanel.php b/src/applications/files/applicationpanel/PhabricatorFilesApplicationStorageEnginePanel.php index a174102c18..a92f3cf763 100644 --- a/src/applications/files/applicationpanel/PhabricatorFilesApplicationStorageEnginePanel.php +++ b/src/applications/files/applicationpanel/PhabricatorFilesApplicationStorageEnginePanel.php @@ -61,8 +61,6 @@ final class PhabricatorFilesApplicationStorageEnginePanel ); } - $table = - $table = id(new AphrontTableView($rows)) ->setNoDataString(pht('No storage engines available.')) ->setHeaders( diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php index 4a6381581b..4da078c004 100644 --- a/src/applications/maniphest/query/ManiphestTaskQuery.php +++ b/src/applications/maniphest/query/ManiphestTaskQuery.php @@ -563,7 +563,7 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery { $fulltext_query->setParameter('types', array(ManiphestTaskPHIDType::TYPECONST)); - $engine = PhabricatorSearchEngineSelector::newSelector()->newEngine(); + $engine = PhabricatorSearchEngine::loadEngine(); $fulltext_results = $engine->executeSearch($fulltext_query); if (empty($fulltext_results)) { diff --git a/src/applications/search/applicationpanel/PhabricatorSearchApplicationStorageEnginePanel.php b/src/applications/search/applicationpanel/PhabricatorSearchApplicationStorageEnginePanel.php new file mode 100644 index 0000000000..b54a818398 --- /dev/null +++ b/src/applications/search/applicationpanel/PhabricatorSearchApplicationStorageEnginePanel.php @@ -0,0 +1,82 @@ +getViewer(); + $application = $this->getApplication(); + + $active_engine = PhabricatorSearchEngine::loadEngine(); + $engines = PhabricatorSearchEngine::loadAllEngines(); + + $rows = array(); + $rowc = array(); + + foreach ($engines as $key => $engine) { + try { + $index_exists = $engine->indexExists() ? pht('Yes') : pht('No'); + } catch (Exception $ex) { + $index_exists = pht('N/A'); + } + + try { + $index_is_sane = $engine->indexIsSane() ? pht('Yes') : pht('No'); + } catch (Exception $ex) { + $index_is_sane = pht('N/A'); + } + + if ($engine == $active_engine) { + $rowc[] = 'highlighted'; + } else { + $rowc[] = null; + } + + $rows[] = array( + $key, + get_class($engine), + $index_exists, + $index_is_sane, + ); + } + + $table = id(new AphrontTableView($rows)) + ->setNoDataString(pht('No search engines available.')) + ->setHeaders( + array( + pht('Key'), + pht('Class'), + pht('Index Exists'), + pht('Index Is Sane'), + )) + ->setRowClasses($rowc) + ->setColumnClasses( + array( + '', + 'wide', + '', + )); + + $box = id(new PHUIObjectBoxView()) + ->setHeaderText(pht('Search Engines')) + ->appendChild($table); + + return $box; + } + + public function handlePanelRequest( + AphrontRequest $request, + PhabricatorController $controller) { + return new Aphront404Response(); + } + +} diff --git a/src/applications/search/config/PhabricatorSearchConfigOptions.php b/src/applications/search/config/PhabricatorSearchConfigOptions.php index f8cb143b94..453821bc49 100644 --- a/src/applications/search/config/PhabricatorSearchConfigOptions.php +++ b/src/applications/search/config/PhabricatorSearchConfigOptions.php @@ -21,21 +21,6 @@ final class PhabricatorSearchConfigOptions public function getOptions() { return array( - $this->newOption( - 'search.engine-selector', - 'class', - 'PhabricatorDefaultSearchEngineSelector') - ->setBaseClass('PhabricatorSearchEngineSelector') - ->setSummary(pht('Search engine selector.')) - ->setDescription( - pht( - 'Phabricator uses a search engine selector to choose which '. - 'search engine to use when indexing and reconstructing '. - 'documents, and when executing queries. You can override the '. - 'engine selector to provide a new selector class which can '. - 'select some custom engine you implement, if you want to store '. - 'your documents in some search engine which does not have '. - 'default support.')), $this->newOption('search.elastic.host', 'string', null) ->setLocked(true) ->setDescription(pht('Elastic Search host.')) diff --git a/src/applications/search/engine/PhabricatorElasticSearchEngine.php b/src/applications/search/engine/PhabricatorElasticSearchEngine.php index 4b30fb4c66..f6efc17044 100644 --- a/src/applications/search/engine/PhabricatorElasticSearchEngine.php +++ b/src/applications/search/engine/PhabricatorElasticSearchEngine.php @@ -1,13 +1,31 @@ uri = $uri; + return $this; + } + + public function setIndex($index) { $this->index = $index; + return $this; } public function setTimeout($timeout) { @@ -15,6 +33,14 @@ final class PhabricatorElasticSearchEngine extends PhabricatorSearchEngine { return $this; } + public function getURI() { + return $this->uri; + } + + public function getIndex() { + return $this->index; + } + public function getTimeout() { return $this->timeout; } @@ -99,7 +125,7 @@ final class PhabricatorElasticSearchEngine extends PhabricatorSearchEngine { $spec[] = array( 'simple_query_string' => array( 'query' => $query->getParameter('query'), - 'fields' => array( 'field.corpus' ), + 'fields' => array('field.corpus'), ), ); diff --git a/src/applications/search/engine/PhabricatorMySQLSearchEngine.php b/src/applications/search/engine/PhabricatorMySQLSearchEngine.php index 42ed21d2e8..3e006399ea 100644 --- a/src/applications/search/engine/PhabricatorMySQLSearchEngine.php +++ b/src/applications/search/engine/PhabricatorMySQLSearchEngine.php @@ -2,12 +2,24 @@ final class PhabricatorMySQLSearchEngine extends PhabricatorSearchEngine { + public function getEngineIdentifier() { + return 'mysql'; + } + + public function getEnginePriority() { + return 100; + } + + public function isEnabled() { + return true; + } + public function reindexAbstractDocument( PhabricatorSearchAbstractDocument $doc) { $phid = $doc->getPHID(); if (!$phid) { - throw new Exception('Document has no PHID!'); + throw new Exception(pht('Document has no PHID!')); } $store = new PhabricatorSearchDocument(); @@ -31,7 +43,7 @@ final class PhabricatorMySQLSearchEngine extends PhabricatorSearchEngine { queryfx( $conn_w, 'INSERT INTO %T (phid, phidType, field, auxPHID, corpus) '. - ' VALUES (%s, %s, %s, %ns, %s)', + 'VALUES (%s, %s, %s, %ns, %s)', $field_dao->getTableName(), $phid, $doc->getDocumentType(), @@ -63,9 +75,9 @@ final class PhabricatorMySQLSearchEngine extends PhabricatorSearchEngine { if ($sql) { queryfx( $conn_w, - 'INSERT INTO %T'. - ' (phid, relatedPHID, relation, relatedType, relatedTime) '. - ' VALUES %Q', + 'INSERT INTO %T '. + '(phid, relatedPHID, relation, relatedType, relatedTime) '. + 'VALUES %Q', $rship_dao->getTableName(), implode(', ', $sql)); } diff --git a/src/applications/search/engine/PhabricatorSearchEngine.php b/src/applications/search/engine/PhabricatorSearchEngine.php index 1521294b13..0ba8e321d8 100644 --- a/src/applications/search/engine/PhabricatorSearchEngine.php +++ b/src/applications/search/engine/PhabricatorSearchEngine.php @@ -1,6 +1,5 @@ setAncestorClass(__CLASS__) + ->loadObjects(); + + $map = array(); + foreach ($objects as $engine) { + $key = $engine->getEngineIdentifier(); + if (empty($map[$key])) { + $map[$key] = $engine; + } else { + throw new Exception( + pht( + 'Search engines "%s" and "%s" have the same engine identifier '. + '"%s". Each storage engine must have a unique identifier.', + get_class($engine), + get_class($map[$key]), + $key)); + } + } + + $map = msort($map, 'getEnginePriority'); + + $engines = $map; + } + + return $engines; + } + + /** + * @task load + */ + public static function loadActiveEngines() { + $engines = self::loadAllEngines(); + + $active = array(); + foreach ($engines as $key => $engine) { + if (!$engine->isEnabled()) { + continue; + } + + $active[$key] = $engine; + } + + return $active; + } + + public static function loadEngine() { + return head(self::loadActiveEngines()); + } + } diff --git a/src/applications/search/index/PhabricatorSearchDocumentIndexer.php b/src/applications/search/index/PhabricatorSearchDocumentIndexer.php index 4e5089aa8c..18d07765ad 100644 --- a/src/applications/search/index/PhabricatorSearchDocumentIndexer.php +++ b/src/applications/search/index/PhabricatorSearchDocumentIndexer.php @@ -69,7 +69,7 @@ abstract class PhabricatorSearchDocumentIndexer extends Phobject { $this->indexProjects($document, $object); } - $engine = PhabricatorSearchEngineSelector::newSelector()->newEngine(); + $engine = PhabricatorSearchEngine::loadEngine(); try { $engine->reindexAbstractDocument($document); } catch (Exception $ex) { diff --git a/src/applications/search/management/PhabricatorSearchManagementInitWorkflow.php b/src/applications/search/management/PhabricatorSearchManagementInitWorkflow.php index 6e4811dd7f..e4a8ddb693 100644 --- a/src/applications/search/management/PhabricatorSearchManagementInitWorkflow.php +++ b/src/applications/search/management/PhabricatorSearchManagementInitWorkflow.php @@ -13,7 +13,7 @@ final class PhabricatorSearchManagementInitWorkflow public function execute(PhutilArgumentParser $args) { $console = PhutilConsole::getConsole(); - $engine = PhabricatorSearchEngineSelector::newSelector()->newEngine(); + $engine = PhabricatorSearchEngine::loadEngine(); $work_done = false; if (!$engine->indexExists()) { diff --git a/src/applications/search/query/PhabricatorSearchDocumentQuery.php b/src/applications/search/query/PhabricatorSearchDocumentQuery.php index 903d40dd5a..1770f4b046 100644 --- a/src/applications/search/query/PhabricatorSearchDocumentQuery.php +++ b/src/applications/search/query/PhabricatorSearchDocumentQuery.php @@ -74,7 +74,7 @@ final class PhabricatorSearchDocumentQuery ->setParameter('offset', $this->getOffset()) ->setParameter('limit', $this->getRawResultLimit()); - $engine = PhabricatorSearchEngineSelector::newSelector()->newEngine(); + $engine = PhabricatorSearchEngine::loadEngine(); return $engine->executeSearch($query); } diff --git a/src/applications/search/selector/PhabricatorDefaultSearchEngineSelector.php b/src/applications/search/selector/PhabricatorDefaultSearchEngineSelector.php deleted file mode 100644 index 9e06b1182a..0000000000 --- a/src/applications/search/selector/PhabricatorDefaultSearchEngineSelector.php +++ /dev/null @@ -1,19 +0,0 @@ - - } - - abstract public function newEngine(); - - final public static function newSelector() { - return PhabricatorEnv::newObjectFromConfig('search.engine-selector'); - } - -} From b5bf8e998d5340a04d9f7dd6b8fe68eb51b82e4f Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Wed, 20 May 2015 07:02:08 +1000 Subject: [PATCH 63/86] Remove unused PhabricatorFeedStory subclasses Summary: Remove a bunch of unused `PhabricatorFeedStory` subclasses. Test Plan: `grep` Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: btrahan, Korvin, epriestley Maniphest Tasks: T5655 Differential Revision: https://secure.phabricator.com/D11674 --- src/__phutil_library_map__.php | 14 -- .../story/PhabricatorFeedStoryAggregate.php | 74 ------ .../feed/story/PhabricatorFeedStoryAudit.php | 49 ---- .../feed/story/PhabricatorFeedStoryCommit.php | 107 -------- .../PhabricatorFeedStoryDifferential.php | 237 ------------------ ...bricatorFeedStoryDifferentialAggregate.php | 66 ----- ...PhabricatorFeedStoryManiphestAggregate.php | 66 ----- .../story/PhabricatorFeedStoryPhriction.php | 95 ------- .../PhabricatorNotificationBuilder.php | 26 -- 9 files changed, 734 deletions(-) delete mode 100644 src/applications/feed/story/PhabricatorFeedStoryAggregate.php delete mode 100644 src/applications/feed/story/PhabricatorFeedStoryAudit.php delete mode 100644 src/applications/feed/story/PhabricatorFeedStoryCommit.php delete mode 100644 src/applications/feed/story/PhabricatorFeedStoryDifferential.php delete mode 100644 src/applications/feed/story/PhabricatorFeedStoryDifferentialAggregate.php delete mode 100644 src/applications/feed/story/PhabricatorFeedStoryManiphestAggregate.php delete mode 100644 src/applications/feed/story/PhabricatorFeedStoryPhriction.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 79e98ed18a..39cc7a3751 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1832,15 +1832,8 @@ phutil_register_library_map(array( 'PhabricatorFeedQuery' => 'applications/feed/query/PhabricatorFeedQuery.php', 'PhabricatorFeedSearchEngine' => 'applications/feed/query/PhabricatorFeedSearchEngine.php', 'PhabricatorFeedStory' => 'applications/feed/story/PhabricatorFeedStory.php', - 'PhabricatorFeedStoryAggregate' => 'applications/feed/story/PhabricatorFeedStoryAggregate.php', - 'PhabricatorFeedStoryAudit' => 'applications/feed/story/PhabricatorFeedStoryAudit.php', - 'PhabricatorFeedStoryCommit' => 'applications/feed/story/PhabricatorFeedStoryCommit.php', 'PhabricatorFeedStoryData' => 'applications/feed/storage/PhabricatorFeedStoryData.php', - 'PhabricatorFeedStoryDifferential' => 'applications/feed/story/PhabricatorFeedStoryDifferential.php', - 'PhabricatorFeedStoryDifferentialAggregate' => 'applications/feed/story/PhabricatorFeedStoryDifferentialAggregate.php', - 'PhabricatorFeedStoryManiphestAggregate' => 'applications/feed/story/PhabricatorFeedStoryManiphestAggregate.php', 'PhabricatorFeedStoryNotification' => 'applications/notification/storage/PhabricatorFeedStoryNotification.php', - 'PhabricatorFeedStoryPhriction' => 'applications/feed/story/PhabricatorFeedStoryPhriction.php', 'PhabricatorFeedStoryPublisher' => 'applications/feed/PhabricatorFeedStoryPublisher.php', 'PhabricatorFeedStoryReference' => 'applications/feed/storage/PhabricatorFeedStoryReference.php', 'PhabricatorFile' => 'applications/files/storage/PhabricatorFile.php', @@ -5225,15 +5218,8 @@ phutil_register_library_map(array( 'PhabricatorPolicyInterface', 'PhabricatorMarkupInterface', ), - 'PhabricatorFeedStoryAggregate' => 'PhabricatorFeedStory', - 'PhabricatorFeedStoryAudit' => 'PhabricatorFeedStory', - 'PhabricatorFeedStoryCommit' => 'PhabricatorFeedStory', 'PhabricatorFeedStoryData' => 'PhabricatorFeedDAO', - 'PhabricatorFeedStoryDifferential' => 'PhabricatorFeedStory', - 'PhabricatorFeedStoryDifferentialAggregate' => 'PhabricatorFeedStoryAggregate', - 'PhabricatorFeedStoryManiphestAggregate' => 'PhabricatorFeedStoryAggregate', 'PhabricatorFeedStoryNotification' => 'PhabricatorFeedDAO', - 'PhabricatorFeedStoryPhriction' => 'PhabricatorFeedStory', 'PhabricatorFeedStoryReference' => 'PhabricatorFeedDAO', 'PhabricatorFile' => array( 'PhabricatorFileDAO', diff --git a/src/applications/feed/story/PhabricatorFeedStoryAggregate.php b/src/applications/feed/story/PhabricatorFeedStoryAggregate.php deleted file mode 100644 index c37a39e53d..0000000000 --- a/src/applications/feed/story/PhabricatorFeedStoryAggregate.php +++ /dev/null @@ -1,74 +0,0 @@ -getAggregateStories())->getHasViewed(); - } - - public function getPrimaryObjectPHID() { - return head($this->getAggregateStories())->getPrimaryObjectPHID(); - } - - public function getRequiredHandlePHIDs() { - $phids = array(); - foreach ($this->getAggregateStories() as $story) { - $phids[] = $story->getRequiredHandlePHIDs(); - } - return array_mergev($phids); - } - - public function getRequiredObjectPHIDs() { - $phids = array(); - foreach ($this->getAggregateStories() as $story) { - $phids[] = $story->getRequiredObjectPHIDs(); - } - return array_mergev($phids); - } - - protected function getAuthorPHIDs() { - $authors = array(); - foreach ($this->getAggregateStories() as $story) { - $authors[] = $story->getStoryData()->getAuthorPHID(); - } - return array_unique(array_filter($authors)); - } - - protected function getDataValues($key, $default) { - $result = array(); - foreach ($this->getAggregateStories() as $key => $story) { - $result[$key] = $story->getStoryData()->getValue($key, $default); - } - return $result; - } - - final public function setAggregateStories(array $aggregate_stories) { - assert_instances_of($aggregate_stories, 'PhabricatorFeedStory'); - $this->aggregateStories = $aggregate_stories; - - $objects = array(); - $handles = array(); - - foreach ($this->aggregateStories as $story) { - $objects += $story->getObjects(); - $handles += $story->getHandles(); - } - - $this->setObjects($objects); - $this->setHandles($handles); - - return $this; - } - - final public function getAggregateStories() { - return $this->aggregateStories; - } - - final public function getNotificationAggregations() { - throw new Exception( - 'You can not get aggregations for an aggregate story.'); - } - -} diff --git a/src/applications/feed/story/PhabricatorFeedStoryAudit.php b/src/applications/feed/story/PhabricatorFeedStoryAudit.php deleted file mode 100644 index 04e1af0d7c..0000000000 --- a/src/applications/feed/story/PhabricatorFeedStoryAudit.php +++ /dev/null @@ -1,49 +0,0 @@ -getStoryData()->getValue('commitPHID'); - } - - public function renderView() { - $author_phid = $this->getAuthorPHID(); - $commit_phid = $this->getPrimaryObjectPHID(); - - $view = $this->newStoryView(); - - $action = $this->getValue('action'); - $verb = PhabricatorAuditActionConstants::getActionPastTenseVerb($action); - - $view->setTitle(hsprintf( - '%s %s commit %s.', - $this->linkTo($author_phid), - $verb, - $this->linkTo($commit_phid))); - - $comments = $this->getValue('content'); - $view->setImage($this->getHandle($author_phid)->getImageURI()); - - if ($comments) { - $content = $this->renderSummary($this->getValue('content')); - $view->appendChild($content); - } - - return $view; - } - - public function renderText() { - $author_name = $this->getHandle($this->getAuthorPHID())->getLinkName(); - - $commit_path = $this->getHandle($this->getPrimaryObjectPHID())->getURI(); - $commit_uri = PhabricatorEnv::getURI($commit_path); - - $action = $this->getValue('action'); - $verb = PhabricatorAuditActionConstants::getActionPastTenseVerb($action); - - $text = "{$author_name} {$verb} commit {$commit_uri}"; - - return $text; - } - -} diff --git a/src/applications/feed/story/PhabricatorFeedStoryCommit.php b/src/applications/feed/story/PhabricatorFeedStoryCommit.php deleted file mode 100644 index 72fa9cc126..0000000000 --- a/src/applications/feed/story/PhabricatorFeedStoryCommit.php +++ /dev/null @@ -1,107 +0,0 @@ -getValue('commitPHID'); - } - - public function getRequiredHandlePHIDs() { - return array( - $this->getValue('committerPHID'), - ); - } - - public function renderView() { - $data = $this->getStoryData(); - - $author = null; - if ($data->getValue('authorPHID')) { - $author = $this->linkTo($data->getValue('authorPHID')); - } else { - $author = $data->getValue('authorName'); - } - - $committer = null; - if ($data->getValue('committerPHID')) { - $committer = $this->linkTo($data->getValue('committerPHID')); - } else if ($data->getValue('committerName')) { - $committer = $data->getValue('committerName'); - } - - $commit = $this->linkTo($data->getValue('commitPHID')); - - if (!$committer) { - $committer = $author; - $author = null; - } - - if ($author) { - $title = pht( - '%s committed %s (authored by %s)', - $committer, - $commit, - $author); - } else { - $title = pht( - '%s committed %s', - $committer, - $commit); - } - - $view = $this->newStoryView(); - - $view->setTitle($title); - - if ($data->getValue('authorPHID')) { - $view->setImage($this->getHandle($data->getAuthorPHID())->getImageURI()); - } - - $content = $this->renderSummary($data->getValue('summary')); - $view->appendChild($content); - - return $view; - } - - public function renderText() { - $author = null; - if ($this->getAuthorPHID()) { - $author = $this->getHandle($this->getAuthorPHID())->getLinkName(); - } else { - $author = $this->getValue('authorName'); - } - - $committer = null; - if ($this->getValue('committerPHID')) { - $committer_handle = $this->getHandle($this->getValue('committerPHID')); - $committer = $committer_handle->getLinkName(); - } else if ($this->getValue('committerName')) { - $committer = $this->getValue('committerName'); - } - - $commit_handle = $this->getHandle($this->getPrimaryObjectPHID()); - $commit_uri = PhabricatorEnv::getURI($commit_handle->getURI()); - $commit_name = $commit_handle->getLinkName(); - - if (!$committer) { - $committer = $author; - $author = null; - } - - if ($author) { - $text = pht( - '%s committed %s (authored by %s).', - $committer, - $commit_name, - $author); - } else { - $text = pht( - '%s committed %s.', - $committer, - $commit_name); - } - - return $text; - } - -} diff --git a/src/applications/feed/story/PhabricatorFeedStoryDifferential.php b/src/applications/feed/story/PhabricatorFeedStoryDifferential.php deleted file mode 100644 index 8d7b98b928..0000000000 --- a/src/applications/feed/story/PhabricatorFeedStoryDifferential.php +++ /dev/null @@ -1,237 +0,0 @@ -getValue('revision_phid'); - } - - public function renderView() { - $data = $this->getStoryData(); - - $view = $this->newStoryView(); - - $line = $this->getLineForData($data); - $view->setTitle($line); - - $href = $this->getHandle($data->getValue('revision_phid'))->getURI(); - $view->setHref($href); - - $action = $data->getValue('action'); - - switch ($action) { - case DifferentialAction::ACTION_CREATE: - case DifferentialAction::ACTION_CLOSE: - case DifferentialAction::ACTION_COMMENT: - $full_size = true; - break; - default: - $full_size = false; - break; - } - - $view->setImage($this->getHandle($data->getAuthorPHID())->getImageURI()); - if ($full_size) { - $content = $this->renderSummary($data->getValue('feedback_content')); - $view->appendChild($content); - } - - return $view; - } - - private function getLineForData($data) { - $actor_phid = $data->getAuthorPHID(); - $revision_phid = $data->getValue('revision_phid'); - $action = $data->getValue('action'); - - $actor_link = $this->linkTo($actor_phid); - $revision_link = $this->linkTo($revision_phid); - - switch ($action) { - case DifferentialAction::ACTION_COMMENT: - $one_line = pht('%s commented on revision %s', - $actor_link, $revision_link); - break; - case DifferentialAction::ACTION_ACCEPT: - $one_line = pht('%s accepted revision %s', - $actor_link, $revision_link); - break; - case DifferentialAction::ACTION_REJECT: - $one_line = pht('%s requested changes to revision %s', - $actor_link, $revision_link); - break; - case DifferentialAction::ACTION_RETHINK: - $one_line = pht('%s planned changes to revision %s', - $actor_link, $revision_link); - break; - case DifferentialAction::ACTION_ABANDON: - $one_line = pht('%s abandoned revision %s', - $actor_link, $revision_link); - break; - case DifferentialAction::ACTION_CLOSE: - $one_line = pht('%s closed revision %s', - $actor_link, $revision_link); - break; - case DifferentialAction::ACTION_REQUEST: - $one_line = pht('%s requested a review of revision %s', - $actor_link, $revision_link); - break; - case DifferentialAction::ACTION_RECLAIM: - $one_line = pht('%s reclaimed revision %s', - $actor_link, $revision_link); - break; - case DifferentialAction::ACTION_UPDATE: - $one_line = pht('%s updated revision %s', - $actor_link, $revision_link); - break; - case DifferentialAction::ACTION_RESIGN: - $one_line = pht('%s resigned from revision %s', - $actor_link, $revision_link); - break; - case DifferentialAction::ACTION_SUMMARIZE: - $one_line = pht('%s summarized revision %s', - $actor_link, $revision_link); - break; - case DifferentialAction::ACTION_TESTPLAN: - $one_line = pht('%s explained the test plan for revision %s', - $actor_link, $revision_link); - break; - case DifferentialAction::ACTION_CREATE: - $one_line = pht('%s created revision %s', - $actor_link, $revision_link); - break; - case DifferentialAction::ACTION_ADDREVIEWERS: - $one_line = pht('%s added reviewers to revision %s', - $actor_link, $revision_link); - break; - case DifferentialAction::ACTION_ADDCCS: - $one_line = pht('%s added CCs to revision %s', - $actor_link, $revision_link); - break; - case DifferentialAction::ACTION_CLAIM: - $one_line = pht('%s commandeered revision %s', - $actor_link, $revision_link); - break; - case DifferentialAction::ACTION_REOPEN: - $one_line = pht('%s reopened revision %s', - $actor_link, $revision_link); - break; - case DifferentialTransaction::TYPE_INLINE: - $one_line = pht('%s added inline comments to %s', - $actor_link, $revision_link); - break; - default: - $one_line = pht('%s edited %s', - $actor_link, $revision_link); - break; - } - - return $one_line; - } - - public function renderText() { - $author_name = $this->getHandle($this->getAuthorPHID())->getLinkName(); - - $revision_handle = $this->getHandle($this->getPrimaryObjectPHID()); - $revision_title = $revision_handle->getLinkName(); - $revision_uri = PhabricatorEnv::getURI($revision_handle->getURI()); - - $action = $this->getValue('action'); - - switch ($action) { - case DifferentialAction::ACTION_COMMENT: - $one_line = pht('%s commented on revision %s %s', - $author_name, $revision_title, $revision_uri); - break; - case DifferentialAction::ACTION_ACCEPT: - $one_line = pht('%s accepted revision %s %s', - $author_name, $revision_title, $revision_uri); - break; - case DifferentialAction::ACTION_REJECT: - $one_line = pht('%s requested changes to revision %s %s', - $author_name, $revision_title, $revision_uri); - break; - case DifferentialAction::ACTION_RETHINK: - $one_line = pht('%s planned changes to revision %s %s', - $author_name, $revision_title, $revision_uri); - break; - case DifferentialAction::ACTION_ABANDON: - $one_line = pht('%s abandoned revision %s %s', - $author_name, $revision_title, $revision_uri); - break; - case DifferentialAction::ACTION_CLOSE: - $one_line = pht('%s closed revision %s %s', - $author_name, $revision_title, $revision_uri); - break; - case DifferentialAction::ACTION_REQUEST: - $one_line = pht('%s requested a review of revision %s %s', - $author_name, $revision_title, $revision_uri); - break; - case DifferentialAction::ACTION_RECLAIM: - $one_line = pht('%s reclaimed revision %s %s', - $author_name, $revision_title, $revision_uri); - break; - case DifferentialAction::ACTION_UPDATE: - $one_line = pht('%s updated revision %s %s', - $author_name, $revision_title, $revision_uri); - break; - case DifferentialAction::ACTION_RESIGN: - $one_line = pht('%s resigned from revision %s %s', - $author_name, $revision_title, $revision_uri); - break; - case DifferentialAction::ACTION_SUMMARIZE: - $one_line = pht('%s summarized revision %s %s', - $author_name, $revision_title, $revision_uri); - break; - case DifferentialAction::ACTION_TESTPLAN: - $one_line = pht('%s explained the test plan for revision %s %s', - $author_name, $revision_title, $revision_uri); - break; - case DifferentialAction::ACTION_CREATE: - $one_line = pht('%s created revision %s %s', - $author_name, $revision_title, $revision_uri); - break; - case DifferentialAction::ACTION_ADDREVIEWERS: - $one_line = pht('%s added reviewers to revision %s %s', - $author_name, $revision_title, $revision_uri); - break; - case DifferentialAction::ACTION_ADDCCS: - $one_line = pht('%s added CCs to revision %s %s', - $author_name, $revision_title, $revision_uri); - break; - case DifferentialAction::ACTION_CLAIM: - $one_line = pht('%s commandeered revision %s %s', - $author_name, $revision_title, $revision_uri); - break; - case DifferentialAction::ACTION_REOPEN: - $one_line = pht('%s reopened revision %s %s', - $author_name, $revision_title, $revision_uri); - break; - case DifferentialTransaction::TYPE_INLINE: - $one_line = pht('%s added inline comments to %s %s', - $author_name, $revision_title, $revision_uri); - break; - default: - $one_line = pht('%s edited %s %s', - $author_name, $revision_title, $revision_uri); - break; - } - - return $one_line; - } - - public function getNotificationAggregations() { - $class = get_class($this); - $phid = $this->getStoryData()->getValue('revision_phid'); - $read = (int)$this->getHasViewed(); - - // Don't aggregate updates separated by more than 2 hours. - $block = (int)($this->getEpoch() / (60 * 60 * 2)); - - return array( - "{$class}:{$phid}:{$read}:{$block}" - => 'PhabricatorFeedStoryDifferentialAggregate', - ); - } - -} diff --git a/src/applications/feed/story/PhabricatorFeedStoryDifferentialAggregate.php b/src/applications/feed/story/PhabricatorFeedStoryDifferentialAggregate.php deleted file mode 100644 index 5b0d5661d9..0000000000 --- a/src/applications/feed/story/PhabricatorFeedStoryDifferentialAggregate.php +++ /dev/null @@ -1,66 +0,0 @@ -getStoryData(); - - $task_link = $this->linkTo($data->getValue('revision_phid')); - - $authors = $this->getAuthorPHIDs(); - - // TODO: These aren't really translatable because linkTo() returns a - // string, not an object with a gender. - - switch (count($authors)) { - case 1: - $author = $this->linkTo(array_shift($authors)); - $title = pht( - '%s made multiple updates to %s', - $author, - $task_link); - break; - case 2: - $author1 = $this->linkTo(array_shift($authors)); - $author2 = $this->linkTo(array_shift($authors)); - $title = pht( - '%s and %s made multiple updates to %s', - $author1, - $author2, - $task_link); - break; - case 3: - $author1 = $this->linkTo(array_shift($authors)); - $author2 = $this->linkTo(array_shift($authors)); - $author3 = $this->linkTo(array_shift($authors)); - $title = pht( - '%s, %s, and %s made multiple updates to %s', - $author1, - $author2, - $author3, - $task_link); - break; - default: - $author1 = $this->linkTo(array_shift($authors)); - $author2 = $this->linkTo(array_shift($authors)); - $others = count($authors); - $title = pht( - '%s, %s, and %d others made multiple updates to %s', - $author1, - $author2, - $others, - $task_link); - break; - } - - $view = $this->newStoryView(); - $view->setTitle($title); - - $href = $this->getHandle($data->getValue('revision_phid'))->getURI(); - $view->setHref($href); - - return $view; - } - -} diff --git a/src/applications/feed/story/PhabricatorFeedStoryManiphestAggregate.php b/src/applications/feed/story/PhabricatorFeedStoryManiphestAggregate.php deleted file mode 100644 index 22a1d8156a..0000000000 --- a/src/applications/feed/story/PhabricatorFeedStoryManiphestAggregate.php +++ /dev/null @@ -1,66 +0,0 @@ -getStoryData(); - - $task_link = $this->linkTo($data->getValue('taskPHID')); - - $authors = $this->getAuthorPHIDs(); - - // TODO: These aren't really translatable because linkTo() returns a - // string, not an object with a gender. - - switch (count($authors)) { - case 1: - $author = $this->linkTo(array_shift($authors)); - $title = pht( - '%s made multiple updates to %s', - $author, - $task_link); - break; - case 2: - $author1 = $this->linkTo(array_shift($authors)); - $author2 = $this->linkTo(array_shift($authors)); - $title = pht( - '%s and %s made multiple updates to %s', - $author1, - $author2, - $task_link); - break; - case 3: - $author1 = $this->linkTo(array_shift($authors)); - $author2 = $this->linkTo(array_shift($authors)); - $author3 = $this->linkTo(array_shift($authors)); - $title = pht( - '%s, %s, and %s made multiple updates to %s', - $author1, - $author2, - $author3, - $task_link); - break; - default: - $author1 = $this->linkTo(array_shift($authors)); - $author2 = $this->linkTo(array_shift($authors)); - $others = count($authors); - $title = pht( - '%s, %s, and %d others made multiple updates to %s', - $author1, - $author2, - $others, - $task_link); - break; - } - - $view = $this->newStoryView(); - $view->setTitle($title); - - $href = $this->getHandle($data->getValue('taskPHID'))->getURI(); - $view->setHref($href); - - return $view; - } - -} diff --git a/src/applications/feed/story/PhabricatorFeedStoryPhriction.php b/src/applications/feed/story/PhabricatorFeedStoryPhriction.php deleted file mode 100644 index 7a91d12ec6..0000000000 --- a/src/applications/feed/story/PhabricatorFeedStoryPhriction.php +++ /dev/null @@ -1,95 +0,0 @@ -getValue('phid'); - } - - public function getRequiredHandlePHIDs() { - $required_phids = parent::getRequiredHandlePHIDs(); - $from_phid = $this->getStoryData()->getValue('movedFromPHID'); - if ($from_phid) { - $required_phids[] = $from_phid; - } - return $required_phids; - } - - public function renderView() { - $data = $this->getStoryData(); - - $author_phid = $data->getAuthorPHID(); - $author_link = $this->linkTo($author_phid); - $document_phid = $data->getValue('phid'); - - $view = $this->newStoryView(); - - $action = $data->getValue('action'); - $verb = PhrictionActionConstants::getActionPastTenseVerb($action); - - switch ($action) { - case PhrictionActionConstants::ACTION_MOVE_HERE: - $from_phid = $data->getValue('movedFromPHID'); - - // Older feed stories may not have 'moved_from_phid', in that case - // we fall back to the default behaviour (hence the fallthrough) - if ($from_phid) { - $document_handle = $this->getHandle($document_phid); - $from_handle = $this->getHandle($from_phid); - $view->setTitle(pht( - '%s moved the document %s from %s to %s.', - $author_link, - $document_handle->renderLink(), - phutil_tag( - 'a', - array( - 'href' => $from_handle->getURI(), - ), - $from_handle->getURI()), - phutil_tag( - 'a', - array( - 'href' => $document_handle->getURI(), - ), - $document_handle->getURI()))); - break; - } - /* Fallthrough */ - default: - $view->setTitle(pht( - '%s %s the document %s.', - $author_link, - $verb, - $this->linkTo($document_phid))); - break; - } - - $view->setImage($this->getHandle($author_phid)->getImageURI()); - switch ($action) { - case PhrictionActionConstants::ACTION_CREATE: - $content = $this->renderSummary($data->getValue('content')); - $view->appendChild($content); - break; - } - - return $view; - } - - public function renderText() { - $author_handle = $this->getHandle($this->getAuthorPHID()); - $author_name = $author_handle->getName(); - - $document_handle = $this->getHandle($this->getPrimaryObjectPHID()); - $document_title = $document_handle->getLinkName(); - $document_uri = PhabricatorEnv::getURI($document_handle->getURI()); - - $action = $this->getValue('action'); - $verb = PhrictionActionConstants::getActionPastTenseVerb($action); - - $text = "{$author_name} {$verb} the document". - " {$document_title} {$document_uri}"; - - return $text; - } - -} diff --git a/src/applications/notification/builder/PhabricatorNotificationBuilder.php b/src/applications/notification/builder/PhabricatorNotificationBuilder.php index 46c73003ea..b39baf4561 100644 --- a/src/applications/notification/builder/PhabricatorNotificationBuilder.php +++ b/src/applications/notification/builder/PhabricatorNotificationBuilder.php @@ -26,32 +26,6 @@ final class PhabricatorNotificationBuilder { // nowhere sensible for the notification to link to, and no reasonable way // to unambiguously clear it. - // Each notification emits keys it can aggregate on. For instance, if this - // story is "a updated T123", it might emit a key like this: - // - // task:phid123:unread => PhabricatorFeedStoryManiphestAggregate - // - // All the unread notifications about the task with PHID "phid123" will - // emit the same key, telling us we can aggregate them into a single - // story of type "PhabricatorFeedStoryManiphestAggregate", which could - // read like "a and b updated T123". - // - // A story might be able to aggregate in multiple ways. Although this is - // unlikely for stories in a notification context, stories in a feed context - // can also aggregate by actor: - // - // task:phid123 => PhabricatorFeedStoryManiphestAggregate - // actor:user123 => PhabricatorFeedStoryActorAggregate - // - // This means the story can either become "a and b updated T123" or - // "a updated T123 and T456". When faced with multiple possibilities, it's - // our job to choose the best aggregation. - // - // For now, we use a simple greedy algorithm and repeatedly select the - // aggregate story which consumes the largest number of individual stories - // until no aggregate story exists that consumes more than one story. - - // Build up a map of all the possible aggregations. $chronokey_map = array(); From f05a7ed7b56ab2b37b5e483794c1d199581134d6 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Tue, 19 May 2015 14:27:47 -0700 Subject: [PATCH 64/86] Transactions - fix inverse edge transaction writes Summary: Ref XXXXX. I broke things a bit in XXXXX in that if the TYPE_EDGE had an inverse transaction, we weren't correctly "doing nothing" and instead were falling back to our old every editor has to implement a no-op ways... Fix things by putting the TYPE_EDGE code in the handle external builtin function like it belongs. Test Plan: made a comment on a task referencng a commit successfully Reviewers: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6403 Differential Revision: https://secure.phabricator.com/D12939 --- ...habricatorApplicationTransactionEditor.php | 109 +++++++++--------- 1 file changed, 56 insertions(+), 53 deletions(-) diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index 0329613b0e..8c9c26bfe9 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -438,61 +438,10 @@ abstract class PhabricatorApplicationTransactionEditor $this->subscribers = $subscribers; return $this->applyBuiltinExternalTransaction($object, $xaction); - case PhabricatorTransactions::TYPE_EDGE: - if ($this->getIsInverseEdgeEditor()) { - // If we're writing an inverse edge transaction, don't actually - // do anything. The initiating editor on the other side of the - // transaction will take care of the edge writes. - break; - } - - $old = $xaction->getOldValue(); - $new = $xaction->getNewValue(); - $src = $object->getPHID(); - $const = $xaction->getMetadataValue('edge:type'); - - $type = PhabricatorEdgeType::getByConstant($const); - if ($type->shouldWriteInverseTransactions()) { - $this->applyInverseEdgeTransactions( - $object, - $xaction, - $type->getInverseEdgeConstant()); - } - - foreach ($new as $dst_phid => $edge) { - $new[$dst_phid]['src'] = $src; - } - - $editor = new PhabricatorEdgeEditor(); - - foreach ($old as $dst_phid => $edge) { - if (!empty($new[$dst_phid])) { - if ($old[$dst_phid]['data'] === $new[$dst_phid]['data']) { - continue; - } - } - $editor->removeEdge($src, $const, $dst_phid); - } - - foreach ($new as $dst_phid => $edge) { - if (!empty($old[$dst_phid])) { - if ($old[$dst_phid]['data'] === $new[$dst_phid]['data']) { - continue; - } - } - - $data = array( - 'data' => $edge['data'], - ); - - $editor->addEdge($src, $const, $dst_phid, $data); - } - - $editor->save(); - return $this->applyBuiltinExternalTransaction($object, $xaction); case PhabricatorTransactions::TYPE_CUSTOMFIELD: $field = $this->getCustomFieldForTransaction($object, $xaction); return $field->applyApplicationTransactionExternalEffects($xaction); + case PhabricatorTransactions::TYPE_EDGE: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_JOIN_POLICY: @@ -547,7 +496,61 @@ abstract class PhabricatorApplicationTransactionEditor protected function applyBuiltinExternalTransaction( PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { - return; + + switch ($xaction->getTransactionType()) { + case PhabricatorTransactions::TYPE_EDGE: + if ($this->getIsInverseEdgeEditor()) { + // If we're writing an inverse edge transaction, don't actually + // do anything. The initiating editor on the other side of the + // transaction will take care of the edge writes. + break; + } + + $old = $xaction->getOldValue(); + $new = $xaction->getNewValue(); + $src = $object->getPHID(); + $const = $xaction->getMetadataValue('edge:type'); + + $type = PhabricatorEdgeType::getByConstant($const); + if ($type->shouldWriteInverseTransactions()) { + $this->applyInverseEdgeTransactions( + $object, + $xaction, + $type->getInverseEdgeConstant()); + } + + foreach ($new as $dst_phid => $edge) { + $new[$dst_phid]['src'] = $src; + } + + $editor = new PhabricatorEdgeEditor(); + + foreach ($old as $dst_phid => $edge) { + if (!empty($new[$dst_phid])) { + if ($old[$dst_phid]['data'] === $new[$dst_phid]['data']) { + continue; + } + } + $editor->removeEdge($src, $const, $dst_phid); + } + + foreach ($new as $dst_phid => $edge) { + if (!empty($old[$dst_phid])) { + if ($old[$dst_phid]['data'] === $new[$dst_phid]['data']) { + continue; + } + } + + $data = array( + 'data' => $edge['data'], + ); + + $editor->addEdge($src, $const, $dst_phid, $data); + } + + $editor->save(); + break; + } } /** From c896aeb62ed94dfd5d778d0faa294d04275b0de1 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Wed, 20 May 2015 07:06:07 +1000 Subject: [PATCH 65/86] Various linter fixes Summary: Apply various linter fixes. Test Plan: Unit tests + eyeballing. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: hach-que, Korvin, epriestley Differential Revision: https://secure.phabricator.com/D12390 --- src/aphront/AphrontRequest.php | 82 +++++++++---------- src/aphront/AphrontURIMapper.php | 6 +- src/aphront/response/AphrontJSONResponse.php | 2 +- .../celerity/CelerityResourceGraph.php | 2 +- .../ConpherenceUpdateController.php | 2 +- ...abricatorDashboardPanelRenderingEngine.php | 4 +- .../diffusion/data/DiffusionPathChange.php | 30 +++---- .../query/DiffusionRenameHistoryQuery.php | 2 +- .../pathchange/DiffusionPathChangeQuery.php | 8 +- .../files/storage/PhabricatorFile.php | 2 +- .../herald/adapter/HeraldAdapter.php | 6 +- .../LegalpadDocumentSignController.php | 2 +- .../PhabricatorMetaMTAReceivedMail.php | 2 +- ...PhabricatorNotificationPanelController.php | 2 +- .../oauthserver/PhabricatorOAuthServer.php | 2 +- .../PhabricatorOwnersDetailController.php | 2 +- .../PhabricatorOwnersListController.php | 2 +- .../PhabricatorPeopleController.php | 4 - .../pholio/editor/PholioMockEditor.php | 6 +- .../pholio/view/PholioMockImagesView.php | 4 +- .../PhabricatorProjectTransactionEditor.php | 2 +- ...ReleephWorkNextRequestConduitAPIMethod.php | 2 +- ...entialReleephRequestFieldSpecification.php | 2 +- .../ReleephRequestTransactionalEditor.php | 2 +- .../releeph/storage/ReleephRequest.php | 7 -- .../storage/ReleephRequestTransaction.php | 4 - .../query/PhabricatorTokenCountQuery.php | 2 +- ...catorApplicationTransactionCommentView.php | 2 +- .../events/PhabricatorEvent.php | 4 - .../DefaultDatabaseConfigurationProvider.php | 2 +- .../storage/lisk/LiskDAOSet.php | 2 +- src/view/AphrontDialogView.php | 2 +- src/view/AphrontJavelinView.php | 6 +- src/view/control/AphrontCursorPagerView.php | 28 +++---- src/view/control/AphrontPagerView.php | 20 ++--- src/view/form/PHUIInfoView.php | 2 +- src/view/layout/PhabricatorSourceCodeView.php | 2 +- src/view/phui/PHUITimelineView.php | 2 +- 38 files changed, 123 insertions(+), 142 deletions(-) diff --git a/src/aphront/AphrontRequest.php b/src/aphront/AphrontRequest.php index ab6e0d9820..4aa52c1fcb 100644 --- a/src/aphront/AphrontRequest.php +++ b/src/aphront/AphrontRequest.php @@ -28,44 +28,44 @@ final class AphrontRequest { private $applicationConfiguration; private $uriData; - final public function __construct($host, $path) { + public function __construct($host, $path) { $this->host = $host; $this->path = $path; } - final public function setURIMap(array $uri_data) { + public function setURIMap(array $uri_data) { $this->uriData = $uri_data; return $this; } - final public function getURIMap() { + public function getURIMap() { return $this->uriData; } - final public function getURIData($key, $default = null) { + public function getURIData($key, $default = null) { return idx($this->uriData, $key, $default); } - final public function setApplicationConfiguration( + public function setApplicationConfiguration( $application_configuration) { $this->applicationConfiguration = $application_configuration; return $this; } - final public function getApplicationConfiguration() { + public function getApplicationConfiguration() { return $this->applicationConfiguration; } - final public function setPath($path) { + public function setPath($path) { $this->path = $path; return $this; } - final public function getPath() { + public function getPath() { return $this->path; } - final public function getHost() { + public function getHost() { // The "Host" header may include a port number, or may be a malicious // header in the form "realdomain.com:ignored@evil.com". Invoke the full // parser to extract the real domain correctly. See here for coverage of @@ -83,7 +83,7 @@ final class AphrontRequest { /** * @task data */ - final public function setRequestData(array $request_data) { + public function setRequestData(array $request_data) { $this->requestData = $request_data; return $this; } @@ -92,7 +92,7 @@ final class AphrontRequest { /** * @task data */ - final public function getRequestData() { + public function getRequestData() { return $this->requestData; } @@ -100,7 +100,7 @@ final class AphrontRequest { /** * @task data */ - final public function getInt($name, $default = null) { + public function getInt($name, $default = null) { if (isset($this->requestData[$name])) { return (int)$this->requestData[$name]; } else { @@ -112,7 +112,7 @@ final class AphrontRequest { /** * @task data */ - final public function getBool($name, $default = null) { + public function getBool($name, $default = null) { if (isset($this->requestData[$name])) { if ($this->requestData[$name] === 'true') { return true; @@ -130,7 +130,7 @@ final class AphrontRequest { /** * @task data */ - final public function getStr($name, $default = null) { + public function getStr($name, $default = null) { if (isset($this->requestData[$name])) { $str = (string)$this->requestData[$name]; // Normalize newline craziness. @@ -148,7 +148,7 @@ final class AphrontRequest { /** * @task data */ - final public function getArr($name, $default = array()) { + public function getArr($name, $default = array()) { if (isset($this->requestData[$name]) && is_array($this->requestData[$name])) { return $this->requestData[$name]; @@ -161,7 +161,7 @@ final class AphrontRequest { /** * @task data */ - final public function getStrList($name, $default = array()) { + public function getStrList($name, $default = array()) { if (!isset($this->requestData[$name])) { return $default; } @@ -174,36 +174,36 @@ final class AphrontRequest { /** * @task data */ - final public function getExists($name) { + public function getExists($name) { return array_key_exists($name, $this->requestData); } - final public function getFileExists($name) { + public function getFileExists($name) { return isset($_FILES[$name]) && (idx($_FILES[$name], 'error') !== UPLOAD_ERR_NO_FILE); } - final public function isHTTPGet() { + public function isHTTPGet() { return ($_SERVER['REQUEST_METHOD'] == 'GET'); } - final public function isHTTPPost() { + public function isHTTPPost() { return ($_SERVER['REQUEST_METHOD'] == 'POST'); } - final public function isAjax() { + public function isAjax() { return $this->getExists(self::TYPE_AJAX) && !$this->isQuicksand(); } - final public function isWorkflow() { + public function isWorkflow() { return $this->getExists(self::TYPE_WORKFLOW) && !$this->isQuicksand(); } - final public function isQuicksand() { + public function isQuicksand() { return $this->getExists(self::TYPE_QUICKSAND); } - final public function isConduit() { + public function isConduit() { return $this->getExists(self::TYPE_CONDUIT); } @@ -215,7 +215,7 @@ final class AphrontRequest { return 'X-Phabricator-Csrf'; } - final public function validateCSRF() { + public function validateCSRF() { $token_name = self::getCSRFTokenName(); $token = $this->getStr($token_name); @@ -281,7 +281,7 @@ final class AphrontRequest { return true; } - final public function isFormPost() { + public function isFormPost() { $post = $this->getExists(self::TYPE_FORM) && !$this->getExists(self::TYPE_HISEC) && $this->isHTTPPost(); @@ -293,7 +293,7 @@ final class AphrontRequest { return $this->validateCSRF(); } - final public function isFormOrHisecPost() { + public function isFormOrHisecPost() { $post = $this->getExists(self::TYPE_FORM) && $this->isHTTPPost(); @@ -305,12 +305,12 @@ final class AphrontRequest { } - final public function setCookiePrefix($prefix) { + public function setCookiePrefix($prefix) { $this->cookiePrefix = $prefix; return $this; } - final private function getPrefixedCookieName($name) { + private function getPrefixedCookieName($name) { if (strlen($this->cookiePrefix)) { return $this->cookiePrefix.'_'.$name; } else { @@ -318,7 +318,7 @@ final class AphrontRequest { } } - final public function getCookie($name, $default = null) { + public function getCookie($name, $default = null) { $name = $this->getPrefixedCookieName($name); $value = idx($_COOKIE, $name, $default); @@ -337,7 +337,7 @@ final class AphrontRequest { return $value; } - final public function clearCookie($name) { + public function clearCookie($name) { $this->setCookieWithExpiration($name, '', time() - (60 * 60 * 24 * 30)); unset($_COOKIE[$name]); } @@ -390,7 +390,7 @@ final class AphrontRequest { * * @task cookie */ - final public function canSetCookies() { + public function canSetCookies() { return (bool)$this->getCookieDomainURI(); } @@ -405,7 +405,7 @@ final class AphrontRequest { * @return this * @task cookie */ - final public function setCookie($name, $value) { + public function setCookie($name, $value) { $far_future = time() + (60 * 60 * 24 * 365 * 5); return $this->setCookieWithExpiration($name, $value, $far_future); } @@ -421,7 +421,7 @@ final class AphrontRequest { * @return this * @task cookie */ - final public function setTemporaryCookie($name, $value) { + public function setTemporaryCookie($name, $value) { return $this->setCookieWithExpiration($name, $value, 0); } @@ -435,7 +435,7 @@ final class AphrontRequest { * @return this * @task cookie */ - final private function setCookieWithExpiration( + private function setCookieWithExpiration( $name, $value, $expire) { @@ -485,31 +485,31 @@ final class AphrontRequest { return $this; } - final public function setUser($user) { + public function setUser($user) { $this->user = $user; return $this; } - final public function getUser() { + public function getUser() { return $this->user; } - final public function getViewer() { + public function getViewer() { return $this->user; } - final public function getRequestURI() { + public function getRequestURI() { $get = $_GET; unset($get['__path__']); $path = phutil_escape_uri($this->getPath()); return id(new PhutilURI($path))->setQueryParams($get); } - final public function isDialogFormPost() { + public function isDialogFormPost() { return $this->isFormPost() && $this->getStr('__dialog__'); } - final public function getRemoteAddr() { + public function getRemoteAddr() { return $_SERVER['REMOTE_ADDR']; } diff --git a/src/aphront/AphrontURIMapper.php b/src/aphront/AphrontURIMapper.php index 9c68f2485f..32f464911a 100644 --- a/src/aphront/AphrontURIMapper.php +++ b/src/aphront/AphrontURIMapper.php @@ -4,11 +4,11 @@ final class AphrontURIMapper { private $map; - final public function __construct(array $map) { + public function __construct(array $map) { $this->map = $map; } - final public function mapPath($path) { + public function mapPath($path) { $map = $this->map; foreach ($map as $rule => $value) { list($controller, $data) = $this->tryRule($rule, $value, $path); @@ -25,7 +25,7 @@ final class AphrontURIMapper { return array(null, null); } - final private function tryRule($rule, $value, $path) { + private function tryRule($rule, $value, $path) { $match = null; $pattern = '#^'.$rule.(is_array($value) ? '' : '$').'#'; if (!preg_match($pattern, $path, $match)) { diff --git a/src/aphront/response/AphrontJSONResponse.php b/src/aphront/response/AphrontJSONResponse.php index a9493a6282..3d1c429d41 100644 --- a/src/aphront/response/AphrontJSONResponse.php +++ b/src/aphront/response/AphrontJSONResponse.php @@ -19,7 +19,7 @@ final class AphrontJSONResponse extends AphrontResponse { if ($this->addJSONShield === null) { return true; } - return (bool) $this->addJSONShield; + return (bool)$this->addJSONShield; } public function buildResponseString() { diff --git a/src/applications/celerity/CelerityResourceGraph.php b/src/applications/celerity/CelerityResourceGraph.php index 715a64c35c..3aa5c12497 100644 --- a/src/applications/celerity/CelerityResourceGraph.php +++ b/src/applications/celerity/CelerityResourceGraph.php @@ -18,7 +18,7 @@ final class CelerityResourceGraph extends AbstractDirectedGraph { return $edges; } - final public function setResourceGraph(array $graph) { + public function setResourceGraph(array $graph) { $this->resourceGraph = $graph; $this->graphSet = true; return $this; diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php index d37fefdf14..8d7db7691c 100644 --- a/src/applications/conpherence/controller/ConpherenceUpdateController.php +++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php @@ -550,7 +550,7 @@ final class ConpherenceUpdateController $content = array( 'non_update' => $non_update, 'transactions' => hsprintf('%s', $rendered_transactions), - 'conpherence_title' => (string) $data['title'], + 'conpherence_title' => (string)$data['title'], 'latest_transaction_id' => $new_latest_transaction_id, 'nav_item' => $nav_item, 'conpherence_phid' => $conpherence->getPHID(), diff --git a/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php b/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php index e8f796fa59..dfba37eaa5 100644 --- a/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php +++ b/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php @@ -246,7 +246,7 @@ final class PhabricatorDashboardPanelRenderingEngine extends Phobject { $action_edit = id(new PHUIIconView()) ->setIconFont('fa-pencil') ->setWorkflow(true) - ->setHref((string) $edit_uri); + ->setHref((string)$edit_uri); $header->addAction($action_edit); if ($dashboard_id) { @@ -255,7 +255,7 @@ final class PhabricatorDashboardPanelRenderingEngine extends Phobject { ->setQueryParam('panelPHID', $panel->getPHID()); $action_remove = id(new PHUIIconView()) ->setIconFont('fa-trash-o') - ->setHref((string) $uri) + ->setHref((string)$uri) ->setWorkflow(true); $header->addAction($action_remove); } diff --git a/src/applications/diffusion/data/DiffusionPathChange.php b/src/applications/diffusion/data/DiffusionPathChange.php index 6f96057014..939fea9449 100644 --- a/src/applications/diffusion/data/DiffusionPathChange.php +++ b/src/applications/diffusion/data/DiffusionPathChange.php @@ -13,12 +13,12 @@ final class DiffusionPathChange { private $targetCommitIdentifier; private $awayPaths = array(); - final public function setPath($path) { + public function setPath($path) { $this->path = $path; return $this; } - final public function getPath() { + public function getPath() { return $this->path; } @@ -58,58 +58,58 @@ final class DiffusionPathChange { return $this->awayPaths; } - final public function setCommitIdentifier($commit) { + public function setCommitIdentifier($commit) { $this->commitIdentifier = $commit; return $this; } - final public function getCommitIdentifier() { + public function getCommitIdentifier() { return $this->commitIdentifier; } - final public function setTargetCommitIdentifier($target_commit_identifier) { + public function setTargetCommitIdentifier($target_commit_identifier) { $this->targetCommitIdentifier = $target_commit_identifier; return $this; } - final public function getTargetCommitIdentifier() { + public function getTargetCommitIdentifier() { return $this->targetCommitIdentifier; } - final public function setCommit($commit) { + public function setCommit($commit) { $this->commit = $commit; return $this; } - final public function getCommit() { + public function getCommit() { return $this->commit; } - final public function setCommitData($commit_data) { + public function setCommitData($commit_data) { $this->commitData = $commit_data; return $this; } - final public function getCommitData() { + public function getCommitData() { return $this->commitData; } - final public function getEpoch() { + public function getEpoch() { if ($this->getCommit()) { return $this->getCommit()->getEpoch(); } return null; } - final public function getAuthorName() { + public function getAuthorName() { if ($this->getCommitData()) { return $this->getCommitData()->getAuthorName(); } return null; } - final public function getSummary() { + public function getSummary() { if (!$this->getCommitData()) { return null; } @@ -118,7 +118,7 @@ final class DiffusionPathChange { return substr($first, 0, 80); } - final public static function convertToArcanistChanges(array $changes) { + public static function convertToArcanistChanges(array $changes) { assert_instances_of($changes, __CLASS__); $direct = array(); $result = array(); @@ -142,7 +142,7 @@ final class DiffusionPathChange { return array_select_keys($result, $direct); } - final public static function convertToDifferentialChangesets( + public static function convertToDifferentialChangesets( PhabricatorUser $user, array $changes) { assert_instances_of($changes, __CLASS__); diff --git a/src/applications/diffusion/query/DiffusionRenameHistoryQuery.php b/src/applications/diffusion/query/DiffusionRenameHistoryQuery.php index 537364b0ce..a8f5615192 100644 --- a/src/applications/diffusion/query/DiffusionRenameHistoryQuery.php +++ b/src/applications/diffusion/query/DiffusionRenameHistoryQuery.php @@ -30,7 +30,7 @@ final class DiffusionRenameHistoryQuery { return $this->oldCommit; } - final public function loadOldFilename() { + public function loadOldFilename() { $drequest = $this->request; $repository_id = $drequest->getRepository()->getID(); $conn_r = id(new PhabricatorRepository())->establishConnection('r'); diff --git a/src/applications/diffusion/query/pathchange/DiffusionPathChangeQuery.php b/src/applications/diffusion/query/pathchange/DiffusionPathChangeQuery.php index c661e55226..d2f4a2b690 100644 --- a/src/applications/diffusion/query/pathchange/DiffusionPathChangeQuery.php +++ b/src/applications/diffusion/query/pathchange/DiffusionPathChangeQuery.php @@ -14,11 +14,11 @@ final class DiffusionPathChangeQuery { return $this->limit; } - final private function __construct() { + private function __construct() { // } - final public static function newFromDiffusionRequest( + public static function newFromDiffusionRequest( DiffusionRequest $request) { $query = new DiffusionPathChangeQuery(); $query->request = $request; @@ -26,11 +26,11 @@ final class DiffusionPathChangeQuery { return $query; } - final protected function getRequest() { + protected function getRequest() { return $this->request; } - final public function loadChanges() { + public function loadChanges() { return $this->executeQuery(); } diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php index f8e99bc965..c236a2368e 100644 --- a/src/applications/files/storage/PhabricatorFile.php +++ b/src/applications/files/storage/PhabricatorFile.php @@ -758,7 +758,7 @@ final class PhabricatorFile extends PhabricatorFileDAO public function getDownloadURI() { $uri = id(new PhutilURI($this->getViewURI())) ->setQueryParam('download', true); - return (string) $uri; + return (string)$uri; } public function getURIForTransform(PhabricatorFileTransform $transform) { diff --git a/src/applications/herald/adapter/HeraldAdapter.php b/src/applications/herald/adapter/HeraldAdapter.php index f56572a398..ca52b8da15 100644 --- a/src/applications/herald/adapter/HeraldAdapter.php +++ b/src/applications/herald/adapter/HeraldAdapter.php @@ -166,7 +166,7 @@ abstract class HeraldAdapter { throw new Exception(pht('You must setIsNewObject to a boolean first!')); } public function setIsNewObject($new) { - $this->isNewObject = (bool) $new; + $this->isNewObject = (bool)$new; return $this; } @@ -681,9 +681,9 @@ abstract class HeraldAdapter { } return $result; case self::CONDITION_HAS_BIT: - return (($condition_value & $field_value) === (int) $condition_value); + return (($condition_value & $field_value) === (int)$condition_value); case self::CONDITION_NOT_BIT: - return (($condition_value & $field_value) !== (int) $condition_value); + return (($condition_value & $field_value) !== (int)$condition_value); default: throw new HeraldInvalidConditionException( "Unknown condition '{$condition_type}'."); diff --git a/src/applications/legalpad/controller/LegalpadDocumentSignController.php b/src/applications/legalpad/controller/LegalpadDocumentSignController.php index b1c23f5d9a..4cd2f59b4c 100644 --- a/src/applications/legalpad/controller/LegalpadDocumentSignController.php +++ b/src/applications/legalpad/controller/LegalpadDocumentSignController.php @@ -199,7 +199,7 @@ final class LegalpadDocumentSignController extends LegalpadController { $next_uri = '/'.$document->getMonogram(); if ($document->getRequireSignature()) { $request_uri = $request->getRequestURI(); - $next_uri = (string) $request_uri; + $next_uri = (string)$request_uri; } } else { $this->sendVerifySignatureEmail( diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php index fa5ad7f752..91634fe577 100644 --- a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php +++ b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php @@ -90,7 +90,7 @@ final class PhabricatorMetaMTAReceivedMail extends PhabricatorMetaMTADAO { return $this->loadPHIDsFromAddresses($addresses); } - final public function loadCCPHIDs() { + public function loadCCPHIDs() { return $this->loadPHIDsFromAddresses($this->getCCAddresses()); } diff --git a/src/applications/notification/controller/PhabricatorNotificationPanelController.php b/src/applications/notification/controller/PhabricatorNotificationPanelController.php index 850bfe7392..3e8f16b07a 100644 --- a/src/applications/notification/controller/PhabricatorNotificationPanelController.php +++ b/src/applications/notification/controller/PhabricatorNotificationPanelController.php @@ -34,7 +34,7 @@ final class PhabricatorNotificationPanelController 'a', array( 'sigil' => 'workflow', - 'href' => (string) $clear_uri, + 'href' => (string)$clear_uri, 'class' => $clear_ui_class, ), pht('Mark All Read')); diff --git a/src/applications/oauthserver/PhabricatorOAuthServer.php b/src/applications/oauthserver/PhabricatorOAuthServer.php index 228ea8e61e..b7dc0d6301 100644 --- a/src/applications/oauthserver/PhabricatorOAuthServer.php +++ b/src/applications/oauthserver/PhabricatorOAuthServer.php @@ -112,7 +112,7 @@ final class PhabricatorOAuthServer { $authorization_code->setClientPHID($client->getPHID()); $authorization_code->setClientSecret($client->getSecret()); $authorization_code->setUserPHID($this->getUser()->getPHID()); - $authorization_code->setRedirectURI((string) $redirect_uri); + $authorization_code->setRedirectURI((string)$redirect_uri); $authorization_code->save(); return $authorization_code; diff --git a/src/applications/owners/controller/PhabricatorOwnersDetailController.php b/src/applications/owners/controller/PhabricatorOwnersDetailController.php index 1db98f14aa..0b50db02d5 100644 --- a/src/applications/owners/controller/PhabricatorOwnersDetailController.php +++ b/src/applications/owners/controller/PhabricatorOwnersDetailController.php @@ -92,7 +92,7 @@ final class PhabricatorOwnersDetailController $path_link = phutil_tag( 'a', array( - 'href' => (string) $href, + 'href' => (string)$href, ), $path->getPath()); $path_links[] = hsprintf( diff --git a/src/applications/owners/controller/PhabricatorOwnersListController.php b/src/applications/owners/controller/PhabricatorOwnersListController.php index ef7b01ebfb..2a206616e6 100644 --- a/src/applications/owners/controller/PhabricatorOwnersListController.php +++ b/src/applications/owners/controller/PhabricatorOwnersListController.php @@ -285,7 +285,7 @@ final class PhabricatorOwnersListController phutil_tag( 'a', array( - 'href' => (string) $href, + 'href' => (string)$href, ), $path->getPath())); } else { diff --git a/src/applications/people/controller/PhabricatorPeopleController.php b/src/applications/people/controller/PhabricatorPeopleController.php index 5b06364bbd..4366c39758 100644 --- a/src/applications/people/controller/PhabricatorPeopleController.php +++ b/src/applications/people/controller/PhabricatorPeopleController.php @@ -45,10 +45,6 @@ abstract class PhabricatorPeopleController extends PhabricatorController { return $this->buildSideNavView(true)->getMenu(); } - protected function buildApplicationCrumbs() { - return parent::buildApplicationCrumbs(); - } - public function buildIconNavView(PhabricatorUser $user) { $viewer = $this->getViewer(); $picture = $user->getProfileImageURI(); diff --git a/src/applications/pholio/editor/PholioMockEditor.php b/src/applications/pholio/editor/PholioMockEditor.php index cd36b563b3..87d8d51167 100644 --- a/src/applications/pholio/editor/PholioMockEditor.php +++ b/src/applications/pholio/editor/PholioMockEditor.php @@ -260,19 +260,19 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor { break; case PholioTransactionType::TYPE_IMAGE_NAME: $image = $this->getImageForXaction($object, $xaction); - $value = (string) head($xaction->getNewValue()); + $value = (string)head($xaction->getNewValue()); $image->setName($value); $image->save(); break; case PholioTransactionType::TYPE_IMAGE_DESCRIPTION: $image = $this->getImageForXaction($object, $xaction); - $value = (string) head($xaction->getNewValue()); + $value = (string)head($xaction->getNewValue()); $image->setDescription($value); $image->save(); break; case PholioTransactionType::TYPE_IMAGE_SEQUENCE: $image = $this->getImageForXaction($object, $xaction); - $value = (int) head($xaction->getNewValue()); + $value = (int)head($xaction->getNewValue()); $image->setSequence($value); $image->save(); break; diff --git a/src/applications/pholio/view/PholioMockImagesView.php b/src/applications/pholio/view/PholioMockImagesView.php index d59e701579..c1bcb46230 100644 --- a/src/applications/pholio/view/PholioMockImagesView.php +++ b/src/applications/pholio/view/PholioMockImagesView.php @@ -137,7 +137,7 @@ final class PholioMockImagesView extends AphrontView { ); $login_uri = id(new PhutilURI('/login/')) - ->setQueryParam('next', (string) $this->getRequestURI()); + ->setQueryParam('next', (string)$this->getRequestURI()); $config = array( 'mockID' => $mock->getID(), @@ -147,7 +147,7 @@ final class PholioMockImagesView extends AphrontView { 'images' => $images, 'selectedID' => $selected_id, 'loggedIn' => $this->getUser()->isLoggedIn(), - 'logInLink' => (string) $login_uri, + 'logInLink' => (string)$login_uri, 'navsequence' => $navsequence, 'fullIcon' => hsprintf('%s', $full_icon), 'downloadIcon' => hsprintf('%s', $download_icon), diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php index 307e186dbd..b85c127241 100644 --- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php +++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php @@ -51,7 +51,7 @@ final class PhabricatorProjectTransactionEditor case PhabricatorProjectTransaction::TYPE_COLOR: return $object->getColor(); case PhabricatorProjectTransaction::TYPE_LOCKED: - return (int) $object->getIsMembershipLocked(); + return (int)$object->getIsMembershipLocked(); } return parent::getCustomTransactionOldValue($object, $xaction); diff --git a/src/applications/releeph/conduit/work/ReleephWorkNextRequestConduitAPIMethod.php b/src/applications/releeph/conduit/work/ReleephWorkNextRequestConduitAPIMethod.php index 5e3d004ce6..e161faf082 100644 --- a/src/applications/releeph/conduit/work/ReleephWorkNextRequestConduitAPIMethod.php +++ b/src/applications/releeph/conduit/work/ReleephWorkNextRequestConduitAPIMethod.php @@ -177,7 +177,7 @@ final class ReleephWorkNextRequestConduitAPIMethod foreach ($releeph_requests as $rq) { // TODO: it's likely that relying on the `id` column to provide // trunk-commit-order is thoroughly broken. - $ordinal = (int) $rq->loadPhabricatorRepositoryCommit()->getID(); + $ordinal = (int)$rq->loadPhabricatorRepositoryCommit()->getID(); $surrogate[$ordinal] = $rq; } ksort($surrogate); diff --git a/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php b/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php index 1c2a10eace..6e635ee4b3 100644 --- a/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php +++ b/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php @@ -180,7 +180,7 @@ final class DifferentialReleephRequestFieldSpecification { "Releeph request token '{$token}'!"); } - $id = (int) $match[1]; + $id = (int)$match[1]; $releeph_request = id(new ReleephRequest())->load($id); if (!$releeph_request) { diff --git a/src/applications/releeph/editor/ReleephRequestTransactionalEditor.php b/src/applications/releeph/editor/ReleephRequestTransactionalEditor.php index 9e4c0083d2..993079c506 100644 --- a/src/applications/releeph/editor/ReleephRequestTransactionalEditor.php +++ b/src/applications/releeph/editor/ReleephRequestTransactionalEditor.php @@ -114,7 +114,7 @@ final class ReleephRequestTransactionalEditor break; case ReleephRequestTransaction::TYPE_MANUAL_IN_BRANCH: - $object->setInBranch((int) $new); + $object->setInBranch((int)$new); break; } } diff --git a/src/applications/releeph/storage/ReleephRequest.php b/src/applications/releeph/storage/ReleephRequest.php index 7f2487107a..f2b51b6d89 100644 --- a/src/applications/releeph/storage/ReleephRequest.php +++ b/src/applications/releeph/storage/ReleephRequest.php @@ -293,13 +293,6 @@ final class ReleephRequest extends ReleephDAO throw new Exception('`status` is now deprecated!'); } -/* -( Make magic Lisk methods private )------------------------------------ */ - - private function setUserIntents(array $ar) { - return parent::setUserIntents($ar); - } - - /* -( PhabricatorApplicationTransactionInterface )------------------------- */ diff --git a/src/applications/releeph/storage/ReleephRequestTransaction.php b/src/applications/releeph/storage/ReleephRequestTransaction.php index f4a4720c78..b12ed6ad8c 100644 --- a/src/applications/releeph/storage/ReleephRequestTransaction.php +++ b/src/applications/releeph/storage/ReleephRequestTransaction.php @@ -146,10 +146,6 @@ final class ReleephRequestTransaction } } - public function getActionStrength() { - return parent::getActionStrength(); - } - public function getActionName() { switch ($this->getTransactionType()) { case self::TYPE_REQUEST: diff --git a/src/applications/tokens/query/PhabricatorTokenCountQuery.php b/src/applications/tokens/query/PhabricatorTokenCountQuery.php index d942f22ce4..64333715fd 100644 --- a/src/applications/tokens/query/PhabricatorTokenCountQuery.php +++ b/src/applications/tokens/query/PhabricatorTokenCountQuery.php @@ -10,7 +10,7 @@ final class PhabricatorTokenCountQuery return $this; } - final public function execute() { + public function execute() { $table = new PhabricatorTokenCount(); $conn_r = $table->establishConnection('r'); diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php index 311c7e8b9f..cbc3739cfb 100644 --- a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php +++ b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php @@ -83,7 +83,7 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView { $user = $this->getUser(); if (!$user->isLoggedIn()) { $uri = id(new PhutilURI('/login/')) - ->setQueryParam('next', (string) $this->getRequestURI()); + ->setQueryParam('next', (string)$this->getRequestURI()); return id(new PHUIObjectBoxView()) ->setFlush(true) ->setHeaderText(pht('Add Comment')) diff --git a/src/infrastructure/events/PhabricatorEvent.php b/src/infrastructure/events/PhabricatorEvent.php index bfb08b203b..b0e8b28ebd 100644 --- a/src/infrastructure/events/PhabricatorEvent.php +++ b/src/infrastructure/events/PhabricatorEvent.php @@ -6,10 +6,6 @@ final class PhabricatorEvent extends PhutilEvent { private $aphrontRequest; private $conduitRequest; - public function __construct($type, array $data = array()) { - parent::__construct($type, $data); - } - public function setUser(PhabricatorUser $user) { $this->user = $user; return $this; diff --git a/src/infrastructure/storage/configuration/DefaultDatabaseConfigurationProvider.php b/src/infrastructure/storage/configuration/DefaultDatabaseConfigurationProvider.php index 839fa2816b..ea83209b43 100644 --- a/src/infrastructure/storage/configuration/DefaultDatabaseConfigurationProvider.php +++ b/src/infrastructure/storage/configuration/DefaultDatabaseConfigurationProvider.php @@ -40,7 +40,7 @@ final class DefaultDatabaseConfigurationProvider return $this->namespace.'_'.$this->getDao()->getApplicationName(); } - final protected function getDao() { + protected function getDao() { return $this->dao; } diff --git a/src/infrastructure/storage/lisk/LiskDAOSet.php b/src/infrastructure/storage/lisk/LiskDAOSet.php index a554a19b62..399aef3687 100644 --- a/src/infrastructure/storage/lisk/LiskDAOSet.php +++ b/src/infrastructure/storage/lisk/LiskDAOSet.php @@ -38,7 +38,7 @@ final class LiskDAOSet { * The main purpose of this method is to break cyclic dependency. * It removes all objects from this set and all subsets created by it. */ - final public function clearSet() { + public function clearSet() { $this->daos = array(); $this->relatives = array(); foreach ($this->subsets as $set) { diff --git a/src/view/AphrontDialogView.php b/src/view/AphrontDialogView.php index 925d76a565..b551c14f35 100644 --- a/src/view/AphrontDialogView.php +++ b/src/view/AphrontDialogView.php @@ -174,7 +174,7 @@ final class AphrontDialogView extends AphrontView { return $this; } - final public function render() { + public function render() { require_celerity_resource('aphront-dialog-view-css'); $buttons = array(); diff --git a/src/view/AphrontJavelinView.php b/src/view/AphrontJavelinView.php index 6471f1f951..7a2954eee3 100644 --- a/src/view/AphrontJavelinView.php +++ b/src/view/AphrontJavelinView.php @@ -46,7 +46,7 @@ final class AphrontJavelinView extends AphrontView { return $this->name; } - final public function setName($template_name) { + public function setName($template_name) { $this->name = $template_name; return $this; } @@ -55,7 +55,7 @@ final class AphrontJavelinView extends AphrontView { return $this->parameters; } - final public function setParameters($template_parameters) { + public function setParameters($template_parameters) { $this->parameters = $template_parameters; return $this; } @@ -64,7 +64,7 @@ final class AphrontJavelinView extends AphrontView { return $this->celerityResource; } - final public function setCelerityResource($celerity_resource) { + public function setCelerityResource($celerity_resource) { $this->celerityResource = $celerity_resource; return $this; } diff --git a/src/view/control/AphrontCursorPagerView.php b/src/view/control/AphrontCursorPagerView.php index 81ab33df81..bc1e872103 100644 --- a/src/view/control/AphrontCursorPagerView.php +++ b/src/view/control/AphrontCursorPagerView.php @@ -13,64 +13,64 @@ final class AphrontCursorPagerView extends AphrontView { private $uri; - final public function setPageSize($page_size) { + public function setPageSize($page_size) { $this->pageSize = max(1, $page_size); return $this; } - final public function getPageSize() { + public function getPageSize() { return $this->pageSize; } - final public function setURI(PhutilURI $uri) { + public function setURI(PhutilURI $uri) { $this->uri = $uri; return $this; } - final public function readFromRequest(AphrontRequest $request) { + public function readFromRequest(AphrontRequest $request) { $this->uri = $request->getRequestURI(); $this->afterID = $request->getStr('after'); $this->beforeID = $request->getStr('before'); return $this; } - final public function setAfterID($after_id) { + public function setAfterID($after_id) { $this->afterID = $after_id; return $this; } - final public function getAfterID() { + public function getAfterID() { return $this->afterID; } - final public function setBeforeID($before_id) { + public function setBeforeID($before_id) { $this->beforeID = $before_id; return $this; } - final public function getBeforeID() { + public function getBeforeID() { return $this->beforeID; } - final public function setNextPageID($next_page_id) { + public function setNextPageID($next_page_id) { $this->nextPageID = $next_page_id; return $this; } - final public function getNextPageID() { + public function getNextPageID() { return $this->nextPageID; } - final public function setPrevPageID($prev_page_id) { + public function setPrevPageID($prev_page_id) { $this->prevPageID = $prev_page_id; return $this; } - final public function getPrevPageID() { + public function getPrevPageID() { return $this->prevPageID; } - final public function sliceResults(array $results) { + public function sliceResults(array $results) { if (count($results) > $this->getPageSize()) { $offset = ($this->beforeID ? count($results) - $this->getPageSize() : 0); $results = array_slice($results, $offset, $this->getPageSize(), true); @@ -79,7 +79,7 @@ final class AphrontCursorPagerView extends AphrontView { return $results; } - final public function getHasMoreResults() { + public function getHasMoreResults() { return $this->moreResults; } diff --git a/src/view/control/AphrontPagerView.php b/src/view/control/AphrontPagerView.php index 8b08b15c5a..82314454f3 100644 --- a/src/view/control/AphrontPagerView.php +++ b/src/view/control/AphrontPagerView.php @@ -13,52 +13,52 @@ final class AphrontPagerView extends AphrontView { private $surroundingPages = 2; private $enableKeyboardShortcuts; - final public function setPageSize($page_size) { + public function setPageSize($page_size) { $this->pageSize = max(1, $page_size); return $this; } - final public function setOffset($offset) { + public function setOffset($offset) { $this->offset = max(0, $offset); return $this; } - final public function getOffset() { + public function getOffset() { return $this->offset; } - final public function getPageSize() { + public function getPageSize() { return $this->pageSize; } - final public function setCount($count) { + public function setCount($count) { $this->count = $count; return $this; } - final public function setHasMorePages($has_more) { + public function setHasMorePages($has_more) { $this->hasMorePages = $has_more; return $this; } - final public function setURI(PhutilURI $uri, $paging_parameter) { + public function setURI(PhutilURI $uri, $paging_parameter) { $this->uri = $uri; $this->pagingParameter = $paging_parameter; return $this; } - final public function readFromRequest(AphrontRequest $request) { + public function readFromRequest(AphrontRequest $request) { $this->uri = $request->getRequestURI(); $this->pagingParameter = 'offset'; $this->offset = $request->getInt($this->pagingParameter); return $this; } - final public function willShowPagingControls() { + public function willShowPagingControls() { return $this->hasMorePages; } - final public function setSurroundingPages($pages) { + public function setSurroundingPages($pages) { $this->surroundingPages = max(0, $pages); return $this; } diff --git a/src/view/form/PHUIInfoView.php b/src/view/form/PHUIInfoView.php index 497fcf3f78..f6e6f9b054 100644 --- a/src/view/form/PHUIInfoView.php +++ b/src/view/form/PHUIInfoView.php @@ -40,7 +40,7 @@ final class PHUIInfoView extends AphrontView { return $this; } - final public function render() { + public function render() { require_celerity_resource('phui-info-view-css'); $errors = $this->errors; diff --git a/src/view/layout/PhabricatorSourceCodeView.php b/src/view/layout/PhabricatorSourceCodeView.php index 9a9454cbfa..7fb3f2ca66 100644 --- a/src/view/layout/PhabricatorSourceCodeView.php +++ b/src/view/layout/PhabricatorSourceCodeView.php @@ -72,7 +72,7 @@ final class PhabricatorSourceCodeView extends AphrontView { if ($this->canClickHighlight) { $line_uri = $this->uri.'$'.$line_number; - $line_href = (string) new PhutilURI($line_uri); + $line_href = (string)new PhutilURI($line_uri); $tag_number = javelin_tag( 'a', diff --git a/src/view/phui/PHUITimelineView.php b/src/view/phui/PHUITimelineView.php index fe8cdc5971..b17e075711 100644 --- a/src/view/phui/PHUITimelineView.php +++ b/src/view/phui/PHUITimelineView.php @@ -132,7 +132,7 @@ final class PHUITimelineView extends AphrontView { javelin_tag( 'a', array( - 'href' => (string) $uri, + 'href' => (string)$uri, 'mustcapture' => true, 'sigil' => 'show-older-link', ), From 2154f17b3d7b7c4a47aee4ec49669f9a952f2e7c Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Tue, 19 May 2015 15:22:41 -0700 Subject: [PATCH 66/86] Transactions - fix bug adding people to projects Summary: Fixes T8264. Broken in D12929. Sweep all the applyBuiltin implementations and always break; rather than return Test Plan: added myself to a project successfully (showed up as a member) Reviewers: epriestley, chad Subscribers: Korvin, epriestley Maniphest Tasks: T6403, T8264 Differential Revision: https://secure.phabricator.com/D12940 --- src/applications/audit/editor/PhabricatorAuditEditor.php | 2 +- .../differential/editor/DifferentialTransactionEditor.php | 2 +- .../project/editor/PhabricatorProjectTransactionEditor.php | 6 +----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php index c628286a92..b2fd9d84b2 100644 --- a/src/applications/audit/editor/PhabricatorAuditEditor.php +++ b/src/applications/audit/editor/PhabricatorAuditEditor.php @@ -200,7 +200,7 @@ final class PhabricatorAuditEditor $state, $phid); } - return; + break; } return parent::applyBuiltinExternalTransaction($object, $xaction); diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php index d195d91833..0a02dec209 100644 --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -609,7 +609,7 @@ final class DifferentialTransactionEditor $state, $phid); } - return; + break; } return parent::applyBuiltinExternalTransaction($object, $xaction); diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php index b85c127241..d449b62801 100644 --- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php +++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php @@ -163,11 +163,7 @@ final class PhabricatorProjectTransactionEditor PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { - $old = $xaction->getOldValue(); - $new = $xaction->getNewValue(); - switch ($xaction->getTransactionType()) { - case PhabricatorTransactions::TYPE_EDGE: $edge_type = $xaction->getMetadataValue('edge:type'); switch ($edge_type) { @@ -220,7 +216,7 @@ final class PhabricatorProjectTransactionEditor } break; } - return; + break; } return parent::applyBuiltinExternalTransaction($object, $xaction); From 69940f2b9ee4dfb37b17b711e5e8c05aa3490d23 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Wed, 20 May 2015 09:37:39 +1000 Subject: [PATCH 67/86] Replace ArcanistPhutilTestCase refs with PhutilTestCase Summary: Ref T7977. Remove the `PhabricatorTestCase::getLink` method. Depends on D12665. Test Plan: `arc unit`. Reviewers: avivey, #blessed_reviewers, epriestley Reviewed By: avivey, #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7977 Differential Revision: https://secure.phabricator.com/D12667 --- src/__phutil_library_map__.php | 10 +++++----- .../__tests__/DifferentialAdjustmentMapTestCase.php | 2 +- .../storage/__tests__/DifferentialDiffTestCase.php | 2 +- .../storage/__tests__/DifferentialHunkTestCase.php | 2 +- .../request/__tests__/DiffusionURITestCase.php | 2 +- src/docs/contributor/unit_tests.diviner | 4 ++-- src/docs/user/userguide/arcanist_coverage.diviner | 2 +- src/infrastructure/testing/PhabricatorTestCase.php | 10 +--------- 8 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 39cc7a3751..cbc2e27de1 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -3532,7 +3532,7 @@ phutil_register_library_map(array( 'DifferentialActionEmailCommand' => 'MetaMTAEmailTransactionCommand', 'DifferentialActionMenuEventListener' => 'PhabricatorEventListener', 'DifferentialAddCommentView' => 'AphrontView', - 'DifferentialAdjustmentMapTestCase' => 'ArcanistPhutilTestCase', + 'DifferentialAdjustmentMapTestCase' => 'PhutilTestCase', 'DifferentialAffectedPath' => 'DifferentialDAO', 'DifferentialApplyPatchField' => 'DifferentialCustomField', 'DifferentialAsanaRepresentationField' => 'DifferentialCustomField', @@ -3597,7 +3597,7 @@ phutil_register_library_map(array( 'DifferentialDiffProperty' => 'DifferentialDAO', 'DifferentialDiffQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'DifferentialDiffTableOfContentsView' => 'AphrontView', - 'DifferentialDiffTestCase' => 'ArcanistPhutilTestCase', + 'DifferentialDiffTestCase' => 'PhutilTestCase', 'DifferentialDiffTransaction' => 'PhabricatorApplicationTransaction', 'DifferentialDiffViewController' => 'DifferentialController', 'DifferentialDoorkeeperRevisionFeedStoryPublisher' => 'DoorkeeperFeedStoryPublisher', @@ -3626,7 +3626,7 @@ phutil_register_library_map(array( ), 'DifferentialHunkParserTestCase' => 'PhabricatorTestCase', 'DifferentialHunkQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'DifferentialHunkTestCase' => 'ArcanistPhutilTestCase', + 'DifferentialHunkTestCase' => 'PhutilTestCase', 'DifferentialInlineComment' => 'PhabricatorInlineCommentInterface', 'DifferentialInlineCommentEditController' => 'PhabricatorInlineCommentController', 'DifferentialInlineCommentPreviewController' => 'PhabricatorInlineCommentPreviewController', @@ -3861,7 +3861,7 @@ phutil_register_library_map(array( 'DiffusionTagListController' => 'DiffusionController', 'DiffusionTagListView' => 'DiffusionView', 'DiffusionTagsQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod', - 'DiffusionURITestCase' => 'ArcanistPhutilTestCase', + 'DiffusionURITestCase' => 'PhutilTestCase', 'DiffusionUpdateCoverageConduitAPIMethod' => 'DiffusionConduitAPIMethod', 'DiffusionView' => 'AphrontView', 'DivinerArticleAtomizer' => 'DivinerAtomizer', @@ -6083,7 +6083,7 @@ phutil_register_library_map(array( 'PhabricatorTOTPAuthFactorTestCase' => 'PhabricatorTestCase', 'PhabricatorTaskmasterDaemon' => 'PhabricatorDaemon', 'PhabricatorTestApplication' => 'PhabricatorApplication', - 'PhabricatorTestCase' => 'ArcanistPhutilTestCase', + 'PhabricatorTestCase' => 'PhutilTestCase', 'PhabricatorTestController' => 'PhabricatorController', 'PhabricatorTestNoCycleEdgeType' => 'PhabricatorEdgeType', 'PhabricatorTestStorageEngine' => 'PhabricatorFileStorageEngine', diff --git a/src/applications/differential/storage/__tests__/DifferentialAdjustmentMapTestCase.php b/src/applications/differential/storage/__tests__/DifferentialAdjustmentMapTestCase.php index 8fc28953fc..1146afec4f 100644 --- a/src/applications/differential/storage/__tests__/DifferentialAdjustmentMapTestCase.php +++ b/src/applications/differential/storage/__tests__/DifferentialAdjustmentMapTestCase.php @@ -1,6 +1,6 @@ detectCopiesIn('lint_engine.diff'); diff --git a/src/applications/differential/storage/__tests__/DifferentialHunkTestCase.php b/src/applications/differential/storage/__tests__/DifferentialHunkTestCase.php index 2fcd7a9427..49866ac038 100644 --- a/src/applications/differential/storage/__tests__/DifferentialHunkTestCase.php +++ b/src/applications/differential/storage/__tests__/DifferentialHunkTestCase.php @@ -1,6 +1,6 @@ Date: Tue, 19 May 2015 16:55:36 -0700 Subject: [PATCH 68/86] Calendar event icons show up on month and day views Summary: Closes T7936, Calendar event icons show up on month and day views Test Plan: Calendar month and day views should show event icons Reviewers: chad, #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7936 Differential Revision: https://secure.phabricator.com/D12943 --- resources/celerity/map.php | 8 +- .../PhabricatorCalendarEventSearchEngine.php | 2 + .../view/AphrontCalendarEventView.php | 10 +++ .../phui/calendar/PHUICalendarDayView.php | 3 +- .../phui/calendar/PHUICalendarListView.php | 73 +++++++++++-------- .../css/phui/calendar/phui-calendar-list.css | 26 ++++--- .../css/phui/calendar/phui-calendar-month.css | 30 +++----- 7 files changed, 84 insertions(+), 68 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index c2b79e7a10..e150725a0e 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -122,8 +122,8 @@ return array( 'rsrc/css/layout/phabricator-side-menu-view.css' => 'c1db9e9c', 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/phui/calendar/phui-calendar-day.css' => 'c0cf782a', - 'rsrc/css/phui/calendar/phui-calendar-list.css' => '857a0d83', - 'rsrc/css/phui/calendar/phui-calendar-month.css' => '1d0e1e9b', + 'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1c7f338', + 'rsrc/css/phui/calendar/phui-calendar-month.css' => '94b1750a', 'rsrc/css/phui/calendar/phui-calendar.css' => 'ccabe893', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', @@ -764,8 +764,8 @@ return array( 'phui-button-css' => 'de610129', 'phui-calendar-css' => 'ccabe893', 'phui-calendar-day-css' => 'c0cf782a', - 'phui-calendar-list-css' => '857a0d83', - 'phui-calendar-month-css' => '1d0e1e9b', + 'phui-calendar-list-css' => 'c1c7f338', + 'phui-calendar-month-css' => '94b1750a', 'phui-crumbs-view-css' => '594d719e', 'phui-document-view-css' => '94d5dcd8', 'phui-feed-story-css' => 'c9f3a0b5', diff --git a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php index 4f65202a2c..b9ca2b81bf 100644 --- a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php +++ b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php @@ -364,6 +364,7 @@ final class PhabricatorCalendarEventSearchEngine $event = new AphrontCalendarEventView(); $event->setEpochRange($status->getDateFrom(), $status->getDateTo()); $event->setIsAllDay($status->getIsAllDay()); + $event->setIcon($status->getIcon()); $name_text = $handles[$status->getUserPHID()]->getName(); $status_text = $status->getName(); @@ -411,6 +412,7 @@ final class PhabricatorCalendarEventSearchEngine $event->setEventID($status->getID()); $event->setEpochRange($status->getDateFrom(), $status->getDateTo()); $event->setIsAllDay($status->getIsAllDay()); + $event->setIcon($status->getIcon()); $event->setViewerIsInvited($viewer_is_invited); $event->setName($status->getName()); diff --git a/src/applications/calendar/view/AphrontCalendarEventView.php b/src/applications/calendar/view/AphrontCalendarEventView.php index 669844290f..eb80a3ce49 100644 --- a/src/applications/calendar/view/AphrontCalendarEventView.php +++ b/src/applications/calendar/view/AphrontCalendarEventView.php @@ -11,6 +11,7 @@ final class AphrontCalendarEventView extends AphrontView { private $viewerIsInvited; private $uri; private $isAllDay; + private $icon; public function setURI($uri) { $this->uri = $uri; @@ -87,6 +88,15 @@ final class AphrontCalendarEventView extends AphrontView { return $this->isAllDay; } + public function setIcon($icon) { + $this->icon = $icon; + return $this; + } + + public function getIcon() { + return $this->icon; + } + public function getMultiDay() { $nextday = strtotime('12:00 AM Tomorrow', $this->getEpochStart()); diff --git a/src/view/phui/calendar/PHUICalendarDayView.php b/src/view/phui/calendar/PHUICalendarDayView.php index 45a4f6d1bc..337ef50738 100644 --- a/src/view/phui/calendar/PHUICalendarDayView.php +++ b/src/view/phui/calendar/PHUICalendarDayView.php @@ -276,7 +276,8 @@ final class PHUICalendarDayView extends AphrontView { ->addClass('calendar-day-view-sidebar'); $list = id(new PHUICalendarListView()) - ->setUser($this->user); + ->setUser($this->user) + ->setView('day'); if (count($events) == 0) { $list->showBlankState(true); diff --git a/src/view/phui/calendar/PHUICalendarListView.php b/src/view/phui/calendar/PHUICalendarListView.php index dd4bf34848..e1f37fa1ae 100644 --- a/src/view/phui/calendar/PHUICalendarListView.php +++ b/src/view/phui/calendar/PHUICalendarListView.php @@ -4,6 +4,16 @@ final class PHUICalendarListView extends AphrontTagView { private $events = array(); private $blankState; + private $view; + + private function getView() { + return $this->view; + } + + public function setView($view) { + $this->view = $view; + return $this; + } public function addEvent(AphrontCalendarEventView $event) { $this->events[] = $event; @@ -37,26 +47,28 @@ final class PHUICalendarListView extends AphrontTagView { if ($event->getIsAllDay()) { $timelabel = pht('All Day'); - $dot = null; } else { $timelabel = phabricator_time( $event->getEpochStart(), $this->getUser()); - - $dot = phutil_tag( - 'span', - array( - 'class' => 'phui-calendar-list-dot', - ), - ''); } + if ($event->getViewerIsInvited()) { + $icon_color = 'green'; + } else { + $icon_color = null; + } + + $dot = id(new PHUIIconView()) + ->setIconFont($event->getIcon(), $icon_color) + ->addClass('phui-calendar-list-item-icon'); + $title = phutil_tag( 'span', array( 'class' => 'phui-calendar-list-title', ), - $this->renderEventLink($event, $allday)); + $this->getEventTitle($event, $allday)); $time = phutil_tag( 'span', array( @@ -72,10 +84,18 @@ final class PHUICalendarListView extends AphrontTagView { $class = $class.' all-day'; } - $content = phutil_tag( + $tip = $this->getEventTooltip($event); + $tip_align = ($this->getView() == 'day') ? 'E' : 'N'; + $content = javelin_tag( 'a', array( 'href' => '/E'.$event->getEventID(), + 'sigil' => 'has-tooltip', + 'meta' => array( + 'tip' => $tip, + 'size' => 200, + 'align' => $tip_align, + ), ), array( $dot, @@ -110,8 +130,17 @@ final class PHUICalendarListView extends AphrontTagView { return $list; } - private function renderEventLink($event) { + private function getEventTitle($event) { + $class = 'phui-calendar-item'; + return phutil_tag( + 'span', + array( + 'class' => $class, + ), + $event->getName()); + } + private function getEventTooltip(AphrontCalendarEventView $event) { Javelin::initBehavior('phabricator-tooltips'); $start = id(AphrontFormDateControlValue::newFromEpoch( @@ -145,27 +174,7 @@ final class PHUICalendarListView extends AphrontTagView { $end->getValueAsFormat('M j, Y, g:i A')); } } - - $description = $event->getDescription(); - if (strlen($description) == 0) { - $description = pht('(%s)', $event->getName()); - } - - $class = 'phui-calendar-item'; - - $anchor = javelin_tag( - 'span', - array( - 'sigil' => 'has-tooltip', - 'class' => $class, - 'meta' => array( - 'tip' => $tip, - 'size' => 200, - ), - ), - $event->getName()); - - return $anchor; + return $tip; } public function getIsViewerInvitedOnList() { diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-list.css b/webroot/rsrc/css/phui/calendar/phui-calendar-list.css index 0155f730a4..c9bf7023d1 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-list.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-list.css @@ -29,25 +29,30 @@ .phui-calendar-list-item { position: relative; + line-height: 18px; + height: 18px; } -.phui-calendar-list-dot { - position: relative; - display: inline-block; - width: 5px; - height: 5px; - margin-right: 6px; - top: -5px; - border-radius: 10px; - border: 1px solid transparent; +.phui-calendar-list-item a { + display: block; + width: auto; + min-height: 18px; +} + +.phui-calendar-list-item-icon { + position: absolute; + left: 0; + top: 3px; } .phui-calendar-list-title { width: 200px; - display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + position: absolute; + left: 20px; + top: 0; } .phui-calendar-viewer-invited .phui-calendar-list-title { @@ -61,6 +66,7 @@ right: 0; color: {$lightgreytext}; text-align: right; + line-height: 20px; } .phui-calendar-list-item-empty { diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css index 6c0e20a2f6..d528c260f1 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css @@ -180,6 +180,7 @@ li.phui-calendar-viewer-invited.all-day { display: block; overflow: hidden; position: relative; + height: 18px; } .phui-calendar-view li.phui-calendar-list-item { @@ -187,40 +188,27 @@ li.phui-calendar-viewer-invited.all-day { width: auto; } -.phui-calendar-view .phui-calendar-list-dot { - position: relative; +.phui-calendar-list-item-icon { display: block; - float: left; - width: 3px; - height: 3px; - margin-right: 4px; - border-radius: 10px; - top: 5px; - left: 0; - display: none; + left: 0px; } .phui-calendar-view li.phui-calendar-list-item .phui-calendar-list-title { width: auto; position: absolute; - right: 0; - left: 60px; + left: 20px; + right: 60px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; } -li.all-day { - line-height: 18px; -} - .phui-calendar-view li.phui-calendar-list-item .phui-calendar-list-time { - position: relative; - display: inline-block; - float: left; + position: absolute; + top: 0; + right: 0px; padding: 0; - line-height: 18px; width: 60px; color: {$lightgreytext}; - text-align: left; + text-align: right; } From cbc5ad1604d02c805c899faefe75794add8bfa6b Mon Sep 17 00:00:00 2001 From: cburroughs Date: Wed, 20 May 2015 07:19:01 -0700 Subject: [PATCH 69/86] fix trvial space typo in user guide Test Plan: Read. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D12950 --- src/docs/user/userguide/users.diviner | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docs/user/userguide/users.diviner b/src/docs/user/userguide/users.diviner index 8d1e28aedb..83ceefac46 100644 --- a/src/docs/user/userguide/users.diviner +++ b/src/docs/user/userguide/users.diviner @@ -52,7 +52,7 @@ would allow administrators to gain other users' credentials). - administrators can access them, edit settings, and retrieve credentials; - they do not receive email; - they appear with lower precedence in the UI when selecting users, with - a "Bot" note (because i t usually does not make sense to, for example, + a "Bot" note (because it usually does not make sense to, for example, assign a task to a bot). = Disabled Users = From 953983983362fbba2d5e21b9399678435dae30f9 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 20 May 2015 09:08:39 -0700 Subject: [PATCH 70/86] Show authors as usernames when they're linked Summary: This data is available and loaded, just not used. Test Plan: {F411442} Reviewers: chad Reviewed By: chad Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D12951 --- src/applications/audit/view/PhabricatorAuditListView.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/applications/audit/view/PhabricatorAuditListView.php b/src/applications/audit/view/PhabricatorAuditListView.php index 6fc54f2e5f..96844c5b48 100644 --- a/src/applications/audit/view/PhabricatorAuditListView.php +++ b/src/applications/audit/view/PhabricatorAuditListView.php @@ -142,7 +142,12 @@ final class PhabricatorAuditListView extends AphrontView { $status_text = null; $status_color = null; } - $author_name = $commit->getCommitData()->getAuthorName(); + $author_phid = $commit->getAuthorPHID(); + if ($author_phid) { + $author_name = $this->getHandle($author_phid)->renderLink(); + } else { + $author_name = $commit->getCommitData()->getAuthorName(); + } $item = id(new PHUIObjectItemView()) ->setObjectName($commit_name) From 6b1d13bfaf3dec8bfc1957dddeb45a965011b79e Mon Sep 17 00:00:00 2001 From: lkassianik Date: Wed, 20 May 2015 09:51:26 -0700 Subject: [PATCH 71/86] Time control typeaheads. Summary: Ref T8031, Time control typeaheads Test Plan: Edit an event, type '3', typeahead should suggest, '3:00 AM', '3:30 AM', '3:00 PM', '3:30 PM'. Reviewers: chad, epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T8031 Differential Revision: https://secure.phabricator.com/D12953 --- resources/celerity/map.php | 28 +++++++++----- .../form/control/AphrontFormDateControl.php | 38 ++++++++++++++++++- webroot/rsrc/css/phui/phui-form-view.css | 15 +++++++- .../typeahead/source/TypeaheadStaticSource.js | 8 ++-- .../rsrc/js/core/behavior-time-typeahead.js | 36 ++++++++++++++++++ 5 files changed, 110 insertions(+), 15 deletions(-) create mode 100644 webroot/rsrc/js/core/behavior-time-typeahead.js diff --git a/resources/celerity/map.php b/resources/celerity/map.php index e150725a0e..1502be2eac 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -7,7 +7,7 @@ */ return array( 'names' => array( - 'core.pkg.css' => 'e3ba62e8', + 'core.pkg.css' => '36142bff', 'core.pkg.js' => '328799d0', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => 'bb338e4b', @@ -134,7 +134,7 @@ return array( 'rsrc/css/phui/phui-document.css' => '94d5dcd8', 'rsrc/css/phui/phui-feed-story.css' => 'c9f3a0b5', 'rsrc/css/phui/phui-fontkit.css' => 'dd8ddf27', - 'rsrc/css/phui/phui-form-view.css' => '94ae3032', + 'rsrc/css/phui/phui-form-view.css' => '79793450', 'rsrc/css/phui/phui-form.css' => 'f535f938', 'rsrc/css/phui/phui-header-view.css' => '75aaf372', 'rsrc/css/phui/phui-icon.css' => 'bc766998', @@ -231,7 +231,7 @@ return array( 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadOnDemandSource.js' => '8b3fd187', 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadPreloadedSource.js' => '54f314a0', 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadSource.js' => '2818f5ce', - 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadStaticSource.js' => '316b8fa1', + 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadStaticSource.js' => '6c0e62fa', 'rsrc/externals/raphael/g.raphael.js' => '40dde778', 'rsrc/externals/raphael/g.raphael.line.js' => '40da039e', 'rsrc/externals/raphael/raphael.js' => '51ee6b43', @@ -466,6 +466,7 @@ return array( 'rsrc/js/core/behavior-scrollbar.js' => '834a1173', 'rsrc/js/core/behavior-search-typeahead.js' => '048330fa', 'rsrc/js/core/behavior-select-on-click.js' => '4e3e79a6', + 'rsrc/js/core/behavior-time-typeahead.js' => '8cf340fd', 'rsrc/js/core/behavior-toggle-class.js' => '5d7c9f33', 'rsrc/js/core/behavior-tokenizer.js' => 'b3a4b884', 'rsrc/js/core/behavior-tooltip.js' => '3ee3408b', @@ -640,6 +641,7 @@ return array( 'javelin-behavior-slowvote-embed' => '887ad43f', 'javelin-behavior-stripe-payment-form' => '3f5d6dbf', 'javelin-behavior-test-payment-form' => 'fc91ab6c', + 'javelin-behavior-time-typeahead' => '8cf340fd', 'javelin-behavior-toggle-class' => '5d7c9f33', 'javelin-behavior-typeahead-browse' => '635de1ec', 'javelin-behavior-typeahead-search' => '93d0c9e3', @@ -677,7 +679,7 @@ return array( 'javelin-typeahead-ondemand-source' => '8b3fd187', 'javelin-typeahead-preloaded-source' => '54f314a0', 'javelin-typeahead-source' => '2818f5ce', - 'javelin-typeahead-static-source' => '316b8fa1', + 'javelin-typeahead-static-source' => '6c0e62fa', 'javelin-uri' => '6eff08aa', 'javelin-util' => '93cc50d6', 'javelin-vector' => '2caa8fb8', @@ -772,7 +774,7 @@ return array( 'phui-font-icon-base-css' => '3dad2ae3', 'phui-fontkit-css' => 'dd8ddf27', 'phui-form-css' => 'f535f938', - 'phui-form-view-css' => '94ae3032', + 'phui-form-view-css' => '79793450', 'phui-header-view-css' => '75aaf372', 'phui-icon-view-css' => 'bc766998', 'phui-image-mask-css' => '5a8b09c8', @@ -1036,10 +1038,6 @@ return array( 'javelin-install', 'javelin-event', ), - '316b8fa1' => array( - 'javelin-install', - 'javelin-typeahead-source', - ), '331b1611' => array( 'javelin-install', ), @@ -1307,6 +1305,10 @@ return array( '69adf288' => array( 'javelin-install', ), + '6c0e62fa' => array( + 'javelin-install', + 'javelin-typeahead-source', + ), '6c2b09a2' => array( 'javelin-install', 'javelin-util', @@ -1482,6 +1484,14 @@ return array( 'javelin-stratcom', 'javelin-behavior', ), + '8cf340fd' => array( + 'javelin-behavior', + 'javelin-util', + 'javelin-dom', + 'javelin-stratcom', + 'javelin-vector', + 'javelin-typeahead-static-source', + ), '8cf6d262' => array( 'javelin-install', 'javelin-dom', diff --git a/src/view/form/control/AphrontFormDateControl.php b/src/view/form/control/AphrontFormDateControl.php index 84de3b3215..df0efe2c4a 100644 --- a/src/view/form/control/AphrontFormDateControl.php +++ b/src/view/form/control/AphrontFormDateControl.php @@ -270,9 +270,19 @@ final class AphrontFormDateControl extends AphrontFormControl { ), $cicon); + $values = $this->getTimeTypeaheadValues(); + + $time_id = celerity_generate_unique_node_id(); + Javelin::initBehavior('time-typeahead', array( + 'timeID' => $time_id, + 'timeValues' => $values, + )); + + $time_sel = javelin_tag( 'input', array( + 'autocomplete' => 'off', 'name' => $this->getTimeInputName(), 'sigil' => 'time-input', 'value' => $this->getTimeInputValue(), @@ -281,6 +291,14 @@ final class AphrontFormDateControl extends AphrontFormControl { ), ''); + $time_div = javelin_tag( + 'div', + array( + 'id' => $time_id, + 'class' => 'aphront-form-date-time-input-container', + ), + $time_sel); + Javelin::initBehavior('fancy-datepicker', array()); $classes = array(); @@ -308,7 +326,7 @@ final class AphrontFormDateControl extends AphrontFormControl { $months_sel, $years_sel, $cal_icon, - $time_sel, + $time_div, )); } @@ -359,4 +377,22 @@ final class AphrontFormDateControl extends AphrontFormControl { return $value; } + private function getTimeTypeaheadValues() { + $times = array(); + $am_pm_list = array('AM', 'PM'); + + foreach ($am_pm_list as $am_pm) { + for ($hour = 0; $hour < 12; $hour++) { + $actual_hour = ($hour == 0) ? 12 : $hour; + $times[] = $actual_hour.':00 '.$am_pm; + $times[] = $actual_hour.':30 '.$am_pm; + } + } + + foreach ($times as $key => $time) { + $times[$key] = array($key, $time); + } + return $times; + } + } diff --git a/webroot/rsrc/css/phui/phui-form-view.css b/webroot/rsrc/css/phui/phui-form-view.css index 5a3180d8b0..2600de81ac 100644 --- a/webroot/rsrc/css/phui/phui-form-view.css +++ b/webroot/rsrc/css/phui/phui-form-view.css @@ -334,9 +334,22 @@ table.aphront-form-control-checkbox-layout th { font-size: 16px; } +.aphront-form-date-container .aphront-form-date-time-input-container { + position: relative; + display: inline-block; + width: 7em; +} + .aphront-form-date-container input.aphront-form-date-time-input { width: 7em; - display: inline; +} + +.aphront-form-date-time-input-container div.jx-typeahead-results a.jx-result { + border: none; +} + +.phui-time-typeahead-value { + padding: 4px; } .fancy-datepicker { diff --git a/webroot/rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadStaticSource.js b/webroot/rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadStaticSource.js index 765074ff27..9bd6bff8f4 100644 --- a/webroot/rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadStaticSource.js +++ b/webroot/rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadStaticSource.js @@ -16,19 +16,19 @@ JX.install('TypeaheadStaticSource', { construct : function(data) { JX.TypeaheadSource.call(this); - this._data = data; + this.data = data; }, members : { - _data : null, + data : null, didChange : function(value) { this.matchResults(value); }, didStart : function() { - for (var ii = 0; ii < this._data.length; ii++) { - this.addResult(this._data[ii]); + for (var ii = 0; ii < this.data.length; ii++) { + this.addResult(this.data[ii]); } } } diff --git a/webroot/rsrc/js/core/behavior-time-typeahead.js b/webroot/rsrc/js/core/behavior-time-typeahead.js new file mode 100644 index 0000000000..158b8fbd4b --- /dev/null +++ b/webroot/rsrc/js/core/behavior-time-typeahead.js @@ -0,0 +1,36 @@ +/** + * @provides javelin-behavior-time-typeahead + * @requires javelin-behavior + * javelin-util + * javelin-dom + * javelin-stratcom + * javelin-vector + * javelin-typeahead-static-source + */ + +JX.behavior('time-typeahead', function(config) { + var root = JX.$(config.timeID); + var datasource = new JX.TypeaheadStaticSource(config.timeValues); + datasource.setTransformer(function(v) { + var attributes = {'className' : 'phui-time-typeahead-value'}; + var display = JX.$N('div', attributes, v[1]); + var object = { + 'id' : v[0], + 'name' : v[1], + 'display' : display, + 'uri' : null + }; + return object; + }); + datasource.setSortHandler(function(value, list) { + list.sort(function(u,v){ + return (u.id > v.id) ? 1 : -1; + }); + }); + datasource.setMaximumResultCount(24); + var typeahead = new JX.Typeahead( + root, + JX.DOM.find(root, 'input', null)); + typeahead.setDatasource(datasource); + typeahead.start(); +}); From bb0004fd41bcec661940cbaf09d00792499cb769 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Wed, 20 May 2015 10:59:41 -0700 Subject: [PATCH 72/86] Make default start value of new events to be the next whole hour and the end value to be the next whole hour after that. Summary: Ref T8031, Make default start value of new events to be the next whole hour and the end value to be the next whole hour after that. Test Plan: Create new event at, say, 10:30am. Event default times should be 11:00 AM - 12:00 PM Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T8031 Differential Revision: https://secure.phabricator.com/D12954 --- ...PhabricatorCalendarEventEditController.php | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php index cf9797da45..f77846dd21 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php @@ -23,8 +23,8 @@ final class PhabricatorCalendarEventEditController if ($this->isCreate()) { $event = PhabricatorCalendarEvent::initializeNewCalendarEvent($user); - $end_value = AphrontFormDateControlValue::newFromEpoch($user, time()); - $start_value = AphrontFormDateControlValue::newFromEpoch($user, time()); + list($start_value, $end_value) = $this->getDefaultTimeValues($user); + $submit_label = pht('Create'); $page_title = pht('Create Event'); $redirect = 'created'; @@ -349,4 +349,22 @@ final class PhabricatorCalendarEventEditController return $new; } + private function getDefaultTimeValues($user) { + $start = new DateTime('@'.time()); + $start->setTimeZone($user->getTimeZone()); + + $start->setTime($start->format('H'), 0, 0); + $start->modify('+1 hour'); + $end = id(clone $start)->modify('+1 hour'); + + $start_value = AphrontFormDateControlValue::newFromEpoch( + $user, + $start->format('U')); + $end_value = AphrontFormDateControlValue::newFromEpoch( + $user, + $end->format('U')); + + return array($start_value, $end_value); + } + } From 9de39c12a2b48195f282abe4d930543d4bf24530 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Wed, 20 May 2015 13:54:22 -0700 Subject: [PATCH 73/86] Maniphest + Differential - don't show transaction preview until user interacts with the form. Summary: Fixes T4846. These are one off (for now) since they have various crazy actions with them. I think this will get unified and more cleaned up when we refine the UI for taking multiple actions at once, etc. Test Plan: noted no "commented on x" in either maniphest or differential. starting making a comment and noted prevew showed. started adding a subscriber (added to tokenizer) and preview showed. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T4846 Differential Revision: https://secure.phabricator.com/D12936 --- resources/celerity/map.php | 64 +++++++++---------- .../differential/behavior-comment-preview.js | 23 +++++-- .../maniphest/behavior-transaction-preview.js | 18 +++++- 3 files changed, 68 insertions(+), 37 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 1502be2eac..85e21f4a12 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -11,11 +11,11 @@ return array( 'core.pkg.js' => '328799d0', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => 'bb338e4b', - 'differential.pkg.js' => '45b3b51d', + 'differential.pkg.js' => '63a77807', 'diffusion.pkg.css' => '591664fa', 'diffusion.pkg.js' => '0115b37c', 'maniphest.pkg.css' => '68d4dd3d', - 'maniphest.pkg.js' => 'df4aa49f', + 'maniphest.pkg.js' => '2f4f52c2', 'rsrc/css/aphront/aphront-bars.css' => '231ac33c', 'rsrc/css/aphront/dark-console.css' => '6378ef3d', 'rsrc/css/aphront/dialog-view.css' => '9b32db0a', @@ -349,7 +349,7 @@ return array( 'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => 'd4c87bf4', 'rsrc/js/application/differential/behavior-add-reviewers-and-ccs.js' => 'e10f8e18', 'rsrc/js/application/differential/behavior-comment-jump.js' => '4fdb476d', - 'rsrc/js/application/differential/behavior-comment-preview.js' => '8e1389b5', + 'rsrc/js/application/differential/behavior-comment-preview.js' => 'b064af76', 'rsrc/js/application/differential/behavior-diff-radios.js' => 'e1ff79b1', 'rsrc/js/application/differential/behavior-dropdown-menus.js' => '2035b9cb', 'rsrc/js/application/differential/behavior-edit-inline-comments.js' => 'e723c323', @@ -379,7 +379,7 @@ return array( 'rsrc/js/application/maniphest/behavior-subpriorityeditor.js' => '84845b5b', 'rsrc/js/application/maniphest/behavior-transaction-controls.js' => '44168bad', 'rsrc/js/application/maniphest/behavior-transaction-expand.js' => '5fefb143', - 'rsrc/js/application/maniphest/behavior-transaction-preview.js' => 'f8248bc5', + 'rsrc/js/application/maniphest/behavior-transaction-preview.js' => '4c95d29e', 'rsrc/js/application/owners/OwnersPathEditor.js' => 'aa1733d0', 'rsrc/js/application/owners/owners-path-editor.js' => '7a68dda3', 'rsrc/js/application/passphrase/passphrase-credential-control.js' => '3cb0b2fc', @@ -466,7 +466,7 @@ return array( 'rsrc/js/core/behavior-scrollbar.js' => '834a1173', 'rsrc/js/core/behavior-search-typeahead.js' => '048330fa', 'rsrc/js/core/behavior-select-on-click.js' => '4e3e79a6', - 'rsrc/js/core/behavior-time-typeahead.js' => '8cf340fd', + 'rsrc/js/core/behavior-time-typeahead.js' => '3416cef7', 'rsrc/js/core/behavior-toggle-class.js' => '5d7c9f33', 'rsrc/js/core/behavior-tokenizer.js' => 'b3a4b884', 'rsrc/js/core/behavior-tooltip.js' => '3ee3408b', @@ -559,7 +559,7 @@ return array( 'javelin-behavior-differential-diff-radios' => 'e1ff79b1', 'javelin-behavior-differential-dropdown-menus' => '2035b9cb', 'javelin-behavior-differential-edit-inline-comments' => 'e723c323', - 'javelin-behavior-differential-feedback-preview' => '8e1389b5', + 'javelin-behavior-differential-feedback-preview' => 'b064af76', 'javelin-behavior-differential-keyboard-navigation' => '2c426492', 'javelin-behavior-differential-populate' => '8694b1df', 'javelin-behavior-differential-show-field-details' => 'bba9eedf', @@ -590,7 +590,7 @@ return array( 'javelin-behavior-maniphest-subpriority-editor' => '84845b5b', 'javelin-behavior-maniphest-transaction-controls' => '44168bad', 'javelin-behavior-maniphest-transaction-expand' => '5fefb143', - 'javelin-behavior-maniphest-transaction-preview' => 'f8248bc5', + 'javelin-behavior-maniphest-transaction-preview' => '4c95d29e', 'javelin-behavior-owners-path-editor' => '7a68dda3', 'javelin-behavior-passphrase-credential-control' => '3cb0b2fc', 'javelin-behavior-persona-login' => '9414ff18', @@ -641,7 +641,7 @@ return array( 'javelin-behavior-slowvote-embed' => '887ad43f', 'javelin-behavior-stripe-payment-form' => '3f5d6dbf', 'javelin-behavior-test-payment-form' => 'fc91ab6c', - 'javelin-behavior-time-typeahead' => '8cf340fd', + 'javelin-behavior-time-typeahead' => '3416cef7', 'javelin-behavior-toggle-class' => '5d7c9f33', 'javelin-behavior-typeahead-browse' => '635de1ec', 'javelin-behavior-typeahead-search' => '93d0c9e3', @@ -1041,6 +1041,14 @@ return array( '331b1611' => array( 'javelin-install', ), + '3416cef7' => array( + 'javelin-behavior', + 'javelin-util', + 'javelin-dom', + 'javelin-stratcom', + 'javelin-vector', + 'javelin-typeahead-static-source', + ), '3975b470' => array( 'javelin-behavior', 'javelin-dom', @@ -1130,6 +1138,14 @@ return array( 'javelin-request', 'javelin-util', ), + '4c95d29e' => array( + 'javelin-behavior', + 'javelin-dom', + 'javelin-util', + 'javelin-json', + 'javelin-stratcom', + 'phabricator-shaped-request', + ), '4cebc641' => array( 'javelin-install', ), @@ -1484,27 +1500,11 @@ return array( 'javelin-stratcom', 'javelin-behavior', ), - '8cf340fd' => array( - 'javelin-behavior', - 'javelin-util', - 'javelin-dom', - 'javelin-stratcom', - 'javelin-vector', - 'javelin-typeahead-static-source', - ), '8cf6d262' => array( 'javelin-install', 'javelin-dom', 'javelin-util', ), - '8e1389b5' => array( - 'javelin-behavior', - 'javelin-stratcom', - 'javelin-dom', - 'javelin-request', - 'javelin-util', - 'phabricator-shaped-request', - ), '8ef9ab58' => array( 'javelin-behavior', 'javelin-dom', @@ -1663,6 +1663,14 @@ return array( 'javelin-stratcom', 'javelin-install', ), + 'b064af76' => array( + 'javelin-behavior', + 'javelin-stratcom', + 'javelin-dom', + 'javelin-request', + 'javelin-util', + 'phabricator-shaped-request', + ), 'b1a59974' => array( 'javelin-behavior', 'javelin-aphlict', @@ -1983,14 +1991,6 @@ return array( 'javelin-typeahead-ondemand-source', 'javelin-util', ), - 'f8248bc5' => array( - 'javelin-behavior', - 'javelin-dom', - 'javelin-util', - 'javelin-json', - 'javelin-stratcom', - 'phabricator-shaped-request', - ), 'f829edb3' => array( 'javelin-view', 'javelin-install', diff --git a/webroot/rsrc/js/application/differential/behavior-comment-preview.js b/webroot/rsrc/js/application/differential/behavior-comment-preview.js index 3cf50535fd..283e6ea12c 100644 --- a/webroot/rsrc/js/application/differential/behavior-comment-preview.js +++ b/webroot/rsrc/js/application/differential/behavior-comment-preview.js @@ -21,10 +21,25 @@ JX.behavior('differential-feedback-preview', function(config) { var callback = function(r) { var preview = JX.$(config.preview); - JX.DOM.setContent(preview, JX.$H(r)); - JX.Stratcom.invoke('differential-preview-update', null, { - container: preview - }); + var data = getdata(); + var hide = true; + for (var field in data) { + if (field == 'action') { + continue; + } + if (data[field]) { + hide = false; + } + } + if (hide) { + JX.DOM.hide(preview); + } else { + JX.DOM.setContent(preview, JX.$H(r)); + JX.Stratcom.invoke('differential-preview-update', null, { + container: preview + }); + JX.DOM.show(preview); + } }; var getdata = function() { diff --git a/webroot/rsrc/js/application/maniphest/behavior-transaction-preview.js b/webroot/rsrc/js/application/maniphest/behavior-transaction-preview.js index ca18eb69d4..66b58b1f4b 100644 --- a/webroot/rsrc/js/application/maniphest/behavior-transaction-preview.js +++ b/webroot/rsrc/js/application/maniphest/behavior-transaction-preview.js @@ -14,7 +14,23 @@ JX.behavior('maniphest-transaction-preview', function(config) { var action = JX.$(config.action); var callback = function(r) { - JX.DOM.setContent(JX.$(config.preview), JX.$H(r)); + var panel = JX.$(config.preview); + var data = getdata(); + var hide = true; + for (var field in data) { + if (field == 'action') { + continue; + } + if (data[field]) { + hide = false; + } + } + if (hide) { + JX.DOM.hide(panel); + } else { + JX.DOM.setContent(panel, JX.$H(r)); + JX.DOM.show(panel); + } }; var getdata = function() { From 4787069e96fb8b664713d1c2c838139a74394151 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Wed, 20 May 2015 13:55:23 -0700 Subject: [PATCH 74/86] Transactions - finish making built-in transaction types implementation optional Summary: Fixes T6403. Remaining built-ins were already built-in effectively so this is a small re-factor plus some docs. I probably wouldn't have written anything if not for the TODO so please feel free to tell me to write something else or what have you. Test Plan: NA since this didn't actually change anything. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6403 Differential Revision: https://secure.phabricator.com/D12937 --- ...habricatorApplicationTransactionEditor.php | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index 8c9c26bfe9..57a3e4bde8 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -385,12 +385,11 @@ abstract class PhabricatorApplicationTransactionEditor PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { - case PhabricatorTransactions::TYPE_BUILDABLE: - case PhabricatorTransactions::TYPE_TOKEN: - return; case PhabricatorTransactions::TYPE_CUSTOMFIELD: $field = $this->getCustomFieldForTransaction($object, $xaction); return $field->applyApplicationTransactionInternalEffects($xaction); + case PhabricatorTransactions::TYPE_BUILDABLE: + case PhabricatorTransactions::TYPE_TOKEN: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_JOIN_POLICY: @@ -408,9 +407,6 @@ abstract class PhabricatorApplicationTransactionEditor PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { - case PhabricatorTransactions::TYPE_BUILDABLE: - case PhabricatorTransactions::TYPE_TOKEN: - return; case PhabricatorTransactions::TYPE_SUBSCRIBERS: $subeditor = id(new PhabricatorSubscriptionsEditor()) ->setObject($object) @@ -442,6 +438,8 @@ abstract class PhabricatorApplicationTransactionEditor $field = $this->getCustomFieldForTransaction($object, $xaction); return $field->applyApplicationTransactionExternalEffects($xaction); case PhabricatorTransactions::TYPE_EDGE: + case PhabricatorTransactions::TYPE_BUILDABLE: + case PhabricatorTransactions::TYPE_TOKEN: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_JOIN_POLICY: @@ -471,11 +469,17 @@ abstract class PhabricatorApplicationTransactionEditor "implementation!"); } - // TODO: Write proper documentation for these hooks. These are like the - // "applyCustom" hooks, except that implementation is optional, so you do - // not need to handle all of the builtin transaction types. See T6403. These - // are not completely implemented. - + /** + * @{class:PhabricatorTransactions} provides many built-in transactions + * which should not require much - if any - code in specific applications. + * + * This method is a hook for the exceedingly-rare cases where you may need + * to do **additional** work for built-in transactions. Developers should + * extend this method, making sure to return the parent implementation + * regardless of handling any transactions. + * + * See also @{method:applyBuiltinExternalTransaction}. + */ protected function applyBuiltinInternalTransaction( PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { @@ -493,6 +497,9 @@ abstract class PhabricatorApplicationTransactionEditor } } + /** + * See @{method::applyBuiltinInternalTransaction}. + */ protected function applyBuiltinExternalTransaction( PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { From 985eb26c7e32cdc19536769def6ab037645100fb Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 20 May 2015 14:20:53 -0700 Subject: [PATCH 75/86] Increase severity of bin/remove destroy warning Summary: Make sure we're 100% clear that this is really, truly not recommended. Also improve the text itself, and show the objects which are being destroyed more clearly. Test Plan: Removed objects with `bin/remove destroy`. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D12952 --- ...PhabricatorSystemRemoveDestroyWorkflow.php | 76 ++++++++++++++++--- .../PhabricatorUSEnglishTranslation.php | 11 +++ 2 files changed, 78 insertions(+), 9 deletions(-) diff --git a/src/applications/system/management/PhabricatorSystemRemoveDestroyWorkflow.php b/src/applications/system/management/PhabricatorSystemRemoveDestroyWorkflow.php index 2a4244e97f..2abbc52691 100644 --- a/src/applications/system/management/PhabricatorSystemRemoveDestroyWorkflow.php +++ b/src/applications/system/management/PhabricatorSystemRemoveDestroyWorkflow.php @@ -54,23 +54,81 @@ final class PhabricatorSystemRemoveDestroyWorkflow } } + $banner = <<writeOut("\n\n%s\n\n", $banner); + $console->writeOut( - "**%s**\n\n", - pht(' IMPORTANT: OBJECTS WILL BE PERMANENTLY DESTROYED! ')); + "** %s ** %s\n\n%s\n\n". + "** %s ** %s\n\n%s\n\n", + pht('IMPORTANT'), + pht('DATA WILL BE PERMANENTLY DESTROYED'), + phutil_console_wrap( + pht( + 'Objects will be permanently destroyed. There is no way to '. + 'undo this operation or ever retrieve this data unless you '. + 'maintain external backups.')), + pht('IMPORTANT'), + pht('DELETING OBJECTS OFTEN BREAKS THINGS'), + phutil_console_wrap( + pht( + 'Destroying objects may cause related objects to stop working, '. + 'and may leave scattered references to objects which no longer '. + 'exist. In most cases, it is much better to disable or archive '. + 'objects instead of destroying them. This risk is greatest when '. + 'deleting complex or highly connected objects like repositories, '. + 'projects and users.'. + "\n\n". + 'These tattered edges are an expected consquence of destroying '. + 'objects, and the Phabricator upstream will not help you fix '. + 'them. We strongly recomend disabling or archiving objects '. + 'instead.'))); + + $phids = mpull($named_objects, 'getPHID'); + $handles = PhabricatorUser::getOmnipotentUser()->loadHandles($phids); $console->writeOut( pht( - "There is no way to undo this operation or ever retrieve this data.". - "\n\n". - "These %s object(s) will be **completely destroyed forever**:". - "\n\n", - new PhutilNumber(count($named_objects)))); + 'These %s object(s) will be destroyed forever:', + new PhutilNumber(count($named_objects)))."\n\n"); foreach ($named_objects as $object_name => $object) { + $phid = $object->getPHID(); + $console->writeOut( - " - %s (%s)\n", + " - %s (%s) %s\n", $object_name, - get_class($object)); + get_class($object), + $handles[$phid]->getFullName()); } $force = $args->getArg('force'); diff --git a/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php b/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php index a1e0433b2c..61dd34fbe2 100644 --- a/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php +++ b/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php @@ -1067,6 +1067,17 @@ final class PhabricatorUSEnglishTranslation ), ), + 'These %s object(s) will be destroyed forever:' => array( + 'This object will be destroyed forever:', + 'These objects will be destroyed forever:', + ), + + 'Are you absolutely certain you want to destroy these %s '. + 'object(s)?' => array( + 'Are you absolutely certain you want to destroy this object?', + 'Are you absolutely certain you want to destroy these objects?', + ), + ); } From f99c7beb90fd20f2be51598032c89179bc12fab1 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 20 May 2015 14:21:33 -0700 Subject: [PATCH 76/86] Fully remove all the public-create-mail settings Summary: Fixes T5703. These have been unused in production for a while and the new stuff seems good. Test Plan: Mostly `grep`. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5703 Differential Revision: https://secure.phabricator.com/D12949 --- .../PhabricatorExtraConfigSetupCheck.php | 9 ++++ .../config/PhabricatorFilesConfigOptions.php | 14 ----- .../PhabricatorManiphestConfigOptions.php | 51 ------------------- .../ManiphestTaskEditController.php | 15 +----- .../config/PhabricatorPasteConfigOptions.php | 14 ----- 5 files changed, 10 insertions(+), 93 deletions(-) diff --git a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php index 2d69334c47..a88dff0f22 100644 --- a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php +++ b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php @@ -171,6 +171,10 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck { 'Phabricator no longer supports global customization of monospaced '. 'fonts.'); + $public_mail_reason = pht( + 'Inbound mail addresses are now configured for each application '. + 'in the Applications tool.'); + $ancient_config += array( 'phid.external-loaders' => pht( @@ -256,6 +260,11 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck { 'search.engine-selector' => pht( 'Phabricator now automatically discovers available search engines '. 'at runtime.'), + + 'metamta.files.public-create-email' => $public_mail_reason, + 'metamta.maniphest.public-create-email' => $public_mail_reason, + 'metamta.maniphest.default-public-author' => $public_mail_reason, + 'metamta.paste.public-create-email' => $public_mail_reason, ); return $ancient_config; diff --git a/src/applications/files/config/PhabricatorFilesConfigOptions.php b/src/applications/files/config/PhabricatorFilesConfigOptions.php index 7f18da3e99..ac62d410fe 100644 --- a/src/applications/files/config/PhabricatorFilesConfigOptions.php +++ b/src/applications/files/config/PhabricatorFilesConfigOptions.php @@ -156,20 +156,6 @@ final class PhabricatorFilesConfigOptions "Set this to a valid Amazon S3 bucket to store files there. You ". "must also configure S3 access keys in the 'Amazon Web Services' ". "group.")), - $this->newOption( - 'metamta.files.public-create-email', - 'string', - null) - ->setLocked(true) - ->setLockedMessage(pht( - 'This configuration is deprecated. See description for details.')) - ->setSummary(pht('DEPRECATED - Allow uploaded files via email.')) - ->setDescription( - pht( - 'This config has been deprecated in favor of [[ '. - '/applications/view/PhabricatorFilesApplication/ | '. - 'application settings ]], which allow for multiple email '. - 'addresses and other functionality.')), $this->newOption( 'metamta.files.subject-prefix', 'string', diff --git a/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php b/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php index c2b87629f0..04d59c9966 100644 --- a/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php +++ b/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php @@ -296,57 +296,6 @@ EOTEXT 'string', '[Maniphest]') ->setDescription(pht('Subject prefix for Maniphest mail.')), - $this->newOption( - 'metamta.maniphest.public-create-email', - 'string', - null) - ->setLocked(true) - ->setLockedMessage(pht( - 'This configuration is deprecated. See description for details.')) - ->setSummary(pht('DEPRECATED - Allow filing bugs via email.')) - ->setDescription( - pht( - 'This config has been deprecated in favor of [[ '. - '/applications/view/PhabricatorManiphestApplication/ | '. - 'application settings ]], which allow for multiple email '. - 'addresses and other functionality.'."\n\n". - 'You can configure an email address like '. - '"bugs@phabricator.example.com" which will automatically create '. - 'Maniphest tasks when users send email to it. This relies on the '. - '"From" address to authenticate users, so it is is not completely '. - 'secure. To set this up, enter a complete email address like '. - '"bugs@phabricator.example.com" and then configure mail to that '. - 'address so it routed to Phabricator (if you\'ve already '. - 'configured reply handlers, you\'re probably already done). See '. - '"Configuring Inbound Email" in the documentation for more '. - 'information.')), - $this->newOption( - 'metamta.maniphest.default-public-author', - 'string', - null) - ->setLocked(true) - ->setLockedMessage(pht( - 'This configuration is deprecated. See description for details.')) - ->setSummary(pht( - 'DEPRECATED - Username anonymous bugs are filed under.')) - ->setDescription( - pht( - 'This config has been deprecated in favor of [[ '. - '/applications/view/PhabricatorManiphestApplication/ | '. - 'application settings ]], which allow for multiple email '. - 'addresses each with its own default author, and other '. - 'functionality.'."\n\n". - 'If you enable `metamta.maniphest.public-create-email` and create '. - 'an email address like "bugs@phabricator.example.com", it will '. - 'default to rejecting mail which doesn\'t come from a known user. '. - 'However, you might want to let anyone send email to this '. - 'address; to do so, set a default author here (a Phabricator '. - 'username). A typical use of this might be to create a "System '. - 'Agent" user called "bugs" and use that name here. If you specify '. - 'a valid username, mail will always be accepted and used to '. - 'create a task, even if the sender is not a system user. The '. - 'original email address will be stored in an `From Email` field '. - 'on the task.')), $this->newOption( 'maniphest.priorities.unbreak-now', 'int', diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php index 915ea6c33a..d9a4e44381 100644 --- a/src/applications/maniphest/controller/ManiphestTaskEditController.php +++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php @@ -684,19 +684,7 @@ final class ManiphestTaskEditController extends ManiphestController { 'tokenizerID' => $project_tokenizer_id, )); - $description_control = new PhabricatorRemarkupControl(); - // "Upsell" creating tasks via email in create flows if the instance is - // configured for this awesomeness. - $email_create = PhabricatorEnv::getEnvConfig( - 'metamta.maniphest.public-create-email'); - if (!$task->getID() && $email_create) { - $email_hint = pht( - 'You can also create tasks by sending an email to: %s', - phutil_tag('tt', array(), $email_create)); - $description_control->setCaption($email_hint); - } - - $description_control + $description_control = id(new PhabricatorRemarkupControl()) ->setLabel(pht('Description')) ->setName('description') ->setID('description-textarea') @@ -706,7 +694,6 @@ final class ManiphestTaskEditController extends ManiphestController { $form ->appendChild($description_control); - if ($request->isAjax()) { $dialog = id(new AphrontDialogView()) ->setUser($user) diff --git a/src/applications/paste/config/PhabricatorPasteConfigOptions.php b/src/applications/paste/config/PhabricatorPasteConfigOptions.php index e12fdc954d..bb970905c4 100644 --- a/src/applications/paste/config/PhabricatorPasteConfigOptions.php +++ b/src/applications/paste/config/PhabricatorPasteConfigOptions.php @@ -21,20 +21,6 @@ final class PhabricatorPasteConfigOptions public function getOptions() { return array( - $this->newOption( - 'metamta.paste.public-create-email', - 'string', - null) - ->setLocked(true) - ->setLockedMessage(pht( - 'This configuration is deprecated. See description for details.')) - ->setSummary(pht('DEPRECATED - Allow creating pastes via email.')) - ->setDescription( - pht( - 'This config has been deprecated in favor of [[ '. - '/applications/view/PhabricatorPasteApplication/ | '. - 'application settings ]], which allow for multiple email '. - 'addresses and other functionality.')), $this->newOption( 'metamta.paste.subject-prefix', 'string', From f5a9d1f8d47bff1b5ba5e59a7b096fd0746a83cc Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 20 May 2015 14:21:46 -0700 Subject: [PATCH 77/86] Raise a setup issue for misconfigured Elasticsearch Summary: Fixes T8274. That report is very light on details, but I think the issue is that their Elasticsearch is misconfigured and the new setup warning dies a little too hard if the server is just completely dead. Test Plan: Set `search.elastic.host` to an invalid server, got a similar-looking exception (?), applied patch, got a setup warning instead. Reviewers: btrahan, joshuaspence Reviewed By: btrahan, joshuaspence Subscribers: epriestley Maniphest Tasks: T8274 Differential Revision: https://secure.phabricator.com/D12948 --- .../PhabricatorElasticSearchSetupCheck.php | 87 ++++++++++++------- 1 file changed, 57 insertions(+), 30 deletions(-) diff --git a/src/applications/config/check/PhabricatorElasticSearchSetupCheck.php b/src/applications/config/check/PhabricatorElasticSearchSetupCheck.php index a573c14490..47a3cb4b18 100644 --- a/src/applications/config/check/PhabricatorElasticSearchSetupCheck.php +++ b/src/applications/config/check/PhabricatorElasticSearchSetupCheck.php @@ -7,44 +7,71 @@ final class PhabricatorElasticSearchSetupCheck extends PhabricatorSetupCheck { } protected function executeChecks() { - if ($this->shouldUseElasticSearchEngine()) { - $engine = new PhabricatorElasticSearchEngine(); + if (!$this->shouldUseElasticSearchEngine()) { + return; + } - if (!$engine->indexExists()) { - $summary = pht( - 'You enabled Elasticsearch but the index does not exist.'); + $engine = new PhabricatorElasticSearchEngine(); - $message = pht( - 'You likely enabled search.elastic.host without creating the '. - 'index. Run `./bin/search init` to correct the index.'); - - $this - ->newIssue('elastic.missing-index') - ->setName(pht('Elasticsearch index Not Found')) - ->setSummary($summary) - ->setMessage($message) - ->addRelatedPhabricatorConfig('search.elastic.host'); - } else if (!$engine->indexIsSane()) { - $summary = pht( - 'Elasticsearch index exists but needs correction.'); - - $message = pht( - 'Either the Phabricator schema for Elasticsearch has changed '. - 'or Elasticsearch created the index automatically. Run '. - '`./bin/search init` to correct the index.'); - - $this - ->newIssue('elastic.broken-index') - ->setName(pht('Elasticsearch index Incorrect')) - ->setSummary($summary) - ->setMessage($message); + $index_exists = null; + $index_sane = null; + try { + $index_exists = $engine->indexExists(); + if ($index_exists) { + $index_sane = $engine->indexIsSane(); } + } catch (Exception $ex) { + $summary = pht('Elasticsearch is not reachable as configured.'); + $message = pht( + 'Elasticsearch is configured (with the %s setting) but Phabricator '. + 'encountered an exception when trying to test the index.'. + "\n\n". + '%s', + phutil_tag('tt', array(), 'search.elastic.host'), + phutil_tag('pre', array(), $ex->getMessage())); + + $this->newIssue('elastic.misconfigured') + ->setName(pht('Elasticsearch Misconfigured')) + ->setSummary($summary) + ->setMessage($message) + ->addRelatedPhabricatorConfig('search.elastic.host'); + return; + } + + if (!$index_exists) { + $summary = pht( + 'You enabled Elasticsearch but the index does not exist.'); + + $message = pht( + 'You likely enabled search.elastic.host without creating the '. + 'index. Run `./bin/search init` to correct the index.'); + + $this + ->newIssue('elastic.missing-index') + ->setName(pht('Elasticsearch index Not Found')) + ->setSummary($summary) + ->setMessage($message) + ->addRelatedPhabricatorConfig('search.elastic.host'); + } else if (!$index_sane) { + $summary = pht( + 'Elasticsearch index exists but needs correction.'); + + $message = pht( + 'Either the Phabricator schema for Elasticsearch has changed '. + 'or Elasticsearch created the index automatically. Run '. + '`./bin/search init` to correct the index.'); + + $this + ->newIssue('elastic.broken-index') + ->setName(pht('Elasticsearch index Incorrect')) + ->setSummary($summary) + ->setMessage($message); } } protected function shouldUseElasticSearchEngine() { $search_engine = PhabricatorSearchEngine::loadEngine(); - return $search_engine instanceof PhabricatorElasticSearchEngine; + return ($search_engine instanceof PhabricatorElasticSearchEngine); } } From a04af2a9eeee8269656bdaf61119cccace3a4ebd Mon Sep 17 00:00:00 2001 From: lkassianik Date: Wed, 20 May 2015 17:10:12 -0700 Subject: [PATCH 78/86] Calendar event datepicker should auto-complete end time to be an hour from start time unless end time has been edited. Summary: Ref T8031, Calendar event datepicker should auto-complete end time to be an hour from start time unless end time has been edited Test Plan: Create event, edit start time, end time should adjust to an hour from start time. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T8031 Differential Revision: https://secure.phabricator.com/D12960 --- resources/celerity/map.php | 20 ++-- ...PhabricatorCalendarEventEditController.php | 12 ++- .../form/control/AphrontFormDateControl.php | 9 +- .../rsrc/js/core/behavior-time-typeahead.js | 93 ++++++++++++++++++- 4 files changed, 115 insertions(+), 19 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 85e21f4a12..3f062c9513 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -466,7 +466,7 @@ return array( 'rsrc/js/core/behavior-scrollbar.js' => '834a1173', 'rsrc/js/core/behavior-search-typeahead.js' => '048330fa', 'rsrc/js/core/behavior-select-on-click.js' => '4e3e79a6', - 'rsrc/js/core/behavior-time-typeahead.js' => '3416cef7', + 'rsrc/js/core/behavior-time-typeahead.js' => '8bfbb401', 'rsrc/js/core/behavior-toggle-class.js' => '5d7c9f33', 'rsrc/js/core/behavior-tokenizer.js' => 'b3a4b884', 'rsrc/js/core/behavior-tooltip.js' => '3ee3408b', @@ -641,7 +641,7 @@ return array( 'javelin-behavior-slowvote-embed' => '887ad43f', 'javelin-behavior-stripe-payment-form' => '3f5d6dbf', 'javelin-behavior-test-payment-form' => 'fc91ab6c', - 'javelin-behavior-time-typeahead' => '3416cef7', + 'javelin-behavior-time-typeahead' => '8bfbb401', 'javelin-behavior-toggle-class' => '5d7c9f33', 'javelin-behavior-typeahead-browse' => '635de1ec', 'javelin-behavior-typeahead-search' => '93d0c9e3', @@ -1041,14 +1041,6 @@ return array( '331b1611' => array( 'javelin-install', ), - '3416cef7' => array( - 'javelin-behavior', - 'javelin-util', - 'javelin-dom', - 'javelin-stratcom', - 'javelin-vector', - 'javelin-typeahead-static-source', - ), '3975b470' => array( 'javelin-behavior', 'javelin-dom', @@ -1495,6 +1487,14 @@ return array( 'javelin-request', 'javelin-typeahead-source', ), + '8bfbb401' => array( + 'javelin-behavior', + 'javelin-util', + 'javelin-dom', + 'javelin-stratcom', + 'javelin-vector', + 'javelin-typeahead-static-source', + ), '8ce821c5' => array( 'phabricator-notification', 'javelin-stratcom', diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php index f77846dd21..41744edecf 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php @@ -21,6 +21,10 @@ final class PhabricatorCalendarEventEditController $error_end_date = true; $validation_exception = null; + $all_day_id = celerity_generate_unique_node_id(); + $start_date_id = celerity_generate_unique_node_id(); + $end_date_id = null; + if ($this->isCreate()) { $event = PhabricatorCalendarEvent::initializeNewCalendarEvent($user); list($start_value, $end_value) = $this->getDefaultTimeValues($user); @@ -31,6 +35,7 @@ final class PhabricatorCalendarEventEditController $subscribers = array(); $invitees = array($user_phid); $cancel_uri = $this->getApplicationURI(); + $end_date_id = celerity_generate_unique_node_id(); } else { $event = id(new PhabricatorCalendarEventQuery()) ->setViewer($user) @@ -178,10 +183,6 @@ final class PhabricatorCalendarEventEditController } } - $all_day_id = celerity_generate_unique_node_id(); - $start_date_id = celerity_generate_unique_node_id(); - $end_date_id = celerity_generate_unique_node_id(); - Javelin::initBehavior('event-all-day', array( 'allDayID' => $all_day_id, 'startDateID' => $start_date_id, @@ -209,7 +210,8 @@ final class PhabricatorCalendarEventEditController ->setError($error_start_date) ->setValue($start_value) ->setID($start_date_id) - ->setIsTimeDisabled($is_all_day); + ->setIsTimeDisabled($is_all_day) + ->setEndDateID($end_date_id); $end_control = id(new AphrontFormDateControl()) ->setUser($user) diff --git a/src/view/form/control/AphrontFormDateControl.php b/src/view/form/control/AphrontFormDateControl.php index df0efe2c4a..2615c1c5ee 100644 --- a/src/view/form/control/AphrontFormDateControl.php +++ b/src/view/form/control/AphrontFormDateControl.php @@ -13,6 +13,7 @@ final class AphrontFormDateControl extends AphrontFormControl { private $continueOnInvalidDate = false; private $isTimeDisabled; private $isDisabled; + private $endDateID; public function setAllowNull($allow_null) { $this->allowNull = $allow_null; @@ -24,6 +25,11 @@ final class AphrontFormDateControl extends AphrontFormControl { return $this; } + public function setEndDateID($value) { + $this->endDateID = $value; + return $this; + } + const TIME_START_OF_DAY = 'start-of-day'; const TIME_END_OF_DAY = 'end-of-day'; const TIME_START_OF_BUSINESS = 'start-of-business'; @@ -274,7 +280,8 @@ final class AphrontFormDateControl extends AphrontFormControl { $time_id = celerity_generate_unique_node_id(); Javelin::initBehavior('time-typeahead', array( - 'timeID' => $time_id, + 'startTimeID' => $time_id, + 'endTimeID' => $this->endDateID, 'timeValues' => $values, )); diff --git a/webroot/rsrc/js/core/behavior-time-typeahead.js b/webroot/rsrc/js/core/behavior-time-typeahead.js index 158b8fbd4b..381eea7f36 100644 --- a/webroot/rsrc/js/core/behavior-time-typeahead.js +++ b/webroot/rsrc/js/core/behavior-time-typeahead.js @@ -9,7 +9,11 @@ */ JX.behavior('time-typeahead', function(config) { - var root = JX.$(config.timeID); + var start_date_control = JX.$(config.startTimeID); + var end_date_control = config.endTimeID ? JX.$(config.endTimeID) : null; + + var end_date_tampered = false; + var datasource = new JX.TypeaheadStaticSource(config.timeValues); datasource.setTransformer(function(v) { var attributes = {'className' : 'phui-time-typeahead-value'}; @@ -29,8 +33,91 @@ JX.behavior('time-typeahead', function(config) { }); datasource.setMaximumResultCount(24); var typeahead = new JX.Typeahead( - root, - JX.DOM.find(root, 'input', null)); + start_date_control, + JX.DOM.find(start_date_control, 'input', null)); typeahead.setDatasource(datasource); + + if (!end_date_control) { + typeahead.start(); + return; + } + + var start_time_control = JX.DOM.find( + start_date_control, + 'input', + 'time-input'); + var end_time_control = JX.DOM.find( + end_date_control, + 'input', + 'time-input'); + + JX.DOM.listen(start_time_control, 'input', null, function() { + if (end_date_tampered) { + return; + } + var time = start_time_control.value; + var end_value = getNewValue(time); + if (end_value) { + end_time_control.value = end_value; + } + }); + + typeahead.listen('choose', function(e) { + if (end_date_tampered) { + return; + } + var time = e.name; + var end_value = getNewValue(time); + if (end_value) { + end_time_control.value = end_value; + } + }); + + JX.DOM.listen(end_date_control, 'input', null, function() { + end_date_tampered = true; + }); + + + function getNewValue(time) { + var regex = /^([01]?\d)(?::([0-5]\d))?\s*((am|pm))?$/i; + + if (!regex.test(time)) { + return null; + } + + var results = regex.exec(time); + var hours = parseInt(results[1], 10); + var minutes = parseInt(results[2], 10) ? parseInt(results[2], 10) : 0; + + var real_time = 0; + + if (/pm/i.test(results[3])) { + real_time = 12*60; + } else if (/am/i.test(results[3]) && hours == 12) { + hours = 0; + } + + real_time = real_time + (hours * 60) + minutes; + + var end_time = real_time + 60; + + var end_meridian = 'AM'; + var end_hours = Math.floor(end_time / 60); + + if (end_hours == 12) { + end_meridian = 'PM'; + } else if (end_hours > 12 && end_hours < 24) { + end_hours = end_hours - 12; + end_meridian = 'PM'; + } else if (end_hours == 24) { + end_hours = end_hours - 12; + } + + var end_minutes = end_time%60; + end_minutes = (end_minutes > 9) ? end_minutes : ('0' + end_minutes); + var end_value = end_hours + ':' + end_minutes + ' ' + end_meridian; + return end_value; + } + typeahead.start(); }); From f21972a01f1a67c335812017db1abea05b5be7d9 Mon Sep 17 00:00:00 2001 From: Aviv Eyal Date: Thu, 21 May 2015 08:25:34 -0700 Subject: [PATCH 79/86] Only link symbols if there might be any Summary: fixes T8260. Only turn on symbol links if: - The repository has any configuration about symbols, or - There actually are symbols in the repository. Test Plan: Look at revisions and files in various states of configurations and having symbols. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: joshuaspence, Korvin, epriestley Maniphest Tasks: T8260 Differential Revision: https://secure.phabricator.com/D12946 --- .../DifferentialRevisionViewController.php | 27 ++++++++++--------- .../DiffusionBrowseFileController.php | 19 +++++++++++-- .../diffusion/query/DiffusionSymbolQuery.php | 20 ++++++++++++++ 3 files changed, 51 insertions(+), 15 deletions(-) diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index 849ef056aa..cdefdd65d7 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -261,12 +261,11 @@ final class DifferentialRevisionViewController extends DifferentialController { $repository = $revision->getRepository(); if ($repository) { - list($symbol_indexes, $repository_phids) = $this->buildSymbolIndexes( + $symbol_indexes = $this->buildSymbolIndexes( $repository, $visible_changesets); } else { $symbol_indexes = array(); - $repository_phids = null; } $revision_detail->setActions($actions); @@ -306,15 +305,6 @@ final class DifferentialRevisionViewController extends DifferentialController { ), $comment_view); - if ($repository) { - Javelin::initBehavior( - 'repository-crossreference', - array( - 'section' => $wrap_id, - 'repositories' => $repository_phids, - )); - } - $changeset_view = new DifferentialChangesetListView(); $changeset_view->setChangesets($changesets); $changeset_view->setVisibleChangesets($visible_changesets); @@ -758,11 +748,22 @@ final class DifferentialRevisionViewController extends DifferentialController { $langs = $repository->getSymbolLanguages(); $langs = nonempty($langs, array()); + $sources = $repository->getSymbolSources(); + $sources = nonempty($sources, array()); + $symbol_indexes = array(); + if ($langs && $sources) { + $have_symbols = id(new DiffusionSymbolQuery()) + ->existsSymbolsInRepository($repository->getPHID()); + if (!$have_symbols) { + return $symbol_indexes; + } + } + $repository_phids = array_merge( array($repository->getPHID()), - nonempty($repository->getSymbolSources(), array())); + $sources); $indexed_langs = array_fill_keys($langs, true); foreach ($visible_changesets as $key => $changeset) { @@ -775,7 +776,7 @@ final class DifferentialRevisionViewController extends DifferentialController { } } - return array($symbol_indexes, $repository_phids); + return $symbol_indexes; } private function loadOtherRevisions( diff --git a/src/applications/diffusion/controller/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/DiffusionBrowseFileController.php index 731906943c..6fcda177a5 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseFileController.php @@ -267,13 +267,28 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController { $id = celerity_generate_unique_node_id(); $repo = $drequest->getRepository(); - $symbol_repos = $repo->getSymbolSources(); + $symbol_repos = nonempty($repo->getSymbolSources(), array()); $symbol_repos[] = $repo; $lang = last(explode('.', $drequest->getPath())); $repo_languages = $repo->getSymbolLanguages(); + $repo_languages = nonempty($repo_languages, array()); $repo_languages = array_fill_keys($repo_languages, true); - if (empty($repo_languages) || isset($repo_languages[$lang])) { + + $needs_symbols = true; + if ($repo_languages && $symbol_repos) { + $have_symbols = id(new DiffusionSymbolQuery()) + ->existsSymbolsInRepository($repo->getPHID()); + if (!$have_symbols) { + $needs_symbols = false; + } + } + + if ($needs_symbols && $repo_languages) { + $needs_symbols = isset($repo_languages[$lang]); + } + + if ($needs_symbols) { Javelin::initBehavior( 'repository-crossreference', array( diff --git a/src/applications/diffusion/query/DiffusionSymbolQuery.php b/src/applications/diffusion/query/DiffusionSymbolQuery.php index 6017c45f6f..0e08b7b32d 100644 --- a/src/applications/diffusion/query/DiffusionSymbolQuery.php +++ b/src/applications/diffusion/query/DiffusionSymbolQuery.php @@ -113,6 +113,26 @@ final class DiffusionSymbolQuery extends PhabricatorOffsetPagedQuery { } +/* -( Specialized Query )-------------------------------------------------- */ + + public function existsSymbolsInRepository($repository_phid) { + $this + ->withRepositoryPHIDs(array($repository_phid)) + ->setLimit(1); + + $symbol = new PhabricatorRepositorySymbol(); + $conn_r = $symbol->establishConnection('r'); + + $data = queryfx_all( + $conn_r, + 'SELECT * FROM %T %Q %Q', + $symbol->getTableName(), + $this->buildWhereClause($conn_r), + $this->buildLimitClause($conn_r)); + + return (!empty($data)); + } + /* -( Executing the Query )------------------------------------------------ */ From 7ecd5155e52fd7810610f2c6a936cd8efebe7cf9 Mon Sep 17 00:00:00 2001 From: Fabian Stelzer Date: Thu, 21 May 2015 09:01:17 -0700 Subject: [PATCH 80/86] elasticsearch host quick fix Summary: Quick fix for the elasticsearch search engine Ref T8274 Test Plan: Did a couple of searches Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8274 Differential Revision: https://secure.phabricator.com/D12967 --- .../search/engine/PhabricatorElasticSearchEngine.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/applications/search/engine/PhabricatorElasticSearchEngine.php b/src/applications/search/engine/PhabricatorElasticSearchEngine.php index f6efc17044..fa09e64a9c 100644 --- a/src/applications/search/engine/PhabricatorElasticSearchEngine.php +++ b/src/applications/search/engine/PhabricatorElasticSearchEngine.php @@ -6,6 +6,11 @@ final class PhabricatorElasticSearchEngine extends PhabricatorSearchEngine { private $index; private $timeout; + public function __construct() { + $this->uri = PhabricatorEnv::getEnvConfig('search.elastic.host'); + $this->index = PhabricatorEnv::getEnvConfig('search.elastic.namespace'); + } + public function getEngineIdentifier() { return 'elasticsearch'; } @@ -15,7 +20,7 @@ final class PhabricatorElasticSearchEngine extends PhabricatorSearchEngine { } public function isEnabled() { - return (bool)PhabricatorEnv::getEnvConfig('search.elastic.host'); + return (bool)$this->uri; } public function setURI($uri) { From a50de8958efbb678173043f6b74bb5f3ea5d21e0 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 21 May 2015 09:27:57 -0700 Subject: [PATCH 81/86] Return empty array as a default value for repository symbol languages Summary: Fixes T8283. The code in `FileController` assumes this value is an array. Test Plan: Loaded any file in Diffusion in unconfigured repository, no more warning. Reviewers: avivey, joshuaspence, btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8283 Differential Revision: https://secure.phabricator.com/D12964 --- src/applications/repository/storage/PhabricatorRepository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php index 8108051282..70387edec8 100644 --- a/src/applications/repository/storage/PhabricatorRepository.php +++ b/src/applications/repository/storage/PhabricatorRepository.php @@ -1781,11 +1781,11 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO /* -( Symbols )-------------------------------------------------------------*/ public function getSymbolSources() { - return $this->getDetail('symbol-sources'); + return $this->getDetail('symbol-sources', array()); } public function getSymbolLanguages() { - return $this->getDetail('symbol-languages'); + return $this->getDetail('symbol-languages', array()); } From d70ca6b7c8b55b3b2ed294550303d7b051ef90c6 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 21 May 2015 09:42:20 -0700 Subject: [PATCH 82/86] When file transforms race and lose, accept defeat gracefully Summary: Fixes T8277. Transforming files can race; resolve the race after we lose. Test Plan: - Added `sleep(10)` near the bottom of the transform controller. - Transformed a file in two browser windows at the same time; got something like this (exception corresponds to the loser of the race): {F412526} - Applied patch. - Repeated process, got this: {F412527} Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8277 Differential Revision: https://secure.phabricator.com/D12965 --- .../PhabricatorFileTransformController.php | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/applications/files/controller/PhabricatorFileTransformController.php b/src/applications/files/controller/PhabricatorFileTransformController.php index 0e7e2b73d7..77676c1b55 100644 --- a/src/applications/files/controller/PhabricatorFileTransformController.php +++ b/src/applications/files/controller/PhabricatorFileTransformController.php @@ -30,11 +30,7 @@ final class PhabricatorFileTransformController } $transform = $request->getURIData('transform'); - $xform = id(new PhabricatorTransformedFile()) - ->loadOneWhere( - 'originalPHID = %s AND transform = %s', - $source_phid, - $transform); + $xform = $this->loadTransform($source_phid, $transform); if ($xform) { if ($is_regenerate) { @@ -80,8 +76,20 @@ final class PhabricatorFileTransformController $xform = id(new PhabricatorTransformedFile()) ->setOriginalPHID($source_phid) ->setTransform($transform) - ->setTransformedPHID($xformed_file->getPHID()) - ->save(); + ->setTransformedPHID($xformed_file->getPHID()); + + try { + $xform->save(); + } catch (AphrontDuplicateKeyQueryException $ex) { + // If we collide when saving, we've raced another endpoint which was + // transforming the same file. Just throw our work away and use that + // transform instead. + $this->destroyTransform($xform); + $xform = $this->loadTransform($source_phid, $transform); + if (!$xform) { + return new Aphront404Response(); + } + } return $this->buildTransformedFileResponse($xform); } @@ -113,7 +121,9 @@ final class PhabricatorFileTransformController $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); if (!$file) { - $xform->delete(); + if ($xform->getID()) { + $xform->delete(); + } } else { $engine->destroyObject($file); } @@ -121,4 +131,11 @@ final class PhabricatorFileTransformController unset($unguarded); } + private function loadTransform($source_phid, $transform) { + return id(new PhabricatorTransformedFile())->loadOneWhere( + 'originalPHID = %s AND transform = %s', + $source_phid, + $transform); + } + } From df1522088452e5e9edac6ec92fcd00dc7df809c6 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 21 May 2015 16:10:53 -0700 Subject: [PATCH 83/86] Adjust CloudFront configuration instructions to allow POST Summary: Ref T8293. We may submit POST requests to the alternate file domain, and CloudFront should be configured to route them. Test Plan: See T8293. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8293 Differential Revision: https://secure.phabricator.com/D12973 --- src/docs/user/configuration/configuring_file_domain.diviner | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/docs/user/configuration/configuring_file_domain.diviner b/src/docs/user/configuration/configuring_file_domain.diviner index 5724bc3536..98576e5ae3 100644 --- a/src/docs/user/configuration/configuring_file_domain.diviner +++ b/src/docs/user/configuration/configuring_file_domain.diviner @@ -52,6 +52,10 @@ your Phabricator install as an origin (make sure you point it at the primary domain name of your install, not just a load balancer or instance). You do not need to set up a new domain name, which makes setup a bit more straightforward. +Most settings can be left at their default values, but you should change +the **Allowed HTTP Methods** setting from `GET, HEAD` to +`GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE`. + Once configured, accessing the distribution's domain name should return a Phabricator error page indicating that Phabricator does not recognize the domain. If you see this page, it means you've configured things correctly. From 680e8fdfdb482072fd7134443b13c4b34191ed3f Mon Sep 17 00:00:00 2001 From: lkassianik Date: Thu, 21 May 2015 17:10:27 -0700 Subject: [PATCH 84/86] Calendar query results should be ordered from first start date to last start date Summary: Closes T8041, Calendar query results should be ordered from first start date to last start date Test Plan: Open "Upcoming Events" in Calendar, verify that the event with the first start date is first and that events are ordered in ascending start dates. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8041 Differential Revision: https://secure.phabricator.com/D12968 --- .../query/PhabricatorCalendarEventQuery.php | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/applications/calendar/query/PhabricatorCalendarEventQuery.php b/src/applications/calendar/query/PhabricatorCalendarEventQuery.php index c66e367793..474ac49a46 100644 --- a/src/applications/calendar/query/PhabricatorCalendarEventQuery.php +++ b/src/applications/calendar/query/PhabricatorCalendarEventQuery.php @@ -42,6 +42,30 @@ final class PhabricatorCalendarEventQuery return $this; } + protected function getDefaultOrderVector() { + return array('start', 'id'); + } + + public function getOrderableColumns() { + return array( + 'start' => array( + 'table' => $this->getPrimaryTableAlias(), + 'column' => 'dateFrom', + 'reverse' => true, + 'type' => 'int', + 'unique' => false, + ), + ) + parent::getOrderableColumns(); + } + + protected function getPagingValueMap($cursor, array $keys) { + $event = $this->loadCursorObject($cursor); + return array( + 'start' => $event->getDateFrom(), + 'id' => $event->getID(), + ); + } + protected function loadPage() { $table = new PhabricatorCalendarEvent(); $conn_r = $table->establishConnection('r'); From d3268aecc226397a09e47b8b24aebe48f226fe9c Mon Sep 17 00:00:00 2001 From: lkassianik Date: Thu, 21 May 2015 17:11:26 -0700 Subject: [PATCH 85/86] Possible fix for month view day deadzone Summary: Ref T8193, Possible fix for month view day deadzone Test Plan: Open Calendar month view in Chrome, Firefox, or Safari. Verify that days with many events still link to the day views of those days. Reviewers: chad, epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T8193 Differential Revision: https://secure.phabricator.com/D12969 --- resources/celerity/map.php | 4 +-- .../phui/calendar/PHUICalendarMonthView.php | 29 +++++++++++++++---- .../css/phui/calendar/phui-calendar-month.css | 6 ++-- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 3f062c9513..ad88264ee5 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -123,7 +123,7 @@ return array( 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/phui/calendar/phui-calendar-day.css' => 'c0cf782a', 'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1c7f338', - 'rsrc/css/phui/calendar/phui-calendar-month.css' => '94b1750a', + 'rsrc/css/phui/calendar/phui-calendar-month.css' => '476be7e0', 'rsrc/css/phui/calendar/phui-calendar.css' => 'ccabe893', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', @@ -767,7 +767,7 @@ return array( 'phui-calendar-css' => 'ccabe893', 'phui-calendar-day-css' => 'c0cf782a', 'phui-calendar-list-css' => 'c1c7f338', - 'phui-calendar-month-css' => '94b1750a', + 'phui-calendar-month-css' => '476be7e0', 'phui-crumbs-view-css' => '594d719e', 'phui-document-view-css' => '94d5dcd8', 'phui-feed-story-css' => 'c9f3a0b5', diff --git a/src/view/phui/calendar/PHUICalendarMonthView.php b/src/view/phui/calendar/PHUICalendarMonthView.php index 806ecad719..3adbe5eae7 100644 --- a/src/view/phui/calendar/PHUICalendarMonthView.php +++ b/src/view/phui/calendar/PHUICalendarMonthView.php @@ -117,8 +117,10 @@ final class PHUICalendarMonthView extends AphrontView { foreach ($cell_lists_by_week as $week_of_cell_lists) { $cells = array(); + $max_count = $this->getMaxDailyEventsForWeek($week_of_cell_lists); + foreach ($week_of_cell_lists as $cell_list) { - $cells[] = $this->getEventListCell($cell_list); + $cells[] = $this->getEventListCell($cell_list, $max_count); } $rows[] = phutil_tag('tr', array(), $cells); @@ -153,7 +155,19 @@ final class PHUICalendarMonthView extends AphrontView { return $box; } - private function getEventListCell($event_list) { + private function getMaxDailyEventsForWeek($week_of_cell_lists) { + $max_count = 0; + + foreach ($week_of_cell_lists as $cell_list) { + if ($cell_list['count'] > $max_count) { + $max_count = $cell_list['count']; + } + } + + return $max_count; + } + + private function getEventListCell($event_list, $max_count = 0) { $list = $event_list['list']; $class = $event_list['class']; $uri = $event_list['uri']; @@ -162,7 +176,7 @@ final class PHUICalendarMonthView extends AphrontView { $viewer_is_invited = $list->getIsViewerInvitedOnList(); $event_count_badge = $this->getEventCountBadge($count, $viewer_is_invited); - $cell_day_secret_link = $this->getHiddenDayLink($uri); + $cell_day_secret_link = $this->getHiddenDayLink($uri, $max_count, 125); $cell_data_div = phutil_tag( 'div', @@ -191,7 +205,7 @@ final class PHUICalendarMonthView extends AphrontView { if ($date) { $uri = $event_list['uri']; - $cell_day_secret_link = $this->getHiddenDayLink($uri); + $cell_day_secret_link = $this->getHiddenDayLink($uri, 0, 25); $cell_day = phutil_tag( 'a', @@ -291,11 +305,16 @@ final class PHUICalendarMonthView extends AphrontView { $event_count); } - private function getHiddenDayLink($uri) { + private function getHiddenDayLink($uri, $count, $max_height) { + // approximately the height of the tallest cell + $height = 18 * $count + 5; + $height = ($height > $max_height) ? $height : $max_height; + $height_style = 'height: '.$height.'px'; return phutil_tag( 'a', array( 'class' => 'phui-calendar-month-secret-link', + 'style' => $height_style, 'href' => $uri, ), null); diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css index d528c260f1..a219e49cf7 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css @@ -54,9 +54,6 @@ a.phui-calendar-month-secret-link { position: absolute; left: 0; right: 0; - top: 0; - bottom: 0; - outline: 0; } table.phui-calendar-view tr td:first-child { @@ -149,7 +146,8 @@ table.phui-calendar-view td.phui-calendar-date-number-container { background: transparent; } -.phui-calendar-view .phui-calendar-list { +.phui-calendar-view .phui-calendar-list, +.phui-calendar-view .phui-calendar-month-list { padding: 1px; width: auto; } From 36e2d02d6ec5db26f4dfc813a4f02238d18cc8a5 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Fri, 22 May 2015 17:27:56 +1000 Subject: [PATCH 86/86] phtize all the things Summary: `pht`ize a whole bunch of strings in rP. Test Plan: Intense eyeballing. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: hach-que, Korvin, epriestley Differential Revision: https://secure.phabricator.com/D12797 --- .arclint | 1 - .../autopatches/20140106.macromailkey.2.php | 6 +- .../sql/autopatches/20140108.ddbpname.2.php | 6 +- .../autopatches/20140113.legalpadsig.2.php | 6 +- .../autopatches/20140115.auth.3.unlimit.php | 4 +- .../autopatches/20140205.cal.3.phid-mig.php | 6 +- .../20140210.herald.rule-condition-mig.php | 7 +- .../20140210.projcfield.1.blurb.php | 5 +- .../20140211.dx.2.migcommenttext.php | 10 +- .../autopatches/20140212.dx.1.armageddon.php | 8 +- .../autopatches/20140218.passwords.4.vcs.php | 6 +- .../20140226.dxcustom.1.fielddata.php | 6 +- .../autopatches/20140321.mstatus.2.mig.php | 18 +-- .../autopatches/20140323.harbor.1.renames.php | 6 +- .../autopatches/20140325.push.3.groups.php | 6 +- .../autopatches/20140410.accountsecret.2.php | 8 +- .../autopatches/20140420.rel.2.objectmig.php | 6 +- .../20140521.projectslug.2.mig.php | 10 +- .../sql/autopatches/20140711.pnames.2.php | 6 +- .../sql/autopatches/20140722.appname.php | 8 +- .../20140722.audit.3.miginlines.php | 6 +- .../autopatches/20140722.audit.4.migtext.php | 8 +- .../sql/autopatches/20140722.renameauth.php | 2 +- .../20140725.audit.1.migxactions.php | 6 +- .../20140731.audit.1.subscribers.php | 6 +- resources/sql/autopatches/20140731.cancdn.php | 2 +- .../sql/autopatches/20140805.boardcol.2.php | 8 +- .../sql/autopatches/20140808.boardprop.3.php | 4 +- .../sql/autopatches/20140815.cancdncase.php | 5 +- .../sql/autopatches/20140904.macroattach.php | 6 +- .../sql/autopatches/20140914.betaproto.php | 8 +- .../20141107.phriction.policy.2.php | 13 +- .../20141107.phriction.popkeys.php | 8 +- .../sql/autopatches/20141107.ssh.4.keymig.php | 10 +- .../sql/autopatches/20141113.auditdupes.php | 4 +- .../autopatches/20141218.maniphestcctxn.php | 7 +- .../autopatches/20141222.maniphestprojtxn.php | 6 +- .../sql/autopatches/20150102.policyname.php | 2 +- .../20150116.maniphestapplicationemails.php | 6 +- .../20150120.maniphestdefaultauthor.php | 4 +- .../20150129.pastefileapplicationemails.php | 12 +- .../autopatches/20150501.calendar.2.reply.php | 6 +- .../20150506.calendarunnamedevents.1.php | 6 +- resources/sql/patches/059.engines.php | 11 +- resources/sql/patches/079.nametokenindex.php | 6 +- resources/sql/patches/081.filekeys.php | 6 +- .../patches/090.forceuniqueprojectnames.php | 30 ++-- resources/sql/patches/093.gitremotes.php | 13 +- .../patches/098.heraldruletypemigration.php | 6 +- resources/sql/patches/102.heraldcleanup.php | 6 +- .../sql/patches/111.commitauditmigration.php | 8 +- .../sql/patches/131.migraterevisionquery.php | 4 +- .../sql/patches/20121209.xmacromigrate.php | 4 +- .../patches/20130201.revisionunsubscribed.php | 4 +- .../sql/patches/20130218.updatechannelid.php | 4 +- .../sql/patches/20130219.commitsummarymig.php | 6 +- .../patches/20130403.conpherencecachemig.php | 7 +- resources/sql/patches/20130409.commitdrev.php | 4 +- .../sql/patches/20130502.countdownrevamp2.php | 4 +- .../patches/20130507.releephrqmailkeypop.php | 6 +- .../sql/patches/20130529.macroauthormig.php | 6 +- .../sql/patches/20130611.migrateoauth.php | 10 +- resources/sql/patches/20130611.nukeldap.php | 8 +- resources/sql/patches/20130619.authconf.php | 6 +- .../patches/20130703.legalpaddocdenorm.php | 16 +- .../patches/20130711.pholioimageobsolete.php | 4 +- .../sql/patches/20130711.trimrealnames.php | 8 +- .../sql/patches/20130715.votecomments.php | 10 +- .../20130716.archivememberlessprojects.php | 11 +- .../sql/patches/20130728.ponderunique.php | 10 +- .../sql/patches/20130728.ponderxcomment.php | 6 +- .../sql/patches/20130801.pastexactions.php | 6 +- .../sql/patches/20130802.heraldphids.php | 6 +- .../sql/patches/20130805.pastemailkeypop.php | 6 +- .../20130820.file-mailkey-populate.php | 4 +- .../sql/patches/20130915.maniphestmigrate.php | 6 +- resources/sql/patches/20130919.mfieldconf.php | 8 +- .../patches/20130921.xmigratemaniphest.php | 6 +- resources/sql/patches/20130926.dinline.php | 6 +- .../sql/patches/20131004.dxreviewers.php | 4 +- .../sql/patches/20131020.pxactionmig.php | 6 +- .../sql/patches/20131106.diffphid.2.mig.php | 4 +- .../patches/20131112.userverified.2.mig.php | 4 +- resources/sql/patches/20131118.ownerorder.php | 4 +- .../20131121.repocredentials.2.mig.php | 14 +- .../patches/20131205.buildstepordermig.php | 8 +- .../patches/20131217.pushlogphid.2.mig.php | 6 +- resources/sql/patches/emailtableport.php | 6 +- .../sql/patches/legalpad-mailkey-populate.php | 8 +- resources/sql/patches/liskcounters.php | 2 +- .../migrate-differential-dependencies.php | 8 +- .../migrate-maniphest-dependencies.php | 8 +- .../patches/migrate-maniphest-revisions.php | 8 +- .../sql/patches/migrate-project-edges.php | 8 +- .../sql/patches/ponder-mailkey-populate.php | 8 +- scripts/__init_script__.php | 2 +- scripts/almanac/manage_almanac.php | 2 +- scripts/aphront/aphrontpath.php | 6 +- scripts/cache/manage_cache.php | 2 +- scripts/celerity/generate_sprites.php | 14 +- scripts/daemon/manage_daemons.php | 2 +- scripts/diviner/diviner.php | 2 +- scripts/drydock/drydock_control.php | 2 +- scripts/fact/manage_facts.php | 2 +- scripts/files/manage_files.php | 2 +- scripts/lipsum/manage_lipsum.php | 2 +- scripts/mail/mail_handler.php | 2 +- scripts/mail/manage_mail.php | 2 +- scripts/repository/commit_hook.php | 4 +- scripts/repository/manage_repositories.php | 2 +- scripts/repository/rebuild_summaries.php | 4 +- scripts/repository/save_lint.php | 2 +- scripts/search/manage_search.php | 2 +- scripts/setup/manage_audit.php | 2 +- scripts/setup/manage_auth.php | 2 +- scripts/setup/manage_celerity.php | 2 +- scripts/setup/manage_config.php | 2 +- scripts/setup/manage_feed.php | 2 +- scripts/setup/manage_harbormaster.php | 2 +- scripts/setup/manage_hunks.php | 2 +- scripts/setup/manage_i18n.php | 2 +- scripts/setup/manage_phortune.php | 2 +- scripts/setup/manage_policy.php | 2 +- scripts/setup/manage_remove.php | 2 +- scripts/setup/manage_trigger.php | 2 +- scripts/setup/manage_worker.php | 2 +- scripts/sms/manage_sms.php | 2 +- scripts/sql/manage_storage.php | 73 ++++----- scripts/ssh/ssh-exec.php | 35 +++-- scripts/symbols/import_repository_symbols.php | 12 +- scripts/user/account_admin.php | 88 +++++------ scripts/user/add_user.php | 23 ++- scripts/util/add_macro.php | 10 +- scripts/util/emit_test_event.php | 8 +- src/__tests__/PhabricatorCelerityTestCase.php | 3 +- .../PhabricatorInfrastructureTestCase.php | 2 +- src/aphront/AphrontRequest.php | 39 ++--- .../__tests__/AphrontRequestTestCase.php | 2 +- .../AphrontApplicationConfiguration.php | 28 ++-- ...AphrontDefaultApplicationConfiguration.php | 11 +- src/aphront/response/Aphront404Response.php | 9 +- src/aphront/sink/AphrontHTTPSink.php | 14 +- .../controller/AlmanacConsoleController.php | 12 +- .../AlmanacServiceEditController.php | 4 - ...ricatorAphlictManagementStatusWorkflow.php | 4 +- .../PhabricatorAphlictManagementWorkflow.php | 46 ++++-- .../query/AphlictDropdownDataQuery.php | 4 +- .../ArcanistProjectInfoConduitAPIMethod.php | 4 +- .../conduit/AuditQueryConduitAPIMethod.php | 2 +- .../PhabricatorAuditActionConstants.php | 32 ++-- .../PhabricatorAuditCommitStatusConstants.php | 2 +- .../audit/editor/PhabricatorAuditEditor.php | 4 +- .../mail/PhabricatorAuditMailReceiver.php | 4 +- .../mail/PhabricatorAuditReplyHandler.php | 5 +- ...abricatorAuditManagementDeleteWorkflow.php | 36 +++-- .../audit/view/PhabricatorAuditListView.php | 8 +- .../view/PhabricatorAuditTransactionView.php | 2 +- .../PhabricatorAuthConduitAPIMethod.php | 6 +- .../PhabricatorAuthLoginController.php | 6 +- ...bricatorAuthNeedsMultiFactorController.php | 2 +- .../PhabricatorAuthRegisterController.php | 3 +- ...habricatorAuthSSHKeyGenerateController.php | 9 +- .../PhabricatorAuthStartController.php | 4 +- .../PhabricatorEmailLoginController.php | 38 ++--- .../PhabricatorTOTPAuthFactorTestCase.php | 2 - ...icatorAuthManagementCachePKCS8Workflow.php | 10 +- .../PhabricatorAuthManagementLDAPWorkflow.php | 8 +- ...abricatorAuthManagementRecoverWorkflow.php | 13 +- ...abricatorAuthManagementRefreshWorkflow.php | 6 +- ...PhabricatorAuthManagementStripWorkflow.php | 16 +- ...AuthManagementTrustOAuthClientWorkflow.php | 3 +- ...thManagementUntrustOAuthClientWorkflow.php | 5 +- .../auth/provider/PhabricatorAuthProvider.php | 14 +- .../provider/PhabricatorLDAPAuthProvider.php | 11 +- .../PhabricatorOAuth1AuthProvider.php | 4 +- .../PhabricatorOAuth2AuthProvider.php | 5 +- .../provider/PhabricatorOAuthAuthProvider.php | 5 +- .../PhabricatorPasswordAuthProvider.php | 14 +- .../PhabricatorPersonaAuthProvider.php | 7 +- .../PhabricatorPhabricatorAuthProvider.php | 3 +- .../PhabricatorAuthProviderConfigQuery.php | 2 +- .../sshkey/PhabricatorAuthSSHPublicKey.php | 3 +- .../base/PhabricatorApplication.php | 8 +- .../base/controller/PhabricatorController.php | 6 +- .../PhabricatorAccessControlTestCase.php | 24 +-- src/applications/cache/PhabricatorCaches.php | 4 +- .../PhabricatorKeyValueDatabaseCache.php | 4 +- ...habricatorCacheManagementPurgeWorkflow.php | 31 ++-- .../cache/spec/PhabricatorCacheSpec.php | 4 +- .../cache/spec/PhabricatorOpcodeCacheSpec.php | 57 +++---- .../mail/PhabricatorCalendarReplyHandler.php | 5 +- .../PhabricatorCalendarHolidayTestCase.php | 4 +- .../view/AphrontCalendarEventView.php | 2 +- .../celerity/CelerityResourceMap.php | 3 +- .../celerity/CelerityResourceMapGenerator.php | 14 +- .../celerity/CelerityResourceTransformer.php | 5 +- .../celerity/CeleritySpriteGenerator.php | 7 +- .../CelerityStaticResourceResponse.php | 9 +- .../controller/CelerityResourceController.php | 2 +- .../conduit/ChatLogQueryConduitAPIMethod.php | 2 +- .../conduit/ChatLogRecordConduitAPIMethod.php | 2 +- ...habricatorChatLogChannelListController.php | 4 +- ...PhabricatorChatLogChannelLogController.php | 6 +- .../call/__tests__/ConduitCallTestCase.php | 4 +- .../PhabricatorConduitAPIController.php | 58 ++++---- .../PhabricatorConduitConsoleController.php | 9 +- .../PhabricatorConduitLogController.php | 4 +- .../conduit/method/ConduitAPIMethod.php | 11 +- .../method/ConduitConnectConduitAPIMethod.php | 46 +++--- .../ConduitGetCertificateConduitAPIMethod.php | 10 +- .../method/ConduitPingConduitAPIMethod.php | 2 +- .../method/ConduitQueryConduitAPIMethod.php | 2 +- .../conduit/protocol/ConduitAPIRequest.php | 7 +- .../query/PhabricatorConduitSearchEngine.php | 11 +- .../conduit/ssh/ConduitSSHWorkflow.php | 4 +- .../check/PhabricatorAuthSetupCheck.php | 9 +- .../check/PhabricatorBinariesSetupCheck.php | 17 ++- .../check/PhabricatorDaemonsSetupCheck.php | 26 ++-- .../check/PhabricatorDatabaseSetupCheck.php | 25 ++-- .../PhabricatorExtraConfigSetupCheck.php | 42 +++--- .../check/PhabricatorFileinfoSetupCheck.php | 8 +- .../config/check/PhabricatorGDSetupCheck.php | 17 ++- .../PhabricatorImagemagickSetupCheck.php | 10 +- .../check/PhabricatorMySQLSetupCheck.php | 11 +- .../check/PhabricatorPHPConfigSetupCheck.php | 39 +++-- .../check/PhabricatorPathSetupCheck.php | 27 ++-- .../check/PhabricatorPygmentSetupCheck.php | 36 +++-- .../config/check/PhabricatorSetupCheck.php | 8 +- .../check/PhabricatorTimezoneSetupCheck.php | 6 +- .../PhabricatorConfigIgnoreController.php | 2 +- .../PhabricatorCustomHeaderConfigType.php | 30 ++-- ...bricatorConfigManagementDeleteWorkflow.php | 25 ++-- ...PhabricatorConfigManagementGetWorkflow.php | 12 +- ...habricatorConfigManagementListWorkflow.php | 2 +- ...ricatorConfigManagementMigrateWorkflow.php | 36 +++-- ...PhabricatorConfigManagementSetWorkflow.php | 93 +++++++----- .../option/PhabricatorAWSConfigOptions.php | 4 +- .../PhabricatorAccessLogConfigOptions.php | 11 +- .../PhabricatorApplicationConfigOptions.php | 2 +- ...PhabricatorAuthenticationConfigOptions.php | 7 +- .../PhabricatorClusterConfigOptions.php | 7 +- .../config/option/PhabricatorConfigOption.php | 6 +- .../option/PhabricatorCoreConfigOptions.php | 83 ++++++----- .../PhabricatorDeveloperConfigOptions.php | 12 +- .../PhabricatorMailgunConfigOptions.php | 5 +- .../PhabricatorMetaMTAConfigOptions.php | 29 ++-- .../option/PhabricatorMySQLConfigOptions.php | 4 +- .../option/PhabricatorPHDConfigOptions.php | 18 ++- .../PhabricatorPHPMailerConfigOptions.php | 9 +- .../option/PhabricatorSMSConfigOptions.php | 12 +- .../PhabricatorSecurityConfigOptions.php | 35 +++-- ...ricatorSyntaxHighlightingConfigOptions.php | 6 +- .../PhabricatorTranslationsConfigOptions.php | 8 +- .../option/PhabricatorUIConfigOptions.php | 3 +- ...ConpherenceQueryThreadConduitAPIMethod.php | 8 +- ...erenceQueryTransactionConduitAPIMethod.php | 6 +- .../ConpherenceUpdateController.php | 2 +- .../mail/ConpherenceReplyHandler.php | 5 +- .../plugin/DarkConsoleErrorLogPlugin.php | 4 +- .../console/plugin/DarkConsoleEventPlugin.php | 14 +- .../plugin/DarkConsoleRequestPlugin.php | 9 +- .../plugin/DarkConsoleServicesPlugin.php | 42 +++--- .../plugin/DarkConsoleXHProfPlugin.php | 14 +- .../errorlog/DarkConsoleErrorLogPluginAPI.php | 2 +- .../PhabricatorCountdownDeleteController.php | 5 +- .../PhabricatorDaemonConsoleController.php | 2 +- .../PhabricatorDaemonLogViewController.php | 6 +- .../PhabricatorWorkerTaskDetailController.php | 4 +- ...abricatorDaemonManagementDebugWorkflow.php | 6 +- ...PhabricatorDaemonManagementLogWorkflow.php | 8 +- ...bricatorDaemonManagementReloadWorkflow.php | 3 +- ...ricatorDaemonManagementRestartWorkflow.php | 4 +- ...abricatorDaemonManagementStartWorkflow.php | 13 +- ...bricatorDaemonManagementStatusWorkflow.php | 2 +- ...habricatorDaemonManagementStopWorkflow.php | 3 +- .../PhabricatorDaemonManagementWorkflow.php | 100 ++++++++----- .../view/PhabricatorDaemonLogEventsView.php | 2 +- .../PhabricatorDashboardEditController.php | 8 +- .../PhabricatorDashboardLayoutConfig.php | 4 +- .../DifferentialParseRenderTestCase.php | 3 +- .../PhabricatorDifferentialApplication.php | 8 +- .../DifferentialCloseConduitAPIMethod.php | 2 +- ...ferentialCreateCommentConduitAPIMethod.php | 2 +- ...DifferentialCreateDiffConduitAPIMethod.php | 2 +- ...fferentialCreateInlineConduitAPIMethod.php | 17 ++- ...erentialCreateRevisionConduitAPIMethod.php | 2 +- .../DifferentialFindConduitAPIMethod.php | 4 +- ...FinishPostponedLintersConduitAPIMethod.php | 12 +- ...ifferentialGetAllDiffsConduitAPIMethod.php | 5 +- ...entialGetCommitMessageConduitAPIMethod.php | 4 +- ...erentialGetCommitPathsConduitAPIMethod.php | 7 +- .../DifferentialGetDiffConduitAPIMethod.php | 6 +- ...ialGetRevisionCommentsConduitAPIMethod.php | 2 +- .../DifferentialQueryConduitAPIMethod.php | 12 +- ...rentialSetDiffPropertyConduitAPIMethod.php | 4 +- ...erentialUpdateRevisionConduitAPIMethod.php | 8 +- ...ntialUpdateUnitResultsConduitAPIMethod.php | 7 +- .../PhabricatorDifferentialConfigOptions.php | 16 +- .../constants/DifferentialAction.php | 53 ++++--- .../constants/DifferentialChangeType.php | 2 +- .../DifferentialChangesetViewController.php | 2 +- .../DifferentialDiffCreateController.php | 2 +- ...ifferentialInlineCommentEditController.php | 4 +- ...erentialRevisionCloseDetailsController.php | 16 +- .../DifferentialRevisionEditController.php | 3 +- .../DifferentialRevisionLandController.php | 16 +- .../DifferentialRevisionViewController.php | 6 +- .../customfield/DifferentialBranchField.php | 5 +- .../DifferentialConflictsField.php | 4 +- .../DifferentialDependsOnField.php | 3 +- .../customfield/DifferentialGitSVNIDField.php | 4 +- .../customfield/DifferentialLintField.php | 10 +- .../DifferentialManiphestTasksField.php | 5 +- .../DifferentialProjectReviewersField.php | 3 +- .../DifferentialRepositoryField.php | 3 +- .../DifferentialRevisionIDField.php | 3 +- .../customfield/DifferentialUnitField.php | 22 +-- .../editor/DifferentialTransactionEditor.php | 21 ++- .../DifferentialGitHubLandingStrategy.php | 20 ++- .../DifferentialHostedGitLandingStrategy.php | 10 +- ...erentialHostedMercurialLandingStrategy.php | 6 +- .../landing/DifferentialLandingStrategy.php | 8 +- ...rDifferentialRevisionTestDataGenerator.php | 8 +- .../mail/DifferentialCreateMailReceiver.php | 4 +- .../mail/DifferentialReplyHandler.php | 2 +- .../mail/DifferentialRevisionMailReceiver.php | 4 +- .../parser/DifferentialChangesetParser.php | 11 +- .../DifferentialCommitMessageParser.php | 6 +- .../parser/DifferentialHunkParser.php | 23 +-- ...ifferentialCommitMessageParserTestCase.php | 5 +- .../DifferentialHunkParserTestCase.php | 140 +++++++++--------- .../query/DifferentialHunkQuery.php | 4 +- .../query/DifferentialRevisionQuery.php | 4 +- .../DifferentialChangesetHTMLRenderer.php | 11 +- .../render/DifferentialChangesetRenderer.php | 2 +- .../DifferentialChangesetTwoUpRenderer.php | 10 +- .../search/DifferentialSearchIndexer.php | 2 +- .../storage/DifferentialReviewer.php | 2 +- .../storage/DifferentialRevision.php | 3 +- .../storage/DifferentialTransaction.php | 15 +- .../DifferentialDiffTableOfContentsView.php | 10 +- .../DifferentialRevisionUpdateHistoryView.php | 4 +- .../view/DifferentialTransactionView.php | 2 +- .../diffusion/DiffusionLintSaveRunner.php | 2 +- .../DiffusionBrowseQueryConduitAPIMethod.php | 4 +- ...DiffusionCreateCommentConduitAPIMethod.php | 18 ++- .../DiffusionDiffQueryConduitAPIMethod.php | 4 +- .../DiffusionExistsQueryConduitAPIMethod.php | 4 +- ...fusionFileContentQueryConduitAPIMethod.php | 2 +- .../DiffusionGetCommitsConduitAPIMethod.php | 2 +- ...GetRecentCommitsByPathConduitAPIMethod.php | 3 +- .../DiffusionHistoryQueryConduitAPIMethod.php | 5 +- ...sionMergedCommitsQueryConduitAPIMethod.php | 4 +- .../DiffusionQueryConduitAPIMethod.php | 2 +- .../DiffusionRawDiffQueryConduitAPIMethod.php | 4 +- .../DiffusionRefsQueryConduitAPIMethod.php | 4 +- .../DiffusionSearchQueryConduitAPIMethod.php | 4 +- .../PhabricatorDiffusionConfigOptions.php | 19 ++- .../DiffusionBrowseDirectoryController.php | 4 +- .../DiffusionBrowseFileController.php | 13 +- .../DiffusionBrowseSearchController.php | 4 +- .../DiffusionCommitBranchesController.php | 2 +- .../controller/DiffusionCommitController.php | 20 +-- .../controller/DiffusionController.php | 2 +- .../DiffusionExternalController.php | 8 +- .../controller/DiffusionHistoryController.php | 2 - .../DiffusionInlineCommentController.php | 4 +- .../DiffusionPathValidateController.php | 2 +- .../DiffusionRepositoryController.php | 9 +- .../DiffusionRepositoryCreateController.php | 11 +- ...ffusionRepositoryEditActionsController.php | 3 +- ...DiffusionRepositoryEditBasicController.php | 24 +-- ...fusionRepositoryEditBranchesController.php | 12 +- ...iffusionRepositoryEditDeleteController.php | 5 +- ...fusionRepositoryEditEncodingController.php | 3 +- .../DiffusionRepositoryEditMainController.php | 3 +- ...ffusionRepositoryEditStorageController.php | 9 +- ...sionRepositoryEditSubversionController.php | 6 +- .../DiffusionRepositoryNewController.php | 10 +- .../controller/DiffusionServeController.php | 12 +- .../diffusion/data/DiffusionGitBranch.php | 14 +- .../diffusion/data/DiffusionRepositoryTag.php | 2 +- .../engine/DiffusionCommitHookEngine.php | 5 +- .../exception/DiffusionSetupException.php | 2 +- .../DiffusionMercurialWireProtocol.php | 4 +- .../DiffusionSubversionWireProtocol.php | 11 +- .../query/DiffusionCachedResolveRefsQuery.php | 2 +- .../diffusion/query/DiffusionCommitQuery.php | 10 +- .../diffusion/query/DiffusionQuery.php | 2 +- .../DiffusionGitFileContentQuery.php | 6 +- .../DiffusionSvnFileContentQuery.php | 7 +- .../lowlevel/DiffusionLowLevelCommitQuery.php | 3 +- .../DiffusionLowLevelParentsQuery.php | 3 +- .../DiffusionLowLevelResolveRefsQuery.php | 23 ++- .../__tests__/DiffusionPathQueryTestCase.php | 8 +- .../diffusion/request/DiffusionGitRequest.php | 2 +- .../request/DiffusionMercurialRequest.php | 2 +- .../diffusion/request/DiffusionRequest.php | 61 +++++--- .../__tests__/DiffusionURITestCase.php | 2 +- .../DiffusionMercurialServeSSHWorkflow.php | 4 +- ...nMercurialWireClientSSHProtocolChannel.php | 2 +- .../diffusion/ssh/DiffusionSSHWorkflow.php | 3 +- .../DiffusionSubversionServeSSHWorkflow.php | 13 +- .../DiffusionMercurialWireSSHTestCase.php | 2 +- .../view/DiffusionEmptyResultView.php | 13 +- .../diffusion/view/DiffusionView.php | 7 +- src/applications/diviner/atom/DivinerAtom.php | 4 +- .../atomizer/DivinerArticleAtomizer.php | 2 +- .../worker/DoorkeeperAsanaFeedWorker.php | 44 +++--- .../worker/DoorkeeperFeedWorker.php | 10 +- .../worker/DoorkeeperJIRAFeedWorker.php | 22 ++- .../DrydockBlueprintImplementation.php | 37 +++-- ...reallocatedHostBlueprintImplementation.php | 9 +- ...dockWorkingCopyBlueprintImplementation.php | 12 +- .../constants/DrydockResourceStatus.php | 2 +- .../controller/DrydockConsoleController.php | 11 +- .../DrydockLeaseReleaseController.php | 19 ++- .../DrydockResourceViewController.php | 2 +- .../command/DrydockSSHCommandInterface.php | 9 +- .../DrydockSFTPFilesystemInterface.php | 2 +- .../DrydockManagementCloseWorkflow.php | 10 +- ...rydockManagementCreateResourceWorkflow.php | 20 ++- .../DrydockManagementLeaseWorkflow.php | 12 +- .../DrydockManagementReleaseWorkflow.php | 10 +- .../drydock/storage/DrydockBlueprint.php | 5 +- .../drydock/storage/DrydockLease.php | 15 +- .../drydock/worker/DrydockAllocatorWorker.php | 10 +- .../PhabricatorFactChartController.php | 2 +- .../fact/daemon/PhabricatorFactDaemon.php | 8 +- .../engine/PhabricatorFactCountEngine.php | 8 +- .../PhabricatorFactLastUpdatedEngine.php | 2 +- .../extract/PhabricatorFactUpdateIterator.php | 2 +- ...abricatorFactManagementAnalyzeWorkflow.php | 6 +- ...abricatorFactManagementCursorsWorkflow.php | 2 +- .../fact/spec/PhabricatorFactSpec.php | 5 +- .../feed/PhabricatorFeedStoryPublisher.php | 27 +++- .../feed/builder/PhabricatorFeedBuilder.php | 2 +- .../conduit/FeedPublishConduitAPIMethod.php | 2 +- .../conduit/FeedQueryConduitAPIMethod.php | 14 +- .../feed/query/PhabricatorFeedQuery.php | 3 +- .../feed/story/PhabricatorFeedStory.php | 10 +- .../feed/worker/FeedPushWorker.php | 2 +- .../PhabricatorFilesApplication.php | 3 +- .../files/conduit/FileConduitAPIMethod.php | 3 +- .../conduit/FileDownloadConduitAPIMethod.php | 4 +- .../conduit/FileInfoConduitAPIMethod.php | 4 +- .../conduit/FileUploadConduitAPIMethod.php | 2 +- .../FileUploadHashConduitAPIMethod.php | 2 +- .../config/PhabricatorFilesConfigOptions.php | 31 ++-- .../PhabricatorFileDeleteController.php | 10 +- .../PhabricatorLocalDiskFileStorageEngine.php | 10 +- .../PhabricatorMySQLFileStorageEngine.php | 2 +- .../engine/PhabricatorS3FileStorageEngine.php | 9 +- .../engine/PhabricatorTestStorageEngine.php | 2 +- .../PhabricatorFileUploadException.php | 35 ++--- .../files/mail/FileCreateMailReceiver.php | 3 +- .../files/mail/FileMailReceiver.php | 4 +- .../files/mail/FileReplyHandler.php | 2 +- .../PhabricatorFilesManagementCatWorkflow.php | 7 +- ...bricatorFilesManagementCompactWorkflow.php | 5 +- ...bricatorFilesManagementEnginesWorkflow.php | 4 +- ...bricatorFilesManagementMigrateWorkflow.php | 57 ++++--- ...habricatorFilesManagementPurgeWorkflow.php | 24 +-- ...bricatorFilesManagementRebuildWorkflow.php | 67 +++++---- .../PhabricatorFilesManagementWorkflow.php | 8 +- .../PhabricatorEmbedFileRemarkupRule.php | 6 +- .../files/query/PhabricatorFileQuery.php | 7 +- .../files/storage/PhabricatorFile.php | 56 +++---- .../PhabricatorGlobalUploadTargetView.php | 2 +- .../conduit/FlagDeleteConduitAPIMethod.php | 8 +- .../flag/conduit/FlagEditConduitAPIMethod.php | 2 +- .../conduit/FlagQueryConduitAPIMethod.php | 2 +- .../flag/query/PhabricatorFlagQuery.php | 3 +- .../fund/editor/FundInitiativeEditor.php | 2 +- .../fund/mail/FundInitiativeReplyHandler.php | 2 +- .../fund/phortune/FundBackerProduct.php | 4 +- .../fund/search/FundInitiativeIndexer.php | 5 +- .../fund/storage/FundInitiative.php | 3 +- .../HarbormasterBuildActionController.php | 3 +- .../HarbormasterBuildViewController.php | 4 +- .../HarbormasterPlanEditController.php | 2 +- .../HarbormasterPlanViewController.php | 2 +- .../HarbormasterStepDeleteController.php | 6 +- .../HarbormasterStepEditController.php | 5 +- .../HarbormasterBuildTransactionEditor.php | 2 +- .../HarbormasterManagementBuildWorkflow.php | 10 +- ...ormasterCommandBuildStepImplementation.php | 4 +- ...WaitForPreviousBuildStepImplementation.php | 2 +- .../storage/build/HarbormasterBuild.php | 2 +- .../build/HarbormasterBuildArtifact.php | 17 ++- .../storage/build/HarbormasterBuildLog.php | 10 +- .../herald/adapter/HeraldAdapter.php | 42 +++--- .../herald/adapter/HeraldCommitAdapter.php | 2 +- .../HeraldDifferentialRevisionAdapter.php | 8 +- .../controller/HeraldRuleController.php | 2 +- .../HeraldTestConsoleController.php | 2 +- .../controller/HeraldTranscriptController.php | 11 +- .../herald/engine/HeraldEngine.php | 21 +-- .../query/HeraldTranscriptSearchEngine.php | 2 +- .../herald/storage/HeraldRule.php | 2 +- .../PhabricatorHomeMainController.php | 26 ++-- .../LegalpadDocumentEditController.php | 3 +- .../LegalpadDocumentSignController.php | 41 +++-- ...ocumentSignatureVerificationController.php | 4 +- .../legalpad/mail/LegalpadMailReceiver.php | 4 +- .../legalpad/mail/LegalpadReplyHandler.php | 2 +- .../query/LegalpadDocumentSearchEngine.php | 1 - .../legalpad/storage/LegalpadDocument.php | 3 +- .../legalpad/storage/LegalpadDocumentBody.php | 2 +- .../PhabricatorTestDataGenerator.php | 4 +- .../MacroCreateMemeConduitAPIMethod.php | 2 +- .../conduit/MacroQueryConduitAPIMethod.php | 2 +- .../PhabricatorMacroDisableController.php | 12 +- .../mail/PhabricatorMacroMailReceiver.php | 4 +- .../mail/PhabricatorMacroReplyHandler.php | 3 +- .../macro/query/PhabricatorMacroQuery.php | 4 +- .../PhabricatorMailingListsApplication.php | 4 +- .../__tests__/ManiphestTaskTestCase.php | 10 +- .../command/ManiphestAssignEmailCommand.php | 12 +- .../command/ManiphestPriorityEmailCommand.php | 10 +- .../command/ManiphestStatusEmailCommand.php | 10 +- .../conduit/ManiphestConduitAPIMethod.php | 11 +- .../ManiphestCreateTaskConduitAPIMethod.php | 4 +- ...estGetTaskTransactionsConduitAPIMethod.php | 2 +- .../conduit/ManiphestInfoConduitAPIMethod.php | 4 +- .../ManiphestQueryConduitAPIMethod.php | 2 +- ...ManiphestQueryStatusesConduitAPIMethod.php | 3 +- .../ManiphestUpdateConduitAPIMethod.php | 14 +- .../PhabricatorManiphestConfigOptions.php | 14 +- .../ManiphestBatchEditController.php | 2 +- .../controller/ManiphestExportController.php | 14 +- .../controller/ManiphestReportController.php | 6 +- .../ManiphestTransactionSaveController.php | 2 +- .../editor/ManiphestTransactionEditor.php | 8 +- .../mail/ManiphestCreateMailReceiver.php | 4 +- .../maniphest/mail/ManiphestReplyHandler.php | 2 +- .../mail/ManiphestTaskMailReceiver.php | 4 +- .../maniphest/query/ManiphestTaskQuery.php | 2 +- ...atorApplicationEmailCommandsController.php | 25 +--- ...bricatorApplicationUninstallController.php | 30 ++-- ...icatorMailImplementationMailgunAdapter.php | 5 +- ...abricatorMailImplementationTestAdapter.php | 4 +- .../PhabricatorContentSourceView.php | 2 +- ...icatorMetaMTASendGridReceiveController.php | 2 +- ...catorMailManagementListInboundWorkflow.php | 13 +- ...atorMailManagementListOutboundWorkflow.php | 11 +- ...catorMailManagementReceiveTestWorkflow.php | 19 ++- ...habricatorMailManagementResendWorkflow.php | 19 ++- ...bricatorMailManagementSendTestWorkflow.php | 30 ++-- ...catorMailManagementShowInboundWorkflow.php | 13 +- ...atorMailManagementShowOutboundWorkflow.php | 13 +- .../PhabricatorMailReceiverTestCase.php | 2 +- .../storage/PhabricatorMetaMTAMail.php | 22 +-- .../PhabricatorMetaMTAReceivedMail.php | 4 +- .../PhabricatorMetaMTAMailTestCase.php | 32 ++-- ...PhabricatorNotificationClearController.php | 7 +- ...habricatorNotificationStatusController.php | 10 +- .../setup/PhabricatorAphlictSetupCheck.php | 10 +- .../controller/NuanceQueueViewController.php | 2 +- .../NuanceRequestorEditController.php | 2 +- .../NuancePhabricatorFormSourceDefinition.php | 2 +- .../nuance/source/NuanceSourceDefinition.php | 15 +- .../oauthserver/PhabricatorOAuthServer.php | 22 +-- .../PhabricatorOAuthServerScope.php | 4 +- .../PhabricatorOAuthServerTestCase.php | 18 ++- .../PhabricatorOAuthServerController.php | 16 +- .../PhabricatorOAuthServerTokenController.php | 56 ++++--- .../PhabricatorOAuthClientEditController.php | 4 +- ...PhabricatorOAuthClientSecretController.php | 4 +- ...OAuthServerAuthorizationsSettingsPanel.php | 7 +- .../conduit/OwnersQueryConduitAPIMethod.php | 21 ++- .../PhabricatorOwnersDeleteController.php | 8 +- .../PhabricatorOwnersEditController.php | 14 +- .../owners/mail/OwnersPackageReplyHandler.php | 5 +- .../owners/mail/PackageCreateMail.php | 2 +- .../owners/mail/PackageDeleteMail.php | 2 +- src/applications/owners/mail/PackageMail.php | 27 ++-- .../owners/mail/PackageModifyMail.php | 26 ++-- .../PassphraseCredentialConduitController.php | 6 +- ...sphraseCredentialTypeSSHPrivateKeyText.php | 8 +- .../conduit/PasteCreateConduitAPIMethod.php | 6 +- .../conduit/PasteInfoConduitAPIMethod.php | 6 +- .../conduit/PasteQueryConduitAPIMethod.php | 2 +- .../paste/mail/PasteReplyHandler.php | 3 +- .../conduit/UserDisableConduitAPIMethod.php | 6 +- .../conduit/UserEnableConduitAPIMethod.php | 6 +- .../conduit/UserFindConduitAPIMethod.php | 4 +- .../conduit/UserQueryConduitAPIMethod.php | 4 +- .../conduit/UserWhoAmIConduitAPIMethod.php | 2 +- .../PhabricatorPeopleApproveController.php | 12 +- .../PhabricatorPeopleDeleteController.php | 7 +- .../PhabricatorPeopleDisableController.php | 3 +- .../PhabricatorPeopleFeedController.php | 5 +- .../PhabricatorPeopleLdapController.php | 4 +- .../PhabricatorPeopleNewController.php | 6 +- .../PhabricatorPeopleWelcomeController.php | 4 +- .../people/editor/PhabricatorUserEditor.php | 58 ++++---- .../PhabricatorUserEditorTestCase.php | 4 +- .../people/storage/PhabricatorUser.php | 93 ++++++------ .../people/storage/PhabricatorUserEmail.php | 73 +++++---- .../__tests__/PhabricatorUserTestCase.php | 2 +- .../PhabricatorPeopleNoOwnerDatasource.php | 18 +-- .../typeahead/PhabricatorViewerDatasource.php | 19 ++- .../conduit/PhameQueryConduitAPIMethod.php | 2 +- .../PhameQueryPostsConduitAPIMethod.php | 2 +- .../phame/controller/PhameController.php | 12 +- .../blog/PhameBlogEditController.php | 2 +- .../blog/PhameBlogListController.php | 2 +- .../blog/PhameBlogViewController.php | 4 +- .../post/PhamePostListController.php | 2 +- .../post/PhamePostViewController.php | 10 +- .../phame/skins/PhameSkinSpecification.php | 12 +- src/applications/phame/storage/PhameBlog.php | 5 +- src/applications/phame/storage/PhamePost.php | 8 +- .../phid/conduit/PHIDInfoConduitAPIMethod.php | 6 +- .../conduit/PHIDLookupConduitAPIMethod.php | 2 +- .../conduit/PHIDQueryConduitAPIMethod.php | 2 +- .../phid/storage/PhabricatorPHID.php | 2 +- .../phid/type/PhabricatorPHIDType.php | 12 +- .../controller/PholioInlineController.php | 2 +- .../controller/PholioMockEditController.php | 2 +- .../pholio/mail/PholioReplyHandler.php | 2 +- .../pholio/view/PholioMockImagesView.php | 4 +- .../pholio/view/PholioTransactionView.php | 6 +- .../PhortuneMonthYearExpiryControl.php | 2 +- .../PhortuneCartCancelController.php | 6 +- .../PhortuneCartCheckoutController.php | 2 +- .../PhortuneMerchantViewController.php | 1 - .../PhortunePaymentMethodCreateController.php | 5 +- .../PhortuneProviderEditController.php | 3 +- .../phortune/currency/PhortuneCurrency.php | 4 +- .../currency/PhortuneCurrencySerializer.php | 3 +- .../PhortuneNotImplementedException.php | 5 +- .../mail/PhortuneCartReplyHandler.php | 2 +- ...catorPhortuneManagementInvoiceWorkflow.php | 27 ++-- .../PhortunePayPalPaymentProvider.php | 3 +- .../PhortuneStripePaymentProvider.php | 5 +- .../phortune/storage/PhortuneCart.php | 35 +++-- .../phortune/view/PhortuneCreditCardForm.php | 6 +- .../worker/PhortuneSubscriptionWorker.php | 3 +- .../PhabricatorPHPASTApplication.php | 2 +- .../PhabricatorXHPASTViewFrameController.php | 2 +- .../PhabricatorXHPASTViewPanelController.php | 2 +- .../PhabricatorXHPASTViewRunController.php | 2 +- .../PhabricatorXHPASTViewStreamController.php | 2 +- .../PhragmentGetPatchConduitAPIMethod.php | 2 +- ...hragmentQueryFragmentsConduitAPIMethod.php | 2 +- .../controller/PhragmentController.php | 16 +- .../controller/PhragmentCreateController.php | 6 +- .../controller/PhragmentHistoryController.php | 2 +- .../controller/PhragmentRevertController.php | 2 +- .../controller/PhragmentVersionController.php | 6 +- .../phragment/storage/PhragmentFragment.php | 5 +- .../PhrequentTrackingConduitAPIMethod.php | 3 +- .../controller/PhrequentTrackController.php | 6 +- .../query/PhrequentUserTimeQuery.php | 2 +- .../PhrictionHistoryConduitAPIMethod.php | 2 +- .../conduit/PhrictionInfoConduitAPIMethod.php | 2 +- .../constants/PhrictionActionConstants.php | 14 +- .../constants/PhrictionChangeType.php | 14 +- .../PhrictionDocumentController.php | 2 +- .../controller/PhrictionEditController.php | 11 +- .../controller/PhrictionHistoryController.php | 2 +- .../phriction/mail/PhrictionReplyHandler.php | 3 +- .../query/PhrictionDocumentQuery.php | 2 +- .../phriction/storage/PhrictionDocument.php | 2 +- .../__tests__/PhabricatorPolicyTestCase.php | 35 +++-- .../PhabricatorPolicyCapability.php | 14 +- .../config/PhabricatorPolicyConfigOptions.php | 5 +- .../policy/config/PolicyLockOptionType.php | 33 +++-- .../PhabricatorPolicyEditController.php | 7 +- .../policy/filter/PhabricatorPolicyFilter.php | 15 +- ...habricatorPolicyManagementShowWorkflow.php | 8 +- ...bricatorPolicyManagementUnlockWorkflow.php | 18 +-- .../policy/query/PhabricatorPolicyQuery.php | 8 +- .../policy/storage/PhabricatorPolicy.php | 16 +- .../PhabricatorPonderApplication.php | 4 +- .../ponder/constants/PonderQuestionStatus.php | 2 +- .../controller/PonderAnswerSaveController.php | 3 +- .../ponder/editor/PonderVoteEditor.php | 4 +- .../mail/PonderQuestionReplyHandler.php | 2 +- .../ponder/phid/PonderAnswerPHIDType.php | 2 +- .../ponder/query/PonderQuestionQuery.php | 2 +- .../ponder/storage/PonderQuestion.php | 3 +- .../storage/PonderQuestionTransaction.php | 4 +- .../conduit/ProjectQueryConduitAPIMethod.php | 2 +- .../PhabricatorProjectEditorTestCase.php | 20 +-- .../project/mail/ProjectReplyHandler.php | 3 +- .../project/query/PhabricatorProjectQuery.php | 4 +- .../__tests__/ProjectRemarkupRuleTestCase.php | 2 +- .../storage/PhabricatorProjectTransaction.php | 14 +- ...habricatorProjectLogicalUserDatasource.php | 13 +- ...PhabricatorProjectNoProjectsDatasource.php | 11 +- .../commitfinder/ReleephCommitFinder.php | 26 +++- .../ReleephGetBranchesConduitAPIMethod.php | 2 +- .../ReleephProjectInfoConduitAPIMethod.php | 14 +- .../ReleephQueryRequestsConduitAPIMethod.php | 4 +- .../ReleephRequestConduitAPIMethod.php | 11 +- .../ReleephWorkCanPushConduitAPIMethod.php | 2 +- ...leephWorkGetAuthorInfoConduitAPIMethod.php | 2 +- ...GetBranchCommitMessageConduitAPIMethod.php | 14 +- .../ReleephWorkGetBranchConduitAPIMethod.php | 2 +- ...phWorkGetCommitMessageConduitAPIMethod.php | 6 +- ...ReleephWorkNextRequestConduitAPIMethod.php | 10 +- .../ReleephWorkRecordConduitAPIMethod.php | 5 +- ...phWorkRecordPickStatusConduitAPIMethod.php | 4 +- .../branch/ReleephBranchCreateController.php | 9 +- .../branch/ReleephBranchEditController.php | 4 +- .../ReleephProductCreateController.php | 6 +- .../product/ReleephProductEditController.php | 4 +- .../ReleephRequestActionController.php | 8 +- ...ephRequestDifferentialCreateController.php | 24 +-- .../request/ReleephRequestEditController.php | 30 ++-- ...entialReleephRequestFieldSpecification.php | 65 ++++---- .../releeph/editor/ReleephBranchEditor.php | 7 +- .../ReleephRequestTransactionalEditor.php | 11 +- .../field/selector/ReleephFieldSelector.php | 11 +- .../ReleephDependsOnFieldSpecification.php | 1 + .../ReleephDiffChurnFieldSpecification.php | 6 +- .../ReleephDiffSizeFieldSpecification.php | 18 ++- .../ReleephFieldSpecification.php | 3 +- .../ReleephIntentFieldSpecification.php | 8 +- .../ReleephLevelFieldSpecification.php | 14 +- .../ReleephReasonFieldSpecification.php | 12 +- .../ReleephRequestorFieldSpecification.php | 4 +- .../ReleephRevisionFieldSpecification.php | 2 +- .../ReleephSeverityFieldSpecification.php | 15 +- .../ReleephSummaryFieldSpecification.php | 12 +- .../mail/ReleephRequestReplyHandler.php | 2 +- .../releeph/query/ReleephBranchQuery.php | 2 +- .../releeph/query/ReleephRequestQuery.php | 2 +- .../releeph/storage/ReleephRequest.php | 2 +- .../view/branch/ReleephBranchPreviewView.php | 4 +- .../view/branch/ReleephBranchTemplate.php | 23 +-- .../RemarkupProcessConduitAPIMethod.php | 6 +- .../RepositoryCreateConduitAPIMethod.php | 12 +- ...ositoryArcanistProjectDeleteController.php | 7 +- ...epositoryArcanistProjectEditController.php | 2 +- .../PhabricatorRepositoryListController.php | 2 +- .../daemon/PhabricatorGitGraphStream.php | 5 +- .../PhabricatorRepositoryPullLocalDaemon.php | 10 +- .../PhabricatorRepositoryDiscoveryEngine.php | 4 +- .../engine/PhabricatorRepositoryEngine.php | 2 +- .../PhabricatorRepositoryPullEngine.php | 57 ++++--- .../engine/PhabricatorRepositoryRefEngine.php | 2 +- ...habricatorWorkingCopyDiscoveryTestCase.php | 2 +- .../PhabricatorWorkingCopyTestCase.php | 15 +- .../PhabricatorRepositoryGraphCache.php | 2 +- ...catorRepositoryManagementCacheWorkflow.php | 12 +- ...orRepositoryManagementDiscoverWorkflow.php | 16 +- ...icatorRepositoryManagementEditWorkflow.php | 16 +- ...rRepositoryManagementImportingWorkflow.php | 12 +- ...icatorRepositoryManagementListWorkflow.php | 4 +- ...epositoryManagementLookupUsersWorkflow.php | 5 +- ...positoryManagementMarkImportedWorkflow.php | 8 +- ...atorRepositoryManagementMirrorWorkflow.php | 5 +- ...icatorRepositoryManagementPullWorkflow.php | 16 +- ...icatorRepositoryManagementRefsWorkflow.php | 10 +- ...torRepositoryManagementReparseWorkflow.php | 69 +++++---- ...atorRepositoryManagementUpdateWorkflow.php | 4 +- ...habricatorRepositoryManagementWorkflow.php | 2 +- .../query/PhabricatorRepositoryQuery.php | 5 +- ...abricatorRepositoryCommitSearchIndexer.php | 2 +- .../storage/PhabricatorRepository.php | 49 +++--- .../PhabricatorRepositoryVCSPassword.php | 2 +- .../PhabricatorRepositoryTestCase.php | 8 +- ...habricatorRepositoryCommitOwnersWorker.php | 12 +- .../PhabricatorChangeParserTestCase.php | 2 +- ...atorRepositoryCommitChangeParserWorker.php | 4 +- ...rRepositoryGitCommitChangeParserWorker.php | 2 +- ...rRepositorySvnCommitChangeParserWorker.php | 46 ++++-- ...torRepositoryCommitMessageParserWorker.php | 7 +- .../PhabricatorSearchAttachController.php | 57 +++---- .../PhabricatorApplicationSearchEngine.php | 4 +- .../engine/PhabricatorJumpNavHandler.php | 2 +- .../PhabricatorSearchDocumentIndexer.php | 18 ++- ...abricatorSearchManagementIndexWorkflow.php | 34 +++-- ...habricatorSearchManagementInitWorkflow.php | 9 +- ...abricatorSearchApplicationSearchEngine.php | 10 +- .../query/PhabricatorSearchDocumentQuery.php | 3 +- ...ricatorConduitCertificateSettingsPanel.php | 9 +- ...torConpherencePreferencesSettingsPanel.php | 7 +- ...catorDeveloperPreferencesSettingsPanel.php | 18 ++- ...habricatorDiffPreferencesSettingsPanel.php | 9 +- ...ricatorDisplayPreferencesSettingsPanel.php | 14 +- ...PhabricatorEmailAddressesSettingsPanel.php | 2 +- .../PhabricatorEmailFormatSettingsPanel.php | 8 +- .../panel/PhabricatorSSHKeysSettingsPanel.php | 2 +- ...bricatorSearchPreferencesSettingsPanel.php | 2 +- .../storage/PhabricatorUserPreferences.php | 6 +- .../conduit/SlowvoteInfoConduitAPIMethod.php | 4 +- ...atorSubscriptionsSubscribeEmailCommand.php | 11 +- ...bricatorSystemSelectEncodingController.php | 8 +- .../phid/PhabricatorTokenTokenPHIDType.php | 2 +- ...torApplicationTransactionCommentEditor.php | 6 +- ...habricatorApplicationTransactionEditor.php | 124 ++++++++++------ ...licationTransactionValidationException.php | 2 +- .../PhabricatorApplicationTransaction.php | 5 +- .../PhabricatorApplicationTransactionView.php | 5 +- ...ricatorTypeaheadFunctionHelpController.php | 34 ++--- .../examples/JavelinReactorUIExample.php | 26 ++-- .../uiexample/examples/JavelinUIExample.php | 8 +- .../examples/JavelinViewUIExample.php | 6 +- .../examples/PHUIActionHeaderExample.php | 44 +++--- .../examples/PHUIActionPanelExample.php | 6 +- .../uiexample/examples/PHUIBoxExample.php | 12 +- .../examples/PHUIButtonBarExample.php | 2 +- .../uiexample/examples/PHUIButtonExample.php | 37 +++-- .../examples/PHUIColorPalletteExample.php | 6 +- .../examples/PHUIDocumentExample.php | 36 ++--- .../examples/PHUIFeedStoryExample.php | 30 ++-- .../uiexample/examples/PHUIIconExample.php | 4 +- .../examples/PHUIImageMaskExample.php | 5 +- .../uiexample/examples/PHUIInfoExample.php | 35 ++--- .../examples/PHUIInfoPanelExample.php | 67 +++++---- .../uiexample/examples/PHUIListExample.php | 58 ++++---- .../examples/PHUIObjectItemListExample.php | 16 +- .../examples/PHUIPropertyListExample.php | 61 ++++---- .../uiexample/examples/PHUITagExample.php | 32 ++-- .../uiexample/examples/PHUITextExample.php | 30 ++-- .../examples/PHUITimelineExample.php | 37 ++--- .../examples/PHUITypeaheadExample.php | 4 +- .../PhabricatorAphrontBarUIExample.php | 4 +- .../examples/PhabricatorBarePageUIExample.php | 4 +- .../examples/PhabricatorBusyUIExample.php | 4 +- .../examples/PhabricatorGestureUIExample.php | 10 +- .../PhabricatorHovercardUIExample.php | 21 +-- .../PhabricatorListFilterUIExample.php | 13 +- .../PhabricatorMultiColumnUIExample.php | 27 ++-- .../PhabricatorNotificationUIExample.php | 9 +- .../examples/PhabricatorPagerUIExample.php | 29 ++-- .../PhabricatorSetupIssueUIExample.php | 4 +- .../PhabricatorSortTableUIExample.php | 16 +- .../examples/PhabricatorStatusUIExample.php | 8 +- .../examples/PhabricatorTooltipUIExample.php | 6 +- .../PhabricatorTwoColumnUIExample.php | 4 +- .../examples/PhabricatorUIExample.php | 9 +- .../PhabricatorXHProfProfileTopLevelView.php | 20 +-- ...orCustomFieldDataNotAvailableException.php | 15 +- ...habricatorCustomFieldNotProxyException.php | 19 +-- .../field/PhabricatorCustomFieldList.php | 8 +- .../PhabricatorCustomFieldIndexStorage.php | 3 +- .../daemon/bot/PhabricatorBot.php | 8 +- .../adapter/PhabricatorIRCProtocolAdapter.php | 18 ++- .../PhabricatorStreamingProtocolAdapter.php | 6 +- .../handler/PhabricatorBotDebugLogHandler.php | 2 +- .../bot/handler/PhabricatorBotHandler.php | 2 +- .../handler/PhabricatorBotSymbolHandler.php | 7 +- .../handler/PhabricatorBotWhatsNewHandler.php | 2 +- .../workers/PhabricatorTaskmasterDaemon.php | 4 +- .../__tests__/PhabricatorTestWorker.php | 4 +- .../__tests__/PhabricatorWorkerTestCase.php | 19 ++- .../PhabricatorMetronomicTriggerClock.php | 3 +- .../clock/PhabricatorNeverTriggerClock.php | 3 +- ...ricatorWorkerTriggerManagementWorkflow.php | 2 +- .../query/PhabricatorWorkerLeaseQuery.php | 14 +- .../storage/PhabricatorWorkerActiveTask.php | 22 +-- .../storage/PhabricatorWorkerArchiveTask.php | 2 +- .../workers/storage/PhabricatorWorkerTask.php | 9 +- .../view/PHUIDiffInlineCommentUndoView.php | 2 +- .../edges/constants/PhabricatorEdgeConfig.php | 4 +- .../PhabricatorEdgeCycleException.php | 5 +- .../edges/query/PhabricatorEdgeQuery.php | 7 +- .../edges/type/PhabricatorEdgeType.php | 14 +- .../edges/util/PhabricatorEdgeGraph.php | 2 +- .../env/PhabricatorConfigFileSource.php | 5 +- .../env/PhabricatorConfigLocalSource.php | 3 +- .../env/PhabricatorConfigProxySource.php | 2 +- .../env/PhabricatorConfigSource.php | 6 +- .../env/PhabricatorConfigStackSource.php | 2 +- src/infrastructure/env/PhabricatorEnv.php | 14 +- .../env/__tests__/PhabricatorEnvTestCase.php | 11 +- .../events/PhabricatorEventEngine.php | 2 +- .../events/PhabricatorEventListener.php | 2 +- .../PhabricatorExampleEventListener.php | 2 +- .../PhabricatorBritishEnglishTranslation.php | 4 +- .../lint/linter/PhabricatorJavelinLinter.php | 56 ++++--- .../markup/PhabricatorMarkupEngine.php | 12 +- ...bricatorRemarkupCowsayBlockInterpreter.php | 4 +- .../query/order/PhabricatorQueryOrderItem.php | 3 +- .../policy/PhabricatorPolicyAwareQuery.php | 4 +- ...catorSMSManagementListOutboundWorkflow.php | 17 +-- ...abricatorSMSManagementSendTestWorkflow.php | 11 +- ...catorSMSManagementShowOutboundWorkflow.php | 13 +- .../PhabricatorSMSDemultiplexWorker.php | 3 +- .../sms/worker/PhabricatorSMSSendWorker.php | 8 +- .../ssh/PhabricatorSSHPassthruCommand.php | 15 +- ...rontIsolatedDatabaseConnectionTestCase.php | 8 +- .../__tests__/QueryFormattingTestCase.php | 2 +- src/infrastructure/storage/lisk/LiskDAO.php | 60 +++++--- .../storage/lisk/LiskDAOSet.php | 5 +- .../PhabricatorDataNotAttachedException.php | 24 +-- .../storage/lisk/PhabricatorLiskDAO.php | 2 +- .../lisk/__tests__/LiskFixtureTestCase.php | 2 +- .../lisk/__tests__/LiskIsolationTestCase.php | 30 ++-- .../lisk/__tests__/LiskIsolationTestDAO.php | 5 +- ...ricatorStorageManagementAdjustWorkflow.php | 10 +- ...atorStorageManagementDatabasesWorkflow.php | 2 +- ...icatorStorageManagementDestroyWorkflow.php | 29 ++-- ...abricatorStorageManagementDumpWorkflow.php | 7 +- ...bricatorStorageManagementProbeWorkflow.php | 2 +- ...torStorageManagementQuickstartWorkflow.php | 7 +- ...bricatorStorageManagementShellWorkflow.php | 2 +- ...ricatorStorageManagementStatusWorkflow.php | 19 +-- ...icatorStorageManagementUpgradeWorkflow.php | 63 +++++--- .../storage/patch/PhabricatorSQLPatchList.php | 88 +++++++---- .../testing/PhabricatorTestCase.php | 11 +- src/infrastructure/time/PhabricatorTime.php | 2 +- src/infrastructure/util/PhabricatorHash.php | 9 +- .../__tests__/PhabricatorHashTestCase.php | 4 +- .../__tests__/PhabricatorSlugTestCase.php | 6 +- .../PhabricatorLocalTimeTestCase.php | 10 +- src/view/form/PHUIFormPageView.php | 8 +- src/view/form/PHUIPagedFormView.php | 10 +- .../control/AphrontFormCheckboxControl.php | 2 +- src/view/form/control/AphrontFormControl.php | 4 +- .../form/control/AphrontFormDateControl.php | 2 +- .../control/AphrontFormPasswordControl.php | 10 +- .../control/PHUIFormMultiSubmitControl.php | 2 +- src/view/layout/AphrontMoreView.php | 2 +- src/view/layout/AphrontMultiColumnView.php | 2 +- src/view/layout/PhabricatorActionView.php | 6 +- src/view/page/PhabricatorStandardPageView.php | 3 +- src/view/phui/PHUIHeaderView.php | 2 +- src/view/phui/PHUIObjectItemView.php | 6 +- .../hovercard/PhabricatorHovercardView.php | 2 +- support/aphlict/server/aphlict_launcher.php | 2 +- webroot/index.php | 1 - 928 files changed, 5267 insertions(+), 4239 deletions(-) diff --git a/.arclint b/.arclint index 0077bdf518..e8b804fedb 100644 --- a/.arclint +++ b/.arclint @@ -74,7 +74,6 @@ "type": "xhpast", "include": "(\\.php$)", "severity": { - "16": "advice", "34": "error" }, "xhpast.blacklisted.function": { diff --git a/resources/sql/autopatches/20140106.macromailkey.2.php b/resources/sql/autopatches/20140106.macromailkey.2.php index fdca4e4d59..a91e5a2c20 100644 --- a/resources/sql/autopatches/20140106.macromailkey.2.php +++ b/resources/sql/autopatches/20140106.macromailkey.2.php @@ -1,6 +1,6 @@ establishConnection('w'); @@ -8,7 +8,7 @@ $iterator = new LiskMigrationIterator($table); foreach ($iterator as $macro) { $id = $macro->getID(); - echo "Populating macro {$id}...\n"; + echo pht('Populating macro %d...', $id)."\n"; if (!$macro->getMailKey()) { queryfx( @@ -20,4 +20,4 @@ foreach ($iterator as $macro) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140108.ddbpname.2.php b/resources/sql/autopatches/20140108.ddbpname.2.php index ca7e3ef8b2..3316f3df1d 100644 --- a/resources/sql/autopatches/20140108.ddbpname.2.php +++ b/resources/sql/autopatches/20140108.ddbpname.2.php @@ -1,6 +1,6 @@ establishConnection('w'); @@ -8,7 +8,7 @@ $iterator = new LiskMigrationIterator($table); foreach ($iterator as $blueprint) { $id = $blueprint->getID(); - echo "Populating blueprint {$id}...\n"; + echo pht('Populating blueprint %d...', $id)."\n"; if (!strlen($blueprint->getBlueprintName())) { queryfx( @@ -20,4 +20,4 @@ foreach ($iterator as $blueprint) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140113.legalpadsig.2.php b/resources/sql/autopatches/20140113.legalpadsig.2.php index 8b244e2480..6c7b0131b2 100644 --- a/resources/sql/autopatches/20140113.legalpadsig.2.php +++ b/resources/sql/autopatches/20140113.legalpadsig.2.php @@ -1,6 +1,6 @@ establishConnection('w'); @@ -8,7 +8,7 @@ $iterator = new LiskMigrationIterator($table); foreach ($iterator as $sig) { $id = $sig->getID(); - echo "Populating signature {$id}...\n"; + echo pht('Populating signature %d...', $id)."\n"; if (!$sig->getSecretKey()) { queryfx( @@ -20,4 +20,4 @@ foreach ($iterator as $sig) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140115.auth.3.unlimit.php b/resources/sql/autopatches/20140115.auth.3.unlimit.php index 80c316f64a..9e5bc7fed3 100644 --- a/resources/sql/autopatches/20140115.auth.3.unlimit.php +++ b/resources/sql/autopatches/20140115.auth.3.unlimit.php @@ -9,7 +9,7 @@ $conn_w = $session_table->establishConnection('w'); foreach (new LiskMigrationIterator($session_table) as $session) { $id = $session->getID(); - echo "Migrating session {$id}...\n"; + echo pht('Migrating session %d...', $id)."\n"; $old_type = $session->getType(); $new_type = preg_replace('/-.*$/', '', $old_type); @@ -23,4 +23,4 @@ foreach (new LiskMigrationIterator($session_table) as $session) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140205.cal.3.phid-mig.php b/resources/sql/autopatches/20140205.cal.3.phid-mig.php index 6ba4ff7c5c..7aff389d17 100644 --- a/resources/sql/autopatches/20140205.cal.3.phid-mig.php +++ b/resources/sql/autopatches/20140205.cal.3.phid-mig.php @@ -3,11 +3,11 @@ $table = new PhabricatorCalendarEvent(); $conn_w = $table->establishConnection('w'); -echo "Assigning PHIDs to events...\n"; +echo pht('Assigning PHIDs to events...')."\n"; foreach (new LiskMigrationIterator($table) as $event) { $id = $event->getID(); - echo "Updating event {$id}...\n"; + echo pht('Updating event %d...', $id)."\n"; if ($event->getPHID()) { continue; } @@ -19,4 +19,4 @@ foreach (new LiskMigrationIterator($table) as $event) { $table->generatePHID(), $id); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140210.herald.rule-condition-mig.php b/resources/sql/autopatches/20140210.herald.rule-condition-mig.php index c653fa9d50..90f8aa0b3e 100644 --- a/resources/sql/autopatches/20140210.herald.rule-condition-mig.php +++ b/resources/sql/autopatches/20140210.herald.rule-condition-mig.php @@ -3,7 +3,8 @@ $table = new HeraldCondition(); $conn_w = $table->establishConnection('w'); -echo "Migrating Herald conditions of type Herald rule from IDs to PHIDs...\n"; +echo pht( + "Migrating Herald conditions of type Herald rule from IDs to PHIDs...\n"); foreach (new LiskMigrationIterator($table) as $condition) { if ($condition->getFieldName() != HeraldAdapter::FIELD_RULE) { continue; @@ -14,7 +15,7 @@ foreach (new LiskMigrationIterator($table) as $condition) { continue; } $id = $condition->getID(); - echo "Updating condition {$id}...\n"; + echo pht('Updating condition %s...', $id)."\n"; $rule = id(new HeraldRuleQuery()) ->setViewer(PhabricatorUser::getOmnipotentUser()) @@ -28,4 +29,4 @@ foreach (new LiskMigrationIterator($table) as $condition) { json_encode($rule->getPHID()), $id); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140210.projcfield.1.blurb.php b/resources/sql/autopatches/20140210.projcfield.1.blurb.php index 3cb39c5dc1..90c4242e8d 100644 --- a/resources/sql/autopatches/20140210.projcfield.1.blurb.php +++ b/resources/sql/autopatches/20140210.projcfield.1.blurb.php @@ -5,10 +5,9 @@ $table_name = id(new PhabricatorProjectCustomFieldStorage())->getTableName(); $rows = new LiskRawMigrationIterator($conn_w, 'project_profile'); -echo "Migrating project descriptions to custom storage...\n"; +echo pht('Migrating project descriptions to custom storage...')."\n"; foreach ($rows as $row) { $phid = $row['projectPHID']; - echo "Migrating {$phid}...\n"; $desc = $row['blurb']; if (strlen($desc)) { @@ -23,4 +22,4 @@ foreach ($rows as $row) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140211.dx.2.migcommenttext.php b/resources/sql/autopatches/20140211.dx.2.migcommenttext.php index 8a76690ec5..705e858069 100644 --- a/resources/sql/autopatches/20140211.dx.2.migcommenttext.php +++ b/resources/sql/autopatches/20140211.dx.2.migcommenttext.php @@ -7,18 +7,18 @@ $content_source = PhabricatorContentSource::newForSource( PhabricatorContentSource::SOURCE_LEGACY, array())->serialize(); -echo "Migrating Differential comment text to modern storage...\n"; +echo pht('Migrating Differential comment text to modern storage...')."\n"; foreach ($rows as $row) { $id = $row['id']; - echo "Migrating Differential comment {$id}...\n"; + echo pht('Migrating Differential comment %d...', $id)."\n"; if (!strlen($row['content'])) { - echo "Comment has no text, continuing.\n"; + echo pht('Comment has no text, continuing.')."\n"; continue; } $revision = id(new DifferentialRevision())->load($row['revisionID']); if (!$revision) { - echo "Comment has no valid revision, continuing.\n"; + echo pht('Comment has no valid revision, continuing.')."\n"; continue; } @@ -68,4 +68,4 @@ foreach ($rows as $row) { $row['id']); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140212.dx.1.armageddon.php b/resources/sql/autopatches/20140212.dx.1.armageddon.php index 525bf78318..d2749bd5cf 100644 --- a/resources/sql/autopatches/20140212.dx.1.armageddon.php +++ b/resources/sql/autopatches/20140212.dx.1.armageddon.php @@ -7,14 +7,14 @@ $content_source = PhabricatorContentSource::newForSource( PhabricatorContentSource::SOURCE_LEGACY, array())->serialize(); -echo "Migrating Differential comments to modern storage...\n"; +echo pht('Migrating Differential comments to modern storage...')."\n"; foreach ($rows as $row) { $id = $row['id']; - echo "Migrating comment {$id}...\n"; + echo pht('Migrating comment %d...', $id)."\n"; $revision = id(new DifferentialRevision())->load($row['revisionID']); if (!$revision) { - echo "No revision, continuing.\n"; + echo pht('No revision, continuing.')."\n"; continue; } @@ -219,4 +219,4 @@ foreach ($rows as $row) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140218.passwords.4.vcs.php b/resources/sql/autopatches/20140218.passwords.4.vcs.php index 5e58c63e86..1030775326 100644 --- a/resources/sql/autopatches/20140218.passwords.4.vcs.php +++ b/resources/sql/autopatches/20140218.passwords.4.vcs.php @@ -3,13 +3,13 @@ $table = new PhabricatorRepositoryVCSPassword(); $conn_w = $table->establishConnection('w'); -echo "Upgrading password hashing for VCS passwords.\n"; +echo pht('Upgrading password hashing for VCS passwords.')."\n"; $best_hasher = PhabricatorPasswordHasher::getBestHasher(); foreach (new LiskMigrationIterator($table) as $password) { $id = $password->getID(); - echo "Migrating VCS password {$id}...\n"; + echo pht('Migrating VCS password %d...', $id)."\n"; $input_hash = $password->getPasswordHash(); $input_envelope = new PhutilOpaqueEnvelope($input_hash); @@ -24,4 +24,4 @@ foreach (new LiskMigrationIterator($table) as $password) { $id); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140226.dxcustom.1.fielddata.php b/resources/sql/autopatches/20140226.dxcustom.1.fielddata.php index aa1adf41be..9b1382f5b9 100644 --- a/resources/sql/autopatches/20140226.dxcustom.1.fielddata.php +++ b/resources/sql/autopatches/20140226.dxcustom.1.fielddata.php @@ -3,12 +3,12 @@ $conn_w = id(new DifferentialRevision())->establishConnection('w'); $rows = new LiskRawMigrationIterator($conn_w, 'differential_auxiliaryfield'); -echo "Modernizing Differential auxiliary field storage...\n"; +echo pht('Modernizing Differential auxiliary field storage...')."\n"; $table_name = id(new DifferentialCustomFieldStorage())->getTableName(); foreach ($rows as $row) { $id = $row['id']; - echo "Migrating row {$id}...\n"; + echo pht('Migrating row %d...', $id)."\n"; queryfx( $conn_w, 'INSERT IGNORE INTO %T (objectPHID, fieldIndex, fieldValue) @@ -19,4 +19,4 @@ foreach ($rows as $row) { $row['value']); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140321.mstatus.2.mig.php b/resources/sql/autopatches/20140321.mstatus.2.mig.php index 66c13844c3..7f91e00e1b 100644 --- a/resources/sql/autopatches/20140321.mstatus.2.mig.php +++ b/resources/sql/autopatches/20140321.mstatus.2.mig.php @@ -11,10 +11,10 @@ $status_map = array( $conn_w = id(new ManiphestTask())->establishConnection('w'); -echo "Migrating tasks to new status constants...\n"; +echo pht('Migrating tasks to new status constants...')."\n"; foreach (new LiskMigrationIterator(new ManiphestTask()) as $task) { $id = $task->getID(); - echo "Migrating T{$id}...\n"; + echo pht('Migrating %s...', "T{$id}")."\n"; $status = $task->getStatus(); if (isset($status_map[$status])) { @@ -27,13 +27,13 @@ foreach (new LiskMigrationIterator(new ManiphestTask()) as $task) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; -echo "Migrating task transactions to new status constants...\n"; +echo pht('Migrating task transactions to new status constants...')."\n"; foreach (new LiskMigrationIterator(new ManiphestTransaction()) as $xaction) { $id = $xaction->getID(); - echo "Migrating {$id}...\n"; + echo pht('Migrating %d...', $id)."\n"; if ($xaction->getTransactionType() == ManiphestTransaction::TYPE_STATUS) { $old = $xaction->getOldValue(); @@ -55,14 +55,14 @@ foreach (new LiskMigrationIterator(new ManiphestTransaction()) as $xaction) { $id); } } -echo "Done.\n"; +echo pht('Done.')."\n"; $conn_w = id(new PhabricatorSavedQuery())->establishConnection('w'); -echo "Migrating searches to new status constants...\n"; +echo pht('Migrating searches to new status constants...')."\n"; foreach (new LiskMigrationIterator(new PhabricatorSavedQuery()) as $query) { $id = $query->getID(); - echo "Migrating {$id}...\n"; + echo pht('Migrating %d...', $id)."\n"; if ($query->getEngineClassName() !== 'ManiphestTaskSearchEngine') { continue; @@ -91,4 +91,4 @@ foreach (new LiskMigrationIterator(new PhabricatorSavedQuery()) as $query) { } } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140323.harbor.1.renames.php b/resources/sql/autopatches/20140323.harbor.1.renames.php index 892402bf80..8aab25d876 100644 --- a/resources/sql/autopatches/20140323.harbor.1.renames.php +++ b/resources/sql/autopatches/20140323.harbor.1.renames.php @@ -14,14 +14,14 @@ $tables = array( id(new HarbormasterBuildTarget())->getTableName(), ); -echo "Renaming Harbormaster classes...\n"; +echo pht('Renaming Harbormaster classes...')."\n"; $conn_w = id(new HarbormasterBuildStep())->establishConnection('w'); foreach ($names as $name) { $old = $name; $new = 'Harbormaster'.$name; - echo "Renaming {$old} -> {$new}...\n"; + echo pht('Renaming %s -> %s...', $old, $new)."\n"; foreach ($tables as $table) { queryfx( $conn_w, @@ -32,4 +32,4 @@ foreach ($names as $name) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140325.push.3.groups.php b/resources/sql/autopatches/20140325.push.3.groups.php index b6a33ad4d8..8706da306a 100644 --- a/resources/sql/autopatches/20140325.push.3.groups.php +++ b/resources/sql/autopatches/20140325.push.3.groups.php @@ -2,7 +2,7 @@ $conn_w = id(new PhabricatorRepository())->establishConnection('w'); -echo "Adding transaction log event groups...\n"; +echo pht('Adding transaction log event groups...')."\n"; $logs = queryfx_all( $conn_w, @@ -10,7 +10,7 @@ $logs = queryfx_all( 'repository_pushlog'); foreach ($logs as $log) { $id = $log['id']; - echo "Migrating log {$id}...\n"; + echo pht('Migrating log %d...', $id)."\n"; if ($log['pushEventPHID']) { continue; } @@ -40,4 +40,4 @@ foreach ($logs as $log) { $log['transactionKey']); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140410.accountsecret.2.php b/resources/sql/autopatches/20140410.accountsecret.2.php index bd8fd3968a..7d0cf7ad88 100644 --- a/resources/sql/autopatches/20140410.accountsecret.2.php +++ b/resources/sql/autopatches/20140410.accountsecret.2.php @@ -1,12 +1,10 @@ getID(); - echo "Updating {$id}...\n"; + echo pht('Updating %d...', $id)."\n"; if (strlen($user->getAccountSecret())) { continue; @@ -20,4 +18,4 @@ foreach (new LiskMigrationIterator(new PhabricatorUser()) as $user) { $id); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140420.rel.2.objectmig.php b/resources/sql/autopatches/20140420.rel.2.objectmig.php index 6441f7c009..f54416a5b0 100644 --- a/resources/sql/autopatches/20140420.rel.2.objectmig.php +++ b/resources/sql/autopatches/20140420.rel.2.objectmig.php @@ -4,11 +4,11 @@ $pull_table = new ReleephRequest(); $table_name = $pull_table->getTableName(); $conn_w = $pull_table->establishConnection('w'); -echo "Setting object PHIDs for requests...\n"; +echo pht('Setting object PHIDs for requests...')."\n"; foreach (new LiskMigrationIterator($pull_table) as $pull) { $id = $pull->getID(); - echo "Migrating pull request {$id}...\n"; + echo pht('Migrating pull request %d...', $id)."\n"; if ($pull->getRequestedObjectPHID()) { // We already have a valid PHID, so skip this request. continue; @@ -42,4 +42,4 @@ foreach (new LiskMigrationIterator($pull_table) as $pull) { $id); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140521.projectslug.2.mig.php b/resources/sql/autopatches/20140521.projectslug.2.mig.php index ad086e10bc..ca6ccf886a 100644 --- a/resources/sql/autopatches/20140521.projectslug.2.mig.php +++ b/resources/sql/autopatches/20140521.projectslug.2.mig.php @@ -6,16 +6,16 @@ $conn_w = $project_table->establishConnection('w'); $slug_table_name = id(new PhabricatorProjectSlug())->getTableName(); $time = time(); -echo "Migrating project phriction slugs...\n"; +echo pht('Migrating project phriction slugs...')."\n"; foreach (new LiskMigrationIterator($project_table) as $project) { $id = $project->getID(); - echo "Migrating project {$id}...\n"; + echo pht('Migrating project %d...', $id)."\n"; $phriction_slug = rtrim($project->getPhrictionSlug(), '/'); $slug = id(new PhabricatorProjectSlug()) ->loadOneWhere('slug = %s', $phriction_slug); if ($slug) { - echo "Already migrated {$id}... Continuing.\n"; + echo pht('Already migrated %d... Continuing.', $id)."\n"; continue; } queryfx( @@ -27,7 +27,7 @@ foreach (new LiskMigrationIterator($project_table) as $project) { $phriction_slug, $time, $time); - echo "Migrated {$id}.\n"; + echo pht('Migrated %d.', $id)."\n"; } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140711.pnames.2.php b/resources/sql/autopatches/20140711.pnames.2.php index ee3658384f..16030b5853 100644 --- a/resources/sql/autopatches/20140711.pnames.2.php +++ b/resources/sql/autopatches/20140711.pnames.2.php @@ -1,11 +1,11 @@ getName(); - echo "Updating project '{$name}'...\n"; + echo pht("Updating project '%d'...", $name)."\n"; $project->updateDatasourceTokens(); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140722.appname.php b/resources/sql/autopatches/20140722.appname.php index fca11bb4b5..8c3e5918b2 100644 --- a/resources/sql/autopatches/20140722.appname.php +++ b/resources/sql/autopatches/20140722.appname.php @@ -74,7 +74,7 @@ foreach ($applications as $application) { /* -( User preferences )--------------------------------------------------- */ -echo "Migrating user preferences...\n"; +echo pht('Migrating user preferences...')."\n"; $table = new PhabricatorUserPreferences(); $conn_w = $table->establishConnection('w'); $pref_pinned = PhabricatorUserPreferences::PREFERENCE_APP_PINNED; @@ -107,7 +107,7 @@ foreach (new LiskMigrationIterator(new PhabricatorUser()) as $user) { /* -( Dashboard installs )------------------------------------------------- */ -echo "Migrating dashboard installs...\n"; +echo pht('Migrating dashboard installs...')."\n"; $table = new PhabricatorDashboardInstall(); $conn_w = $table->establishConnection('w'); @@ -126,7 +126,7 @@ foreach (new LiskMigrationIterator($table) as $dashboard_install) { /* -( Phabricator configuration )------------------------------------------ */ $config_key = 'phabricator.uninstalled-applications'; -echo "Migrating `{$config_key}` config...\n"; +echo pht('Migrating `%s` config...', $config_key)."\n"; $config = PhabricatorConfigEntry::loadConfigEntry($config_key); $old_config = $config->getValue(); @@ -147,7 +147,7 @@ if ($old_config) { /* -( phabricator.application-settings )----------------------------------- */ $config_key = 'phabricator.application-settings'; -echo "Migrating `{$config_key}` config...\n"; +echo pht('Migrating `%s` config...', $config_key)."\n"; $config = PhabricatorConfigEntry::loadConfigEntry($config_key); $old_config = $config->getValue(); diff --git a/resources/sql/autopatches/20140722.audit.3.miginlines.php b/resources/sql/autopatches/20140722.audit.3.miginlines.php index 30d9b1c797..c6778fa659 100644 --- a/resources/sql/autopatches/20140722.audit.3.miginlines.php +++ b/resources/sql/autopatches/20140722.audit.3.miginlines.php @@ -7,7 +7,7 @@ $conn_w->openTransaction(); $src_table = 'audit_inlinecomment'; $dst_table = 'audit_transaction_comment'; -echo "Migrating Audit inline comments to new format...\n"; +echo pht('Migrating Audit inline comments to new format...')."\n"; $content_source = PhabricatorContentSource::newForSource( PhabricatorContentSource::SOURCE_LEGACY, @@ -17,7 +17,7 @@ $rows = new LiskRawMigrationIterator($conn_w, $src_table); foreach ($rows as $row) { $id = $row['id']; - echo "Migrating inline #{$id}...\n"; + echo pht('Migrating inline #%d...', $id); if ($row['auditCommentID']) { $xaction_phid = PhabricatorPHID::generateNewPHID( @@ -74,4 +74,4 @@ foreach ($rows as $row) { } $conn_w->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140722.audit.4.migtext.php b/resources/sql/autopatches/20140722.audit.4.migtext.php index 1bcd3d36b8..2da4e2683e 100644 --- a/resources/sql/autopatches/20140722.audit.4.migtext.php +++ b/resources/sql/autopatches/20140722.audit.4.migtext.php @@ -7,12 +7,12 @@ $content_source = PhabricatorContentSource::newForSource( PhabricatorContentSource::SOURCE_LEGACY, array())->serialize(); -echo "Migrating Audit comment text to modern storage...\n"; +echo pht('Migrating Audit comment text to modern storage...')."\n"; foreach ($rows as $row) { $id = $row['id']; - echo "Migrating Audit comment {$id}...\n"; + echo pht('Migrating Audit comment %d...', $id)."\n"; if (!strlen($row['content'])) { - echo "Comment has no text, continuing.\n"; + echo pht('Comment has no text, continuing.')."\n"; continue; } @@ -58,4 +58,4 @@ foreach ($rows as $row) { $row['id']); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140722.renameauth.php b/resources/sql/autopatches/20140722.renameauth.php index 8a021c834d..225031d2f1 100644 --- a/resources/sql/autopatches/20140722.renameauth.php +++ b/resources/sql/autopatches/20140722.renameauth.php @@ -18,7 +18,7 @@ $map = array( 'PhabricatorAuthProviderOAuthWordPress' => 'PhabricatorWordPressAuthProvider', ); -echo "Migrating auth providers...\n"; +echo pht('Migrating auth providers...')."\n"; $table = new PhabricatorAuthProviderConfig(); $conn_w = $table->establishConnection('w'); diff --git a/resources/sql/autopatches/20140725.audit.1.migxactions.php b/resources/sql/autopatches/20140725.audit.1.migxactions.php index 064ac92202..e0e14e439b 100644 --- a/resources/sql/autopatches/20140725.audit.1.migxactions.php +++ b/resources/sql/autopatches/20140725.audit.1.migxactions.php @@ -7,10 +7,10 @@ $content_source = PhabricatorContentSource::newForSource( PhabricatorContentSource::SOURCE_LEGACY, array())->serialize(); -echo "Migrating Audit comments to modern storage...\n"; +echo pht('Migrating Audit comments to modern storage...')."\n"; foreach ($rows as $row) { $id = $row['id']; - echo "Migrating comment {$id}...\n"; + echo pht('Migrating comment %d...', $id)."\n"; $comments = queryfx_all( $conn_w, @@ -147,4 +147,4 @@ foreach ($rows as $row) { } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140731.audit.1.subscribers.php b/resources/sql/autopatches/20140731.audit.1.subscribers.php index c648ce3c00..b452275295 100644 --- a/resources/sql/autopatches/20140731.audit.1.subscribers.php +++ b/resources/sql/autopatches/20140731.audit.1.subscribers.php @@ -3,11 +3,11 @@ $table = new PhabricatorRepositoryAuditRequest(); $conn_w = $table->establishConnection('w'); -echo "Migrating Audit subscribers to subscriptions...\n"; +echo pht('Migrating Audit subscribers to subscriptions...')."\n"; foreach (new LiskMigrationIterator($table) as $request) { $id = $request->getID(); - echo "Migrating auditor {$id}...\n"; + echo pht("Migrating audit %d...\n", $id); if ($request->getAuditStatus() != 'cc') { // This isn't a "subscriber", so skip it. @@ -27,4 +27,4 @@ foreach (new LiskMigrationIterator($table) as $request) { $request->delete(); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140731.cancdn.php b/resources/sql/autopatches/20140731.cancdn.php index 7994d88abf..f4090b092c 100644 --- a/resources/sql/autopatches/20140731.cancdn.php +++ b/resources/sql/autopatches/20140731.cancdn.php @@ -4,7 +4,7 @@ $table = new PhabricatorFile(); $conn_w = $table->establishConnection('w'); foreach (new LiskMigrationIterator($table) as $file) { $id = $file->getID(); - echo "Updating flags for file {$id}...\n"; + echo pht('Updating flags for file %d...', $id)."\n"; $meta = $file->getMetadata(); if (!idx($meta, 'canCDN')) { diff --git a/resources/sql/autopatches/20140805.boardcol.2.php b/resources/sql/autopatches/20140805.boardcol.2.php index b8a78278d8..317de4e370 100644 --- a/resources/sql/autopatches/20140805.boardcol.2.php +++ b/resources/sql/autopatches/20140805.boardcol.2.php @@ -19,12 +19,12 @@ foreach ($rows as $row) { $sql = array(); foreach ($cols as $col_phid => $obj_phids) { - echo "Migrating column '{$col_phid}'...\n"; + echo pht("Migrating column '%s'...", $col_phid)."\n"; $column = id(new PhabricatorProjectColumn())->loadOneWhere( 'phid = %s', $col_phid); if (!$column) { - echo "Column '{$col_phid}' does not exist.\n"; + echo pht("Column '%s' does not exist.", $col_phid)."\n"; continue; } @@ -40,7 +40,7 @@ foreach ($cols as $col_phid => $obj_phids) { } } -echo "Inserting rows...\n"; +echo pht('Inserting rows...')."\n"; foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) { queryfx( $conn_w, @@ -50,4 +50,4 @@ foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) { $chunk); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140808.boardprop.3.php b/resources/sql/autopatches/20140808.boardprop.3.php index 116cc773a3..947ce85f60 100644 --- a/resources/sql/autopatches/20140808.boardprop.3.php +++ b/resources/sql/autopatches/20140808.boardprop.3.php @@ -6,7 +6,7 @@ $conn_w = $table->establishConnection('w'); foreach (new LiskMigrationIterator($table) as $column) { $id = $column->getID(); - echo "Adjusting column {$id}...\n"; + echo pht('Adjusting column %d...', $id)."\n"; if ($column->getSequence() == 0) { $properties = $column->getProperties(); @@ -21,4 +21,4 @@ foreach (new LiskMigrationIterator($table) as $column) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140815.cancdncase.php b/resources/sql/autopatches/20140815.cancdncase.php index 400fdbb01a..0e9cafaabd 100644 --- a/resources/sql/autopatches/20140815.cancdncase.php +++ b/resources/sql/autopatches/20140815.cancdncase.php @@ -7,7 +7,10 @@ $table = new PhabricatorFile(); $conn_w = $table->establishConnection('w'); foreach (new LiskMigrationIterator($table) as $file) { $id = $file->getID(); - echo "Updating capitalization of canCDN property for file {$id}...\n"; + echo pht( + "Updating capitalization of %s property for file %d...\n", + 'canCDN', + $id); $meta = $file->getMetadata(); if (isset($meta['cancdn'])) { diff --git a/resources/sql/autopatches/20140904.macroattach.php b/resources/sql/autopatches/20140904.macroattach.php index 5e82f3aa5f..4761964758 100644 --- a/resources/sql/autopatches/20140904.macroattach.php +++ b/resources/sql/autopatches/20140904.macroattach.php @@ -4,7 +4,7 @@ $table = new PhabricatorFileImageMacro(); foreach (new LiskMigrationIterator($table) as $macro) { $name = $macro->getName(); - echo "Linking macro '{$name}'...\n"; + echo pht("Linking macro '%s'...", $name)."\n"; $editor = new PhabricatorEdgeEditor(); @@ -16,11 +16,11 @@ foreach (new LiskMigrationIterator($table) as $macro) { foreach ($phids as $phid) { $editor->addEdge( $macro->getPHID(), - PhabricatorObjectHasFileEdgeType::EDGECONST , + PhabricatorObjectHasFileEdgeType::EDGECONST, $phid); } $editor->save(); } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140914.betaproto.php b/resources/sql/autopatches/20140914.betaproto.php index 4471d47fee..849c5acb3b 100644 --- a/resources/sql/autopatches/20140914.betaproto.php +++ b/resources/sql/autopatches/20140914.betaproto.php @@ -3,16 +3,16 @@ $old_key = 'phabricator.show-beta-applications'; $new_key = 'phabricator.show-prototypes'; -echo "Migrating '{$old_key}' to '{$new_key}'...\n"; +echo pht("Migrating '%s' to '%s'...", $old_key, $new_key)."\n"; if (PhabricatorEnv::getEnvConfig($new_key)) { - echo "Skipping migration, new data is already set.\n"; + echo pht('Skipping migration, new data is already set.')."\n"; return; } $old = PhabricatorEnv::getEnvConfigIfExists($old_key); if (!$old) { - echo "Skipping migration, old data does not exist.\n"; + echo pht('Skipping migration, old data does not exist.')."\n"; return; } @@ -21,4 +21,4 @@ PhabricatorConfigEntry::loadConfigEntry($new_key) ->setValue($old) ->save(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20141107.phriction.policy.2.php b/resources/sql/autopatches/20141107.phriction.policy.2.php index 9391173c6a..a7cc6ca3e4 100644 --- a/resources/sql/autopatches/20141107.phriction.policy.2.php +++ b/resources/sql/autopatches/20141107.phriction.policy.2.php @@ -3,7 +3,7 @@ $table = new PhrictionDocument(); $conn_w = $table->establishConnection('w'); -echo "Populating Phriction policies.\n"; +echo pht('Populating Phriction policies.')."\n"; $default_view_policy = PhabricatorPolicies::POLICY_USER; $default_edit_policy = PhabricatorPolicies::POLICY_USER; @@ -12,7 +12,7 @@ foreach (new LiskMigrationIterator($table) as $doc) { $id = $doc->getID(); if ($doc->getViewPolicy() && $doc->getEditPolicy()) { - echo "Skipping doc $id; already has policy set.\n"; + echo pht('Skipping document %d; already has policy set.', $id)."\n"; continue; } @@ -38,7 +38,10 @@ foreach (new LiskMigrationIterator($table) as $doc) { $edit_policy = nonempty($project->getEditPolicy(), $default_edit_policy); $project_name = $project->getName(); - echo "Migrating doc $id to project policy $project_name...\n"; + echo pht( + "Migrating document %d to project policy %s...\n", + $id, + $project_name); $doc->setViewPolicy($view_policy); $doc->setEditPolicy($edit_policy); $doc->save(); @@ -46,10 +49,10 @@ foreach (new LiskMigrationIterator($table) as $doc) { } } - echo "Migrating doc $id to default install policy...\n"; + echo pht('Migrating document %d to default install policy...', $id)."\n"; $doc->setViewPolicy($default_view_policy); $doc->setEditPolicy($default_edit_policy); $doc->save(); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20141107.phriction.popkeys.php b/resources/sql/autopatches/20141107.phriction.popkeys.php index 9af7e3a952..31629c7fea 100644 --- a/resources/sql/autopatches/20141107.phriction.popkeys.php +++ b/resources/sql/autopatches/20141107.phriction.popkeys.php @@ -3,7 +3,7 @@ $table = new PhrictionDocument(); $conn_w = $table->establishConnection('w'); -echo "Populating Phriction mailkeys.\n"; +echo pht('Populating Phriction mailkeys.')."\n"; foreach (new LiskMigrationIterator($table) as $doc) { $id = $doc->getID(); @@ -12,10 +12,10 @@ foreach (new LiskMigrationIterator($table) as $doc) { if ((strlen($key) == 20) && (strpos($key, "\0") === false)) { // To be valid, keys must have length 20 and not contain any null bytes. // See T6487. - echo "Document has valid mailkey.\n"; + echo pht('Document has valid mailkey.')."\n"; continue; } else { - echo "Populating mailkey for document {$id}...\n"; + echo pht('Populating mailkey for document %d...', $id)."\n"; $mail_key = Filesystem::readRandomCharacters(20); queryfx( $conn_w, @@ -26,4 +26,4 @@ foreach (new LiskMigrationIterator($table) as $doc) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20141107.ssh.4.keymig.php b/resources/sql/autopatches/20141107.ssh.4.keymig.php index 2388a282cc..f3e2d3f098 100644 --- a/resources/sql/autopatches/20141107.ssh.4.keymig.php +++ b/resources/sql/autopatches/20141107.ssh.4.keymig.php @@ -3,18 +3,18 @@ $table = new PhabricatorAuthSSHKey(); $conn_w = $table->establishConnection('w'); -echo "Updating SSH public key indexes...\n"; +echo pht('Updating SSH public key indexes...')."\n"; $keys = new LiskMigrationIterator($table); foreach ($keys as $key) { $id = $key->getID(); - echo "Updating key {$id}...\n"; + echo pht('Updating key %d...', $id)."\n"; try { $hash = $key->toPublicKey()->getHash(); } catch (Exception $ex) { - echo "Key has bad format! Removing key.\n"; + echo pht('Key has bad format! Removing key.')."\n"; queryfx( $conn_w, 'DELETE FROM %T WHERE id = %d', @@ -30,7 +30,7 @@ foreach ($keys as $key) { $hash, $key->getID()); if ($collision) { - echo "Key is a duplicate! Removing key.\n"; + echo pht('Key is a duplicate! Removing key.')."\n"; queryfx( $conn_w, 'DELETE FROM %T WHERE id = %d', @@ -47,4 +47,4 @@ foreach ($keys as $key) { $key->getID()); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20141113.auditdupes.php b/resources/sql/autopatches/20141113.auditdupes.php index 2cc7b9bab4..32a6586ca5 100644 --- a/resources/sql/autopatches/20141113.auditdupes.php +++ b/resources/sql/autopatches/20141113.auditdupes.php @@ -3,7 +3,7 @@ $table = new PhabricatorRepositoryAuditRequest(); $conn_w = $table->establishConnection('w'); -echo "Removing duplicate Audit requests...\n"; +echo pht('Removing duplicate Audit requests...')."\n"; $seen_audit_map = array(); foreach (new LiskMigrationIterator($table) as $request) { $commit_phid = $request->getCommitPHID(); @@ -19,4 +19,4 @@ foreach (new LiskMigrationIterator($table) as $request) { $seen_audit_map[$commit_phid][$auditor_phid] = 1; } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20141218.maniphestcctxn.php b/resources/sql/autopatches/20141218.maniphestcctxn.php index fb1a67a41d..4ac3c62101 100644 --- a/resources/sql/autopatches/20141218.maniphestcctxn.php +++ b/resources/sql/autopatches/20141218.maniphestcctxn.php @@ -3,8 +3,9 @@ $table = new ManiphestTransaction(); $conn_w = $table->establishConnection('w'); -echo "Converting Maniphest CC transactions to modern SUBSCRIBER ". - "transactions...\n"; +echo pht( + "Converting Maniphest CC transactions to modern ". + "subscriber transactions...\n"); foreach (new LiskMigrationIterator($table) as $txn) { // ManiphestTransaction::TYPE_CCS if ($txn->getTransactionType() == 'ccs') { @@ -17,4 +18,4 @@ foreach (new LiskMigrationIterator($table) as $txn) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20141222.maniphestprojtxn.php b/resources/sql/autopatches/20141222.maniphestprojtxn.php index 1fa5726fa4..ba7a8f2f1f 100644 --- a/resources/sql/autopatches/20141222.maniphestprojtxn.php +++ b/resources/sql/autopatches/20141222.maniphestprojtxn.php @@ -3,8 +3,8 @@ $table = new ManiphestTransaction(); $conn_w = $table->establishConnection('w'); -echo "Converting Maniphest project transactions to modern EDGE ". - "transactions...\n"; +echo pht( + "Converting Maniphest project transactions to modern edge transactions...\n"); $metadata = array( 'edge:type' => PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, ); @@ -31,7 +31,7 @@ foreach (new LiskMigrationIterator($table) as $txn) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; function mig20141222_build_edge_data(array $project_phids, $task_phid) { $edge_data = array(); diff --git a/resources/sql/autopatches/20150102.policyname.php b/resources/sql/autopatches/20150102.policyname.php index a76143527e..cf94b918e7 100644 --- a/resources/sql/autopatches/20150102.policyname.php +++ b/resources/sql/autopatches/20150102.policyname.php @@ -15,7 +15,7 @@ foreach ($policies as $policy) { $map[$old_name] = $new_name; } -echo "Migrating policies...\n"; +echo pht('Migrating policies...')."\n"; $table = new PhabricatorPolicy(); $conn_w = $table->establishConnection('w'); diff --git a/resources/sql/autopatches/20150116.maniphestapplicationemails.php b/resources/sql/autopatches/20150116.maniphestapplicationemails.php index c3e1f53eee..91430568ca 100644 --- a/resources/sql/autopatches/20150116.maniphestapplicationemails.php +++ b/resources/sql/autopatches/20150116.maniphestapplicationemails.php @@ -1,7 +1,7 @@ setApplicationPHID($maniphest->getPHID()) ->save(); } catch (AphrontDuplicateKeyQueryException $ex) { - // already migrated? + // Already migrated? } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20150120.maniphestdefaultauthor.php b/resources/sql/autopatches/20150120.maniphestdefaultauthor.php index ae064544f2..352dd4cbbd 100644 --- a/resources/sql/autopatches/20150120.maniphestdefaultauthor.php +++ b/resources/sql/autopatches/20150120.maniphestdefaultauthor.php @@ -1,7 +1,7 @@ setApplicationPHID($files_app->getPHID()) ->save(); } catch (AphrontDuplicateKeyQueryException $ex) { - // already migrated? + // Already migrated? } } @@ -31,8 +33,8 @@ if ($value_paste) { ->setApplicationPHID($paste_app->getPHID()) ->save(); } catch (AphrontDuplicateKeyQueryException $ex) { - // already migrated? + // Already migrated? } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20150501.calendar.2.reply.php b/resources/sql/autopatches/20150501.calendar.2.reply.php index 0b448e79cf..2dab8268a6 100644 --- a/resources/sql/autopatches/20150501.calendar.2.reply.php +++ b/resources/sql/autopatches/20150501.calendar.2.reply.php @@ -1,6 +1,6 @@ establishConnection('w'); @@ -8,7 +8,7 @@ $iterator = new LiskMigrationIterator($table); foreach ($iterator as $event) { $id = $event->getID(); - echo "Populating event {$id}...\n"; + echo pht('Populating event %d...', $id)."\n"; queryfx( $conn_w, @@ -18,4 +18,4 @@ foreach ($iterator as $event) { $id); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20150506.calendarunnamedevents.1.php b/resources/sql/autopatches/20150506.calendarunnamedevents.1.php index 0b8c029584..00512de9ed 100644 --- a/resources/sql/autopatches/20150506.calendarunnamedevents.1.php +++ b/resources/sql/autopatches/20150506.calendarunnamedevents.1.php @@ -1,6 +1,6 @@ establishConnection('w'); @@ -9,7 +9,7 @@ foreach ($iterator as $event) { $id = $event->getID(); if (strlen($event->getName()) == 0) { - echo "Renaming event {$id}...\n"; + echo pht('Renaming event %d...', $id)."\n"; $viewer = PhabricatorUser::getOmnipotentUser(); // NOTE: This uses PeopleQuery directly, instead of HandleQuery, to avoid @@ -35,4 +35,4 @@ foreach ($iterator as $event) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/059.engines.php b/resources/sql/patches/059.engines.php index 8c1c7bc8e3..96e28b7a31 100644 --- a/resources/sql/patches/059.engines.php +++ b/resources/sql/patches/059.engines.php @@ -15,17 +15,18 @@ if (!$tables) { return; } -echo "There are ".count($tables)." tables using the MyISAM engine. These will ". - "now be converted to InnoDB. This process may take a few minutes, please ". - "be patient.\n"; +echo pht( + "There are %d tables using the MyISAM engine. These will now be converted ". + "to InnoDB. This process may take a few minutes, please be patient.\n", + count($tables)); foreach ($tables as $table) { $name = $table['db'].'.'.$table['tbl']; - echo "Converting {$name}...\n"; + echo pht('Converting %s...', $name)."\n"; queryfx( $conn, 'ALTER TABLE %T.%T ENGINE=InnoDB', $table['db'], $table['tbl']); } -echo "Done!\n"; +echo pht('Done!')."\n"; diff --git a/resources/sql/patches/079.nametokenindex.php b/resources/sql/patches/079.nametokenindex.php index 931a850bf0..e0f607e0b7 100644 --- a/resources/sql/patches/079.nametokenindex.php +++ b/resources/sql/patches/079.nametokenindex.php @@ -1,13 +1,13 @@ openTransaction(); $table->beginReadLocking(); $users = $table->loadAll(); -echo count($users).' users to index'; +echo pht('%d users to index', count($users)); foreach ($users as $user) { $user->updateNameTokens(); echo '.'; @@ -15,4 +15,4 @@ foreach ($users as $user) { $table->endReadLocking(); $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/081.filekeys.php b/resources/sql/patches/081.filekeys.php index 1a4a3851fe..c129e80918 100644 --- a/resources/sql/patches/081.filekeys.php +++ b/resources/sql/patches/081.filekeys.php @@ -1,12 +1,12 @@ openTransaction(); $table->beginReadLocking(); $files = $table->loadAllWhere('secretKey IS NULL'); -echo count($files).' files to generate keys for'; +echo pht('%d files to generate keys for', count($files)); foreach ($files as $file) { queryfx( $file->establishConnection('w'), @@ -19,4 +19,4 @@ foreach ($files as $file) { $table->endReadLocking(); $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/090.forceuniqueprojectnames.php b/resources/sql/patches/090.forceuniqueprojectnames.php index c3881ad011..a12de8ecfd 100644 --- a/resources/sql/patches/090.forceuniqueprojectnames.php +++ b/resources/sql/patches/090.forceuniqueprojectnames.php @@ -1,6 +1,6 @@ openTransaction(); $table->beginReadLocking(); @@ -14,8 +14,8 @@ foreach ($projects as $project) { $slug = $project->getPhrictionSlug(); if ($slug == '/') { $project_id = $project->getID(); - echo "Project #{$project_id} doesn't have a meaningful name...\n"; - $project->setName(trim('Unnamed Project '.$project->getName())); + echo pht("Project #%d doesn't have a meaningful name...", $project_id)."\n"; + $project->setName(trim(pht('Unnamed Project %s', $project->getName()))); } $slug_map[$slug][] = $project->getID(); } @@ -25,15 +25,18 @@ foreach ($slug_map as $slug => $similar) { if (count($similar) <= 1) { continue; } - echo "Too many projects are similar to '{$slug}'...\n"; + echo pht("Too many projects are similar to '%s'...", $slug)."\n"; foreach (array_slice($similar, 1, null, true) as $key => $project_id) { $project = $projects[$project_id]; $old_name = $project->getName(); $new_name = rename_project($project, $projects); - echo "Renaming project #{$project_id} ". - "from '{$old_name}' to '{$new_name}'.\n"; + echo pht( + "Renaming project #%d from '%s' to '%s'.\n", + $project_id, + $old_name, + $new_name); $project->setName($new_name); } } @@ -47,7 +50,7 @@ while ($update) { $project->setPhrictionSlug($name); $slug = $project->getPhrictionSlug(); - echo "Updating project #{$id} '{$name}' ({$slug})..."; + echo pht("Updating project #%d '%s' (%s)... ", $id, $name, $slug); try { queryfx( $project->establishConnection('w'), @@ -57,22 +60,23 @@ while ($update) { $slug, $project->getID()); unset($update[$key]); - echo "okay.\n"; + echo pht('OKAY')."\n"; } catch (AphrontDuplicateKeyQueryException $ex) { - echo "failed, will retry.\n"; + echo pht('Failed, will retry.')."\n"; } } if (count($update) == $size) { throw new Exception( - 'Failed to make any progress while updating projects. Schema upgrade '. - 'has failed. Go manually fix your project names to be unique (they are '. - 'probably ridiculous?) and then try again.'); + pht( + 'Failed to make any progress while updating projects. Schema upgrade '. + 'has failed. Go manually fix your project names to be unique '. + '(they are probably ridiculous?) and then try again.')); } } $table->endReadLocking(); $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; /** diff --git a/resources/sql/patches/093.gitremotes.php b/resources/sql/patches/093.gitremotes.php index 7af320bf89..5817919e24 100644 --- a/resources/sql/patches/093.gitremotes.php +++ b/resources/sql/patches/093.gitremotes.php @@ -1,6 +1,6 @@ openTransaction(); @@ -30,8 +30,13 @@ foreach ($repos as $repo) { $id = $repo['id']; $name = $repo['name']; - echo "Updating default branch for repository #{$id} '{$name}' from ". - "'{$old}' to '{$new}' to remove the explicit remote.\n"; + echo pht( + "Updating default branch for repository #%d '%s' from ". + "'%s' to '%s' to remove the explicit remote.\n", + $id, + $name, + $old, + $new); queryfx( $conn_w, 'UPDATE %T SET details = %s WHERE id = %d', @@ -41,4 +46,4 @@ foreach ($repos as $repo) { } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/098.heraldruletypemigration.php b/resources/sql/patches/098.heraldruletypemigration.php index 0efc8c7e94..896f2353f3 100644 --- a/resources/sql/patches/098.heraldruletypemigration.php +++ b/resources/sql/patches/098.heraldruletypemigration.php @@ -1,6 +1,6 @@ openTransaction(); $table->beginReadLocking(); @@ -41,11 +41,11 @@ foreach ($rules as $rule) { $rule->getRuleType(), $rule->getID()); - echo "Setting rule '".$rule->getName()."' to personal. "; + echo pht("Setting rule '%s' to personal.", $rule->getName())."\n"; } } } $table->endReadLocking(); $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/102.heraldcleanup.php b/resources/sql/patches/102.heraldcleanup.php index 24bf382c09..5b885bd670 100644 --- a/resources/sql/patches/102.heraldcleanup.php +++ b/resources/sql/patches/102.heraldcleanup.php @@ -1,6 +1,6 @@ openTransaction(); $table->beginReadLocking(); @@ -24,7 +24,7 @@ if ($rules) { mpull($rules, 'getID')); } -echo 'This may take a moment'; +echo pht('This may take a moment')."\n"; do { queryfx( $conn_w, @@ -36,4 +36,4 @@ do { $table->endReadLocking(); $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/111.commitauditmigration.php b/resources/sql/patches/111.commitauditmigration.php index 489a07d789..935317b577 100644 --- a/resources/sql/patches/111.commitauditmigration.php +++ b/resources/sql/patches/111.commitauditmigration.php @@ -1,6 +1,6 @@ openTransaction(); @@ -31,10 +31,10 @@ foreach ($commits as $commit) { } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; -echo "Updating old commit mailKeys...\n"; +echo pht('Updating old commit %s...', 'mailKeys')."\n"; $table->openTransaction(); $commits = queryfx_all( @@ -55,4 +55,4 @@ foreach ($commits as $commit) { } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/131.migraterevisionquery.php b/resources/sql/patches/131.migraterevisionquery.php index cf505b6295..316c7cdee2 100644 --- a/resources/sql/patches/131.migraterevisionquery.php +++ b/resources/sql/patches/131.migraterevisionquery.php @@ -5,7 +5,7 @@ $table->openTransaction(); $table->beginReadLocking(); $conn_w = $table->establishConnection('w'); -echo 'Migrating revisions'; +echo pht('Migrating revisions')."\n"; do { $revisions = $table->loadAllWhere('branchName IS NULL LIMIT 1000'); @@ -32,4 +32,4 @@ do { $table->endReadLocking(); $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/20121209.xmacromigrate.php b/resources/sql/patches/20121209.xmacromigrate.php index df52cb317c..bdd9fc1276 100644 --- a/resources/sql/patches/20121209.xmacromigrate.php +++ b/resources/sql/patches/20121209.xmacromigrate.php @@ -1,6 +1,6 @@ openTransaction(); @@ -20,4 +20,4 @@ foreach (new LiskMigrationIterator($table) as $macro) { } $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/20130201.revisionunsubscribed.php b/resources/sql/patches/20130201.revisionunsubscribed.php index 0f01e1d129..904fe1cc86 100644 --- a/resources/sql/patches/20130201.revisionunsubscribed.php +++ b/resources/sql/patches/20130201.revisionunsubscribed.php @@ -1,6 +1,6 @@ openTransaction(); @@ -29,4 +29,4 @@ foreach ($revs as $rev) { } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130218.updatechannelid.php b/resources/sql/patches/20130218.updatechannelid.php index b8b6d8c416..cf60544a3b 100644 --- a/resources/sql/patches/20130218.updatechannelid.php +++ b/resources/sql/patches/20130218.updatechannelid.php @@ -1,6 +1,6 @@ endReadLocking(); $event_table->saveTransaction(); $channel_table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/20130219.commitsummarymig.php b/resources/sql/patches/20130219.commitsummarymig.php index 85ed6e34f4..60bdd1542c 100644 --- a/resources/sql/patches/20130219.commitsummarymig.php +++ b/resources/sql/patches/20130219.commitsummarymig.php @@ -1,12 +1,12 @@ establishConnection('w'); $commits = new LiskMigrationIterator($table); foreach ($commits as $commit) { - echo 'Filling Commit #'.$commit->getID()."\n"; + echo pht('Filling Commit #%d', $commit->getID())."\n"; if (strlen($commit->getSummary())) { continue; @@ -28,4 +28,4 @@ foreach ($commits as $commit) { $commit->getID()); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130403.conpherencecachemig.php b/resources/sql/patches/20130403.conpherencecachemig.php index ffc50006c0..cad9fc626d 100644 --- a/resources/sql/patches/20130403.conpherencecachemig.php +++ b/resources/sql/patches/20130403.conpherencecachemig.php @@ -1,6 +1,7 @@ openTransaction(); @@ -10,7 +11,7 @@ $participant_table = new ConpherenceParticipant(); $conpherences = new LiskMigrationIterator($table); foreach ($conpherences as $conpherence) { - echo 'Migrating conpherence #'.$conpherence->getID()."\n"; + echo pht('Migrating conpherence #%d', $conpherence->getID())."\n"; $participants = id(new ConpherenceParticipant()) ->loadAllWhere('conpherencePHID = %s', $conpherence->getPHID()); @@ -61,4 +62,4 @@ foreach ($conpherences as $conpherence) { } $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/20130409.commitdrev.php b/resources/sql/patches/20130409.commitdrev.php index d3a2faefbd..fb556f1846 100644 --- a/resources/sql/patches/20130409.commitdrev.php +++ b/resources/sql/patches/20130409.commitdrev.php @@ -1,6 +1,6 @@ save(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/20130502.countdownrevamp2.php b/resources/sql/patches/20130502.countdownrevamp2.php index 6f7e41e1d2..04d998dab9 100644 --- a/resources/sql/patches/20130502.countdownrevamp2.php +++ b/resources/sql/patches/20130502.countdownrevamp2.php @@ -1,6 +1,6 @@ openTransaction(); @@ -20,4 +20,4 @@ foreach (new LiskMigrationIterator($table) as $countdown) { } $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/20130507.releephrqmailkeypop.php b/resources/sql/patches/20130507.releephrqmailkeypop.php index 4acf3a5383..016381dc58 100644 --- a/resources/sql/patches/20130507.releephrqmailkeypop.php +++ b/resources/sql/patches/20130507.releephrqmailkeypop.php @@ -1,6 +1,6 @@ openTransaction(); @@ -17,11 +17,11 @@ foreach (new LiskMigrationIterator($table) as $rq) { $rq->getTableName(), Filesystem::readRandomCharacters(20), $id); - echo "Generated Key\n"; + echo pht('Generated Key')."\n"; } else { echo "-\n"; } } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130529.macroauthormig.php b/resources/sql/patches/20130529.macroauthormig.php index 89f10e29c8..f642f392c8 100644 --- a/resources/sql/patches/20130529.macroauthormig.php +++ b/resources/sql/patches/20130529.macroauthormig.php @@ -1,8 +1,8 @@ getID()."\n"; + echo pht('Macro #%d', $macro->getID())."\n"; if ($macro->getAuthorPHID()) { // Already have an author; skip it. @@ -36,4 +36,4 @@ foreach (new LiskMigrationIterator(new PhabricatorFileImageMacro()) as $macro) { $macro->getID()); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130611.migrateoauth.php b/resources/sql/patches/20130611.migrateoauth.php index 468ee78ff4..3622b2772e 100644 --- a/resources/sql/patches/20130611.migrateoauth.php +++ b/resources/sql/patches/20130611.migrateoauth.php @@ -9,7 +9,7 @@ $conn_w = $table->establishConnection('w'); $xaccount = new PhabricatorExternalAccount(); -echo "Migrating OAuth to ExternalAccount...\n"; +echo pht('Migrating OAuth to %s...', 'ExternalAccount')."\n"; $domain_map = array( 'disqus' => 'disqus.com', @@ -31,18 +31,18 @@ $rows = queryfx_all( $conn_w, 'SELECT * FROM user_oauthinfo'); foreach ($rows as $row) { - echo "Migrating row ID #".$row['id'].".\n"; + echo pht('Migrating row ID #%d.', $row['id'])."\n"; $user = id(new PhabricatorUser())->loadOneWhere( 'id = %d', $row['userID']); if (!$user) { - echo "Bad user ID!\n"; + echo pht('Bad user ID!')."\n"; continue; } $domain = idx($domain_map, $row['oauthProvider']); if (empty($domain)) { - echo "Unknown OAuth provider!\n"; + echo pht('Unknown OAuth provider!')."\n"; continue; } @@ -63,4 +63,4 @@ foreach ($rows as $row) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130611.nukeldap.php b/resources/sql/patches/20130611.nukeldap.php index ee97bb64ab..3f225cfa84 100644 --- a/resources/sql/patches/20130611.nukeldap.php +++ b/resources/sql/patches/20130611.nukeldap.php @@ -9,16 +9,16 @@ $conn_w = $table->establishConnection('w'); $xaccount = new PhabricatorExternalAccount(); -echo "Migrating LDAP to ExternalAccount...\n"; +echo pht('Migrating LDAP to %s...', 'ExternalAccount')."\n"; $rows = queryfx_all($conn_w, 'SELECT * FROM %T', $table_name); foreach ($rows as $row) { - echo "Migrating row ID #".$row['id'].".\n"; + echo pht('Migrating row ID #%d.', $row['id'])."\n"; $user = id(new PhabricatorUser())->loadOneWhere( 'id = %d', $row['userID']); if (!$user) { - echo "Bad user ID!\n"; + echo pht('Bad user ID!')."\n"; continue; } @@ -38,4 +38,4 @@ foreach ($rows as $row) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130619.authconf.php b/resources/sql/patches/20130619.authconf.php index 0b56735521..ab0378ee64 100644 --- a/resources/sql/patches/20130619.authconf.php +++ b/resources/sql/patches/20130619.authconf.php @@ -60,11 +60,11 @@ foreach ($config_map as $provider_class => $spec) { $enabled_default); if (!$enabled) { - echo pht("Skipping %s (not enabled).\n", $provider_class); + echo pht('Skipping %s (not enabled).', $provider_class)."\n"; // This provider was not previously enabled, so we can skip migrating it. continue; } else { - echo pht("Migrating %s...\n", $provider_class); + echo pht('Migrating %s...', $provider_class)."\n"; } $registration_key = idx($spec, 'registration'); @@ -161,4 +161,4 @@ foreach ($config_map as $provider_class => $spec) { $config->save(); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130703.legalpaddocdenorm.php b/resources/sql/patches/20130703.legalpaddocdenorm.php index 9cb6ef1979..61056ceb23 100644 --- a/resources/sql/patches/20130703.legalpaddocdenorm.php +++ b/resources/sql/patches/20130703.legalpaddocdenorm.php @@ -1,7 +1,9 @@ openTransaction(); @@ -9,14 +11,14 @@ foreach (new LiskMigrationIterator($table) as $document) { $updated = false; $id = $document->getID(); - echo "Document {$id}: "; + echo pht('Document %d: ', $id); if (!$document->getTitle()) { $document_body = id(new LegalpadDocumentBody()) ->loadOneWhere('phid = %s', $document->getDocumentBodyPHID()); $title = $document_body->getTitle(); $document->setTitle($title); $updated = true; - echo "Added title: $title\n"; + echo pht('Added title: %s', $title)."\n"; } else { echo "-\n"; } @@ -29,9 +31,9 @@ foreach (new LiskMigrationIterator($table) as $document) { $document->getPHID(), $type); $document->setRecentContributorPHIDs(array_slice($contributors, 0, 3)); - echo "Added recent contributor phids.\n"; + echo pht('Added recent contributor PHIDs.')."\n"; $document->setContributorCount(count($contributors)); - echo "Added contributor count.\n"; + echo pht('Added contributor count.')."\n"; } if (!$updated) { @@ -43,4 +45,4 @@ foreach (new LiskMigrationIterator($table) as $document) { } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130711.pholioimageobsolete.php b/resources/sql/patches/20130711.pholioimageobsolete.php index eae9a479d8..a0f805c69b 100644 --- a/resources/sql/patches/20130711.pholioimageobsolete.php +++ b/resources/sql/patches/20130711.pholioimageobsolete.php @@ -1,6 +1,6 @@ openTransaction(); @@ -20,4 +20,4 @@ foreach (new LiskMigrationIterator($table) as $image) { } $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/20130711.trimrealnames.php b/resources/sql/patches/20130711.trimrealnames.php index c422565b32..a5d2ef2c40 100644 --- a/resources/sql/patches/20130711.trimrealnames.php +++ b/resources/sql/patches/20130711.trimrealnames.php @@ -3,18 +3,18 @@ $table = new PhabricatorUser(); $conn_w = $table->establishConnection('w'); -echo "Trimming trailing whitespace from user real names...\n"; +echo pht('Trimming trailing whitespace from user real names...')."\n"; foreach (new LiskMigrationIterator($table) as $user) { $id = $user->getID(); $real = $user->getRealName(); $trim = rtrim($real); if ($trim == $real) { - echo "User {$id} is already trim.\n"; + echo pht('User %d is already trim.', $id)."\n"; continue; } - echo "Trimming user {$id} from '{$real}' to '{$trim}'.\n"; + echo pht("Trimming user %d from '%s' to '%s'.", $id, $real, $trim)."\n"; qsprintf( $conn_w, 'UPDATE %T SET realName = %s WHERE id = %d', @@ -23,4 +23,4 @@ foreach (new LiskMigrationIterator($table) as $user) { $id); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130715.votecomments.php b/resources/sql/patches/20130715.votecomments.php index c60b13bb37..0d540596b3 100644 --- a/resources/sql/patches/20130715.votecomments.php +++ b/resources/sql/patches/20130715.votecomments.php @@ -1,6 +1,6 @@ setViewer($viewer) ->withIDs(array($poll_id)) ->executeOne(); if (!$poll) { - echo "No poll.\n"; + echo pht('No poll.')."\n"; continue; } @@ -36,7 +36,7 @@ foreach ($comments as $comment) { ->withPHIDs(array($author_phid)) ->executeOne(); if (!$user) { - echo "No user.\n"; + echo pht('No user.')."\n"; continue; } @@ -98,4 +98,4 @@ foreach ($comments as $comment) { $conn_w->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130716.archivememberlessprojects.php b/resources/sql/patches/20130716.archivememberlessprojects.php index 259c564cec..bd5671cba3 100644 --- a/resources/sql/patches/20130716.archivememberlessprojects.php +++ b/resources/sql/patches/20130716.archivememberlessprojects.php @@ -1,18 +1,17 @@ openTransaction(); foreach (new LiskMigrationIterator($table) as $project) { - $members = PhabricatorEdgeQuery::loadDestinationPHIDs( $project->getPHID(), PhabricatorProjectProjectHasMemberEdgeType::EDGECONST); if (count($members)) { - echo sprintf( + echo pht( 'Project "%s" has %d members; skipping.', $project->getName(), count($members)), "\n"; @@ -20,13 +19,13 @@ foreach (new LiskMigrationIterator($table) as $project) { } if ($project->getStatus() == PhabricatorProjectStatus::STATUS_ARCHIVED) { - echo sprintf( + echo pht( 'Project "%s" already archived; skipping.', $project->getName()), "\n"; continue; } - echo sprintf('Archiving project "%s"...', $project->getName()), "\n"; + echo pht('Archiving project "%s"...', $project->getName())."\n"; queryfx( $table->establishConnection('w'), 'UPDATE %T SET status = %s WHERE id = %d', @@ -36,4 +35,4 @@ foreach (new LiskMigrationIterator($table) as $project) { } $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/20130728.ponderunique.php b/resources/sql/patches/20130728.ponderunique.php index 94a45ae786..2facd4e3f0 100644 --- a/resources/sql/patches/20130728.ponderunique.php +++ b/resources/sql/patches/20130728.ponderunique.php @@ -2,7 +2,7 @@ $map = array(); -echo "Merging duplicate answers by authors...\n"; +echo pht('Merging duplicate answers by authors...')."\n"; $atable = new PonderAnswer(); $conn_w = $atable->establishConnection('w'); @@ -14,14 +14,14 @@ foreach ($answers as $answer) { $qid = $answer->getQuestionID(); $author_phid = $answer->getAuthorPHID(); - echo "Processing answer ID #{$aid}...\n"; + echo pht('Processing answer ID #%d...', $aid)."\n"; if (empty($map[$qid][$author_phid])) { - echo "Answer is unique.\n"; + echo pht('Answer is unique.')."\n"; $map[$qid][$author_phid] = $answer; continue; } else { - echo "Merging answer.\n"; + echo pht('Merging answer.')."\n"; $target = $map[$qid][$author_phid]; queryfx( $conn_w, @@ -55,4 +55,4 @@ foreach ($answers as $answer) { } $conn_w->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130728.ponderxcomment.php b/resources/sql/patches/20130728.ponderxcomment.php index 1fb65ade76..92e858f95e 100644 --- a/resources/sql/patches/20130728.ponderxcomment.php +++ b/resources/sql/patches/20130728.ponderxcomment.php @@ -6,13 +6,13 @@ $atable = new PonderAnswerTransaction(); $conn_w = $qtable->establishConnection('w'); $conn_w->openTransaction(); -echo "Migrating Ponder comments to ApplicationTransactions...\n"; +echo pht('Migrating Ponder comments to %s...', 'ApplicationTransactions')."\n"; $rows = new LiskRawMigrationIterator($conn_w, 'ponder_comment'); foreach ($rows as $row) { $id = $row['id']; - echo "Migrating {$id}...\n"; + echo pht('Migrating %d...', $id)."\n"; $type = phid_get_type($row['targetPHID']); switch ($type) { @@ -83,4 +83,4 @@ foreach ($rows as $row) { $conn_w->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130801.pastexactions.php b/resources/sql/patches/20130801.pastexactions.php index 52d5a081da..1977eb984e 100644 --- a/resources/sql/patches/20130801.pastexactions.php +++ b/resources/sql/patches/20130801.pastexactions.php @@ -6,13 +6,13 @@ $x_table = new PhabricatorPasteTransaction(); $conn_w = $table->establishConnection('w'); $conn_w->openTransaction(); -echo "Adding transactions for existing paste objects...\n"; +echo pht('Adding transactions for existing paste objects...')."\n"; $rows = new LiskRawMigrationIterator($conn_w, 'pastebin_paste'); foreach ($rows as $row) { $id = $row['id']; - echo "Adding transactions for paste id {$id}...\n"; + echo pht('Adding transactions for paste id %d...', $id)."\n"; $xaction_phid = PhabricatorPHID::generateNewPHID( PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST); @@ -45,4 +45,4 @@ foreach ($rows as $row) { $conn_w->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130802.heraldphids.php b/resources/sql/patches/20130802.heraldphids.php index 814bbddef1..726a335d1f 100644 --- a/resources/sql/patches/20130802.heraldphids.php +++ b/resources/sql/patches/20130802.heraldphids.php @@ -3,11 +3,11 @@ $table = new HeraldRule(); $conn_w = $table->establishConnection('w'); -echo "Assigning PHIDs to Herald Rules...\n"; +echo pht('Assigning PHIDs to Herald Rules...')."\n"; foreach (new LiskMigrationIterator(new HeraldRule()) as $rule) { $id = $rule->getID(); - echo "Rule {$id}.\n"; + echo pht('Rule %d.', $id)."\n"; if ($rule->getPHID()) { continue; @@ -21,4 +21,4 @@ foreach (new LiskMigrationIterator(new HeraldRule()) as $rule) { $rule->getID()); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130805.pastemailkeypop.php b/resources/sql/patches/20130805.pastemailkeypop.php index 5354453b6d..bb2d51ded5 100644 --- a/resources/sql/patches/20130805.pastemailkeypop.php +++ b/resources/sql/patches/20130805.pastemailkeypop.php @@ -1,6 +1,6 @@ openTransaction(); @@ -17,11 +17,11 @@ foreach (new LiskMigrationIterator($table) as $paste) { $paste->getTableName(), Filesystem::readRandomCharacters(20), $id); - echo "Generated Key\n"; + echo pht('Generated Key')."\n"; } else { echo "-\n"; } } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130820.file-mailkey-populate.php b/resources/sql/patches/20130820.file-mailkey-populate.php index de1a920d97..ba4d6d1606 100644 --- a/resources/sql/patches/20130820.file-mailkey-populate.php +++ b/resources/sql/patches/20130820.file-mailkey-populate.php @@ -1,6 +1,6 @@ getTableName(); @@ -35,4 +35,4 @@ if ($sql) { } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130915.maniphestmigrate.php b/resources/sql/patches/20130915.maniphestmigrate.php index a9013662e3..c1c4bcaf5d 100644 --- a/resources/sql/patches/20130915.maniphestmigrate.php +++ b/resources/sql/patches/20130915.maniphestmigrate.php @@ -5,12 +5,12 @@ $table_name = id(new ManiphestCustomFieldStorage())->getTableName(); $rows = new LiskRawMigrationIterator($conn_w, 'maniphest_taskauxiliarystorage'); -echo "Migrating custom storage for Maniphest fields...\n"; +echo pht('Migrating custom storage for Maniphest fields...')."\n"; foreach ($rows as $row) { $phid = $row['taskPHID']; $name = $row['name']; - echo "Migrating {$phid} / {$name}...\n"; + echo pht('Migrating %s / %s...', $phid, $name)."\n"; queryfx( $conn_w, @@ -22,4 +22,4 @@ foreach ($rows as $row) { $row['value']); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130919.mfieldconf.php b/resources/sql/patches/20130919.mfieldconf.php index 099e7c0813..c79521acbc 100644 --- a/resources/sql/patches/20130919.mfieldconf.php +++ b/resources/sql/patches/20130919.mfieldconf.php @@ -1,18 +1,18 @@ setValue($new) ->save(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130921.xmigratemaniphest.php b/resources/sql/patches/20130921.xmigratemaniphest.php index 24614867f8..2f7f5952ce 100644 --- a/resources/sql/patches/20130921.xmigratemaniphest.php +++ b/resources/sql/patches/20130921.xmigratemaniphest.php @@ -14,7 +14,7 @@ foreach ($rows as $row) { $row_id = $row['id']; $task_id = $row['taskID']; - echo "Migrating row {$row_id} (T{$task_id})...\n"; + echo pht('Migrating row %d (%s)...', $row_id, "T{$task_id}")."\n"; $task_row = queryfx_one( $conn_w, @@ -22,7 +22,7 @@ foreach ($rows as $row) { $task_table->getTableName(), $task_id); if (!$task_row) { - echo "Skipping, no such task.\n"; + echo pht('Skipping, no such task.')."\n"; continue; } @@ -145,4 +145,4 @@ foreach ($rows as $row) { } $conn_w->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130926.dinline.php b/resources/sql/patches/20130926.dinline.php index 36632d9103..f2d9e9f205 100644 --- a/resources/sql/patches/20130926.dinline.php +++ b/resources/sql/patches/20130926.dinline.php @@ -7,7 +7,7 @@ $conn_w->openTransaction(); $src_table = 'differential_inlinecomment'; $dst_table = 'differential_transaction_comment'; -echo "Migrating Differential inline comments to new format...\n"; +echo pht('Migrating Differential inline comments to new format...')."\n"; $content_source = PhabricatorContentSource::newForSource( PhabricatorContentSource::SOURCE_LEGACY, @@ -19,7 +19,7 @@ foreach ($rows as $row) { $revision_id = $row['revisionID']; - echo "Migrating inline #{$id} (D{$revision_id})...\n"; + echo pht('Migrating inline #%d (%s)...', $id, "D{$revision_id}")."\n"; $revision_row = queryfx_one( $conn_w, @@ -87,4 +87,4 @@ foreach ($rows as $row) { } $conn_w->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20131004.dxreviewers.php b/resources/sql/patches/20131004.dxreviewers.php index b117048a1e..4f853f5ddc 100644 --- a/resources/sql/patches/20131004.dxreviewers.php +++ b/resources/sql/patches/20131004.dxreviewers.php @@ -10,7 +10,7 @@ foreach (new LiskMigrationIterator($table) as $revision) { $revision_id = $revision->getID(); $revision_phid = $revision->getPHID(); - echo "Migrating reviewers for D{$revision_id}...\n"; + echo pht('Migrating reviewers for %s...', "D{$revision_id}")."\n"; $reviewer_phids = queryfx_all( $conn_w, @@ -48,4 +48,4 @@ foreach (new LiskMigrationIterator($table) as $revision) { $editor->save(); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20131020.pxactionmig.php b/resources/sql/patches/20131020.pxactionmig.php index eb7c706e1f..7bf4416cd0 100644 --- a/resources/sql/patches/20131020.pxactionmig.php +++ b/resources/sql/patches/20131020.pxactionmig.php @@ -7,7 +7,7 @@ $conn_w->openTransaction(); $src_table = 'project_legacytransaction'; $dst_table = 'project_transaction'; -echo "Migrating Project transactions to new format...\n"; +echo pht('Migrating Project transactions to new format...')."\n"; $content_source = PhabricatorContentSource::newForSource( PhabricatorContentSource::SOURCE_LEGACY, @@ -19,7 +19,7 @@ foreach ($rows as $row) { $project_id = $row['projectID']; - echo "Migrating transaction #{$id} (Project {$project_id})...\n"; + echo pht('Migrating transaction #%d (Project %d)...', $id, $project_id)."\n"; $project_row = queryfx_one( $conn_w, @@ -89,4 +89,4 @@ foreach ($rows as $row) { } $conn_w->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20131106.diffphid.2.mig.php b/resources/sql/patches/20131106.diffphid.2.mig.php index b7f502f47a..67fd14aad0 100644 --- a/resources/sql/patches/20131106.diffphid.2.mig.php +++ b/resources/sql/patches/20131106.diffphid.2.mig.php @@ -13,7 +13,7 @@ foreach ($chunk_iter as $chunk) { foreach ($chunk as $diff) { $id = $diff->getID(); - echo "Migrating diff ID {$id}...\n"; + echo pht('Migrating diff ID %d...', $id)."\n"; $phid = $diff->getPHID(); if (strlen($phid)) { @@ -44,4 +44,4 @@ foreach ($chunk_iter as $chunk) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20131112.userverified.2.mig.php b/resources/sql/patches/20131112.userverified.2.mig.php index 381fc966ab..a8c231ec20 100644 --- a/resources/sql/patches/20131112.userverified.2.mig.php +++ b/resources/sql/patches/20131112.userverified.2.mig.php @@ -5,7 +5,7 @@ $conn_w = $table->establishConnection('w'); foreach (new LiskMigrationIterator($table) as $user) { $username = $user->getUsername(); - echo "Migrating {$username}...\n"; + echo pht('Migrating %s...', $username)."\n"; if ($user->getIsEmailVerified()) { // Email already verified. continue; @@ -30,4 +30,4 @@ foreach (new LiskMigrationIterator($table) as $user) { $user->getID()); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20131118.ownerorder.php b/resources/sql/patches/20131118.ownerorder.php index 35433f8e12..a3a5659946 100644 --- a/resources/sql/patches/20131118.ownerorder.php +++ b/resources/sql/patches/20131118.ownerorder.php @@ -9,7 +9,7 @@ $user_conn = $user_table->establishConnection('r'); foreach (new LiskMigrationIterator($table) as $task) { $id = $task->getID(); - echo "Checking task T{$id}...\n"; + echo pht('Checking task %s...', "T{$id}")."\n"; $owner_phid = $task->getOwnerPHID(); if (!$owner_phid && !$task->getOwnerOrdering()) { @@ -39,4 +39,4 @@ foreach (new LiskMigrationIterator($table) as $task) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20131121.repocredentials.2.mig.php b/resources/sql/patches/20131121.repocredentials.2.mig.php index acb7f2f01d..3953b8416f 100644 --- a/resources/sql/patches/20131121.repocredentials.2.mig.php +++ b/resources/sql/patches/20131121.repocredentials.2.mig.php @@ -7,16 +7,16 @@ $viewer = PhabricatorUser::getOmnipotentUser(); $map = array(); foreach (new LiskMigrationIterator($table) as $repository) { $callsign = $repository->getCallsign(); - echo "Examining repository {$callsign}...\n"; + echo pht('Examining repository %s...', $callsign)."\n"; if ($repository->getCredentialPHID()) { - echo "...already has a Credential.\n"; + echo pht('...already has a Credential.')."\n"; continue; } $raw_uri = $repository->getRemoteURI(); if (!$raw_uri) { - echo "...no remote URI.\n"; + echo pht('...no remote URI.')."\n"; continue; } @@ -50,12 +50,12 @@ foreach (new LiskMigrationIterator($table) as $repository) { } if (!$username || !$secret) { - echo "...no credentials set.\n"; + echo pht('...no credentials set.')."\n"; continue; } $map[$type][$username][$secret][] = $repository; - echo "...will migrate.\n"; + echo pht('...will migrate.')."\n"; } $passphrase = new PassphraseSecret(); @@ -76,7 +76,7 @@ foreach ($map as $credential_type => $credential_usernames) { ->setMaximumGlyphs(128) ->truncateString($signs)); - echo "Creating: {$name}...\n"; + echo pht('Creating: %s...', $name)."\n"; $secret = id(new PassphraseSecret()) ->setSecretData($secret_plaintext) @@ -136,4 +136,4 @@ foreach ($map as $credential_type => $credential_usernames) { $table->saveTransaction(); $passphrase->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20131205.buildstepordermig.php b/resources/sql/patches/20131205.buildstepordermig.php index b17724252a..2216fe50b4 100644 --- a/resources/sql/patches/20131205.buildstepordermig.php +++ b/resources/sql/patches/20131205.buildstepordermig.php @@ -9,7 +9,7 @@ $viewer = PhabricatorUser::getOmnipotentUser(); foreach (new LiskMigrationIterator($table) as $plan) { $planname = $plan->getName(); - echo "Migrating steps in {$planname}...\n"; + echo pht('Migrating steps in %s...', $planname)."\n"; $rows = queryfx_all( $conn_w, @@ -23,10 +23,10 @@ foreach (new LiskMigrationIterator($table) as $plan) { $id = $row['id']; $existing = $row['sequence']; if ($existing != 0) { - echo " - {$id} (already migrated)...\n"; + echo " - ".pht('%d (already migrated)...', $id)."\n"; continue; } - echo " - {$id} to position {$sequence}...\n"; + echo " - ".pht('%d to position %s...', $id, $sequence)."\n"; queryfx( $conn_w, 'UPDATE harbormaster_buildstep '. @@ -38,4 +38,4 @@ foreach (new LiskMigrationIterator($table) as $plan) { } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20131217.pushlogphid.2.mig.php b/resources/sql/patches/20131217.pushlogphid.2.mig.php index edda8d346d..5b253e2289 100644 --- a/resources/sql/patches/20131217.pushlogphid.2.mig.php +++ b/resources/sql/patches/20131217.pushlogphid.2.mig.php @@ -3,12 +3,12 @@ $table = new PhabricatorRepositoryPushLog(); $conn_w = $table->establishConnection('w'); -echo "Assigning PHIDs to push logs...\n"; +echo pht('Assigning PHIDs to push logs...')."\n"; $logs = new LiskMigrationIterator($table); foreach ($logs as $log) { $id = $log->getID(); - echo "Updating {$id}...\n"; + echo pht('Updating %s...', $id)."\n"; queryfx( $conn_w, 'UPDATE %T SET phid = %s WHERE id = %d', @@ -17,4 +17,4 @@ foreach ($logs as $log) { $id); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/emailtableport.php b/resources/sql/patches/emailtableport.php index ba46e70916..d70f3341ff 100644 --- a/resources/sql/patches/emailtableport.php +++ b/resources/sql/patches/emailtableport.php @@ -1,6 +1,6 @@ openTransaction(); @@ -19,7 +19,7 @@ foreach ($emails as $phid => $email) { // NOTE: Grandfather all existing email in as primary / verified. We generate // verification codes because they are used for password resets, etc. - echo "Migrating '{$phid}'...\n"; + echo pht("Migrating '%s'...", $phid)."\n"; queryfx( $conn, 'INSERT INTO %T (userPHID, address, verificationCode, isVerified, isPrimary) @@ -31,4 +31,4 @@ foreach ($emails as $phid => $email) { } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/legalpad-mailkey-populate.php b/resources/sql/patches/legalpad-mailkey-populate.php index e754ab2757..8aa2c593df 100644 --- a/resources/sql/patches/legalpad-mailkey-populate.php +++ b/resources/sql/patches/legalpad-mailkey-populate.php @@ -1,13 +1,13 @@ openTransaction(); foreach (new LiskMigrationIterator($table) as $document) { $id = $document->getID(); - echo "Document {$id}: "; + echo pht('Document %s: ', $id); if (!$document->getMailKey()) { queryfx( $document->establishConnection('w'), @@ -15,11 +15,11 @@ foreach (new LiskMigrationIterator($table) as $document) { $document->getTableName(), Filesystem::readRandomCharacters(20), $id); - echo "Generated Key\n"; + echo pht('Generated Key')."\n"; } else { echo "-\n"; } } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/liskcounters.php b/resources/sql/patches/liskcounters.php index 489747575f..198ed13742 100644 --- a/resources/sql/patches/liskcounters.php +++ b/resources/sql/patches/liskcounters.php @@ -1,6 +1,6 @@ openTransaction(); foreach (new LiskMigrationIterator($table) as $rev) { $id = $rev->getID(); - echo "Revision {$id}: "; + echo pht('Revision %d: ', $id); $deps = $rev->getAttachedPHIDs(DifferentialRevisionPHIDType::TYPECONST); if (!$deps) { @@ -22,8 +22,8 @@ foreach (new LiskMigrationIterator($table) as $rev) { $dep); } $editor->save(); - echo "OKAY\n"; + echo pht('OKAY')."\n"; } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/migrate-maniphest-dependencies.php b/resources/sql/patches/migrate-maniphest-dependencies.php index 394c98a95f..074018264c 100644 --- a/resources/sql/patches/migrate-maniphest-dependencies.php +++ b/resources/sql/patches/migrate-maniphest-dependencies.php @@ -1,12 +1,12 @@ openTransaction(); foreach (new LiskMigrationIterator($table) as $task) { $id = $task->getID(); - echo "Task {$id}: "; + echo pht('Task %d: ', $id); $deps = $task->getAttachedPHIDs(ManiphestTaskPHIDType::TYPECONST); if (!$deps) { @@ -22,8 +22,8 @@ foreach (new LiskMigrationIterator($table) as $task) { $dep); } $editor->save(); - echo "OKAY\n"; + echo pht('OKAY')."\n"; } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/migrate-maniphest-revisions.php b/resources/sql/patches/migrate-maniphest-revisions.php index 0658cfda69..2a8f8061b4 100644 --- a/resources/sql/patches/migrate-maniphest-revisions.php +++ b/resources/sql/patches/migrate-maniphest-revisions.php @@ -1,12 +1,12 @@ establishConnection('w'); foreach (new LiskMigrationIterator($table) as $task) { $id = $task->getID(); - echo "Task {$id}: "; + echo pht('Task %d: ', $id); $revs = $task->getAttachedPHIDs(DifferentialRevisionPHIDType::TYPECONST); if (!$revs) { @@ -22,7 +22,7 @@ foreach (new LiskMigrationIterator($table) as $task) { $rev); } $editor->save(); - echo "OKAY\n"; + echo pht('OKAY')."\n"; } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/migrate-project-edges.php b/resources/sql/patches/migrate-project-edges.php index 855b52b14b..277cf8b155 100644 --- a/resources/sql/patches/migrate-project-edges.php +++ b/resources/sql/patches/migrate-project-edges.php @@ -1,12 +1,12 @@ establishConnection('w'); foreach (new LiskMigrationIterator($table) as $proj) { $id = $proj->getID(); - echo "Project {$id}: "; + echo pht('Project %d: ', $id); $members = queryfx_all( $proj->establishConnection('w'), @@ -29,7 +29,7 @@ foreach (new LiskMigrationIterator($table) as $proj) { $user_phid); } $editor->save(); - echo "OKAY\n"; + echo pht('OKAY')."\n"; } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/ponder-mailkey-populate.php b/resources/sql/patches/ponder-mailkey-populate.php index bdae8f83a0..5d2c77fff4 100644 --- a/resources/sql/patches/ponder-mailkey-populate.php +++ b/resources/sql/patches/ponder-mailkey-populate.php @@ -1,13 +1,13 @@ openTransaction(); foreach (new LiskMigrationIterator($table) as $question) { $id = $question->getID(); - echo "Question {$id}: "; + echo pht('Question %d: ', $id); if (!$question->getMailKey()) { queryfx( $question->establishConnection('w'), @@ -15,11 +15,11 @@ foreach (new LiskMigrationIterator($table) as $question) { $question->getTableName(), Filesystem::readRandomCharacters(20), $id); - echo "Generated Key\n"; + echo pht('Generated Key')."\n"; } else { echo "-\n"; } } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/scripts/__init_script__.php b/scripts/__init_script__.php index c0a198a145..57ada96e64 100644 --- a/scripts/__init_script__.php +++ b/scripts/__init_script__.php @@ -11,7 +11,7 @@ function init_phabricator_script() { @include_once 'libphutil/scripts/__init_script__.php'; if (!@constant('__LIBPHUTIL__')) { echo "ERROR: Unable to load libphutil. Update your PHP 'include_path' to ". - "include the parent directory of libphutil/.\n"; + "include the parent directory of libphutil/.\n"; exit(1); } diff --git a/scripts/almanac/manage_almanac.php b/scripts/almanac/manage_almanac.php index e18b67d74a..933d1b7229 100755 --- a/scripts/almanac/manage_almanac.php +++ b/scripts/almanac/manage_almanac.php @@ -5,7 +5,7 @@ $root = dirname(dirname(dirname(__FILE__))); require_once $root.'/scripts/__init_script__.php'; $args = new PhutilArgumentParser($argv); -$args->setTagline('manage host directory'); +$args->setTagline(pht('manage host directory')); $args->setSynopsis(<<\n"; - echo "Purpose: Print controller which will process passed .\n"; + echo pht('Usage: %s', 'aphrontpath.php ')."\n"; + echo pht( + "Purpose: Print controller which will process passed %s.\n", + ''); exit(1); } diff --git a/scripts/cache/manage_cache.php b/scripts/cache/manage_cache.php index c50efca606..80e8e80819 100755 --- a/scripts/cache/manage_cache.php +++ b/scripts/cache/manage_cache.php @@ -5,7 +5,7 @@ $root = dirname(dirname(dirname(__FILE__))); require_once $root.'/scripts/__init_script__.php'; $args = new PhutilArgumentParser($argv); -$args->setTagline('manage cache'); +$args->setTagline(pht('manage cache')); $args->setSynopsis(<<setTagline('regenerate CSS sprite sheets'); +$args->setTagline(pht('regenerate CSS sprite sheets')); $args->setSynopsis(<<parse( array( array( 'name' => 'force', - 'help' => 'Force regeneration even if sources have not changed.', + 'help' => pht('Force regeneration even if sources have not changed.'), ), )); @@ -39,8 +39,10 @@ list($err) = exec_manual('optipng'); if ($err) { $have_optipng = false; echo phutil_console_format( - " WARNING `optipng` not found in PATH.\n". - "Sprites will not be optimized! Install `optipng`!\n"); + " %s %s\n%s\n", + pht('WARNING'), + pht('`%s` not found in PATH.', 'optipng'), + pht('Sprites will not be optimized! Install `%s`!', 'optipng')); } else { $have_optipng = true; } @@ -75,10 +77,10 @@ foreach ($sheets as $name => $sheet) { $sheet->generateImage($full_path, $scale); if ($have_optipng) { - echo "Optimizing...\n"; + echo pht('Optimizing...')."\n"; phutil_passthru('optipng -o7 -clobber %s', $full_path); } } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/scripts/daemon/manage_daemons.php b/scripts/daemon/manage_daemons.php index 2d4b58dbb2..087c925b81 100755 --- a/scripts/daemon/manage_daemons.php +++ b/scripts/daemon/manage_daemons.php @@ -7,7 +7,7 @@ require_once $root.'/scripts/__init_script__.php'; PhabricatorDaemonManagementWorkflow::requireExtensions(); $args = new PhutilArgumentParser($argv); -$args->setTagline('manage daemons'); +$args->setTagline(pht('manage daemons')); $args->setSynopsis(<<setTagline('documentation generator'); +$args->setTagline(pht('documentation generator')); $args->setSynopsis(<<setTagline('manage drydock software resources'); +$args->setTagline(pht('manage drydock software resources')); $args->setSynopsis(<<setTagline('manage fact configuration'); +$args->setTagline(pht('manage fact configuration')); $args->setSynopsis(<<setTagline('manage files'); +$args->setTagline(pht('manage files')); $args->setSynopsis(<<setTagline('manage lipsum'); +$args->setTagline(pht('manage lipsum')); $args->setSynopsis(<<processReceivedMail(); } catch (Exception $e) { $received - ->setMessage('EXCEPTION: '.$e->getMessage()) + ->setMessage(pht('EXCEPTION: %s', $e->getMessage())) ->save(); throw $e; diff --git a/scripts/mail/manage_mail.php b/scripts/mail/manage_mail.php index 9822565175..7f73303fdb 100755 --- a/scripts/mail/manage_mail.php +++ b/scripts/mail/manage_mail.php @@ -5,7 +5,7 @@ $root = dirname(dirname(dirname(__FILE__))); require_once $root.'/scripts/__init_script__.php'; $args = new PhutilArgumentParser($argv); -$args->setTagline('manage mail'); +$args->setTagline(pht('manage mail')); $args->setSynopsis(<<isGit() || $repository->isHg()) { $username = getenv(DiffusionCommitHookEngine::ENV_USER); if (!strlen($username)) { throw new Exception( - pht('usage: %s should be defined!', DiffusionCommitHookEngine::ENV_USER)); + pht( + 'Usage: %s should be defined!', + DiffusionCommitHookEngine::ENV_USER)); } if ($repository->isHg()) { diff --git a/scripts/repository/manage_repositories.php b/scripts/repository/manage_repositories.php index b3ebac0842..ae0395e663 100755 --- a/scripts/repository/manage_repositories.php +++ b/scripts/repository/manage_repositories.php @@ -5,7 +5,7 @@ $root = dirname(dirname(dirname(__FILE__))); require_once $root.'/scripts/__init_script__.php'; $args = new PhutilArgumentParser($argv); -$args->setTagline('manage repositories'); +$args->setTagline(pht('manage repositories')); $args->setSynopsis(<<setTagline('save lint errors to database') + ->setTagline(pht('save lint errors to database')) ->setSynopsis($synopsis) ->parseStandardArguments() ->parse(array( diff --git a/scripts/search/manage_search.php b/scripts/search/manage_search.php index b07ff54bad..4b119f28cc 100755 --- a/scripts/search/manage_search.php +++ b/scripts/search/manage_search.php @@ -5,7 +5,7 @@ $root = dirname(dirname(dirname(__FILE__))); require_once $root.'/scripts/__init_script__.php'; $args = new PhutilArgumentParser($argv); -$args->setTagline('manage search'); +$args->setTagline(pht('manage search')); $args->setSynopsis(<<setTagline('manage audits'); +$args->setTagline(pht('manage audits')); $args->setSynopsis(<<setTagline('manage authentication'); +$args->setTagline(pht('manage authentication')); $args->setSynopsis(<<setTagline('manage celerity'); +$args->setTagline(pht('manage celerity')); $args->setSynopsis(<<setTagline('manage configuration'); +$args->setTagline(pht('manage configuration')); $args->setSynopsis(<<setTagline('manage feed'); +$args->setTagline(pht('manage feed')); $args->setSynopsis(<<setTagline('manage Harbormaster'); +$args->setTagline(pht('manage Harbormaster')); $args->setSynopsis(<<setTagline('manage hunks'); +$args->setTagline(pht('manage hunks')); $args->setSynopsis(<<setTagline('manage internationalization'); +$args->setTagline(pht('manage internationalization')); $args->setSynopsis(<<setTagline('manage billing'); +$args->setTagline(pht('manage billing')); $args->setSynopsis(<<setTagline('manage policies'); +$args->setTagline(pht('manage policies')); $args->setSynopsis(<<setTagline('remove objects'); +$args->setTagline(pht('remove objects')); $args->setSynopsis(<<setTagline('manage triggers'); +$args->setTagline(pht('manage triggers')); $args->setSynopsis(<<setTagline('manage task queue'); +$args->setTagline(pht('manage task queue')); $args->setSynopsis(<<setTagline('manage SMS'); +$args->setTagline(pht('manage SMS')); $args->setSynopsis(<<setTagline('manage Phabricator storage and schemata'); +$args->setTagline(pht('manage Phabricator storage and schemata')); $args->setSynopsis(<< 'force', 'short' => 'f', - 'help' => 'Do not prompt before performing dangerous operations.', + 'help' => pht( + 'Do not prompt before performing dangerous operations.'), ), array( 'name' => 'user', 'short' => 'u', 'param' => 'username', 'default' => $default_user, - 'help' => "Connect with __username__ instead of the configured ". - "default ('{$default_user}').", + 'help' => pht( + "Connect with __username__ instead of the configured default ('%s').", + $default_user), ), array( 'name' => 'password', 'short' => 'p', 'param' => 'password', - 'help' => 'Use __password__ instead of the configured default.', + 'help' => pht('Use __password__ instead of the configured default.'), ), array( 'name' => 'namespace', 'param' => 'name', 'default' => $default_namespace, - 'help' => "Use namespace __namespace__ instead of the configured ". - "default ('{$default_namespace}'). This is an advanced ". - "feature used by unit tests; you should not normally ". - "use this flag.", + 'help' => pht( + "Use namespace __namespace__ instead of the configured ". + "default ('%s'). This is an advanced feature used by unit tests; ". + "you should not normally use this flag.", + $default_namespace), ), array( 'name' => 'dryrun', - 'help' => 'Do not actually change anything, just show what would be '. - 'changed.', + 'help' => pht( + 'Do not actually change anything, just show what would be changed.'), ), array( 'name' => 'disable-utf8mb4', @@ -93,23 +96,23 @@ try { 'SELECT 1'); } catch (AphrontQueryException $ex) { $message = phutil_console_format( + "**%s**\n\n%s\n\n%s\n\n%s\n\n**%s**: %s\n", + pht('MySQL Credentials Not Configured'), pht( - "**MySQL Credentials Not Configured**\n\n". - "Unable to connect to MySQL using the configured credentials. ". - "You must configure standard credentials before you can upgrade ". - "storage. Run these commands to set up credentials:\n". - "\n". - " phabricator/ $ ./bin/config set mysql.host __host__\n". - " phabricator/ $ ./bin/config set mysql.user __username__\n". - " phabricator/ $ ./bin/config set mysql.pass __password__\n". - "\n". - "These standard credentials are separate from any administrative ". - "credentials provided to this command with __--user__ or ". - "__--password__, and must be configured correctly before you can ". - "proceed.\n". - "\n". - "**Raw MySQL Error**: %s\n", - $ex->getMessage())); + 'Unable to connect to MySQL using the configured credentials. '. + 'You must configure standard credentials before you can upgrade '. + 'storage. Run these commands to set up credentials:'), + " phabricator/ $ ./bin/config set mysql.host __host__\n". + " phabricator/ $ ./bin/config set mysql.user __username__\n". + " phabricator/ $ ./bin/config set mysql.pass __password__", + pht( + 'These standard credentials are separate from any administrative '. + 'credentials provided to this command with __%s__ or '. + '__%s__, and must be configured correctly before you can proceed.', + '--user', + '--password'), + pht('Raw MySQL Error'), + $ex->getMessage()); echo phutil_console_wrap($message); @@ -141,14 +144,16 @@ try { 'SELECT 1'); } catch (AphrontQueryException $ex) { $message = phutil_console_format( + "**%s**\n\n%s\n\n**%s**: %s\n", + pht('Bad Administrative Credentials'), pht( - "**Bad Administrative Credentials**\n\n". - "Unable to connnect to MySQL using the administrative credentials ". - "provided with the __--user__ and __--password__ flags. Check that ". - "you have entered them correctly.\n". - "\n". - "**Raw MySQL Error**: %s\n", - $ex->getMessage())); + 'Unable to connect to MySQL using the administrative credentials '. + 'provided with the __%s__ and __%s__ flags. Check that '. + 'you have entered them correctly.', + '--user', + '--password'), + pht('Raw MySQL Error'), + $ex->getMessage()); echo phutil_console_wrap($message); diff --git a/scripts/ssh/ssh-exec.php b/scripts/ssh/ssh-exec.php index 93b808be92..0eb9b4a3ad 100755 --- a/scripts/ssh/ssh-exec.php +++ b/scripts/ssh/ssh-exec.php @@ -9,7 +9,7 @@ require_once $root.'/scripts/__init_script__.php'; $ssh_log = PhabricatorSSHLog::getLog(); $args = new PhutilArgumentParser($argv); -$args->setTagline('execute SSH requests'); +$args->setTagline(pht('execute SSH requests')); $args->setSynopsis(<<parse( 'help' => pht( 'Provide a command to execute. This makes testing this script '. 'easier. When running normally, the command is read from the '. - 'environment (SSH_ORIGINAL_COMMAND), which is populated by sshd.'), + 'environment (%s), which is populated by sshd.', + 'SSH_ORIGINAL_COMMAND'), ), )); @@ -84,9 +85,11 @@ try { if ($user_name && $device_name) { throw new Exception( pht( - 'The --phabricator-ssh-user and --phabricator-ssh-device flags are '. - 'mutually exclusive. You can not authenticate as both a user ("%s") '. - 'and a device ("%s"). Specify one or the other, but not both.', + 'The %s and %s flags are mutually exclusive. You can not '. + 'authenticate as both a user ("%s") and a device ("%s"). '. + 'Specify one or the other, but not both.', + '--phabricator-ssh-user', + '--phabricator-ssh-device', $user_name, $device_name)); } else if (strlen($user_name)) { @@ -104,9 +107,10 @@ try { if (!$remote_address) { throw new Exception( pht( - 'Unable to identify remote address from the SSH_CLIENT environment '. + 'Unable to identify remote address from the %s environment '. 'variable. Device authentication is accepted only from trusted '. - 'sources.')); + 'sources.', + 'SSH_CLIENT')); } if (!PhabricatorEnv::isClusterAddress($remote_address)) { @@ -134,8 +138,9 @@ try { } else { throw new Exception( pht( - 'This script must be invoked with either the --phabricator-ssh-user '. - 'or --phabricator-ssh-device flag.')); + 'This script must be invoked with either the %s or %s flag.', + '--phabricator-ssh-user', + '--phabricator-ssh-device')); } if ($args->getArg('ssh-command')) { @@ -199,10 +204,12 @@ try { "You haven't specified a command to run. This means you're requesting ". "an interactive shell, but Phabricator does not provide an ". "interactive shell over SSH.\n\n". - "Usually, you should run a command like `git clone` or `hg push` ". + "Usually, you should run a command like `%s` or `%s` ". "rather than connecting directly with SSH.\n\n". "Supported commands are: %s.", $user->getUsername(), + 'git clone', + 'hg push', implode(', ', $workflow_names))); } @@ -225,7 +232,7 @@ try { $parsed_args = new PhutilArgumentParser($parseable_argv); if (empty($workflow_names[$command])) { - throw new Exception('Invalid command.'); + throw new Exception(pht('Invalid command.')); } $workflow = $parsed_args->parseWorkflows($workflows); @@ -235,17 +242,17 @@ try { $sock_stdin = fopen('php://stdin', 'r'); if (!$sock_stdin) { - throw new Exception('Unable to open stdin.'); + throw new Exception(pht('Unable to open stdin.')); } $sock_stdout = fopen('php://stdout', 'w'); if (!$sock_stdout) { - throw new Exception('Unable to open stdout.'); + throw new Exception(pht('Unable to open stdout.')); } $sock_stderr = fopen('php://stderr', 'w'); if (!$sock_stderr) { - throw new Exception('Unable to open stderr.'); + throw new Exception(pht('Unable to open stderr.')); } $socket_channel = new PhutilSocketChannel( diff --git a/scripts/symbols/import_repository_symbols.php b/scripts/symbols/import_repository_symbols.php index 14a83dda0c..94cf601a34 100755 --- a/scripts/symbols/import_repository_symbols.php +++ b/scripts/symbols/import_repository_symbols.php @@ -170,11 +170,11 @@ foreach ($input as $key => $line) { $line_number = $matches['line']; $path = $matches['path']; - check_string_value($context, 'Symbol context', $line_no, 128); - check_string_value($name, 'Symbol name', $line_no, 128); - check_string_value($type, 'Symbol type', $line_no, 12); - check_string_value($lang, 'Symbol language', $line_no, 32); - check_string_value($path, 'Path', $line_no, 512); + check_string_value($context, pht('Symbol context'), $line_no, 128); + check_string_value($name, pht('Symbol name'), $line_no, 128); + check_string_value($type, pht('Symbol type'), $line_no, 12); + check_string_value($lang, pht('Symbol language'), $line_no, 32); + check_string_value($path, pht('Path'), $line_no, 512); if (!strlen($path) || $path[0] != '/') { throw new Exception( @@ -226,4 +226,4 @@ if (count($symbols)) { commit_symbols($symbols, $repository, $no_purge); } -echo pht('Done.'), "\n"; +echo pht('Done.')."\n"; diff --git a/scripts/user/account_admin.php b/scripts/user/account_admin.php index 3d18c16ac7..dc1cb50190 100755 --- a/scripts/user/account_admin.php +++ b/scripts/user/account_admin.php @@ -13,31 +13,32 @@ $is_first_user = (!$any_user); if ($is_first_user) { echo pht( - "WARNING\n\n". - "You're about to create the first account on this install. Normally, you ". - "should use the web interface to create the first account, not this ". - "script.\n\n". - "If you use the web interface, it will drop you into a nice UI workflow ". - "which gives you more help setting up your install. If you create an ". - "account with this script instead, you will skip the setup help and you ". - "will not be able to access it later."); + "WARNING\n\n". + "You're about to create the first account on this install. Normally, ". + "you should use the web interface to create the first account, not ". + "this script.\n\n". + "If you use the web interface, it will drop you into a nice UI workflow ". + "which gives you more help setting up your install. If you create an ". + "account with this script instead, you will skip the setup help and you ". + "will not be able to access it later."); if (!phutil_console_confirm(pht('Skip easy setup and create account?'))) { echo pht('Cancelled.')."\n"; exit(1); } } -echo 'Enter a username to create a new account or edit an existing account.'; +echo pht( + 'Enter a username to create a new account or edit an existing account.'); -$username = phutil_console_prompt('Enter a username:'); +$username = phutil_console_prompt(pht('Enter a username:')); if (!strlen($username)) { - echo "Cancelled.\n"; + echo pht('Cancelled.')."\n"; exit(1); } if (!PhabricatorUser::validateUsername($username)) { $valid = PhabricatorUser::describeValidUsername(); - echo "The username '{$username}' is invalid. {$valid}\n"; + echo pht("The username '%s' is invalid. %s", $username, $valid)."\n"; exit(1); } @@ -49,12 +50,12 @@ $user = id(new PhabricatorUser())->loadOneWhere( if (!$user) { $original = new PhabricatorUser(); - echo "There is no existing user account '{$username}'.\n"; + echo pht("There is no existing user account '%s'.", $username)."\n"; $ok = phutil_console_confirm( - "Do you want to create a new '{$username}' account?", + pht("Do you want to create a new '%s' account?", $username), $default_no = false); if (!$ok) { - echo "Cancelled.\n"; + echo pht('Cancelled.')."\n"; exit(1); } $user = new PhabricatorUser(); @@ -64,12 +65,12 @@ if (!$user) { } else { $original = clone $user; - echo "There is an existing user account '{$username}'.\n"; + echo pht("There is an existing user account '%s'.", $username)."\n"; $ok = phutil_console_confirm( - "Do you want to edit the existing '{$username}' account?", + pht("Do you want to edit the existing '%s' account?", $username), $default_no = false); if (!$ok) { - echo "Cancelled.\n"; + echo pht('Cancelled.')."\n"; exit(1); } @@ -78,12 +79,12 @@ if (!$user) { $user_realname = $user->getRealName(); if (strlen($user_realname)) { - $realname_prompt = ' ['.$user_realname.']'; + $realname_prompt = ' ['.$user_realname.']:'; } else { - $realname_prompt = ''; + $realname_prompt = ':'; } $realname = nonempty( - phutil_console_prompt("Enter user real name{$realname_prompt}:"), + phutil_console_prompt(pht('Enter user real name').$realname_prompt), $user_realname); $user->setRealName($realname); @@ -95,13 +96,14 @@ $user->setRealName($realname); $create_email = null; if ($is_new) { do { - $email = phutil_console_prompt('Enter user email address:'); + $email = phutil_console_prompt(pht('Enter user email address:')); $duplicate = id(new PhabricatorUserEmail())->loadOneWhere( 'address = %s', $email); if ($duplicate) { - echo "ERROR: There is already a user with that email address. ". - "Each user must have a unique email address.\n"; + echo pht( + "ERROR: There is already a user with that email address. ". + "Each user must have a unique email address.\n"); } else { break; } @@ -115,7 +117,7 @@ $changed_pass = false; // it. phutil_passthru('stty -echo'); $password = phutil_console_prompt( - 'Enter a password for this user [blank to leave unchanged]:'); + pht('Enter a password for this user [blank to leave unchanged]:')); phutil_passthru('stty echo'); if (strlen($password)) { $changed_pass = $password; @@ -123,7 +125,7 @@ if (strlen($password)) { $is_system_agent = $user->getIsSystemAgent(); $set_system_agent = phutil_console_confirm( - 'Is this user a bot/script?', + pht('Is this user a bot/script?'), $default_no = !$is_system_agent); $verify_email = null; @@ -135,56 +137,56 @@ if (!$is_new) { $verify_email = $user->loadPrimaryEmail(); if (!$verify_email->getIsVerified()) { $set_verified = phutil_console_confirm( - 'Should the primary email address be verified?', + pht('Should the primary email address be verified?'), $default_no = true); } else { - // already verified so let's not make a fuss + // Already verified so let's not make a fuss. $verify_email = null; } } $is_admin = $user->getIsAdmin(); $set_admin = phutil_console_confirm( - 'Should this user be an administrator?', + pht('Should this user be an administrator?'), $default_no = !$is_admin); -echo "\n\nACCOUNT SUMMARY\n\n"; +echo "\n\n".pht('ACCOUNT SUMMARY')."\n\n"; $tpl = "%12s %-30s %-30s\n"; -printf($tpl, null, 'OLD VALUE', 'NEW VALUE'); -printf($tpl, 'Username', $original->getUsername(), $user->getUsername()); -printf($tpl, 'Real Name', $original->getRealName(), $user->getRealName()); +printf($tpl, null, pht('OLD VALUE'), pht('NEW VALUE')); +printf($tpl, pht('Username'), $original->getUsername(), $user->getUsername()); +printf($tpl, pht('Real Name'), $original->getRealName(), $user->getRealName()); if ($is_new) { - printf($tpl, 'Email', '', $create_email); + printf($tpl, pht('Email'), '', $create_email); } -printf($tpl, 'Password', null, +printf($tpl, pht('Password'), null, ($changed_pass !== false) - ? 'Updated' - : 'Unchanged'); + ? pht('Updated') + : pht('Unchanged')); printf( $tpl, - 'Bot/Script', + pht('Bot/Script'), $original->getIsSystemAgent() ? 'Y' : 'N', $set_system_agent ? 'Y' : 'N'); if ($verify_email) { printf( $tpl, - 'Verify Email', + pht('Verify Email'), $verify_email->getIsVerified() ? 'Y' : 'N', $set_verified ? 'Y' : 'N'); } printf( $tpl, - 'Admin', + pht('Admin'), $original->getIsAdmin() ? 'Y' : 'N', $set_admin ? 'Y' : 'N'); echo "\n"; -if (!phutil_console_confirm('Save these changes?', $default_no = false)) { - echo "Cancelled.\n"; +if (!phutil_console_confirm(pht('Save these changes?'), $default_no = false)) { + echo pht('Cancelled.')."\n"; exit(1); } @@ -223,4 +225,4 @@ $user->openTransaction(); $user->saveTransaction(); -echo "Saved changes.\n"; +echo pht('Saved changes.')."\n"; diff --git a/scripts/user/add_user.php b/scripts/user/add_user.php index f2cdac396b..4c598e47e2 100755 --- a/scripts/user/add_user.php +++ b/scripts/user/add_user.php @@ -5,7 +5,9 @@ $root = dirname(dirname(dirname(__FILE__))); require_once $root.'/scripts/__init_script__.php'; if ($argc !== 5) { - echo "usage: add_user.php \n"; + echo pht( + "Usage: %s\n", + 'add_user.php '); exit(1); } @@ -19,8 +21,9 @@ $admin = id(new PhabricatorUser())->loadOneWhere( $argv[4]); if (!$admin) { throw new Exception( - 'Admin user must be the username of a valid Phabricator account, used '. - 'to send the new user a welcome email.'); + pht( + 'Admin user must be the username of a valid Phabricator account, used '. + 'to send the new user a welcome email.')); } $existing_user = id(new PhabricatorUser())->loadOneWhere( @@ -28,7 +31,9 @@ $existing_user = id(new PhabricatorUser())->loadOneWhere( $username); if ($existing_user) { throw new Exception( - "There is already a user with the username '{$username}'!"); + pht( + "There is already a user with the username '%s'!", + $username)); } $existing_email = id(new PhabricatorUserEmail())->loadOneWhere( @@ -36,7 +41,9 @@ $existing_email = id(new PhabricatorUserEmail())->loadOneWhere( $email); if ($existing_email) { throw new Exception( - "There is already a user with the email '{$email}'!"); + pht( + "There is already a user with the email '%s'!", + $email)); } $user = new PhabricatorUser(); @@ -54,4 +61,8 @@ id(new PhabricatorUserEditor()) $user->sendWelcomeEmail($admin); -echo "Created user '{$username}' (realname='{$realname}', email='{$email}').\n"; +echo pht( + "Created user '%s' (realname='%s', email='%s').\n", + $username, + $realname, + $email); diff --git a/scripts/util/add_macro.php b/scripts/util/add_macro.php index cbfe8480f6..03566cfb76 100755 --- a/scripts/util/add_macro.php +++ b/scripts/util/add_macro.php @@ -5,7 +5,7 @@ $root = dirname(dirname(dirname(__FILE__))); require_once $root.'/scripts/__init_script__.php'; $args = new PhutilArgumentParser($argv); -$args->setTagline('load files as image macros'); +$args->setTagline(pht('load files as image macros')); $args->setSynopsis(<<parse( array( 'name' => 'as', 'param' => 'name', - 'help' => 'Use a specific name instead of the first part of the image '. - 'name.', + 'help' => pht( + 'Use a specific name instead of the first part of the image name.'), ), array( 'name' => 'more', @@ -45,7 +45,7 @@ $existing = id(new PhabricatorFileImageMacro())->loadOneWhere( 'name = %s', $name); if ($existing) { - throw new Exception("A macro already exists with the name '{$name}'!"); + throw new Exception(pht("A macro already exists with the name '%s'!", $name)); } $file = PhabricatorFile::newFromFileData( @@ -62,4 +62,4 @@ $macro = id(new PhabricatorFileImageMacro()) $id = $file->getID(); -echo "Added macro '{$name}' (F{$id}).\n"; +echo pht("Added macro '%s' (%s).", $name, "F{$id}")."\n"; diff --git a/scripts/util/emit_test_event.php b/scripts/util/emit_test_event.php index 500e8390e4..c8502d0fe6 100755 --- a/scripts/util/emit_test_event.php +++ b/scripts/util/emit_test_event.php @@ -5,7 +5,7 @@ $root = dirname(dirname(dirname(__FILE__))); require_once $root.'/scripts/__init_script__.php'; $args = new PhutilArgumentParser($argv); -$args->setTagline('emit a test event'); +$args->setTagline(pht('emit a test event')); $args->setSynopsis(<<parse( $console = PhutilConsole::getConsole(); foreach ($args->getArg('listen') as $listener) { - $console->writeOut("Installing '%s'...\n", $listener); + $console->writeOut("%s\n", pht("Installing '%s'...", $listener)); newv($listener, array())->register(); } -$console->writeOut("Emitting event...\n"); +$console->writeOut("%s\n", pht('Emitting event...')); PhutilEventEngine::dispatchEvent( new PhabricatorEvent( @@ -37,5 +37,5 @@ PhutilEventEngine::dispatchEvent( 'time' => time(), ))); -$console->writeOut("Done.\n"); +$console->writeOut("%s\n", pht('Done.')); exit(0); diff --git a/src/__tests__/PhabricatorCelerityTestCase.php b/src/__tests__/PhabricatorCelerityTestCase.php index 957664f009..a91b214502 100644 --- a/src/__tests__/PhabricatorCelerityTestCase.php +++ b/src/__tests__/PhabricatorCelerityTestCase.php @@ -28,7 +28,8 @@ final class PhabricatorCelerityTestCase extends PhabricatorTestCase { $maps_are_identical, pht( 'When this test fails, it means the Celerity resource map is out '. - 'of date. Run `bin/celerity map` to rebuild it.')); + 'of date. Run `%s` to rebuild it.', + 'bin/celerity map')); } } diff --git a/src/__tests__/PhabricatorInfrastructureTestCase.php b/src/__tests__/PhabricatorInfrastructureTestCase.php index 896a506ed3..19d034eb34 100644 --- a/src/__tests__/PhabricatorInfrastructureTestCase.php +++ b/src/__tests__/PhabricatorInfrastructureTestCase.php @@ -15,7 +15,7 @@ final class PhabricatorInfrastructureTestCase extends PhabricatorTestCase { $this->assertEqual( count($all), count($installed), - 'In test cases, all applications should default to installed.'); + pht('In test cases, all applications should default to installed.')); } public function testRejectMySQLNonUTF8Queries() { diff --git a/src/aphront/AphrontRequest.php b/src/aphront/AphrontRequest.php index 4aa52c1fcb..f4a1ee2cff 100644 --- a/src/aphront/AphrontRequest.php +++ b/src/aphront/AphrontRequest.php @@ -249,21 +249,24 @@ final class AphrontRequest { // in developer mode. if (PhabricatorEnv::getEnvConfig('phabricator.developer-mode')) { // TODO: Clean this up, see T1921. - $more_info[] = - "To avoid this error, use phabricator_form() to construct forms. ". - "If you are already using phabricator_form(), make sure the form ". - "'action' uses a relative URI (i.e., begins with a '/'). Forms ". - "using absolute URIs do not include CSRF tokens, to prevent ". - "leaking tokens to external sites.\n\n". - "If this page performs writes which do not require CSRF ". - "protection (usually, filling caches or logging), you can use ". - "AphrontWriteGuard::beginScopedUnguardedWrites() to temporarily ". - "bypass CSRF protection while writing. You should use this only ". - "for writes which can not be protected with normal CSRF ". + $more_info[] = pht( + "To avoid this error, use %s to construct forms. If you are already ". + "using %s, make sure the form 'action' uses a relative URI (i.e., ". + "begins with a '%s'). Forms using absolute URIs do not include CSRF ". + "tokens, to prevent leaking tokens to external sites.\n\n". + "If this page performs writes which do not require CSRF protection ". + "(usually, filling caches or logging), you can use %s to ". + "temporarily bypass CSRF protection while writing. You should use ". + "this only for writes which can not be protected with normal CSRF ". "mechanisms.\n\n". - "Some UI elements (like PhabricatorActionListView) also have ". - "methods which will allow you to render links as forms (like ". - "setRenderAsForm(true))."; + "Some UI elements (like %s) also have methods which will allow you ". + "to render links as forms (like %s).", + 'phabricator_form()', + 'phabricator_form()', + '/', + 'AphrontWriteGuard::beginScopedUnguardedWrites()', + 'PhabricatorActionListView', + 'setRenderAsForm(true)'); } // This should only be able to happen if you load a form, pull your @@ -272,10 +275,10 @@ final class AphrontRequest { // is incredibly confusing otherwise. throw new AphrontCSRFException( pht( - "You are trying to save some data to Phabricator, but the request ". - "your browser made included an incorrect token. Reload the page ". - "and try again. You may need to clear your cookies.\n\n%s", - implode("\n", $more_info))); + 'You are trying to save some data to Phabricator, but the request '. + 'your browser made included an incorrect token. Reload the page '. + 'and try again. You may need to clear your cookies.')."\n\n". + implode("\n", $more_info)); } return true; diff --git a/src/aphront/__tests__/AphrontRequestTestCase.php b/src/aphront/__tests__/AphrontRequestTestCase.php index 151343ef0b..88fe97761f 100644 --- a/src/aphront/__tests__/AphrontRequestTestCase.php +++ b/src/aphront/__tests__/AphrontRequestTestCase.php @@ -75,7 +75,7 @@ final class AphrontRequestTestCase extends PhabricatorTestCase { $this->assertEqual( $expect, $r->getHost(), - 'Host: '.$input); + pht('Host: %s', $input)); } } diff --git a/src/aphront/configuration/AphrontApplicationConfiguration.php b/src/aphront/configuration/AphrontApplicationConfiguration.php index d828b9a8ce..a3821f18b5 100644 --- a/src/aphront/configuration/AphrontApplicationConfiguration.php +++ b/src/aphront/configuration/AphrontApplicationConfiguration.php @@ -328,13 +328,14 @@ abstract class AphrontApplicationConfiguration { // test) so it's fine that we don't have SERVER_ADDR defined. } else { throw new AphrontUsageException( - pht('No SERVER_ADDR'), + pht('No %s', 'SERVER_ADDR'), pht( 'Phabricator is configured to operate in cluster mode, but '. - 'SERVER_ADDR is not defined in the request context. Your '. - 'webserver configuration needs to forward SERVER_ADDR to '. - 'PHP so Phabricator can reject requests received on '. - 'external interfaces.')); + '%s is not defined in the request context. Your webserver '. + 'configuration needs to forward %s to PHP so Phabricator can '. + 'reject requests received on external interfaces.', + 'SERVER_ADDR', + 'SERVER_ADDR')); } } else { if (!PhabricatorEnv::isClusterAddress($server_addr)) { @@ -413,20 +414,23 @@ abstract class AphrontApplicationConfiguration { ->executeOne(); } catch (PhabricatorPolicyException $ex) { throw new Exception( - 'This blog is not visible to logged out users, so it can not be '. - 'visited from a custom domain.'); + pht( + 'This blog is not visible to logged out users, so it can not be '. + 'visited from a custom domain.')); } if (!$blog) { if ($prod_uri && $prod_uri != $base_uri) { - $prod_str = ' or '.$prod_uri; + $prod_str = pht('%s or %s', $base_uri, $prod_uri); } else { - $prod_str = ''; + $prod_str = $base_uri; } throw new Exception( - 'Specified domain '.$host.' is not configured for Phabricator '. - 'requests. Please use '.$base_uri.$prod_str.' to visit this instance.' - ); + pht( + 'Specified domain %s is not configured for Phabricator '. + 'requests. Please use %s to visit this instance.', + $host, + $prod_str)); } // TODO: Make this more flexible and modular so any application can diff --git a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php index 063ee365d6..3d5bfffd2d 100644 --- a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php +++ b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php @@ -229,11 +229,10 @@ class AphrontDefaultApplicationConfiguration $message = $ex->getMessage(); if ($ex instanceof AphrontSchemaQueryException) { - $message .= - "\n\n". + $message .= "\n\n".pht( "NOTE: This usually indicates that the MySQL schema has not been ". - "properly upgraded. Run 'bin/storage upgrade' to ensure your ". - "schema is up to date."; + "properly upgraded. Run '%s' to ensure your schema is up to date.", + 'bin/storage upgrade'); } if (PhabricatorEnv::getEnvConfig('phabricator.developer-mode')) { @@ -254,13 +253,13 @@ class AphrontDefaultApplicationConfiguration $dialog = new AphrontDialogView(); $dialog - ->setTitle('Unhandled Exception ("'.$class.'")') + ->setTitle(pht('Unhandled Exception ("%s")', $class)) ->setClass('aphront-exception-dialog') ->setUser($user) ->appendChild($content); if ($this->getRequest()->isAjax()) { - $dialog->addCancelButton('/', 'Close'); + $dialog->addCancelButton('/', pht('Close')); } $response = new AphrontDialogResponse(); diff --git a/src/aphront/response/Aphront404Response.php b/src/aphront/response/Aphront404Response.php index 85dec30555..1284cb62e6 100644 --- a/src/aphront/response/Aphront404Response.php +++ b/src/aphront/response/Aphront404Response.php @@ -14,12 +14,13 @@ final class Aphront404Response extends AphrontHTMLResponse { ->setUser($user) ->setTitle(pht('404 Not Found')) ->addCancelButton('/', pht('Focus')) - ->appendParagraph(pht( - 'Do not dwell in the past, do not dream of the future, '. - 'concentrate the mind on the present moment.')); + ->appendParagraph( + pht( + 'Do not dwell in the past, do not dream of the future, '. + 'concentrate the mind on the present moment.')); $view = id(new PhabricatorStandardPageView()) - ->setTitle('404 Not Found') + ->setTitle(pht('404 Not Found')) ->setRequest($request) ->setDeviceReady(true) ->appendChild($dialog); diff --git a/src/aphront/sink/AphrontHTTPSink.php b/src/aphront/sink/AphrontHTTPSink.php index 72bf4244f9..6ed2edff9c 100644 --- a/src/aphront/sink/AphrontHTTPSink.php +++ b/src/aphront/sink/AphrontHTTPSink.php @@ -25,7 +25,7 @@ abstract class AphrontHTTPSink { */ final public function writeHTTPStatus($code, $message = '') { if (!preg_match('/^\d{3}$/', $code)) { - throw new Exception("Malformed HTTP status code '{$code}'!"); + throw new Exception(pht("Malformed HTTP status code '%s'!", $code)); } $code = (int)$code; @@ -42,14 +42,15 @@ abstract class AphrontHTTPSink { final public function writeHeaders(array $headers) { foreach ($headers as $header) { if (!is_array($header) || count($header) !== 2) { - throw new Exception('Malformed header.'); + throw new Exception(pht('Malformed header.')); } list($name, $value) = $header; if (strpos($name, ':') !== false) { throw new Exception( - 'Declining to emit response with malformed HTTP header name: '. - $name); + pht( + 'Declining to emit response with malformed HTTP header name: %s', + $name)); } // Attackers may perform an "HTTP response splitting" attack by making @@ -64,8 +65,9 @@ abstract class AphrontHTTPSink { if (preg_match('/[\r\n\0]/', $name.$value)) { throw new Exception( - "Declining to emit response with unsafe HTTP header: ". - "<'".$name."', '".$value."'>."); + pht( + 'Declining to emit response with unsafe HTTP header: %s', + "<'".$name."', '".$value."'>.")); } } diff --git a/src/applications/almanac/controller/AlmanacConsoleController.php b/src/applications/almanac/controller/AlmanacConsoleController.php index 60fa4e010e..156bd14b78 100644 --- a/src/applications/almanac/controller/AlmanacConsoleController.php +++ b/src/applications/almanac/controller/AlmanacConsoleController.php @@ -18,27 +18,21 @@ final class AlmanacConsoleController extends AlmanacController { ->setHeader(pht('Services')) ->setHref($this->getApplicationURI('service/')) ->setFontIcon('fa-plug') - ->addAttribute( - pht( - 'Manage Almanac services.'))); + ->addAttribute(pht('Manage Almanac services.'))); $menu->addItem( id(new PHUIObjectItemView()) ->setHeader(pht('Devices')) ->setHref($this->getApplicationURI('device/')) ->setFontIcon('fa-server') - ->addAttribute( - pht( - 'Manage Almanac devices.'))); + ->addAttribute(pht('Manage Almanac devices.'))); $menu->addItem( id(new PHUIObjectItemView()) ->setHeader(pht('Networks')) ->setHref($this->getApplicationURI('network/')) ->setFontIcon('fa-globe') - ->addAttribute( - pht( - 'Manage Almanac networks.'))); + ->addAttribute(pht('Manage Almanac networks.'))); $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb(pht('Console')); diff --git a/src/applications/almanac/controller/AlmanacServiceEditController.php b/src/applications/almanac/controller/AlmanacServiceEditController.php index 13f31430e7..be3fe02009 100644 --- a/src/applications/almanac/controller/AlmanacServiceEditController.php +++ b/src/applications/almanac/controller/AlmanacServiceEditController.php @@ -250,8 +250,4 @@ final class AlmanacServiceEditController )); } - - - - } diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementStatusWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementStatusWorkflow.php index 145a5fcff2..85f80bfad4 100644 --- a/src/applications/aphlict/management/PhabricatorAphlictManagementStatusWorkflow.php +++ b/src/applications/aphlict/management/PhabricatorAphlictManagementStatusWorkflow.php @@ -15,11 +15,11 @@ final class PhabricatorAphlictManagementStatusWorkflow $pid = $this->getPID(); if (!$pid) { - $console->writeErr(pht("Aphlict is not running.\n")); + $console->writeErr("%s\n", pht('Aphlict is not running.')); return 1; } - $console->writeOut(pht("Aphlict (%s) is running.\n", $pid)); + $console->writeOut("%s\n", pht('Aphlict (%s) is running.', $pid)); return 0; } diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php index 1c8d855a86..d5d751363b 100644 --- a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php +++ b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php @@ -97,8 +97,10 @@ abstract class PhabricatorAphlictManagementWorkflow private static function mustHaveExtension($ext) { if (!extension_loaded($ext)) { - echo "ERROR: The PHP extension '{$ext}' is not installed. You must ". - "install it to run aphlict on this machine.\n"; + echo pht( + "ERROR: The PHP extension '%s' is not installed. You must ". + "install it to run Aphlict on this machine.", + $ext)."\n"; exit(1); } @@ -106,8 +108,10 @@ abstract class PhabricatorAphlictManagementWorkflow foreach ($extension->getFunctions() as $function) { $function = $function->name; if (!function_exists($function)) { - echo "ERROR: The PHP function {$function}() is disabled. You must ". - "enable it to run aphlict on this machine.\n"; + echo pht( + 'ERROR: The PHP function %s is disabled. You must '. + 'enable it to run Aphlict on this machine.', + $function.'()')."\n"; exit(1); } } @@ -121,7 +125,8 @@ abstract class PhabricatorAphlictManagementWorkflow throw new PhutilArgumentUsageException( pht( 'Unable to start notifications server because it is already '. - 'running. Use `aphlict restart` to restart it.')); + 'running. Use `%s` to restart it.', + 'aphlict restart')); } if (posix_getuid() == 0) { @@ -195,7 +200,9 @@ abstract class PhabricatorAphlictManagementWorkflow $console = PhutilConsole::getConsole(); if ($this->debug) { - $console->writeOut(pht("Starting Aphlict server in foreground...\n")); + $console->writeOut( + "%s\n", + pht('Starting Aphlict server in foreground...')); } else { Filesystem::writeFile($this->getPIDPath(), getmypid()); } @@ -214,10 +221,13 @@ abstract class PhabricatorAphlictManagementWorkflow register_shutdown_function(array($this, 'cleanup')); if ($this->debug) { - $console->writeOut("Launching server:\n\n $ ".$command."\n\n"); + $console->writeOut( + "%s\n\n $ %s\n\n", + pht('Launching server:'), + $command); $err = phutil_passthru('%C', $command); - $console->writeOut(">>> Server exited!\n"); + $console->writeOut(">>> %s\n", pht('Server exited!')); exit($err); } else { while (true) { @@ -242,9 +252,12 @@ abstract class PhabricatorAphlictManagementWorkflow $pid = pcntl_fork(); if ($pid < 0) { - throw new Exception('Failed to fork()!'); + throw new Exception( + pht( + 'Failed to %s!', + 'fork()')); } else if ($pid) { - $console->writeErr(pht("Aphlict Server started.\n")); + $console->writeErr("%s\n", pht('Aphlict Server started.')); exit(0); } @@ -267,11 +280,11 @@ abstract class PhabricatorAphlictManagementWorkflow $pid = $this->getPID(); if (!$pid) { - $console->writeErr(pht("Aphlict is not running.\n")); + $console->writeErr("%s\n", pht('Aphlict is not running.')); return 0; } - $console->writeErr(pht("Stopping Aphlict Server (%s)...\n", $pid)); + $console->writeErr("%s\n", pht('Stopping Aphlict Server (%s)...', $pid)); posix_kill($pid, SIGINT); $start = time(); @@ -287,7 +300,7 @@ abstract class PhabricatorAphlictManagementWorkflow } while (time() < $start + 5); if ($pid) { - $console->writeErr(pht('Sending %s a SIGKILL.', $pid)."\n"); + $console->writeErr("%s\n", pht('Sending %s a SIGKILL.', $pid)); posix_kill($pid, SIGKILL); unset($pid); } @@ -307,8 +320,11 @@ abstract class PhabricatorAphlictManagementWorkflow throw new PhutilArgumentUsageException( pht( - 'No `nodejs` or `node` binary was found in $PATH. You must install '. - 'Node.js to start the Aphlict server.')); + 'No `%s` or `%s` binary was found in %s. You must install '. + 'Node.js to start the Aphlict server.', + 'nodejs', + 'node', + '$PATH')); } } diff --git a/src/applications/aphlict/query/AphlictDropdownDataQuery.php b/src/applications/aphlict/query/AphlictDropdownDataQuery.php index 91ce3ad41f..4f360f28cc 100644 --- a/src/applications/aphlict/query/AphlictDropdownDataQuery.php +++ b/src/applications/aphlict/query/AphlictDropdownDataQuery.php @@ -22,7 +22,7 @@ final class AphlictDropdownDataQuery { public function getNotificationData() { if ($this->notificationData === null) { - throw new Exception('You must execute() first!'); + throw new Exception(pht('You must %s first!', 'execute()')); } return $this->notificationData; } @@ -34,7 +34,7 @@ final class AphlictDropdownDataQuery { public function getConpherenceData() { if ($this->conpherenceData === null) { - throw new Exception('You must execute() first!'); + throw new Exception(pht('You must %s first!', 'execute()')); } return $this->conpherenceData; } diff --git a/src/applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php b/src/applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php index 677c4985aa..ee5cbbff2b 100644 --- a/src/applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php +++ b/src/applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php @@ -8,7 +8,7 @@ final class ArcanistProjectInfoConduitAPIMethod } public function getMethodDescription() { - return 'Get information about Arcanist projects.'; + return pht('Get information about Arcanist projects.'); } protected function defineParamTypes() { @@ -23,7 +23,7 @@ final class ArcanistProjectInfoConduitAPIMethod protected function defineErrorTypes() { return array( - 'ERR-BAD-ARCANIST-PROJECT' => 'No such project exists.', + 'ERR-BAD-ARCANIST-PROJECT' => pht('No such project exists.'), ); } diff --git a/src/applications/audit/conduit/AuditQueryConduitAPIMethod.php b/src/applications/audit/conduit/AuditQueryConduitAPIMethod.php index d5a02810f8..2fc9ca47ee 100644 --- a/src/applications/audit/conduit/AuditQueryConduitAPIMethod.php +++ b/src/applications/audit/conduit/AuditQueryConduitAPIMethod.php @@ -7,7 +7,7 @@ final class AuditQueryConduitAPIMethod extends AuditConduitAPIMethod { } public function getMethodDescription() { - return 'Query audit requests.'; + return pht('Query audit requests.'); } protected function defineParamTypes() { diff --git a/src/applications/audit/constants/PhabricatorAuditActionConstants.php b/src/applications/audit/constants/PhabricatorAuditActionConstants.php index 95dd8cdbf0..afecd0bf8f 100644 --- a/src/applications/audit/constants/PhabricatorAuditActionConstants.php +++ b/src/applications/audit/constants/PhabricatorAuditActionConstants.php @@ -14,12 +14,12 @@ final class PhabricatorAuditActionConstants { public static function getActionNameMap() { $map = array( - self::COMMENT => pht('Comment'), - self::CONCERN => pht("Raise Concern \xE2\x9C\x98"), - self::ACCEPT => pht("Accept Commit \xE2\x9C\x94"), - self::RESIGN => pht('Resign from Audit'), - self::CLOSE => pht('Close Audit'), - self::ADD_CCS => pht('Add CCs'), + self::COMMENT => pht('Comment'), + self::CONCERN => pht("Raise Concern \xE2\x9C\x98"), + self::ACCEPT => pht("Accept Commit \xE2\x9C\x94"), + self::RESIGN => pht('Resign from Audit'), + self::CLOSE => pht('Close Audit'), + self::ADD_CCS => pht('Add CCs'), self::ADD_AUDITORS => pht('Add Auditors'), ); @@ -28,20 +28,20 @@ final class PhabricatorAuditActionConstants { public static function getActionName($constant) { $map = self::getActionNameMap(); - return idx($map, $constant, 'Unknown'); + return idx($map, $constant, pht('Unknown')); } public static function getActionPastTenseVerb($action) { - static $map = array( - self::COMMENT => 'commented on', - self::CONCERN => 'raised a concern with', - self::ACCEPT => 'accepted', - self::RESIGN => 'resigned from', - self::CLOSE => 'closed', - self::ADD_CCS => 'added CCs to', - self::ADD_AUDITORS => 'added auditors to', + $map = array( + self::COMMENT => pht('commented on'), + self::CONCERN => pht('raised a concern with'), + self::ACCEPT => pht('accepted'), + self::RESIGN => pht('resigned from'), + self::CLOSE => pht('closed'), + self::ADD_CCS => pht('added CCs to'), + self::ADD_AUDITORS => pht('added auditors to'), ); - return idx($map, $action, 'updated'); + return idx($map, $action, pht('updated')); } } diff --git a/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php b/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php index aef3c7e224..1bc07aaa56 100644 --- a/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php +++ b/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php @@ -21,7 +21,7 @@ final class PhabricatorAuditCommitStatusConstants { } public static function getStatusName($code) { - return idx(self::getStatusNameMap(), $code, 'Unknown'); + return idx(self::getStatusNameMap(), $code, pht('Unknown')); } public static function getOpenStatusConstants() { diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php index b2fd9d84b2..24bc342f05 100644 --- a/src/applications/audit/editor/PhabricatorAuditEditor.php +++ b/src/applications/audit/editor/PhabricatorAuditEditor.php @@ -28,7 +28,7 @@ final class PhabricatorAuditEditor } else { $name = $this->getActor()->getUsername(); } - return array('Added by '.$name.'.'); + return array(pht('Added by %s.', $name)); } public function setRawPatch($patch) { @@ -432,7 +432,7 @@ final class PhabricatorAuditEditor } foreach ($phids as $phid) { - $this->addAuditReason($phid, 'Requested by Author'); + $this->addAuditReason($phid, pht('Requested by Author')); } return id(new PhabricatorAuditTransaction()) ->setTransactionType(PhabricatorAuditActionConstants::ADD_AUDITORS) diff --git a/src/applications/audit/mail/PhabricatorAuditMailReceiver.php b/src/applications/audit/mail/PhabricatorAuditMailReceiver.php index 2e0a2725ab..29b1748264 100644 --- a/src/applications/audit/mail/PhabricatorAuditMailReceiver.php +++ b/src/applications/audit/mail/PhabricatorAuditMailReceiver.php @@ -3,8 +3,8 @@ final class PhabricatorAuditMailReceiver extends PhabricatorObjectMailReceiver { public function isEnabled() { - $app_class = 'PhabricatorAuditApplication'; - return PhabricatorApplication::isClassInstalled($app_class); + return PhabricatorApplication::isClassInstalled( + 'PhabricatorAuditApplication'); } protected function getObjectPattern() { diff --git a/src/applications/audit/mail/PhabricatorAuditReplyHandler.php b/src/applications/audit/mail/PhabricatorAuditReplyHandler.php index 6aafbd772a..c1eb562bfa 100644 --- a/src/applications/audit/mail/PhabricatorAuditReplyHandler.php +++ b/src/applications/audit/mail/PhabricatorAuditReplyHandler.php @@ -5,7 +5,10 @@ final class PhabricatorAuditReplyHandler public function validateMailReceiver($mail_receiver) { if (!($mail_receiver instanceof PhabricatorRepositoryCommit)) { - throw new Exception('Mail receiver is not a commit!'); + throw new Exception( + pht( + 'Mail receiver is not a %s!', + 'PhabricatorRepositoryCommit')); } } diff --git a/src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php b/src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php index 2d9438dd4e..fa9dbff635 100644 --- a/src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php +++ b/src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php @@ -7,51 +7,54 @@ final class PhabricatorAuditManagementDeleteWorkflow $this ->setName('delete') ->setExamples('**delete** [--dry-run] ...') - ->setSynopsis('Delete audit requests matching parameters.') + ->setSynopsis(pht('Delete audit requests matching parameters.')) ->setArguments( array( array( 'name' => 'dry-run', - 'help' => 'Show what would be deleted, but do not actually delete '. - 'anything.', + 'help' => pht( + 'Show what would be deleted, but do not actually delete '. + 'anything.'), ), array( 'name' => 'users', 'param' => 'names', - 'help' => 'Select only audits by a given list of users.', + 'help' => pht('Select only audits by a given list of users.'), ), array( 'name' => 'repositories', 'param' => 'repos', - 'help' => 'Select only audits in a given list of repositories.', + 'help' => pht( + 'Select only audits in a given list of repositories.'), ), array( 'name' => 'commits', 'param' => 'commits', - 'help' => 'Select only audits for the given commits.', + 'help' => pht('Select only audits for the given commits.'), ), array( 'name' => 'min-commit-date', 'param' => 'date', - 'help' => 'Select only audits for commits on or after the given '. - 'date.', + 'help' => pht( + 'Select only audits for commits on or after the given date.'), ), array( 'name' => 'max-commit-date', 'param' => 'date', - 'help' => 'Select only audits for commits on or before the given '. - 'date.', + 'help' => pht( + 'Select only audits for commits on or before the given date.'), ), array( 'name' => 'status', 'param' => 'status', - 'help' => 'Select only audits in the given status. By default, '. - 'only open audits are selected.', + 'help' => pht( + 'Select only audits in the given status. By default, '. + 'only open audits are selected.'), ), array( 'name' => 'ids', 'param' => 'ids', - 'help' => 'Select only audits with the given IDs.', + 'help' => pht('Select only audits with the given IDs.'), ), )); } @@ -72,7 +75,7 @@ final class PhabricatorAuditManagementDeleteWorkflow $max_date = $this->loadDate($args->getArg('max-commit-date')); if ($min_date && $max_date && ($min_date > $max_date)) { throw new PhutilArgumentUsageException( - 'Specified max date must come after specified min date.'); + pht('Specified maximum date must come after specified minimum date.')); } $is_dry_run = $args->getArg('dry-run'); @@ -250,8 +253,9 @@ final class PhabricatorAuditManagementDeleteWorkflow if (!$epoch || $epoch < 1) { throw new PhutilArgumentUsageException( pht( - 'Unable to parse date "%s". Use a format like "2000-01-01".', - $date)); + 'Unable to parse date "%s". Use a format like "%s".', + $date, + '2000-01-01')); } return $epoch; diff --git a/src/applications/audit/view/PhabricatorAuditListView.php b/src/applications/audit/view/PhabricatorAuditListView.php index 96844c5b48..75aa58db53 100644 --- a/src/applications/audit/view/PhabricatorAuditListView.php +++ b/src/applications/audit/view/PhabricatorAuditListView.php @@ -59,7 +59,7 @@ final class PhabricatorAuditListView extends AphrontView { private function getHandle($phid) { $handle = idx($this->handles, $phid); if (!$handle) { - throw new Exception("No handle for '{$phid}'!"); + throw new Exception(pht("No handle for '%s'!", $phid)); } return $handle; } @@ -98,7 +98,11 @@ final class PhabricatorAuditListView extends AphrontView { public function buildList() { $user = $this->getUser(); if (!$user) { - throw new Exception('you must setUser() before buildList()!'); + throw new Exception( + pht( + 'You must %s before %s!', + 'setUser()', + __FUNCTION__.'()')); } $rowc = array(); diff --git a/src/applications/audit/view/PhabricatorAuditTransactionView.php b/src/applications/audit/view/PhabricatorAuditTransactionView.php index 64a2892ffd..305ea19c56 100644 --- a/src/applications/audit/view/PhabricatorAuditTransactionView.php +++ b/src/applications/audit/view/PhabricatorAuditTransactionView.php @@ -72,7 +72,7 @@ final class PhabricatorAuditTransactionView $inlines[] = $xaction; break; default: - throw new Exception('Unknown grouped transaction type!'); + throw new Exception(pht('Unknown grouped transaction type!')); } } diff --git a/src/applications/auth/conduit/PhabricatorAuthConduitAPIMethod.php b/src/applications/auth/conduit/PhabricatorAuthConduitAPIMethod.php index 07d2a4b157..34bedec0bc 100644 --- a/src/applications/auth/conduit/PhabricatorAuthConduitAPIMethod.php +++ b/src/applications/auth/conduit/PhabricatorAuthConduitAPIMethod.php @@ -3,8 +3,7 @@ abstract class PhabricatorAuthConduitAPIMethod extends ConduitAPIMethod { final public function getApplication() { - return PhabricatorApplication::getByClass( - 'PhabricatorAuthApplication'); + return PhabricatorApplication::getByClass('PhabricatorAuthApplication'); } public function getMethodStatus() { @@ -12,8 +11,7 @@ abstract class PhabricatorAuthConduitAPIMethod extends ConduitAPIMethod { } public function getMethodStatusDescription() { - return pht( - 'These methods are recently introduced and subject to change.'); + return pht('These methods are recently introduced and subject to change.'); } } diff --git a/src/applications/auth/controller/PhabricatorAuthLoginController.php b/src/applications/auth/controller/PhabricatorAuthLoginController.php index f00eff32c5..e3cbeaa2c6 100644 --- a/src/applications/auth/controller/PhabricatorAuthLoginController.php +++ b/src/applications/auth/controller/PhabricatorAuthLoginController.php @@ -68,7 +68,9 @@ final class PhabricatorAuthLoginController if (!$account) { throw new Exception( - 'Auth provider failed to load an account from processLoginRequest()!'); + pht( + 'Auth provider failed to load an account from %s!', + 'processLoginRequest()')); } if ($account->getUserPHID()) { @@ -164,7 +166,7 @@ final class PhabricatorAuthLoginController $next_uri) { if ($account->getUserPHID()) { - throw new Exception('Account is already registered or linked.'); + throw new Exception(pht('Account is already registered or linked.')); } // Regenerate the registration secret key, set it on the external account, diff --git a/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php b/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php index 57516ac6b6..975355ec97 100644 --- a/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php +++ b/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php @@ -40,7 +40,7 @@ final class PhabricatorAuthNeedsMultiFactorController pht( 'Multi-factor authentication helps secure your account by '. 'making it more difficult for attackers to gain access or '. - 'take senstive actions.'), + 'take sensitive actions.'), pht( 'To learn more about multi-factor authentication, click the '. '%s button below.', diff --git a/src/applications/auth/controller/PhabricatorAuthRegisterController.php b/src/applications/auth/controller/PhabricatorAuthRegisterController.php index d27a644480..9341345143 100644 --- a/src/applications/auth/controller/PhabricatorAuthRegisterController.php +++ b/src/applications/auth/controller/PhabricatorAuthRegisterController.php @@ -560,8 +560,7 @@ final class PhabricatorAuthRegisterController return array($account, $provider, $response); } else if (count($providers) > 1) { $response = $this->renderError( - pht( - 'There are too many configured default registration providers.')); + pht('There are too many configured default registration providers.')); return array($account, $provider, $response); } diff --git a/src/applications/auth/controller/PhabricatorAuthSSHKeyGenerateController.php b/src/applications/auth/controller/PhabricatorAuthSSHKeyGenerateController.php index d055db514a..2cb6dc81ea 100644 --- a/src/applications/auth/controller/PhabricatorAuthSSHKeyGenerateController.php +++ b/src/applications/auth/controller/PhabricatorAuthSSHKeyGenerateController.php @@ -55,9 +55,9 @@ final class PhabricatorAuthSSHKeyGenerateController ->setSubmitURI($file->getDownloadURI()) ->appendParagraph( pht( - 'A keypair has been generated, and the public key has been '. - 'added as a recognized key. Use the button below to download '. - 'the private key.')) + 'A keypair has been generated, and the public key has been '. + 'added as a recognized key. Use the button below to download '. + 'the private key.')) ->appendParagraph( pht( 'After you download the private key, it will be destroyed. '. @@ -77,8 +77,7 @@ final class PhabricatorAuthSSHKeyGenerateController 'This workflow will generate a new SSH keypair, add the public '. 'key, and let you download the private key.')) ->appendParagraph( - pht( - 'Phabricator will not retain a copy of the private key.')) + pht('Phabricator will not retain a copy of the private key.')) ->addSubmitButton(pht('Generate New Keypair')) ->addCancelButton($cancel_uri); } catch (Exception $ex) { diff --git a/src/applications/auth/controller/PhabricatorAuthStartController.php b/src/applications/auth/controller/PhabricatorAuthStartController.php index 7ea10690e5..f9b9f7cb41 100644 --- a/src/applications/auth/controller/PhabricatorAuthStartController.php +++ b/src/applications/auth/controller/PhabricatorAuthStartController.php @@ -71,8 +71,8 @@ final class PhabricatorAuthStartController 'This Phabricator install is not configured with any enabled '. 'authentication providers which can be used to log in. If you '. 'have accidentally locked yourself out by disabling all providers, '. - 'you can use `phabricator/bin/auth recover ` to '. - 'recover access to an administrative account.')); + 'you can use `%s` to recover access to an administrative account.'. + 'phabricator/bin/auth recover ')); } $next_uri = $request->getStr('next'); diff --git a/src/applications/auth/controller/PhabricatorEmailLoginController.php b/src/applications/auth/controller/PhabricatorEmailLoginController.php index d21ec5a1bb..9db360d51d 100644 --- a/src/applications/auth/controller/PhabricatorEmailLoginController.php +++ b/src/applications/auth/controller/PhabricatorEmailLoginController.php @@ -72,7 +72,7 @@ final class PhabricatorEmailLoginController $target_email->getUserPHID()); if ($verified_addresses) { $errors[] = pht( - 'That email addess is not verified. You can only send '. + 'That email address is not verified. You can only send '. 'password reset links to a verified address.'); $e_email = pht('Unverified'); } @@ -86,26 +86,22 @@ final class PhabricatorEmailLoginController PhabricatorAuthSessionEngine::ONETIME_RESET); if ($is_serious) { - $body = <<addCancelButton('/', pht('Done')); } } - } $error_view = null; @@ -153,8 +148,7 @@ EOBODY; $dialog = new AphrontDialogView(); $dialog->setUser($request->getUser()); - $dialog->setTitle(pht( - 'Forgot Password / Email Login')); + $dialog->setTitle(pht('Forgot Password / Email Login')); $dialog->appendChild($email_auth); $dialog->addSubmitButton(pht('Send Email')); $dialog->setSubmitURI('/login/email/'); diff --git a/src/applications/auth/factor/__tests__/PhabricatorTOTPAuthFactorTestCase.php b/src/applications/auth/factor/__tests__/PhabricatorTOTPAuthFactorTestCase.php index 464c0b8e54..284db4cde1 100644 --- a/src/applications/auth/factor/__tests__/PhabricatorTOTPAuthFactorTestCase.php +++ b/src/applications/auth/factor/__tests__/PhabricatorTOTPAuthFactorTestCase.php @@ -39,6 +39,4 @@ final class PhabricatorTOTPAuthFactorTestCase extends PhabricatorTestCase { } - - } diff --git a/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php b/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php index a10b3ea64a..22f993cee5 100644 --- a/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php @@ -11,8 +11,8 @@ final class PhabricatorAuthManagementCachePKCS8Workflow pht( 'Cache the PKCS8 format of a public key. When developing on OSX, '. 'this can be used to work around issues with ssh-keygen. Use '. - '`ssh-keygen -e -m PKCS8 -f key.pub` to generate a PKCS8 key to '. - 'feed to this command.')) + '`%s` to generate a PKCS8 key to feed to this command.', + 'ssh-keygen -e -m PKCS8 -f key.pub')) ->setArguments( array( array( @@ -35,7 +35,8 @@ final class PhabricatorAuthManagementCachePKCS8Workflow if (!strlen($public_keyfile)) { throw new PhutilArgumentUsageException( pht( - 'You must specify the path to a public keyfile with --public.')); + 'You must specify the path to a public keyfile with %s.', + '--public')); } if (!Filesystem::pathExists($public_keyfile)) { @@ -51,7 +52,8 @@ final class PhabricatorAuthManagementCachePKCS8Workflow if (!strlen($pkcs8_keyfile)) { throw new PhutilArgumentUsageException( pht( - 'You must specify the path to a pkcs8 keyfile with --pkc8s.')); + 'You must specify the path to a pkcs8 keyfile with %s.', + '--pkc8s')); } if (!Filesystem::pathExists($pkcs8_keyfile)) { diff --git a/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php index e7afcc48d1..725d2dfc49 100644 --- a/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php @@ -21,28 +21,28 @@ final class PhabricatorAuthManagementLDAPWorkflow if (!$provider) { $console->writeOut( "%s\n", - 'The LDAP authentication provider is not enabled.'); + pht('The LDAP authentication provider is not enabled.')); exit(1); } if (!function_exists('ldap_connect')) { $console->writeOut( "%s\n", - 'The LDAP extension is not enabled.'); + pht('The LDAP extension is not enabled.')); exit(1); } $adapter = $provider->getAdapter(); $console->writeOut("%s\n", pht('Enter LDAP Credentials')); - $username = phutil_console_prompt('LDAP Username: '); + $username = phutil_console_prompt(pht('LDAP Username: ')); if (!strlen($username)) { throw new PhutilArgumentUsageException( pht('You must enter an LDAP username.')); } phutil_passthru('stty -echo'); - $password = phutil_console_prompt('LDAP Password: '); + $password = phutil_console_prompt(pht('LDAP Password: ')); phutil_passthru('stty echo'); if (!strlen($password)) { diff --git a/src/applications/auth/management/PhabricatorAuthManagementRecoverWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementRecoverWorkflow.php index fe918adee4..ad843d56ce 100644 --- a/src/applications/auth/management/PhabricatorAuthManagementRecoverWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementRecoverWorkflow.php @@ -8,8 +8,9 @@ final class PhabricatorAuthManagementRecoverWorkflow ->setName('recover') ->setExamples('**recover** __username__') ->setSynopsis( - 'Recover access to an administrative account if you have locked '. - 'yourself out of Phabricator.') + pht( + 'Recover access to an administrative account if you have locked '. + 'yourself out of Phabricator.')) ->setArguments( array( 'username' => array( @@ -29,8 +30,9 @@ final class PhabricatorAuthManagementRecoverWorkflow throw new PhutilArgumentUsageException( pht( 'This Phabricator installation has no recoverable administrator '. - 'accounts. You can use `bin/accountadmin` to create a new '. - 'administrator account or make an existing user an administrator.')); + 'accounts. You can use `%s` to create a new administrator '. + 'account or make an existing user an administrator.', + 'bin/accountadmin')); } $can_recover = mpull($can_recover, 'getUsername'); sort($can_recover); @@ -85,10 +87,11 @@ final class PhabricatorAuthManagementRecoverWorkflow $console->writeOut(' %s', $onetime_uri); $console->writeOut("\n\n"); $console->writeOut( + "%s\n", pht( 'After logging in, you can use the "Auth" application to add or '. 'restore authentication providers and allow normal logins to '. - 'succeed.')."\n"); + 'succeed.')); return 0; } diff --git a/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php index b05b87f5e8..23c0a109cb 100644 --- a/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php @@ -16,17 +16,17 @@ final class PhabricatorAuthManagementRefreshWorkflow array( 'name' => 'user', 'param' => 'user', - 'help' => 'Refresh tokens for a given user.', + 'help' => pht('Refresh tokens for a given user.'), ), array( 'name' => 'type', 'param' => 'provider', - 'help' => 'Refresh tokens for a given provider type.', + 'help' => pht('Refresh tokens for a given provider type.'), ), array( 'name' => 'domain', 'param' => 'domain', - 'help' => 'Refresh tokens for a given domain.', + 'help' => pht('Refresh tokens for a given domain.'), ), )); } diff --git a/src/applications/auth/management/PhabricatorAuthManagementStripWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementStripWorkflow.php index f6d057b57a..f25d05301b 100644 --- a/src/applications/auth/management/PhabricatorAuthManagementStripWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementStripWorkflow.php @@ -7,9 +7,7 @@ final class PhabricatorAuthManagementStripWorkflow $this ->setName('strip') ->setExamples('**strip** [--user username] [--type type]') - ->setSynopsis( - pht( - 'Remove multi-factor authentication from an account.')) + ->setSynopsis(pht('Remove multi-factor authentication from an account.')) ->setArguments( array( array( @@ -50,13 +48,17 @@ final class PhabricatorAuthManagementStripWorkflow if ($usernames && $all_users) { throw new PhutilArgumentUsageException( pht( - 'Specify either specific users with --user, or all users with '. - '--all-users, but not both.')); + 'Specify either specific users with %s, or all users with '. + '%s, but not both.', + '--user', + '--all-users')); } else if (!$usernames && !$all_users) { throw new PhutilArgumentUsageException( pht( - 'Use --user to specify which user to strip factors from, or '. - '--all-users to strip factors from all users.')); + 'Use %s to specify which user to strip factors from, or '. + '%s to strip factors from all users.', + '--user', + '--all-users')); } else if ($usernames) { $users = id(new PhabricatorPeopleQuery()) ->setViewer($this->getViewer()) diff --git a/src/applications/auth/management/PhabricatorAuthManagementTrustOAuthClientWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementTrustOAuthClientWorkflow.php index 229218d3b7..ee5e50b38e 100644 --- a/src/applications/auth/management/PhabricatorAuthManagementTrustOAuthClientWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementTrustOAuthClientWorkflow.php @@ -28,7 +28,8 @@ final class PhabricatorAuthManagementTrustOAuthClientWorkflow if (!$id) { throw new PhutilArgumentUsageException( pht( - 'Specify an OAuth client id with --id.')); + 'Specify an OAuth client id with %s.', + '--id')); } $client = id(new PhabricatorOAuthServerClientQuery()) diff --git a/src/applications/auth/management/PhabricatorAuthManagementUntrustOAuthClientWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementUntrustOAuthClientWorkflow.php index 344e4b8864..a0b3e02fa4 100644 --- a/src/applications/auth/management/PhabricatorAuthManagementUntrustOAuthClientWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementUntrustOAuthClientWorkflow.php @@ -28,7 +28,8 @@ final class PhabricatorAuthManagementUntrustOAuthClientWorkflow if (!$id) { throw new PhutilArgumentUsageException( pht( - 'Specify an OAuth client id with --id.')); + 'Specify an OAuth client ID with %s.', + '--id')); } $client = id(new PhabricatorOAuthServerClientQuery()) @@ -39,7 +40,7 @@ final class PhabricatorAuthManagementUntrustOAuthClientWorkflow if (!$client) { throw new PhutilArgumentUsageException( pht( - 'Failed to find an OAuth client with id %s.', $id)); + 'Failed to find an OAuth client with ID %s.', $id)); } if (!$client->getIsTrusted()) { diff --git a/src/applications/auth/provider/PhabricatorAuthProvider.php b/src/applications/auth/provider/PhabricatorAuthProvider.php index 5ffb18b41a..d495a3091f 100644 --- a/src/applications/auth/provider/PhabricatorAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorAuthProvider.php @@ -195,7 +195,7 @@ abstract class PhabricatorAuthProvider { protected function loadOrCreateAccount($account_id) { if (!strlen($account_id)) { - throw new Exception('loadOrCreateAccount(...): empty account ID!'); + throw new Exception(pht('Empty account ID!')); } $adapter = $this->getAdapter(); @@ -203,14 +203,18 @@ abstract class PhabricatorAuthProvider { if (!strlen($adapter->getAdapterType())) { throw new Exception( - "AuthAdapter (of class '{$adapter_class}') has an invalid ". - "implementation: no adapter type."); + pht( + "AuthAdapter (of class '%s') has an invalid implementation: ". + "no adapter type.", + $adapter_class)); } if (!strlen($adapter->getAdapterDomain())) { throw new Exception( - "AuthAdapter (of class '{$adapter_class}') has an invalid ". - "implementation: no adapter domain."); + pht( + "AuthAdapter (of class '%s') has an invalid implementation: ". + "no adapter domain.", + $adapter_class)); } $account = id(new PhabricatorExternalAccount())->loadOneWhere( diff --git a/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php b/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php index 111d62601b..013cd21736 100644 --- a/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php @@ -110,13 +110,13 @@ final class PhabricatorLDAPAuthProvider extends PhabricatorAuthProvider { ->setFullWidth(true) ->appendChild( id(new AphrontFormTextControl()) - ->setLabel('LDAP Username') + ->setLabel(pht('LDAP Username')) ->setName('ldap_username') ->setValue($v_user) ->setError($e_user)) ->appendChild( id(new AphrontFormPasswordControl()) - ->setLabel('LDAP Password') + ->setLabel(pht('LDAP Password')) ->setName('ldap_password') ->setError($e_pass)); @@ -166,7 +166,7 @@ final class PhabricatorLDAPAuthProvider extends PhabricatorAuthProvider { $account_id = $adapter->getAccountID(); DarkConsoleErrorLogPluginAPI::disableDiscardMode(); } else { - throw new Exception('Username and password are required!'); + throw new Exception(pht('Username and password are required!')); } } catch (PhutilAuthCredentialException $ex) { $response = $controller->buildProviderPageResponse( @@ -258,8 +258,9 @@ final class PhabricatorLDAPAuthProvider extends PhabricatorAuthProvider { 'Before you can set up or use LDAP, you need to install the PHP '. 'LDAP extension. It is not currently installed, so PHP can not '. 'talk to LDAP. Usually you can install it with '. - '`yum install php-ldap`, `apt-get install php5-ldap`, or a '. - 'similar package manager command.')); + '`%s`, `%s`, or a similar package manager command.', + 'yum install php-ldap', + 'apt-get install php5-ldap')); } } diff --git a/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php b/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php index 745232a783..a22707b6cc 100644 --- a/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php +++ b/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php @@ -84,11 +84,11 @@ abstract class PhabricatorOAuth1AuthProvider $verifier = $request->getStr('oauth_verifier'); if (!$token) { - throw new Exception("Expected 'oauth_token' in request!"); + throw new Exception(pht("Expected '%s' in request!", 'oauth_token')); } if (!$verifier) { - throw new Exception("Expected 'oauth_verifier' in request!"); + throw new Exception(pht("Expected '%s' in request!", 'oauth_verifier')); } $adapter->setToken($token); diff --git a/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php b/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php index 4f1f1e8fed..aff6367840 100644 --- a/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php +++ b/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php @@ -198,7 +198,7 @@ abstract class PhabricatorOAuth2AuthProvider $force_refresh = false) { if ($account->getProviderKey() !== $this->getProviderKey()) { - throw new Exception('Account does not match provider!'); + throw new Exception(pht('Account does not match provider!')); } if (!$force_refresh) { @@ -262,8 +262,7 @@ abstract class PhabricatorOAuth2AuthProvider phabricator_datetime($oauth_expires, $viewer))); } else { $item->addAttribute( - pht( - 'Active OAuth Token')); + pht('Active OAuth Token')); } } else if ($is_invalid) { $item->addAttribute(pht('Invalid OAuth Access Token')); diff --git a/src/applications/auth/provider/PhabricatorOAuthAuthProvider.php b/src/applications/auth/provider/PhabricatorOAuthAuthProvider.php index 8f7eae8aac..df76c655f3 100644 --- a/src/applications/auth/provider/PhabricatorOAuthAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorOAuthAuthProvider.php @@ -82,8 +82,9 @@ abstract class PhabricatorOAuthAuthProvider extends PhabricatorAuthProvider { $help = $this->getProviderConfigurationHelp(); return $help."\n\n". - pht('Use the **OAuth App Notes** field to record details about which '. - 'account the external application is registered under.'); + pht( + 'Use the **OAuth App Notes** field to record details about which '. + 'account the external application is registered under.'); } abstract protected function getProviderConfigurationHelp(); diff --git a/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php b/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php index 6307446c88..dbe2203d83 100644 --- a/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php @@ -13,7 +13,8 @@ final class PhabricatorPasswordAuthProvider extends PhabricatorAuthProvider { "(WARNING) Examine the table below for information on how password ". "hashes will be stored in the database.\n\n". "(NOTE) You can select a minimum password length by setting ". - "`account.minimum-password-length` in configuration."); + "`%s` in configuration.", + 'account.minimum-password-length'); } public function renderConfigurationFooter() { @@ -160,7 +161,7 @@ final class PhabricatorPasswordAuthProvider extends PhabricatorAuthProvider { public function buildLinkForm( PhabricatorAuthLinkController $controller) { - throw new Exception("Password providers can't be linked."); + throw new Exception(pht("Password providers can't be linked.")); } private function renderPasswordLoginForm( @@ -205,8 +206,9 @@ final class PhabricatorPasswordAuthProvider extends PhabricatorAuthProvider { $errors[] = pht('CAPTCHA was not entered correctly.'); } else { $e_captcha = pht('Required'); - $errors[] = pht('Too many login failures recently. You must '. - 'submit a CAPTCHA with your login request.'); + $errors[] = pht( + 'Too many login failures recently. You must '. + 'submit a CAPTCHA with your login request.'); } } else if ($request->isHTTPPost()) { // NOTE: This is intentionally vague so as not to disclose whether a @@ -225,13 +227,13 @@ final class PhabricatorPasswordAuthProvider extends PhabricatorAuthProvider { ->appendChild($errors) ->appendChild( id(new AphrontFormTextControl()) - ->setLabel('Username or Email') + ->setLabel(pht('Username or Email')) ->setName('username') ->setValue($v_user) ->setError($e_user)) ->appendChild( id(new AphrontFormPasswordControl()) - ->setLabel('Password') + ->setLabel(pht('Password')) ->setName('password') ->setError($e_pass)); diff --git a/src/applications/auth/provider/PhabricatorPersonaAuthProvider.php b/src/applications/auth/provider/PhabricatorPersonaAuthProvider.php index 843c55a365..e88b466872 100644 --- a/src/applications/auth/provider/PhabricatorPersonaAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorPersonaAuthProvider.php @@ -9,8 +9,7 @@ final class PhabricatorPersonaAuthProvider extends PhabricatorAuthProvider { } public function getDescriptionForCreate() { - return pht( - 'Allow users to login or register using Mozilla Persona.'); + return pht('Allow users to login or register using Mozilla Persona.'); } public function getAdapter() { @@ -54,12 +53,12 @@ final class PhabricatorPersonaAuthProvider extends PhabricatorAuthProvider { $response = null; if (!$request->isAjax()) { - throw new Exception('Expected this request to come via Ajax.'); + throw new Exception(pht('Expected this request to come via Ajax.')); } $assertion = $request->getStr('assertion'); if (!$assertion) { - throw new Exception('Expected identity assertion.'); + throw new Exception(pht('Expected identity assertion.')); } $adapter->setAssertion($assertion); diff --git a/src/applications/auth/provider/PhabricatorPhabricatorAuthProvider.php b/src/applications/auth/provider/PhabricatorPhabricatorAuthProvider.php index b27c895e82..8ea5e71f43 100644 --- a/src/applications/auth/provider/PhabricatorPhabricatorAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorPhabricatorAuthProvider.php @@ -122,7 +122,8 @@ final class PhabricatorPhabricatorAuthProvider $uri = new PhutilURI($values[$key_uri]); if (!$uri->getProtocol()) { $errors[] = pht( - 'Phabricator base URI should include protocol (like "https://").'); + 'Phabricator base URI should include protocol (like "%s").', + 'https://'); $issues[$key_uri] = pht('Invalid'); } } diff --git a/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php b/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php index 028108c2cc..44e5913290 100644 --- a/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php +++ b/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php @@ -88,7 +88,7 @@ final class PhabricatorAuthProviderConfigQuery 'isEnabled = 1'); break; default: - throw new Exception("Unknown status '{$status}'!"); + throw new Exception(pht("Unknown status '%s'!", $status)); } $where[] = $this->buildPagingClause($conn_r); diff --git a/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php b/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php index b30e16db7d..d8660b1956 100644 --- a/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php +++ b/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php @@ -129,8 +129,9 @@ final class PhabricatorAuthSSHPublicKey extends Phobject { throw new PhutilProxyException( pht( 'Failed to convert public key into PKCS8 format. If you are '. - 'developing on OSX, you may be able to use `bin/auth cache-pkcs8` '. + 'developing on OSX, you may be able to use `%s` '. 'to work around this issue. %s', + 'bin/auth cache-pkcs8', $ex->getMessage()), $ex); } diff --git a/src/applications/base/PhabricatorApplication.php b/src/applications/base/PhabricatorApplication.php index 295d4db180..e97e4d605f 100644 --- a/src/applications/base/PhabricatorApplication.php +++ b/src/applications/base/PhabricatorApplication.php @@ -32,7 +32,7 @@ abstract class PhabricatorApplication implements PhabricatorPolicyInterface { public abstract function getName(); public function getShortDescription() { - return $this->getName().' Application'; + return pht('%s Application', $this->getName()); } public function isInstalled() { @@ -254,7 +254,7 @@ abstract class PhabricatorApplication implements PhabricatorPolicyInterface { } public function getAppEmailBlurb() { - throw new Exception('Not Implemented.'); + throw new PhutilMethodNotImplementedException(); } @@ -371,7 +371,7 @@ abstract class PhabricatorApplication implements PhabricatorPolicyInterface { } if (!$selected) { - throw new Exception("No application '{$class_name}'!"); + throw new Exception(pht("No application '%s'!", $class_name)); } return $selected; @@ -531,7 +531,7 @@ abstract class PhabricatorApplication implements PhabricatorPolicyInterface { private function getCustomCapabilitySpecification($capability) { $custom = $this->getCustomCapabilities(); if (!isset($custom[$capability])) { - throw new Exception("Unknown capability '{$capability}'!"); + throw new Exception(pht("Unknown capability '%s'!", $capability)); } return $custom[$capability]; } diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php index e2b899ab6e..04bb633d4e 100644 --- a/src/applications/base/controller/PhabricatorController.php +++ b/src/applications/base/controller/PhabricatorController.php @@ -316,7 +316,7 @@ abstract class PhabricatorController extends AphrontController { public function getApplicationURI($path = '') { if (!$this->getCurrentApplication()) { - throw new Exception('No application!'); + throw new Exception(pht('No application!')); } return $this->getCurrentApplication()->getApplicationURI($path); } @@ -388,8 +388,8 @@ abstract class PhabricatorController extends AphrontController { if (isset($seen[$hash])) { $seen[] = get_class($response); throw new Exception( - 'Cycle while reducing proxy responses: '. - implode(' -> ', $seen)); + pht('Cycle while reducing proxy responses: %s', + implode(' -> ', $seen))); } $seen[$hash] = get_class($response); diff --git a/src/applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php b/src/applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php index 3791d7462a..560e0c95c4 100644 --- a/src/applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php +++ b/src/applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php @@ -63,7 +63,7 @@ final class PhabricatorAccessControlTestCase extends PhabricatorTestCase { // Test standard defaults. $this->checkAccess( - 'Default', + pht('Default'), id(clone $controller), $request, array( @@ -82,7 +82,7 @@ final class PhabricatorAccessControlTestCase extends PhabricatorTestCase { $env->overrideEnvConfig('auth.require-email-verification', true); $this->checkAccess( - 'Email Verification Required', + pht('Email Verification Required'), id(clone $controller), $request, array( @@ -97,7 +97,7 @@ final class PhabricatorAccessControlTestCase extends PhabricatorTestCase { )); $this->checkAccess( - 'Email Verification Required, With Exception', + pht('Email Verification Required, With Exception'), id(clone $controller)->setConfig('email', false), $request, array( @@ -116,7 +116,7 @@ final class PhabricatorAccessControlTestCase extends PhabricatorTestCase { // Test admin access. $this->checkAccess( - 'Admin Required', + pht('Admin Required'), id(clone $controller)->setConfig('admin', true), $request, array( @@ -134,7 +134,7 @@ final class PhabricatorAccessControlTestCase extends PhabricatorTestCase { // Test disabled access. $this->checkAccess( - 'Allow Disabled', + pht('Allow Disabled'), id(clone $controller)->setConfig('enabled', false), $request, array( @@ -152,7 +152,7 @@ final class PhabricatorAccessControlTestCase extends PhabricatorTestCase { // Test no login required. $this->checkAccess( - 'No Login Required', + pht('No Login Required'), id(clone $controller)->setConfig('login', false), $request, array( @@ -170,7 +170,7 @@ final class PhabricatorAccessControlTestCase extends PhabricatorTestCase { // Test public access. $this->checkAccess( - 'Public Access', + pht('Public Access'), id(clone $controller)->setConfig('public', true), $request, array( @@ -185,7 +185,7 @@ final class PhabricatorAccessControlTestCase extends PhabricatorTestCase { $env->overrideEnvConfig('policy.allow-public', true); $this->checkAccess( - 'Public + configured', + pht('Public + configured'), id(clone $controller)->setConfig('public', true), $request, array( @@ -210,7 +210,7 @@ final class PhabricatorAccessControlTestCase extends PhabricatorTestCase { $app_controller = id(clone $controller)->setCurrentApplication($app); $this->checkAccess( - 'Application Controller', + pht('Application Controller'), $app_controller, $request, array( @@ -225,7 +225,7 @@ final class PhabricatorAccessControlTestCase extends PhabricatorTestCase { )); $this->checkAccess( - 'Application Controller', + pht('Application Controller'), id(clone $app_controller)->setConfig('login', false), $request, array( @@ -259,7 +259,7 @@ final class PhabricatorAccessControlTestCase extends PhabricatorTestCase { $this->assertTrue( ($result === null), - "Expect user '{$uname}' to be allowed access to '{$label}'."); + pht("Expect user '%s' to be allowed access to '%s'.", $uname, $label)); } foreach ($no as $user) { @@ -274,7 +274,7 @@ final class PhabricatorAccessControlTestCase extends PhabricatorTestCase { $this->assertFalse( ($result === null), - "Expect user '{$uname}' to be denied access to '{$label}'."); + pht("Expect user '%s' to be denied access to '%s'.", $uname, $label)); } } diff --git a/src/applications/cache/PhabricatorCaches.php b/src/applications/cache/PhabricatorCaches.php index 4e3af7a6a4..1cddba9fb1 100644 --- a/src/applications/cache/PhabricatorCaches.php +++ b/src/applications/cache/PhabricatorCaches.php @@ -332,7 +332,9 @@ final class PhabricatorCaches { public static function inflateData($value) { if (!function_exists('gzinflate')) { throw new Exception( - pht('gzinflate() is not available; unable to read deflated data!')); + pht( + '%s is not available; unable to read deflated data!', + 'gzinflate()')); } $value = gzinflate($value); diff --git a/src/applications/cache/PhabricatorKeyValueDatabaseCache.php b/src/applications/cache/PhabricatorKeyValueDatabaseCache.php index 5bdf60f660..85bc57f8b7 100644 --- a/src/applications/cache/PhabricatorKeyValueDatabaseCache.php +++ b/src/applications/cache/PhabricatorKeyValueDatabaseCache.php @@ -136,7 +136,7 @@ final class PhabricatorKeyValueDatabaseCache private function willWriteValue($key, $value) { if (!is_string($value)) { - throw new Exception('Only strings may be written to the DB cache!'); + throw new Exception(pht('Only strings may be written to the DB cache!')); } static $can_deflate; @@ -162,7 +162,7 @@ final class PhabricatorKeyValueDatabaseCache case self::CACHE_FORMAT_DEFLATE: return PhabricatorCaches::inflateData($value); default: - throw new Exception('Unknown cache format.'); + throw new Exception(pht('Unknown cache format.')); } } diff --git a/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php b/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php index 2d6de653bc..2523a1e333 100644 --- a/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php +++ b/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php @@ -6,24 +6,24 @@ final class PhabricatorCacheManagementPurgeWorkflow protected function didConstruct() { $this ->setName('purge') - ->setSynopsis('Drop data from caches.') + ->setSynopsis(pht('Drop data from caches.')) ->setArguments( array( array( 'name' => 'purge-all', - 'help' => 'Purge all caches.', + 'help' => pht('Purge all caches.'), ), array( 'name' => 'purge-remarkup', - 'help' => 'Purge the remarkup cache.', + 'help' => pht('Purge the remarkup cache.'), ), array( 'name' => 'purge-changeset', - 'help' => 'Purge the Differential changeset cache.', + 'help' => pht('Purge the Differential changeset cache.'), ), array( 'name' => 'purge-general', - 'help' => 'Purge the general cache.', + 'help' => pht('Purge the general cache.'), ), )); } @@ -46,27 +46,30 @@ final class PhabricatorCacheManagementPurgeWorkflow } throw new PhutilArgumentUsageException( - "Specify which cache or caches to purge, or use '--purge-all'. ". - "Available caches are: ".implode(', ', $list).". Use '--help' ". - "for more information."); + pht( + "Specify which cache or caches to purge, or use '%s'. Available ". + "caches are: %s. Use '%s' for more information.", + '--purge-all', + implode(', ', $list), + '--help')); } if ($purge['remarkup']) { - $console->writeOut('Purging remarkup cache...'); + $console->writeOut(pht('Purging remarkup cache...')); $this->purgeRemarkupCache(); - $console->writeOut("done.\n"); + $console->writeOut("%s\n", pht('Done.')); } if ($purge['changeset']) { - $console->writeOut('Purging changeset cache...'); + $console->writeOut(pht('Purging changeset cache...')); $this->purgeChangesetCache(); - $console->writeOut("done.\n"); + $console->writeOut("%s\n", pht('Done.')); } if ($purge['general']) { - $console->writeOut('Purging general cache...'); + $console->writeOut(pht('Purging general cache...')); $this->purgeGeneralCache(); - $console->writeOut("done.\n"); + $console->writeOut("%s\n", pht('Done.')); } } diff --git a/src/applications/cache/spec/PhabricatorCacheSpec.php b/src/applications/cache/spec/PhabricatorCacheSpec.php index 31645ea97f..1688cb07fd 100644 --- a/src/applications/cache/spec/PhabricatorCacheSpec.php +++ b/src/applications/cache/spec/PhabricatorCacheSpec.php @@ -96,8 +96,8 @@ abstract class PhabricatorCacheSpec extends Phobject { $message = pht( 'The APC or APCu PHP extensions are installed, but not enabled in your '. 'PHP configuration. Enabling these extensions will improve Phabricator '. - 'performance. Edit the "apc.enabled" setting to enable these '. - 'extensions.'); + 'performance. Edit the "%s" setting to enable these extensions.', + 'apc.enabled'); return $this ->newIssue('extension.apc.enabled') diff --git a/src/applications/cache/spec/PhabricatorOpcodeCacheSpec.php b/src/applications/cache/spec/PhabricatorOpcodeCacheSpec.php index dd270fa2a0..c129fb0fa0 100644 --- a/src/applications/cache/spec/PhabricatorOpcodeCacheSpec.php +++ b/src/applications/cache/spec/PhabricatorOpcodeCacheSpec.php @@ -35,14 +35,14 @@ final class PhabricatorOpcodeCacheSpec extends PhabricatorCacheSpec { $slam_defense = ini_get('apc.slam_defense'); if (!$write_lock || $slam_defense) { - $summary = pht( - 'Adjust APC settings to quiet unnecessary errors.'); + $summary = pht('Adjust APC settings to quiet unnecessary errors.'); $message = pht( 'Some versions of APC may emit unnecessary errors into the '. 'error log under the current APC settings. To resolve this, '. - 'enable "apc.write_lock" and disable "apc.slam_defense" in '. - 'your PHP configuration.'); + 'enable "%s" and disable "%s" in your PHP configuration.', + 'apc.write_lock', + 'apc.slam_defense'); $this ->newIssue('extension.apc.write-lock') @@ -58,36 +58,40 @@ final class PhabricatorOpcodeCacheSpec extends PhabricatorCacheSpec { $is_stat_enabled = ini_get('apc.stat'); if ($is_stat_enabled && !$is_dev) { $summary = pht( - '"apc.stat" is currently enabled, but should probably be disabled.'); + '"%s" is currently enabled, but should probably be disabled.', + 'apc.stat'); $message = pht( - 'The "apc.stat" setting is currently enabled in your PHP '. - 'configuration. In production mode, "apc.stat" should be '. - 'disabled. This will improve performance slightly.'); + 'The "%s" setting is currently enabled in your PHP configuration. '. + 'In production mode, "%s" should be disabled. '. + 'This will improve performance slightly.', + 'apc.stat', + 'apc.stat'); $this ->newIssue('extension.apc.stat-enabled') - ->setShortName(pht('"apc.stat" Enabled')) - ->setName(pht('"apc.stat" Enabled in Production')) + ->setShortName(pht('"%s" Enabled', 'apc.stat')) + ->setName(pht('"%s" Enabled in Production', 'apc.stat')) ->setSummary($summary) ->setMessage($message) ->addPHPConfig('apc.stat') ->addPhabricatorConfig('phabricator.developer-mode'); } else if (!$is_stat_enabled && $is_dev) { $summary = pht( - '"apc.stat" is currently disabled, but should probably be enabled.'); + '"%s" is currently disabled, but should probably be enabled.', + 'apc.stat'); $message = pht( - 'The "apc.stat" setting is currently disabled in your PHP '. - 'configuration, but Phabricator is running in development mode. '. - 'This option should normally be enabled in development so you do '. - 'not need to restart your webserver after making changes to the '. - 'code.'); + 'The "%s" setting is currently disabled in your PHP configuration, '. + 'but Phabricator is running in development mode. This option should '. + 'normally be enabled in development so you do not need to restart '. + 'your webserver after making changes to the code.', + 'apc.stat'); $this ->newIssue('extension.apc.stat-disabled') - ->setShortName(pht('"apc.stat" Disabled')) - ->setName(pht('"apc.stat" Disabled in Development')) + ->setShortName(pht('"%s" Disabled', 'apc.stat')) + ->setName(pht('"%s" Disabled in Development', 'apc.stat')) ->setSummary($summary) ->setMessage($message) ->addPHPConfig('apc.stat') @@ -128,8 +132,9 @@ final class PhabricatorOpcodeCacheSpec extends PhabricatorCacheSpec { $message = pht( 'In development, OPcache should be configured to always reload '. 'code so the webserver does not need to be restarted after making '. - 'changes. To do this, enable "opcache.validate_timestamps" and '. - 'set "opcache.revalidate_freq" to 0.'); + 'changes. To do this, enable "%s" and set "%s" to 0.', + 'opcache.validate_timestamps', + 'opcache.revalidate_freq'); $this ->newIssue('extension.opcache.devmode') @@ -141,14 +146,13 @@ final class PhabricatorOpcodeCacheSpec extends PhabricatorCacheSpec { ->addPHPConfig('opcache.revalidate_freq') ->addPhabricatorConfig('phabricator.developer-mode'); } else if (!$is_dev && $validate) { - $summary = pht( - 'OPcache is not configured ideally for production.'); + $summary = pht('OPcache is not configured ideally for production.'); $message = pht( 'In production, OPcache should be configured to never '. 'revalidate code. This will slightly improve performance. '. - 'To do this, disable "opcache.validate_timestamps" in your PHP '. - 'configuration.'); + 'To do this, disable "%s" in your PHP configuration.', + 'opcache.validate_timestamps'); $this ->newIssue('extension.opcache.production') @@ -166,8 +170,9 @@ final class PhabricatorOpcodeCacheSpec extends PhabricatorCacheSpec { $message = pht( 'The PHP "Zend OPcache" extension is installed, but not enabled in '. 'your PHP configuration. Enabling it will dramatically improve '. - 'Phabricator performance. Edit the "opcache.enable" setting to '. - 'enable the extension.'); + 'Phabricator performance. Edit the "%s" setting to '. + 'enable the extension.', + 'opcache.enable'); $this->newIssue('extension.opcache.enable') ->setShortName(pht('OPcache Disabled')) diff --git a/src/applications/calendar/mail/PhabricatorCalendarReplyHandler.php b/src/applications/calendar/mail/PhabricatorCalendarReplyHandler.php index 1d60e1294d..23639f1b89 100644 --- a/src/applications/calendar/mail/PhabricatorCalendarReplyHandler.php +++ b/src/applications/calendar/mail/PhabricatorCalendarReplyHandler.php @@ -5,7 +5,10 @@ final class PhabricatorCalendarReplyHandler public function validateMailReceiver($mail_receiver) { if (!($mail_receiver instanceof PhabricatorCalendarEvent)) { - throw new Exception('Mail receiver is not a PhabricatorCalendarEvent!'); + throw new Exception( + pht( + 'Mail receiver is not a %s!', + 'PhabricatorCalendarEvent')); } } diff --git a/src/applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php b/src/applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php index 40ec7f0aac..3e92a19583 100644 --- a/src/applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php +++ b/src/applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php @@ -12,7 +12,7 @@ final class PhabricatorCalendarHolidayTestCase extends PhabricatorTestCase { parent::willRunTests(); id(new PhabricatorCalendarHoliday()) ->setDay('2012-01-02') - ->setName('International Testing Day') + ->setName(pht('International Testing Day')) ->save(); } @@ -32,7 +32,7 @@ final class PhabricatorCalendarHolidayTestCase extends PhabricatorTestCase { $this->assertEqual( $expect, date('Y-m-d', $actual), - "{$n} business days since '{$date}'"); + pht("%d business days since '%s'", $n, $date)); } } diff --git a/src/applications/calendar/view/AphrontCalendarEventView.php b/src/applications/calendar/view/AphrontCalendarEventView.php index eb80a3ce49..fadf5eb889 100644 --- a/src/applications/calendar/view/AphrontCalendarEventView.php +++ b/src/applications/calendar/view/AphrontCalendarEventView.php @@ -107,7 +107,7 @@ final class AphrontCalendarEventView extends AphrontView { } public function render() { - throw new Exception('Events are only rendered indirectly.'); + throw new Exception(pht('Events are only rendered indirectly.')); } } diff --git a/src/applications/celerity/CelerityResourceMap.php b/src/applications/celerity/CelerityResourceMap.php index 5b0c374dab..7e5e00594b 100644 --- a/src/applications/celerity/CelerityResourceMap.php +++ b/src/applications/celerity/CelerityResourceMap.php @@ -43,7 +43,8 @@ final class CelerityResourceMap { if (empty($resources_list[$name])) { throw new Exception( pht( - 'No resource source exists with name "%s"!', $name)); + 'No resource source exists with name "%s"!', + $name)); } $instance = new CelerityResourceMap($resources_list[$name]); diff --git a/src/applications/celerity/CelerityResourceMapGenerator.php b/src/applications/celerity/CelerityResourceMapGenerator.php index 36092e497e..b9c4ddaa37 100644 --- a/src/applications/celerity/CelerityResourceMapGenerator.php +++ b/src/applications/celerity/CelerityResourceMapGenerator.php @@ -244,7 +244,10 @@ EOFILE; if (count($provides) > 1) { throw new Exception( - pht('Resource "%s" must @provide at most one Celerity target.', $name)); + pht( + 'Resource "%s" must %s at most one Celerity target.', + $name, + '@provide')); } return array(head($provides), $requires); @@ -268,7 +271,9 @@ EOFILE; $cycle = $graph->detectCycles($provides); if ($cycle) { throw new Exception( - pht('Cycle detected in resource graph: %s', implode(' > ', $cycle))); + pht( + 'Cycle detected in resource graph: %s', + implode(' > ', $cycle))); } } } @@ -298,9 +303,10 @@ EOFILE; throw new Exception( pht( 'Package specification for "%s" includes "%s", but that symbol '. - 'is not @provided by any resource.', + 'is not %s by any resource.', $package_name, - $symbol)); + $symbol, + '@provided')); } $resource_name = $reverse_map[$symbol_hash]; diff --git a/src/applications/celerity/CelerityResourceTransformer.php b/src/applications/celerity/CelerityResourceTransformer.php index 72880c8ce3..ebfae6a8d6 100644 --- a/src/applications/celerity/CelerityResourceTransformer.php +++ b/src/applications/celerity/CelerityResourceTransformer.php @@ -332,7 +332,10 @@ final class CelerityResourceTransformer { if (empty($map[$var_name])) { $path = $this->currentPath; throw new Exception( - "CSS file '{$path}' has unknown variable '{$var_name}'."); + pht( + "CSS file '%s' has unknown variable '%s'.", + $path, + $var_name)); } return $map[$var_name]; diff --git a/src/applications/celerity/CeleritySpriteGenerator.php b/src/applications/celerity/CeleritySpriteGenerator.php index a42fbfa4db..e25e1050a6 100644 --- a/src/applications/celerity/CeleritySpriteGenerator.php +++ b/src/applications/celerity/CeleritySpriteGenerator.php @@ -223,8 +223,11 @@ final class CeleritySpriteGenerator { foreach ($images as $image) { if (!preg_match('/\.png$/', $image)) { throw new Exception( - "Expected file '{$image}' in '{$path}' to be a sprite source ". - "ending in '.png'."); + pht( + "Expected file '%s' in '%s' to be a sprite source ending in '%s'.", + $image, + $path, + '.png')); } $result[] = substr($image, 0, -4); } diff --git a/src/applications/celerity/CelerityStaticResourceResponse.php b/src/applications/celerity/CelerityStaticResourceResponse.php index 7864515e11..cfb586602e 100644 --- a/src/applications/celerity/CelerityStaticResourceResponse.php +++ b/src/applications/celerity/CelerityStaticResourceResponse.php @@ -244,10 +244,15 @@ final class CelerityStaticResourceResponse { public static function renderInlineScript($data) { if (stripos($data, '') !== false) { throw new Exception( - 'Literal is not allowed inside inline script.'); + pht( + 'Literal %s is not allowed inside inline script.', + '')); } if (strpos($data, ' because it is ignored by HTML parsers. We // would need to send the document with XHTML content type. diff --git a/src/applications/celerity/controller/CelerityResourceController.php b/src/applications/celerity/controller/CelerityResourceController.php index c91f9297c4..717e20f9f9 100644 --- a/src/applications/celerity/controller/CelerityResourceController.php +++ b/src/applications/celerity/controller/CelerityResourceController.php @@ -35,7 +35,7 @@ abstract class CelerityResourceController extends PhabricatorController { $type_map = self::getSupportedResourceTypes(); if (empty($type_map[$type])) { - throw new Exception('Only static resources may be served.'); + throw new Exception(pht('Only static resources may be served.')); } $dev_mode = PhabricatorEnv::getEnvConfig('phabricator.developer-mode'); diff --git a/src/applications/chatlog/conduit/ChatLogQueryConduitAPIMethod.php b/src/applications/chatlog/conduit/ChatLogQueryConduitAPIMethod.php index 8270ced921..434a4671e6 100644 --- a/src/applications/chatlog/conduit/ChatLogQueryConduitAPIMethod.php +++ b/src/applications/chatlog/conduit/ChatLogQueryConduitAPIMethod.php @@ -11,7 +11,7 @@ final class ChatLogQueryConduitAPIMethod extends ChatLogConduitAPIMethod { } public function getMethodDescription() { - return 'Retrieve chatter.'; + return pht('Retrieve chatter.'); } protected function defineParamTypes() { diff --git a/src/applications/chatlog/conduit/ChatLogRecordConduitAPIMethod.php b/src/applications/chatlog/conduit/ChatLogRecordConduitAPIMethod.php index ca94b91dcc..fe972222ae 100644 --- a/src/applications/chatlog/conduit/ChatLogRecordConduitAPIMethod.php +++ b/src/applications/chatlog/conduit/ChatLogRecordConduitAPIMethod.php @@ -11,7 +11,7 @@ final class ChatLogRecordConduitAPIMethod extends ChatLogConduitAPIMethod { } public function getMethodDescription() { - return 'Record chatter.'; + return pht('Record chatter.'); } protected function defineParamTypes() { diff --git a/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php b/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php index c557b2bc2f..3b4892bfe8 100644 --- a/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php +++ b/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php @@ -12,8 +12,8 @@ final class PhabricatorChatLogChannelListController $user = $request->getUser(); $channels = id(new PhabricatorChatLogChannelQuery()) - ->setViewer($user) - ->execute(); + ->setViewer($user) + ->execute(); $list = new PHUIObjectItemListView(); foreach ($channels as $channel) { diff --git a/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php b/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php index c7d2dc990e..327024562a 100644 --- a/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php +++ b/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php @@ -29,9 +29,9 @@ final class PhabricatorChatLogChannelLogController ->withChannelIDs(array($this->channelID)); $channel = id(new PhabricatorChatLogChannelQuery()) - ->setViewer($user) - ->withIDs(array($this->channelID)) - ->executeOne(); + ->setViewer($user) + ->withIDs(array($this->channelID)) + ->executeOne(); if (!$channel) { return new Aphront404Response(); diff --git a/src/applications/conduit/call/__tests__/ConduitCallTestCase.php b/src/applications/conduit/call/__tests__/ConduitCallTestCase.php index a5cc190d68..b62ddcef1a 100644 --- a/src/applications/conduit/call/__tests__/ConduitCallTestCase.php +++ b/src/applications/conduit/call/__tests__/ConduitCallTestCase.php @@ -21,6 +21,8 @@ final class ConduitCallTestCase extends PhabricatorTestCase { $this->assertTrue( ($caught instanceof ConduitException), - 'user.whoami should require authentication'); + pht( + '%s should require authentication.', + 'user.whoami')); } } diff --git a/src/applications/conduit/controller/PhabricatorConduitAPIController.php b/src/applications/conduit/controller/PhabricatorConduitAPIController.php index cdc14da27d..cee47949d2 100644 --- a/src/applications/conduit/controller/PhabricatorConduitAPIController.php +++ b/src/applications/conduit/controller/PhabricatorConduitAPIController.php @@ -176,11 +176,14 @@ final class PhabricatorConduitAPIController $config_key = 'security.allow-conduit-act-as-user'; if (!PhabricatorEnv::getEnvConfig($config_key)) { - throw new Exception('security.allow-conduit-act-as-user is disabled'); + throw new Exception(pht('%s is disabled.', $config_key)); } if (!$api_request->getUser()->getIsAdmin()) { - throw new Exception('Only administrators can use actAsUser'); + throw new Exception( + pht( + 'Only administrators can use %s.', + __FUNCTION__)); } $user = id(new PhabricatorUser())->loadOneWhere( @@ -189,8 +192,10 @@ final class PhabricatorConduitAPIController if (!$user) { throw new Exception( - "The actAsUser username '{$user_name}' is not a valid user." - ); + pht( + "The %s username '%s' is not a valid user.", + __FUNCTION__, + $user_name)); } $api_request->setUser($user); @@ -224,7 +229,8 @@ final class PhabricatorConduitAPIController return array( 'ERR-INVALID-AUTH', pht( - 'Request is missing required "auth.host" parameter.'), + 'Request is missing required "%s" parameter.', + 'auth.host'), ); } @@ -266,8 +272,7 @@ final class PhabricatorConduitAPIController if (!$stored_key) { return array( 'ERR-INVALID-AUTH', - pht( - 'No user or device is associated with that public key.'), + pht('No user or device is associated with that public key.'), ); } @@ -311,7 +316,8 @@ final class PhabricatorConduitAPIController return array( 'ERR-INVALID-AUTH', pht( - 'Provided "auth.type" ("%s") is not recognized.', + 'Provided "%s" ("%s") is not recognized.', + 'auth.type', $auth_type), ); } @@ -405,8 +411,7 @@ final class PhabricatorConduitAPIController if (!($user instanceof PhabricatorUser)) { return array( 'ERR-INVALID-AUTH', - pht( - 'API token is not associated with a valid user.'), + pht('API token is not associated with a valid user.'), ); } @@ -421,12 +426,11 @@ final class PhabricatorConduitAPIController if ($access_token && $method_scope != PhabricatorOAuthServerScope::SCOPE_NOT_ACCESSIBLE) { $token = id(new PhabricatorOAuthServerAccessToken()) - ->loadOneWhere('token = %s', - $access_token); + ->loadOneWhere('token = %s', $access_token); if (!$token) { return array( 'ERR-INVALID-AUTH', - 'Access token does not exist.', + pht('Access token does not exist.'), ); } @@ -436,19 +440,18 @@ final class PhabricatorConduitAPIController if (!$valid) { return array( 'ERR-INVALID-AUTH', - 'Access token is invalid.', + pht('Access token is invalid.'), ); } // valid token, so let's log in the user! $user_phid = $token->getUserPHID(); $user = id(new PhabricatorUser()) - ->loadOneWhere('phid = %s', - $user_phid); + ->loadOneWhere('phid = %s', $user_phid); if (!$user) { return array( 'ERR-INVALID-AUTH', - 'Access token is for invalid user.', + pht('Access token is for invalid user.'), ); } return $this->validateAuthenticatedUser( @@ -467,7 +470,7 @@ final class PhabricatorConduitAPIController if (!$user) { return array( 'ERR-INVALID-AUTH', - 'Authentication is invalid.', + pht('Authentication is invalid.'), ); } $token = idx($metadata, 'authToken'); @@ -476,7 +479,7 @@ final class PhabricatorConduitAPIController if (sha1($token.$certificate) !== $signature) { return array( 'ERR-INVALID-AUTH', - 'Authentication is invalid.', + pht('Authentication is invalid.'), ); } return $this->validateAuthenticatedUser( @@ -491,7 +494,7 @@ final class PhabricatorConduitAPIController if (!$session_key) { return array( 'ERR-INVALID-SESSION', - 'Session key is not present.', + pht('Session key is not present.'), ); } @@ -501,7 +504,7 @@ final class PhabricatorConduitAPIController if (!$user) { return array( 'ERR-INVALID-SESSION', - 'Session key is invalid.', + pht('Session key is invalid.'), ); } @@ -642,10 +645,13 @@ final class PhabricatorConduitAPIController // actually do type checking, it might be reasonable to treat it as // a string if the parameter type is string. throw new Exception( - "The value for parameter '{$key}' is not valid JSON. All ". - "parameters must be encoded as JSON values, including strings ". - "(which means you need to surround them in double quotes). ". - "Check your syntax. Value was: {$value}"); + pht( + "The value for parameter '%s' is not valid JSON. All ". + "parameters must be encoded as JSON values, including strings ". + "(which means you need to surround them in double quotes). ". + "Check your syntax. Value was: %s.", + $key, + $value)); } $params[$key] = $decoded_value; } @@ -666,7 +672,7 @@ final class PhabricatorConduitAPIController } catch (PhutilJSONParserException $ex) { throw new PhutilProxyException( pht( - "Invalid parameter information was passed to method '%s'", + "Invalid parameter information was passed to method '%s'.", $method), $ex); } diff --git a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php index 5c0ccfe6fb..73e32b49f3 100644 --- a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php +++ b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php @@ -46,7 +46,8 @@ final class PhabricatorConduitConsoleController ->appendRemarkupInstructions( pht( 'Enter parameters using **JSON**. For instance, to enter a '. - 'list, type: `["apple", "banana", "cherry"]`')); + 'list, type: `%s`', + '["apple", "banana", "cherry"]')); $params = $method->getParamTypes(); foreach ($params as $param => $desc) { @@ -67,12 +68,12 @@ final class PhabricatorConduitConsoleController $form ->appendChild( id(new AphrontFormSelectControl()) - ->setLabel('Output Format') + ->setLabel(pht('Output Format')) ->setName('output') ->setOptions( array( - 'human' => 'Human Readable', - 'json' => 'JSON', + 'human' => pht('Human Readable'), + 'json' => pht('JSON'), ))) ->appendChild( id(new AphrontFormSubmitControl()) diff --git a/src/applications/conduit/controller/PhabricatorConduitLogController.php b/src/applications/conduit/controller/PhabricatorConduitLogController.php index d8da592372..2effa1815b 100644 --- a/src/applications/conduit/controller/PhabricatorConduitLogController.php +++ b/src/applications/conduit/controller/PhabricatorConduitLogController.php @@ -69,7 +69,7 @@ final class PhabricatorConduitLogController $conn = idx($conns, $call->getConnectionID()); if ($conn) { $name = $conn->getUserName(); - $client = ' (via '.$conn->getClient().')'; + $client = ' '.pht('(via %s)', $conn->getClient()); } else { $name = null; $client = null; @@ -98,7 +98,7 @@ final class PhabricatorConduitLogController array($call->getMethod(), $client), $status, $call->getError(), - number_format($call->getDuration()).' us', + pht('%d us', number_format($call->getDuration())), phabricator_datetime($call->getDateCreated(), $viewer), ); } diff --git a/src/applications/conduit/method/ConduitAPIMethod.php b/src/applications/conduit/method/ConduitAPIMethod.php index f6d464cfc5..0643ca72d1 100644 --- a/src/applications/conduit/method/ConduitAPIMethod.php +++ b/src/applications/conduit/method/ConduitAPIMethod.php @@ -78,7 +78,7 @@ abstract class ConduitAPIMethod } public function getErrorDescription($error_code) { - return idx($this->getErrorTypes(), $error_code, 'Unknown Error'); + return idx($this->getErrorTypes(), $error_code, pht('Unknown Error')); } public function getRequiredScope() { @@ -134,9 +134,12 @@ abstract class ConduitAPIMethod $orig_class = get_class($method_map[$name]); $this_class = get_class($method); throw new Exception( - "Two Conduit API method classes ({$orig_class}, {$this_class}) ". - "both have the same method name ({$name}). API methods ". - "must have unique method names."); + pht( + 'Two Conduit API method classes (%s, %s) both have the same '. + 'method name (%s). API methods must have unique method names.', + $orig_class, + $this_class, + $name)); } } diff --git a/src/applications/conduit/method/ConduitConnectConduitAPIMethod.php b/src/applications/conduit/method/ConduitConnectConduitAPIMethod.php index 12f08f8636..a6ec09ae09 100644 --- a/src/applications/conduit/method/ConduitConnectConduitAPIMethod.php +++ b/src/applications/conduit/method/ConduitConnectConduitAPIMethod.php @@ -15,7 +15,7 @@ final class ConduitConnectConduitAPIMethod extends ConduitAPIMethod { } public function getMethodDescription() { - return 'Connect a session-based client.'; + return pht('Connect a session-based client.'); } protected function defineParamTypes() { @@ -36,22 +36,21 @@ final class ConduitConnectConduitAPIMethod extends ConduitAPIMethod { protected function defineErrorTypes() { return array( - 'ERR-BAD-VERSION' => + 'ERR-BAD-VERSION' => pht( 'Client/server version mismatch. Upgrade your server or downgrade '. - 'your client.', - 'NEW-ARC-VERSION' => - 'Client/server version mismatch. Upgrade your client.', - 'ERR-UNKNOWN-CLIENT' => - 'Client is unknown.', - 'ERR-INVALID-USER' => - 'The username you are attempting to authenticate with is not valid.', - 'ERR-INVALID-CERTIFICATE' => - 'Your authentication certificate for this server is invalid.', - 'ERR-INVALID-TOKEN' => + 'your client.'), + 'NEW-ARC-VERSION' => pht( + 'Client/server version mismatch. Upgrade your client.'), + 'ERR-UNKNOWN-CLIENT' => pht('Client is unknown.'), + 'ERR-INVALID-USER' => pht( + 'The username you are attempting to authenticate with is not valid.'), + 'ERR-INVALID-CERTIFICATE' => pht( + 'Your authentication certificate for this server is invalid.'), + 'ERR-INVALID-TOKEN' => pht( "The challenge token you are authenticating with is outside of the ". "allowed time range. Either your system clock is out of whack or ". - "you're executing a replay attack.", - 'ERR-NO-CERTIFICATE' => 'This server requires authentication.', + "you're executing a replay attack."), + 'ERR-NO-CERTIFICATE' => pht('This server requires authentication.'), ); } @@ -87,16 +86,21 @@ final class ConduitConnectConduitAPIMethod extends ConduitAPIMethod { if ($server_version < $client_version) { $ex = new ConduitException('ERR-BAD-VERSION'); $ex->setErrorDescription( - "Your 'arc' client version is '{$client_version}', which ". - "is newer than the server version, '{$server_version}'. ". - "Upgrade your Phabricator install."); + pht( + "Your '%s' client version is '%d', which is newer than the ". + "server version, '%d'. Upgrade your Phabricator install.", + 'arc', + $client_version, + $server_version)); } else { $ex = new ConduitException('NEW-ARC-VERSION'); $ex->setErrorDescription( - "A new version of arc is available! You need to upgrade ". - "to connect to this server (you are running version ". - "{$client_version}, the server is running version ". - "{$server_version})."); + pht( + 'A new version of arc is available! You need to upgrade '. + 'to connect to this server (you are running version '. + '%d, the server is running version %d).', + $client_version, + $server_version)); } throw $ex; } diff --git a/src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php b/src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php index be14610796..6248b5a6ba 100644 --- a/src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php +++ b/src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php @@ -16,7 +16,7 @@ final class ConduitGetCertificateConduitAPIMethod extends ConduitAPIMethod { } public function getMethodDescription() { - return 'Retrieve certificate information for a user.'; + return pht('Retrieve certificate information for a user.'); } protected function defineParamTypes() { @@ -32,10 +32,10 @@ final class ConduitGetCertificateConduitAPIMethod extends ConduitAPIMethod { protected function defineErrorTypes() { return array( - 'ERR-BAD-TOKEN' => 'Token does not exist or has expired.', - 'ERR-RATE-LIMIT' => + 'ERR-BAD-TOKEN' => pht('Token does not exist or has expired.'), + 'ERR-RATE-LIMIT' => pht( 'You have made too many invalid token requests recently. Wait before '. - 'making more.', + 'making more.'), ); } @@ -69,7 +69,7 @@ final class ConduitGetCertificateConduitAPIMethod extends ConduitAPIMethod { 'phid = %s', $info->getUserPHID()); if (!$user) { - throw new Exception('Certificate token points to an invalid user!'); + throw new Exception(pht('Certificate token points to an invalid user!')); } return array( diff --git a/src/applications/conduit/method/ConduitPingConduitAPIMethod.php b/src/applications/conduit/method/ConduitPingConduitAPIMethod.php index f3c502defa..9e0c1d4ff5 100644 --- a/src/applications/conduit/method/ConduitPingConduitAPIMethod.php +++ b/src/applications/conduit/method/ConduitPingConduitAPIMethod.php @@ -11,7 +11,7 @@ final class ConduitPingConduitAPIMethod extends ConduitAPIMethod { } public function getMethodDescription() { - return 'Basic ping for monitoring or a health-check.'; + return pht('Basic ping for monitoring or a health-check.'); } protected function defineParamTypes() { diff --git a/src/applications/conduit/method/ConduitQueryConduitAPIMethod.php b/src/applications/conduit/method/ConduitQueryConduitAPIMethod.php index f5162a04fc..6cd9283b4c 100644 --- a/src/applications/conduit/method/ConduitQueryConduitAPIMethod.php +++ b/src/applications/conduit/method/ConduitQueryConduitAPIMethod.php @@ -7,7 +7,7 @@ final class ConduitQueryConduitAPIMethod extends ConduitAPIMethod { } public function getMethodDescription() { - return 'Returns the parameters of the Conduit methods.'; + return pht('Returns the parameters of the Conduit methods.'); } protected function defineParamTypes() { diff --git a/src/applications/conduit/protocol/ConduitAPIRequest.php b/src/applications/conduit/protocol/ConduitAPIRequest.php index 7e5a8ae515..fe8af34b65 100644 --- a/src/applications/conduit/protocol/ConduitAPIRequest.php +++ b/src/applications/conduit/protocol/ConduitAPIRequest.php @@ -36,9 +36,10 @@ final class ConduitAPIRequest { public function getUser() { if (!$this->user) { throw new Exception( - 'You can not access the user inside the implementation of a Conduit '. - 'method which does not require authentication (as per '. - 'shouldRequireAuthentication()).'); + pht( + 'You can not access the user inside the implementation of a Conduit '. + 'method which does not require authentication (as per %s).', + 'shouldRequireAuthentication()')); } return $this->user; } diff --git a/src/applications/conduit/query/PhabricatorConduitSearchEngine.php b/src/applications/conduit/query/PhabricatorConduitSearchEngine.php index 0ed7a95b44..eece3e5c17 100644 --- a/src/applications/conduit/query/PhabricatorConduitSearchEngine.php +++ b/src/applications/conduit/query/PhabricatorConduitSearchEngine.php @@ -58,7 +58,7 @@ final class PhabricatorConduitSearchEngine $form ->appendChild( id(new AphrontFormTextControl()) - ->setLabel('Name Contains') + ->setLabel(pht('Name Contains')) ->setName('nameContains') ->setValue($saved->getParameter('nameContains'))); @@ -66,12 +66,13 @@ final class PhabricatorConduitSearchEngine $form ->appendChild( id(new AphrontFormTextControl()) - ->setLabel('Applications') + ->setLabel(pht('Applications')) ->setName('applicationNames') ->setValue(implode(', ', $names)) - ->setCaption(pht( - 'Example: %s', - phutil_tag('tt', array(), 'differential, paste')))); + ->setCaption( + pht( + 'Example: %s', + phutil_tag('tt', array(), 'differential, paste')))); $is_stable = $saved->getParameter('isStable'); $is_unstable = $saved->getParameter('isUnstable'); diff --git a/src/applications/conduit/ssh/ConduitSSHWorkflow.php b/src/applications/conduit/ssh/ConduitSSHWorkflow.php index aed7004d7e..6589fac324 100644 --- a/src/applications/conduit/ssh/ConduitSSHWorkflow.php +++ b/src/applications/conduit/ssh/ConduitSSHWorkflow.php @@ -18,9 +18,9 @@ final class ConduitSSHWorkflow extends PhabricatorSSHWorkflow { $methodv = $args->getArg('method'); if (!$methodv) { - throw new Exception('No Conduit method provided.'); + throw new Exception(pht('No Conduit method provided.')); } else if (count($methodv) > 1) { - throw new Exception('Too many Conduit methods provided.'); + throw new Exception(pht('Too many Conduit methods provided.')); } $method = head($methodv); diff --git a/src/applications/config/check/PhabricatorAuthSetupCheck.php b/src/applications/config/check/PhabricatorAuthSetupCheck.php index 5d4f731867..0295a85b2d 100644 --- a/src/applications/config/check/PhabricatorAuthSetupCheck.php +++ b/src/applications/config/check/PhabricatorAuthSetupCheck.php @@ -27,13 +27,8 @@ final class PhabricatorAuthSetupCheck extends PhabricatorSetupCheck { 'You have not configured any authentication providers yet. You '. 'should add a provider (like username/password, LDAP, or GitHub '. 'OAuth) so users can register and log in. You can add and configure '. - 'providers %s.', - phutil_tag( - 'a', - array( - 'href' => '/auth/', - ), - pht('using the "Auth" application'))); + 'providers using the [[%s | "Auth" application]].', + '/auth/'); $this ->newIssue('auth.noproviders') diff --git a/src/applications/config/check/PhabricatorBinariesSetupCheck.php b/src/applications/config/check/PhabricatorBinariesSetupCheck.php index 87887d4a96..59dc3a78ab 100644 --- a/src/applications/config/check/PhabricatorBinariesSetupCheck.php +++ b/src/applications/config/check/PhabricatorBinariesSetupCheck.php @@ -7,7 +7,6 @@ final class PhabricatorBinariesSetupCheck extends PhabricatorSetupCheck { } protected function executeChecks() { - if (phutil_is_windows()) { $bin_name = 'where'; } else { @@ -28,8 +27,9 @@ final class PhabricatorBinariesSetupCheck extends PhabricatorSetupCheck { if (!Filesystem::binaryExists('diff')) { $message = pht( - "Without 'diff', Phabricator will not be able to generate or render ". - "diffs in multiple applications."); + "Without '%s', Phabricator will not be able to generate or render ". + "diffs in multiple applications.", + 'diff'); $this->raiseWarning('diff', $message); } else { $tmp_a = new TempFile(); @@ -43,12 +43,13 @@ final class PhabricatorBinariesSetupCheck extends PhabricatorSetupCheck { list($err) = exec_manual('diff %s %s', $tmp_a, $tmp_b); if ($err) { $this->newIssue('bin.diff.same') - ->setName(pht("Unexpected 'diff' Behavior")) + ->setName(pht("Unexpected '%s' Behavior", 'diff')) ->setMessage( pht( - "The 'diff' binary on this system has unexpected behavior: ". + "The '%s' binary on this system has unexpected behavior: ". "it was expected to exit without an error code when passed ". "identical files, but exited with code %d.", + 'diff', $err)); } @@ -58,9 +59,10 @@ final class PhabricatorBinariesSetupCheck extends PhabricatorSetupCheck { ->setName(pht("Unexpected 'diff' Behavior")) ->setMessage( pht( - "The 'diff' binary on this system has unexpected behavior: ". + "The '%s' binary on this system has unexpected behavior: ". "it was expected to exit with a nonzero error code when passed ". - "differing files, but did not.")); + "differing files, but did not.", + 'diff')); } } @@ -249,7 +251,6 @@ final class PhabricatorBinariesSetupCheck extends PhabricatorSetupCheck { } private function raiseBadVersionWarning($binary, $bad_version) { - switch ($binary) { case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: break; diff --git a/src/applications/config/check/PhabricatorDaemonsSetupCheck.php b/src/applications/config/check/PhabricatorDaemonsSetupCheck.php index a6b9ef8488..3b4b335134 100644 --- a/src/applications/config/check/PhabricatorDaemonsSetupCheck.php +++ b/src/applications/config/check/PhabricatorDaemonsSetupCheck.php @@ -16,8 +16,7 @@ final class PhabricatorDaemonsSetupCheck extends PhabricatorSetupCheck { ->execute(); if (!$task_daemon) { - $doc_href = PhabricatorEnv::getDocLink( - 'Managing Daemons with phd'); + $doc_href = PhabricatorEnv::getDocLink('Managing Daemons with phd'); $summary = pht( 'You must start the Phabricator daemons to send email, rebuild '. @@ -57,24 +56,29 @@ final class PhabricatorDaemonsSetupCheck extends PhabricatorSetupCheck { if ($phd_user) { if ($daemon->getRunningAsUser() != $phd_user) { - $doc_href = PhabricatorEnv::getDocLink( - 'Managing Daemons with phd'); + $doc_href = PhabricatorEnv::getDocLink('Managing Daemons with phd'); $summary = pht( 'At least one daemon is currently running as a different '. - 'user than configured in the Phabricator phd.user setting'); + 'user than configured in the Phabricator %s setting', + 'phd.user'); $message = pht( 'A daemon is running as user %s while the Phabricator config '. - 'specifies phd.user to be %s.'. + 'specifies %s to be %s.'. "\n\n". - 'Either adjust phd.user to match %s or start '. + 'Either adjust %s to match %s or start '. 'the daemons as the correct user. '. "\n\n". - 'phd Daemons will try to '. - 'use sudo to start as the configured user. '. - 'Make sure that the user who starts phd has the correct '. - 'sudo permissions to start phd daemons as %s', + '%s Daemons will try to use %s to start as the configured user. '. + 'Make sure that the user who starts %s has the correct '. + 'sudo permissions to start %s daemons as %s', + 'phd.user', + 'phd.user', + 'phd', + 'sudo', + 'phd', + 'phd', phutil_tag('tt', array(), $daemon->getRunningAsUser()), phutil_tag('tt', array(), $phd_user), phutil_tag('tt', array(), $daemon->getRunningAsUser()), diff --git a/src/applications/config/check/PhabricatorDatabaseSetupCheck.php b/src/applications/config/check/PhabricatorDatabaseSetupCheck.php index 3f7af1bdb4..4ee0a75c6f 100644 --- a/src/applications/config/check/PhabricatorDatabaseSetupCheck.php +++ b/src/applications/config/check/PhabricatorDatabaseSetupCheck.php @@ -79,8 +79,8 @@ final class PhabricatorDatabaseSetupCheck extends PhabricatorSetupCheck { if (empty($databases[$namespace.'_meta_data'])) { $message = pht( - 'Run the storage upgrade script to setup Phabricator\'s database '. - 'schema.'); + "Run the storage upgrade script to setup Phabricator's database ". + "schema."); $this->newIssue('storage.upgrade') ->setName(pht('Setup MySQL Schema')) @@ -103,10 +103,11 @@ final class PhabricatorDatabaseSetupCheck extends PhabricatorSetupCheck { if ($diff) { $this->newIssue('storage.patch') ->setName(pht('Upgrade MySQL Schema')) - ->setMessage(pht( - "Run the storage upgrade script to upgrade Phabricator's database ". - "schema. Missing patches:
%s
", - phutil_implode_html(phutil_tag('br'), array_keys($diff)))) + ->setMessage( + pht( + "Run the storage upgrade script to upgrade Phabricator's ". + "database schema. Missing patches:
%s
", + phutil_implode_html(phutil_tag('br'), array_keys($diff)))) ->addCommand( hsprintf('phabricator/ $ ./bin/storage upgrade')); } @@ -123,13 +124,15 @@ final class PhabricatorDatabaseSetupCheck extends PhabricatorSetupCheck { ->setName(pht('Deprecated mysql.host Format')) ->setSummary( pht( - 'Move port information from `mysql.host` to `mysql.port` in your '. - 'config.')) + 'Move port information from `%s` to `%s` in your config.', + 'mysql.host', + 'mysql.port')) ->setMessage( pht( - 'Your `mysql.host` configuration contains a port number, but '. - 'this usage is deprecated. Instead, put the port number in '. - '`mysql.port`.')) + 'Your `%s` configuration contains a port number, but this usage '. + 'is deprecated. Instead, put the port number in `%s`.', + 'mysql.host', + 'mysql.port')) ->addPhabricatorConfig('mysql.host') ->addPhabricatorConfig('mysql.port') ->addCommand( diff --git a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php index a88dff0f22..b3c294b3e6 100644 --- a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php +++ b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php @@ -147,8 +147,9 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck { $markup_reason = pht( 'Custom remarkup rules are now added by subclassing '. - 'PhabricatorRemarkupCustomInlineRule or '. - 'PhabricatorRemarkupCustomBlockRule.'); + '%s or %s.', + 'PhabricatorRemarkupCustomInlineRule', + 'PhabricatorRemarkupCustomBlockRule'); $session_reason = pht( 'Sessions now expire and are garbage collected rather than having an '. @@ -178,24 +179,26 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck { $ancient_config += array( 'phid.external-loaders' => pht( - 'External loaders have been replaced. Extend `PhabricatorPHIDType` '. - 'to implement new PHID and handle types.'), + 'External loaders have been replaced. Extend `%s` '. + 'to implement new PHID and handle types.', + 'PhabricatorPHIDType'), 'maniphest.custom-task-extensions-class' => pht( - 'Maniphest fields are now loaded automatically. You can configure '. - 'them with `maniphest.fields`.'), + 'Maniphest fields are now loaded automatically. '. + 'You can configure them with `%s`.', + 'maniphest.fields'), 'maniphest.custom-fields' => pht( - 'Maniphest fields are now defined in '. - '`maniphest.custom-field-definitions`. Existing definitions have '. - 'been migrated.'), + 'Maniphest fields are now defined in `%s`. '. + 'Existing definitions have been migrated.', + 'maniphest.custom-field-definitions'), 'differential.custom-remarkup-rules' => $markup_reason, 'differential.custom-remarkup-block-rules' => $markup_reason, 'auth.sshkeys.enabled' => pht( 'SSH keys are now actually useful, so they are always enabled.'), 'differential.anonymous-access' => pht( - 'Phabricator now has meaningful global access controls. See '. - '`policy.allow-public`.'), + 'Phabricator now has meaningful global access controls. See `%s`.', + 'policy.allow-public'), 'celerity.resource-path' => pht( 'An alternate resource map is no longer supported. Instead, use '. 'multiple maps. See T4222.'), @@ -211,9 +214,10 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck { 'differential.show-test-plan-field' => $differential_field_reason, 'differential.field-selector' => $differential_field_reason, 'phabricator.show-beta-applications' => pht( - 'This option has been renamed to `phabricator.show-prototypes` '. - 'to emphasize the unfinished nature of many prototype applications. '. - 'Your existing setting has been migrated.'), + 'This option has been renamed to `%s` to emphasize the '. + 'unfinished nature of many prototype applications. '. + 'Your existing setting has been migrated.', + 'phabricator.show-prototypes'), 'notification.user' => pht( 'The notification server no longer requires root permissions. Start '. 'the server as the user you want it to run under.'), @@ -223,10 +227,12 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck { 'The translation implementation has changed and providers are no '. 'longer used or supported.'), 'config.mask' => pht( - 'Use `config.hide` instead of this option.'), + 'Use `%s` instead of this option.', + 'config.hide'), 'phd.start-taskmasters' => pht( 'Taskmasters now use an autoscaling pool. You can configure the '. - 'pool size with `phd.taskmasters`.'), + 'pool size with `%s`.', + 'phd.taskmasters'), 'storage.engine-selector' => pht( 'Phabricator now automatically discovers available storage engines '. 'at runtime.'), @@ -234,8 +240,8 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck { 'Phabricator now supports arbitrarily large files. Consult the '. 'documentation for configuration details.'), 'security.allow-outbound-http' => pht( - 'This option has been replaced with the more granular option '. - '`security.outbound-blacklist`.'), + 'This option has been replaced with the more granular option `%s`.', + 'security.outbound-blacklist'), 'metamta.reply.show-hints' => pht( 'Phabricator no longer shows reply hints in mail.'), diff --git a/src/applications/config/check/PhabricatorFileinfoSetupCheck.php b/src/applications/config/check/PhabricatorFileinfoSetupCheck.php index 4f5013c033..543fc4fb7c 100644 --- a/src/applications/config/check/PhabricatorFileinfoSetupCheck.php +++ b/src/applications/config/check/PhabricatorFileinfoSetupCheck.php @@ -9,12 +9,14 @@ final class PhabricatorFileinfoSetupCheck extends PhabricatorSetupCheck { protected function executeChecks() { if (!extension_loaded('fileinfo')) { $message = pht( - "The 'fileinfo' extension is not installed. Without 'fileinfo', ". + "The '%s' extension is not installed. Without '%s', ". "support, Phabricator may not be able to determine the MIME types ". - "of uploaded files."); + "of uploaded files.", + 'fileinfo', + 'fileinfo'); $this->newIssue('extension.fileinfo') - ->setName(pht("Missing 'fileinfo' Extension")) + ->setName(pht("Missing '%s' Extension", 'fileinfo')) ->setMessage($message); } } diff --git a/src/applications/config/check/PhabricatorGDSetupCheck.php b/src/applications/config/check/PhabricatorGDSetupCheck.php index f738715bce..750702c706 100644 --- a/src/applications/config/check/PhabricatorGDSetupCheck.php +++ b/src/applications/config/check/PhabricatorGDSetupCheck.php @@ -9,12 +9,15 @@ final class PhabricatorGDSetupCheck extends PhabricatorSetupCheck { protected function executeChecks() { if (!extension_loaded('gd')) { $message = pht( - "The 'gd' extension is not installed. Without 'gd', support, ". + "The '%s' extension is not installed. Without '%s', support, ". "Phabricator will not be able to process or resize images ". - "(for example, to generate thumbnails). Install or enable 'gd'."); + "(for example, to generate thumbnails). Install or enable '%s'.", + 'gd', + 'gd', + 'gd'); $this->newIssue('extension.gd') - ->setName(pht("Missing 'gd' Extension")) + ->setName(pht("Missing '%s' Extension", 'gd')) ->setMessage($message); } else { $image_type_map = array( @@ -36,15 +39,17 @@ final class PhabricatorGDSetupCheck extends PhabricatorSetupCheck { $have = implode(', ', $have); $message = pht( - "The 'gd' extension has support for only some image types. ". + "The '%s' extension has support for only some image types. ". "Phabricator will be unable to process images of the missing ". - "types until you build 'gd' with support for them. ". + "types until you build '%s' with support for them. ". "Supported types: %s. Missing types: %s.", + 'gd', + 'gd', $have, $missing); $this->newIssue('extension.gd.support') - ->setName(pht("Partial 'gd' Support")) + ->setName(pht("Partial '%s' Support", 'gd')) ->setMessage($message); } } diff --git a/src/applications/config/check/PhabricatorImagemagickSetupCheck.php b/src/applications/config/check/PhabricatorImagemagickSetupCheck.php index 55c538f3a2..a69781132e 100644 --- a/src/applications/config/check/PhabricatorImagemagickSetupCheck.php +++ b/src/applications/config/check/PhabricatorImagemagickSetupCheck.php @@ -11,13 +11,15 @@ final class PhabricatorImagemagickSetupCheck extends PhabricatorSetupCheck { if ($imagemagick) { if (!Filesystem::binaryExists('convert')) { $message = pht( - 'You have enabled Imagemagick in your config, but the \'convert\' '. - 'binary is not in the webserver\'s $PATH. Disable imagemagick '. - 'or make it available to the webserver.'); + "You have enabled Imagemagick in your config, but the '%s' ". + "binary is not in the webserver's %s. Disable imagemagick ". + "or make it available to the webserver.", + 'convert', + '$PATH'); $this->newIssue('files.enable-imagemagick') ->setName(pht( - "'convert' binary not found or Imagemagick is not installed.")) + "'%s' binary not found or Imagemagick is not installed.", 'convert')) ->setMessage($message) ->addRelatedPhabricatorConfig('files.enable-imagemagick') ->addPhabricatorConfig('environment.append-paths'); diff --git a/src/applications/config/check/PhabricatorMySQLSetupCheck.php b/src/applications/config/check/PhabricatorMySQLSetupCheck.php index a5178cc9ed..75ecc06239 100644 --- a/src/applications/config/check/PhabricatorMySQLSetupCheck.php +++ b/src/applications/config/check/PhabricatorMySQLSetupCheck.php @@ -27,14 +27,15 @@ final class PhabricatorMySQLSetupCheck extends PhabricatorSetupCheck { $recommended_minimum = (32 * 1024 * 1024); if ($max_allowed_packet < $recommended_minimum) { $message = pht( - "MySQL is configured with a small 'max_allowed_packet' (%d), ". + "MySQL is configured with a small '%s' (%d), ". "which may cause some large writes to fail. Strongly consider raising ". "this to at least %d in your MySQL configuration.", + 'max_allowed_packet', $max_allowed_packet, $recommended_minimum); $this->newIssue('mysql.max_allowed_packet') - ->setName(pht('Small MySQL "max_allowed_packet"')) + ->setName(pht('Small MySQL "%s"', 'max_allowed_packet')) ->setMessage($message) ->addMySQLConfig('max_allowed_packet'); } @@ -70,7 +71,7 @@ final class PhabricatorMySQLSetupCheck extends PhabricatorSetupCheck { phutil_tag('pre', array(), 'sql_mode=STRICT_ALL_TABLES')); $this->newIssue('mysql.mode') - ->setName(pht('MySQL STRICT_ALL_TABLES Mode Not Set')) + ->setName(pht('MySQL %s Mode Not Set', 'STRICT_ALL_TABLES')) ->setSummary($summary) ->setMessage($message) ->addMySQLConfig('sql_mode'); @@ -109,7 +110,7 @@ final class PhabricatorMySQLSetupCheck extends PhabricatorSetupCheck { phutil_tag('tt', array(), 'ONLY_FULL_GROUP_BY')); $this->newIssue('mysql.mode') - ->setName(pht('MySQL ONLY_FULL_GROUP_BY Mode Set')) + ->setName(pht('MySQL %s Mode Set', 'ONLY_FULL_GROUP_BY')) ->setSummary($summary) ->setMessage($message) ->addMySQLConfig('sql_mode'); @@ -134,7 +135,7 @@ final class PhabricatorMySQLSetupCheck extends PhabricatorSetupCheck { phutil_tag('tt', array(), 'ft_stopword_file')); $this->newIssue('mysql.ft_stopword_file') - ->setName(pht('MySQL ft_stopword_file Not Supported')) + ->setName(pht('MySQL %s Not Supported', 'ft_stopword_file')) ->setSummary($summary) ->setMessage($message) ->addMySQLConfig('ft_stopword_file'); diff --git a/src/applications/config/check/PhabricatorPHPConfigSetupCheck.php b/src/applications/config/check/PhabricatorPHPConfigSetupCheck.php index 57d97226a6..03bbb3c52d 100644 --- a/src/applications/config/check/PhabricatorPHPConfigSetupCheck.php +++ b/src/applications/config/check/PhabricatorPHPConfigSetupCheck.php @@ -14,15 +14,14 @@ final class PhabricatorPHPConfigSetupCheck extends PhabricatorSetupCheck { $safe_mode = ini_get('safe_mode'); if ($safe_mode) { $message = pht( - "You have 'safe_mode' enabled in your PHP configuration, but ". - "Phabricator will not run in safe mode. Safe mode has been deprecated ". - "in PHP 5.3 and removed in PHP 5.4.". - "\n\n". - "Disable safe mode to continue."); + "You have '%s' enabled in your PHP configuration, but Phabricator ". + "will not run in safe mode. Safe mode has been deprecated in PHP 5.3 ". + "and removed in PHP 5.4.\n\nDisable safe mode to continue.", + 'safe_mode'); $this->newIssue('php.safe_mode') ->setIsFatal(true) - ->setName(pht('Disable PHP safe_mode')) + ->setName(pht('Disable PHP %s', 'safe_mode')) ->setMessage($message) ->addPHPConfig('safe_mode'); return; @@ -146,17 +145,15 @@ final class PhabricatorPHPConfigSetupCheck extends PhabricatorSetupCheck { } $issue = $this->newIssue('php.open_basedir') - ->setName(pht('Disable PHP open_basedir')) + ->setName(pht('Disable PHP %s', 'open_basedir')) ->addPHPConfig('open_basedir'); if ($failures) { $message = pht( - "Your server is configured with 'open_basedir', which prevents ". - "Phabricator from opening files it requires access to.". - "\n\n". - "Disable this setting to continue.". - "\n\n". - "Failures:\n\n%s", + "Your server is configured with '%s', which prevents Phabricator ". + "from opening files it requires access to.\n\n". + "Disable this setting to continue.\n\nFailures:\n\n%s", + 'open_basedir', implode("\n\n", $failures)); $issue @@ -166,15 +163,17 @@ final class PhabricatorPHPConfigSetupCheck extends PhabricatorSetupCheck { return; } else { $summary = pht( - "You have 'open_basedir' configured in your PHP settings, which ". - "may cause some features to fail."); + "You have '%s' configured in your PHP settings, which ". + "may cause some features to fail.", + 'open_basedir'); $message = pht( - "You have 'open_basedir' configured in your PHP settings. Although ". - "this setting appears permissive enough that Phabricator will ". - "work properly, you may still run into problems because of it.". - "\n\n". - "Consider disabling 'open_basedir'."); + "You have '%s' configured in your PHP settings. Although this ". + "setting appears permissive enough that Phabricator will work ". + "properly, you may still run into problems because of it.\n\n". + "Consider disabling '%s'.", + 'open_basedir', + 'open_basedir'); $issue ->setSummary($summary) diff --git a/src/applications/config/check/PhabricatorPathSetupCheck.php b/src/applications/config/check/PhabricatorPathSetupCheck.php index 4833e4861a..618c81abb9 100644 --- a/src/applications/config/check/PhabricatorPathSetupCheck.php +++ b/src/applications/config/check/PhabricatorPathSetupCheck.php @@ -13,19 +13,25 @@ final class PhabricatorPathSetupCheck extends PhabricatorSetupCheck { if (!$path) { $summary = pht( - 'The environmental variable $PATH is empty. Phabricator will not '. - 'be able to execute some commands.'); + 'The environmental variable %s is empty. Phabricator will not '. + 'be able to execute some commands.', + '$PATH'); $message = pht( - 'The environmental variable $PATH is empty. Phabricator needs to '. - 'execute some system commands, like `svn`, `git`, `hg`, and `diff`. '. - 'To execute these commands, the binaries must be available in the '. - 'webserver\'s $PATH. You can set additional paths in Phabricator '. - 'configuration.'); + "The environmental variable %s is empty. Phabricator needs to execute ". + "some system commands, like `%s`, `%s`, `%s`, and `%s`. To execute ". + "these commands, the binaries must be available in the webserver's ". + "%s. You can set additional paths in Phabricator configuration.", + '$PATH', + 'svn', + 'git', + 'hg', + 'diff', + '$PATH'); $this ->newIssue('config.environment.append-paths') - ->setName(pht('$PATH Not Set')) + ->setName(pht('%s Not Set', '$PATH')) ->setSummary($summary) ->setMessage($message) ->addPhabricatorConfig('environment.append-paths'); @@ -86,10 +92,11 @@ final class PhabricatorPathSetupCheck extends PhabricatorSetupCheck { if (!phutil_is_windows() && !@file_exists($path_part.'/.')) { $message = pht( "The PATH component '%s' (which resolves as the absolute path ". - "'%s') is not usable because it is not traversable (its '+x' ". + "'%s') is not usable because it is not traversable (its '%s' ". "permission bit is not set).", $path_part, - Filesystem::resolvePath($path_part)); + Filesystem::resolvePath($path_part), + '+x'); } } diff --git a/src/applications/config/check/PhabricatorPygmentSetupCheck.php b/src/applications/config/check/PhabricatorPygmentSetupCheck.php index 26f1f46332..228eb7a33b 100644 --- a/src/applications/config/check/PhabricatorPygmentSetupCheck.php +++ b/src/applications/config/check/PhabricatorPygmentSetupCheck.php @@ -12,17 +12,23 @@ final class PhabricatorPygmentSetupCheck extends PhabricatorSetupCheck { if ($pygment) { if (!Filesystem::binaryExists('pygmentize')) { $summary = pht( - 'You enabled pygments but the pygmentize script is not '. - 'actually available, your $PATH is probably broken.'); + 'You enabled pygments but the %s script is not '. + 'actually available, your %s is probably broken.', + 'pygmentize', + '$PATH'); $message = pht( - 'The environmental variable $PATH does not contain '. - 'pygmentize. You have enabled pygments, which requires '. - 'pygmentize to be available in your $PATH variable.'); + 'The environmental variable %s does not contain %s. '. + 'You have enabled pygments, which requires '. + '%s to be available in your %s variable.', + '$PATH', + 'pygmentize', + 'pygmentize', + '$PATH'); $this ->newIssue('pygments.enabled') - ->setName(pht('pygmentize Not Found')) + ->setName(pht('%s Not Found', 'pygmentize')) ->setSummary($summary) ->setMessage($message) ->addRelatedPhabricatorConfig('pygments.enabled') @@ -31,19 +37,21 @@ final class PhabricatorPygmentSetupCheck extends PhabricatorSetupCheck { list($err) = exec_manual('pygmentize -h'); if ($err) { $summary = pht( - 'You have enabled pygments and the pygmentize script is '. - 'available, but does not seem to work.'); + 'You have enabled pygments and the %s script is '. + 'available, but does not seem to work.', + 'pygmentize'); $message = pht( - 'Phabricator has %s available in $PATH, but the binary '. + 'Phabricator has %s available in %s, but the binary '. 'exited with an error code when run as %s. Check that it is '. 'installed correctly.', + phutil_tag('tt', array(), '$PATH'), phutil_tag('tt', array(), 'pygmentize'), phutil_tag('tt', array(), 'pygmentize -h')); $this ->newIssue('pygments.failed') - ->setName(pht('pygmentize Not Working')) + ->setName(pht('%s Not Working', 'pygmentize')) ->setSummary($summary) ->setMessage($message) ->addRelatedPhabricatorConfig('pygments.enabled') @@ -51,12 +59,14 @@ final class PhabricatorPygmentSetupCheck extends PhabricatorSetupCheck { } } } else { - $summary = pht('Pygments should be installed and enabled '. + $summary = pht( + 'Pygments should be installed and enabled '. 'to provide advanced syntax highlighting.'); - $message = pht('Phabricator can highlight a few languages by default, '. + $message = pht( + 'Phabricator can highlight a few languages by default, '. 'but installing and enabling Pygments (a third-party highlighting '. - 'tool) will add syntax highlighting for many more languages. '."\n\n". + "tool) will add syntax highlighting for many more languages. \n\n". 'For instructions on installing and enabling Pygments, see the '. '%s configuration option.'."\n\n". 'If you do not want to install Pygments, you can ignore this issue.', diff --git a/src/applications/config/check/PhabricatorSetupCheck.php b/src/applications/config/check/PhabricatorSetupCheck.php index a689d14943..beb52de4dd 100644 --- a/src/applications/config/check/PhabricatorSetupCheck.php +++ b/src/applications/config/check/PhabricatorSetupCheck.php @@ -130,7 +130,9 @@ abstract class PhabricatorSetupCheck { foreach ($check->getIssues() as $key => $issue) { if (isset($issues[$key])) { throw new Exception( - "Two setup checks raised an issue with key '{$key}'!"); + pht( + "Two setup checks raised an issue with key '%s'!", + $key)); } $issues[$key] = $issue; if ($issue->getIsFatal()) { @@ -139,8 +141,8 @@ abstract class PhabricatorSetupCheck { } } - foreach (PhabricatorEnv::getEnvConfig('config.ignore-issues') - as $ignorable => $derp) { + $ignore_issues = PhabricatorEnv::getEnvConfig('config.ignore-issues'); + foreach ($ignore_issues as $ignorable => $derp) { if (isset($issues[$ignorable])) { $issues[$ignorable]->setIsIgnored(true); } diff --git a/src/applications/config/check/PhabricatorTimezoneSetupCheck.php b/src/applications/config/check/PhabricatorTimezoneSetupCheck.php index 5fcf74a294..bf087c933a 100644 --- a/src/applications/config/check/PhabricatorTimezoneSetupCheck.php +++ b/src/applications/config/check/PhabricatorTimezoneSetupCheck.php @@ -40,8 +40,10 @@ final class PhabricatorTimezoneSetupCheck extends PhabricatorSetupCheck { $message = pht( "Your configuration fails to specify a server timezone. You can either ". - "set the PHP configuration value 'date.timezone' or the Phabricator ". - "configuration value 'phabricator.timezone' to specify one."); + "set the PHP configuration value '%s' or the Phabricator ". + "configuration value '%s' to specify one.", + 'date.timezone', + 'phabricator.timezone'); $this ->newIssue('config.timezone') diff --git a/src/applications/config/controller/PhabricatorConfigIgnoreController.php b/src/applications/config/controller/PhabricatorConfigIgnoreController.php index a136035536..ba634dec1a 100644 --- a/src/applications/config/controller/PhabricatorConfigIgnoreController.php +++ b/src/applications/config/controller/PhabricatorConfigIgnoreController.php @@ -34,7 +34,7 @@ final class PhabricatorConfigIgnoreController 'This issue will no longer be suppressed, and will return to its '. 'rightful place as a global setup warning.'); } else { - throw new Exception('Unrecognized verb: '.$this->verb); + throw new Exception(pht('Unrecognized verb: %s', $this->verb)); } $dialog = id(new AphrontDialogView()) diff --git a/src/applications/config/custom/PhabricatorCustomHeaderConfigType.php b/src/applications/config/custom/PhabricatorCustomHeaderConfigType.php index b738aa6aa2..fee8ba5a4c 100644 --- a/src/applications/config/custom/PhabricatorCustomHeaderConfigType.php +++ b/src/applications/config/custom/PhabricatorCustomHeaderConfigType.php @@ -5,8 +5,10 @@ final class PhabricatorCustomHeaderConfigType public function validateOption(PhabricatorConfigOption $option, $value) { if (phid_get_type($value) != PhabricatorFileFilePHIDType::TYPECONST) { - throw new Exception(pht( - '%s is not a valid file phid.', $value)); + throw new Exception( + pht( + '%s is not a valid file PHID.', + $value)); } $file = id(new PhabricatorFileQuery()) @@ -14,23 +16,27 @@ final class PhabricatorCustomHeaderConfigType ->withPHIDs(array($value)) ->executeOne(); if (!$file) { - throw new Exception(pht( - '%s is not a valid file phid.', $value)); + throw new Exception( + pht( + '%s is not a valid file PHID.', + $value)); } $most_open_policy = PhabricatorPolicies::getMostOpenPolicy(); if ($file->getViewPolicy() != $most_open_policy) { - throw new Exception(pht( - 'Specified file %s has policy "%s" but should have policy "%s".', - $value, - $file->getViewPolicy(), - $most_open_policy)); + throw new Exception( + pht( + 'Specified file %s has policy "%s" but should have policy "%s".', + $value, + $file->getViewPolicy(), + $most_open_policy)); } if (!$file->isViewableImage()) { - throw new Exception(pht( - 'Specified file %s is not a viewable image.', - $value)); + throw new Exception( + pht( + 'Specified file %s is not a viewable image.', + $value)); } } diff --git a/src/applications/config/management/PhabricatorConfigManagementDeleteWorkflow.php b/src/applications/config/management/PhabricatorConfigManagementDeleteWorkflow.php index 8f8cea0838..24b0f48c26 100644 --- a/src/applications/config/management/PhabricatorConfigManagementDeleteWorkflow.php +++ b/src/applications/config/management/PhabricatorConfigManagementDeleteWorkflow.php @@ -12,8 +12,9 @@ final class PhabricatorConfigManagementDeleteWorkflow array( array( 'name' => 'database', - 'help' => pht('Delete configuration in the database instead of '. - 'in local configuration.'), + 'help' => pht( + 'Delete configuration in the database instead of '. + 'in local configuration.'), ), array( 'name' => 'args', @@ -27,15 +28,15 @@ final class PhabricatorConfigManagementDeleteWorkflow $argv = $args->getArg('args'); if (count($argv) == 0) { - throw new PhutilArgumentUsageException(pht( - 'Specify a configuration key to delete.')); + throw new PhutilArgumentUsageException( + pht('Specify a configuration key to delete.')); } $key = $argv[0]; if (count($argv) > 1) { - throw new PhutilArgumentUsageException(pht( - 'Too many arguments: expected one key.')); + throw new PhutilArgumentUsageException( + pht('Too many arguments: expected one key.')); } @@ -49,10 +50,11 @@ final class PhabricatorConfigManagementDeleteWorkflow } $values = $config->getKeys(array($key)); if (!$values) { - throw new PhutilArgumentUsageException(pht( - "Configuration key '%s' is not set in %s configuration!", - $key, - $config_type)); + throw new PhutilArgumentUsageException( + pht( + "Configuration key '%s' is not set in %s configuration!", + $key, + $config_type)); } if ($use_database) { @@ -64,7 +66,8 @@ final class PhabricatorConfigManagementDeleteWorkflow } $console->writeOut( - pht("Deleted '%s' from %s configuration.", $key, $config_type)."\n"); + "%s\n", + pht("Deleted '%s' from %s configuration.", $key, $config_type)); } } diff --git a/src/applications/config/management/PhabricatorConfigManagementGetWorkflow.php b/src/applications/config/management/PhabricatorConfigManagementGetWorkflow.php index 1924cc4792..800ffe5942 100644 --- a/src/applications/config/management/PhabricatorConfigManagementGetWorkflow.php +++ b/src/applications/config/management/PhabricatorConfigManagementGetWorkflow.php @@ -7,7 +7,7 @@ final class PhabricatorConfigManagementGetWorkflow $this ->setName('get') ->setExamples('**get** __key__') - ->setSynopsis('Get a local configuration value.') + ->setSynopsis(pht('Get a local configuration value.')) ->setArguments( array( array( @@ -23,21 +23,23 @@ final class PhabricatorConfigManagementGetWorkflow $argv = $args->getArg('args'); if (count($argv) == 0) { throw new PhutilArgumentUsageException( - 'Specify a configuration key to get.'); + pht('Specify a configuration key to get.')); } $key = $argv[0]; if (count($argv) > 1) { throw new PhutilArgumentUsageException( - 'Too many arguments: expected one key.'); + pht('Too many arguments: expected one key.')); } $options = PhabricatorApplicationConfigOptions::loadAllOptions(); if (empty($options[$key])) { throw new PhutilArgumentUsageException( - "No such configuration key '{$key}'! Use `config list` to list all ". - "keys."); + pht( + "No such configuration key '%s'! Use `%s` to list all keys.", + $key, + 'config list')); } $values = array(); diff --git a/src/applications/config/management/PhabricatorConfigManagementListWorkflow.php b/src/applications/config/management/PhabricatorConfigManagementListWorkflow.php index 10bd6202b2..ea9922e4d7 100644 --- a/src/applications/config/management/PhabricatorConfigManagementListWorkflow.php +++ b/src/applications/config/management/PhabricatorConfigManagementListWorkflow.php @@ -7,7 +7,7 @@ final class PhabricatorConfigManagementListWorkflow $this ->setName('list') ->setExamples('**list**') - ->setSynopsis('List all configuration keys.'); + ->setSynopsis(pht('List all configuration keys.')); } public function execute(PhutilArgumentParser $args) { diff --git a/src/applications/config/management/PhabricatorConfigManagementMigrateWorkflow.php b/src/applications/config/management/PhabricatorConfigManagementMigrateWorkflow.php index 1f992d003a..67b5733dc7 100644 --- a/src/applications/config/management/PhabricatorConfigManagementMigrateWorkflow.php +++ b/src/applications/config/management/PhabricatorConfigManagementMigrateWorkflow.php @@ -20,54 +20,60 @@ final class PhabricatorConfigManagementMigrateWorkflow $database_config = new PhabricatorConfigDatabaseSource('default'); $config_sources = PhabricatorEnv::getConfigSourceStack()->getStack(); $console->writeOut( - pht('Migrating file-based config to more modern config...')."\n"); + "%s\n", + pht('Migrating file-based config to more modern config...')); foreach ($config_sources as $config_source) { if (!($config_source instanceof PhabricatorConfigFileSource)) { $console->writeOut( - pht('Skipping config of source type %s...', - get_class($config_source))."\n"); + "%s\n", + pht( + 'Skipping config of source type %s...', + get_class($config_source))); continue; } - $console->writeOut(pht('Migrating file source...')."\n"); + $console->writeOut("%s\n", pht('Migrating file source...')); $all_keys = $config_source->getAllKeys(); foreach ($all_keys as $key => $value) { $option = idx($options, $key); if (!$option) { - $console->writeOut(pht('Skipping obsolete option: %s', $key)."\n"); + $console->writeOut("%s\n", pht('Skipping obsolete option: %s', $key)); continue; } $in_local = $local_config->getKeys(array($option->getKey())); if ($in_local) { - $console->writeOut(pht( - 'Skipping option "%s"; already in local config.', $key)."\n"); + $console->writeOut( + "%s\n", + pht('Skipping option "%s"; already in local config.', $key)); continue; } $is_locked = $option->getLocked(); if ($is_locked) { $local_config->setKeys(array($option->getKey() => $value)); $key_count++; - $console->writeOut(pht( - 'Migrated option "%s" from file to local config.', $key)."\n"); + $console->writeOut( + "%s\n", + pht('Migrated option "%s" from file to local config.', $key)); } else { $in_database = $database_config->getKeys(array($option->getKey())); if ($in_database) { - $console->writeOut(pht( - 'Skipping option "%s"; already in database config.', $key)."\n"); + $console->writeOut( + "%s\n", + pht('Skipping option "%s"; already in database config.', $key)); continue; } else { $config_entry = PhabricatorConfigEntry::loadConfigEntry($key); $config_entry->setValue($value); $config_entry->save(); $key_count++; - $console->writeOut(pht( - 'Migrated option "%s" from file to database config.', $key)."\n"); + $console->writeOut( + "%s\n", + pht('Migrated option "%s" from file to database config.', $key)); } } } } - $console->writeOut(pht( - 'Done. Migrated %d keys.', $key_count)."\n"); + $console->writeOut("%s\n", pht('Done. Migrated %d keys.', $key_count)); return 0; } diff --git a/src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php b/src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php index 0da6332268..1da30408ee 100644 --- a/src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php +++ b/src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php @@ -12,8 +12,9 @@ final class PhabricatorConfigManagementSetWorkflow array( array( 'name' => 'database', - 'help' => pht('Update configuration in the database instead of '. - 'in local configuration.'), + 'help' => pht( + 'Update configuration in the database instead of '. + 'in local configuration.'), ), array( 'name' => 'args', @@ -26,31 +27,34 @@ final class PhabricatorConfigManagementSetWorkflow $console = PhutilConsole::getConsole(); $argv = $args->getArg('args'); if (count($argv) == 0) { - throw new PhutilArgumentUsageException(pht( - 'Specify a configuration key and a value to set it to.')); + throw new PhutilArgumentUsageException( + pht('Specify a configuration key and a value to set it to.')); } $key = $argv[0]; if (count($argv) == 1) { - throw new PhutilArgumentUsageException(pht( - "Specify a value to set the key '%s' to.", - $key)); + throw new PhutilArgumentUsageException( + pht( + "Specify a value to set the key '%s' to.", + $key)); } $value = $argv[1]; if (count($argv) > 2) { - throw new PhutilArgumentUsageException(pht( - 'Too many arguments: expected one key and one value.')); + throw new PhutilArgumentUsageException( + pht( + 'Too many arguments: expected one key and one value.')); } $options = PhabricatorApplicationConfigOptions::loadAllOptions(); if (empty($options[$key])) { - throw new PhutilArgumentUsageException(pht( - "No such configuration key '%s'! Use `config list` to list all ". - "keys.", - $key)); + throw new PhutilArgumentUsageException( + pht( + "No such configuration key '%s'! Use `%s` to list all keys.", + $key, + 'config list')); } $option = $options[$key]; @@ -64,10 +68,11 @@ final class PhabricatorConfigManagementSetWorkflow break; case 'int': if (!ctype_digit($value)) { - throw new PhutilArgumentUsageException(pht( - "Config key '%s' is of type '%s'. Specify an integer.", - $key, - $type)); + throw new PhutilArgumentUsageException( + pht( + "Config key '%s' is of type '%s'. Specify an integer.", + $key, + $type)); } $value = (int)$value; break; @@ -77,11 +82,13 @@ final class PhabricatorConfigManagementSetWorkflow } else if ($value == 'false') { $value = false; } else { - throw new PhutilArgumentUsageException(pht( - "Config key '%s' is of type '%s'. ". - "Specify 'true' or 'false'.", - $key, - $type)); + throw new PhutilArgumentUsageException( + pht( + "Config key '%s' is of type '%s'. Specify '%s' or '%s'.", + $key, + $type, + 'true', + 'false')); } break; default: @@ -89,23 +96,25 @@ final class PhabricatorConfigManagementSetWorkflow if (!is_array($value)) { switch ($type) { case 'set': - $message = pht( - "Config key '%s' is of type '%s'. Specify it in JSON. ". - "For example:\n\n". - ' ./bin/config set \'{"value1": true, "value2": true}\''. - "\n", - $key, - $type); + $message = sprintf( + "%s%s\n\n %s\n", + pht( + "Config key '%s' is of type '%s'. Specify it in JSON.", + $key, + $type), + pht('For example:'), + './bin/config set \'{"value1": true, "value2": true}\''); break; default: if (preg_match('/^listgetArg('database'); if ($option->getLocked() && $use_database) { - throw new PhutilArgumentUsageException(pht( - "Config key '%s' is locked and can only be set in local ". - 'configuration.', - $key)); + throw new PhutilArgumentUsageException( + pht( + "Config key '%s' is locked and can only be set in local ". + "configuration.", + $key)); } try { @@ -145,7 +155,8 @@ final class PhabricatorConfigManagementSetWorkflow } $console->writeOut( - pht("Set '%s' in %s configuration.", $key, $config_type)."\n"); + "%s\n", + pht("Set '%s' in %s configuration.", $key, $config_type)); } } diff --git a/src/applications/config/option/PhabricatorAWSConfigOptions.php b/src/applications/config/option/PhabricatorAWSConfigOptions.php index 1a360ffc16..b191e0e40e 100644 --- a/src/applications/config/option/PhabricatorAWSConfigOptions.php +++ b/src/applications/config/option/PhabricatorAWSConfigOptions.php @@ -39,8 +39,8 @@ final class PhabricatorAWSConfigOptions pht( 'Explicit S3 endpoint to use. Leave empty to have Phabricator '. 'select and endpoint. Normally, you do not need to set this.')) - ->addExample(null, 'Use default endpoint') - ->addExample('s3.amazon.com', 'Use specific endpoint'), + ->addExample(null, pht('Use default endpoint')) + ->addExample('s3.amazon.com', pht('Use specific endpoint')), $this->newOption('amazon-ec2.access-key', 'string', null) ->setLocked(true) ->setDescription(pht('Access key for Amazon EC2.')), diff --git a/src/applications/config/option/PhabricatorAccessLogConfigOptions.php b/src/applications/config/option/PhabricatorAccessLogConfigOptions.php index c186fc3557..5bc55f64a7 100644 --- a/src/applications/config/option/PhabricatorAccessLogConfigOptions.php +++ b/src/applications/config/option/PhabricatorAccessLogConfigOptions.php @@ -49,14 +49,16 @@ final class PhabricatorAccessLogConfigOptions ); $http_desc = pht( - 'Format for the HTTP access log. Use {{log.access.path}} to set the '. - 'path. Available variables are:'); + 'Format for the HTTP access log. Use `%s` to set the path. '. + 'Available variables are:', + 'log.access.path'); $http_desc .= "\n\n"; $http_desc .= $this->renderMapHelp($http_map); $ssh_desc = pht( - 'Format for the SSH access log. Use {{log.ssh.path}} to set the '. - 'path. Available variables are:'); + 'Format for the SSH access log. Use %s to set the path. '. + 'Available variables are:', + 'log.ssh.path'); $ssh_desc .= "\n\n"; $ssh_desc .= $this->renderMapHelp($ssh_map); @@ -67,7 +69,6 @@ final class PhabricatorAccessLogConfigOptions ->setDescription( pht( "To enable the Phabricator access log, specify a path. The ". - "access log can provide more detailed information about ". "Phabricator access than normal HTTP access logs (for instance, ". "it can show logged-in users, controllers, and other application ". "data).\n\n". diff --git a/src/applications/config/option/PhabricatorApplicationConfigOptions.php b/src/applications/config/option/PhabricatorApplicationConfigOptions.php index 7ac1df3e16..d99cdf3101 100644 --- a/src/applications/config/option/PhabricatorApplicationConfigOptions.php +++ b/src/applications/config/option/PhabricatorApplicationConfigOptions.php @@ -227,7 +227,7 @@ abstract class PhabricatorApplicationConfigOptions extends Phobject { if (isset($options[$key])) { throw new Exception( pht( - "Mulitple % subclasses contain an option named '%s'!", + "Mulitple %s subclasses contain an option named '%s'!", __CLASS__, $key)); } diff --git a/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php b/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php index dc7996a3ee..a965d16f42 100644 --- a/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php +++ b/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php @@ -55,8 +55,8 @@ final class PhabricatorAuthenticationConfigOptions "registration, you can disable the queue to reduce administrative ". "overhead.\n\n". "NOTE: Before you disable the queue, make sure ". - "{{auth.email-domains}} is configured correctly for your ". - "install!")), + "{{auth.email-domains}} is configured correctly ". + "for your install!")), $this->newOption('auth.email-domains', 'list', array()) ->setSummary(pht('Only allow registration from particular domains.')) ->setDescription( @@ -89,8 +89,7 @@ final class PhabricatorAuthenticationConfigOptions )) ->setSummary( pht( - 'Determines whether or not basic account information is '. - 'editable.')) + 'Determines whether or not basic account information is editable.')) ->setDescription( pht( 'Is basic account information (email, real name, profile '. diff --git a/src/applications/config/option/PhabricatorClusterConfigOptions.php b/src/applications/config/option/PhabricatorClusterConfigOptions.php index f6e2849e43..8684d98233 100644 --- a/src/applications/config/option/PhabricatorClusterConfigOptions.php +++ b/src/applications/config/option/PhabricatorClusterConfigOptions.php @@ -69,9 +69,10 @@ final class PhabricatorClusterConfigOptions 'hosting providers running multi-tenant clusters.'. "\n\n". 'If you provide an instance identifier here (normally by '. - 'injecting it with a `PhabricatorConfigSiteSource`), Phabricator '. - 'will pass it to subprocesses and commit hooks in the '. - '`PHABRICATOR_INSTANCE` environmental variable.')), + 'injecting it with a `%s`), Phabricator will pass it to '. + 'subprocesses and commit hooks in the `%s` environmental variable.', + 'PhabricatorConfigSiteSource', + 'PHABRICATOR_INSTANCE')), ); } diff --git a/src/applications/config/option/PhabricatorConfigOption.php b/src/applications/config/option/PhabricatorConfigOption.php index e5c9773611..e1d71416e7 100644 --- a/src/applications/config/option/PhabricatorConfigOption.php +++ b/src/applications/config/option/PhabricatorConfigOption.php @@ -76,7 +76,9 @@ final class PhabricatorConfigOption } return pht( 'This configuration is locked and can not be edited from the web '. - 'interface. Use `./bin/config` in `phabricator/` to edit it.'); + 'interface. Use `%s` in `%s` to edit it.', + './bin/config', + 'phabricator/'); } public function addExample($value, $description) { @@ -180,7 +182,7 @@ final class PhabricatorConfigOption public function getCustomObject() { if (!$this->customObject) { if (!$this->isCustomType()) { - throw new Exception('This option does not have a custom type!'); + throw new Exception(pht('This option does not have a custom type!')); } $this->customObject = newv(substr($this->getType(), 7), array()); } diff --git a/src/applications/config/option/PhabricatorCoreConfigOptions.php b/src/applications/config/option/PhabricatorCoreConfigOptions.php index b5df38633a..7477bae5b6 100644 --- a/src/applications/config/option/PhabricatorCoreConfigOptions.php +++ b/src/applications/config/option/PhabricatorCoreConfigOptions.php @@ -58,9 +58,9 @@ final class PhabricatorCoreConfigOptions 'Phabricator, and a production environment for deploying it), '. 'set the production environment URI here so that emails and other '. 'durable URIs will always generate with links pointing at the '. - 'production environment. If unset, defaults to '. - '{{phabricator.base-uri}}. Most installs do not need to set '. - 'this option.')) + 'production environment. If unset, defaults to `%s`. Most '. + 'installs do not need to set this option.', + 'phabricator.base-uri')) ->addExample('http://phabricator.example.com/', pht('Valid Setting')), $this->newOption('phabricator.allowed-uris', 'list', array()) ->setLocked(true) @@ -68,9 +68,9 @@ final class PhabricatorCoreConfigOptions ->setDescription( pht( "These alternative URIs will be able to access 'normal' pages ". - "on your Phabricator install. Other features such as OAuth ". - "won't work. The major use case for this is moving installs ". - "across domains.")) + "on your Phabricator install. Other features such as OAuth ". + "won't work. The major use case for this is moving installs ". + "across domains.")) ->addExample( "http://phabricator2.example.com/\n". "http://phabricator3.example.com/", @@ -83,8 +83,9 @@ final class PhabricatorCoreConfigOptions "PHP requires that you set a timezone in your php.ini before ". "using date functions, or it will emit a warning. If this isn't ". "possible (for instance, because you are using HPHP) you can set ". - "some valid constant for date_default_timezone_set() here and ". - "Phabricator will set it on your behalf, silencing the warning.")) + "some valid constant for %s here and Phabricator will set it on ". + "your behalf, silencing the warning.", + 'date_default_timezone_set()')) ->addExample('America/New_York', pht('US East (EDT)')) ->addExample('America/Chicago', pht('US Central (CDT)')) ->addExample('America/Boise', pht('US Mountain (MDT)')) @@ -92,14 +93,14 @@ final class PhabricatorCoreConfigOptions $this->newOption('phabricator.cookie-prefix', 'string', null) ->setLocked(true) ->setSummary( - pht('Set a string Phabricator should use to prefix '. - 'cookie names.')) + pht( + 'Set a string Phabricator should use to prefix cookie names.')) ->setDescription( pht( 'Cookies set for x.com are also sent for y.x.com. Assuming '. 'Phabricator instances are running on both domains, this will '. 'create a collision preventing you from logging in.')) - ->addExample('dev', pht('Prefix cookie with "dev"')), + ->addExample('dev', pht('Prefix cookie with "%s"', 'dev')), $this->newOption('phabricator.show-prototypes', 'bool', false) ->setLocked(true) ->setBoolOptions( @@ -155,22 +156,29 @@ final class PhabricatorCoreConfigOptions 'linked.')), $this->newOption('environment.append-paths', 'list', $paths) ->setSummary( - pht('These paths get appended to your \$PATH envrionment variable.')) + pht( + 'These paths get appended to your %s environment variable.', + '$PATH')) ->setDescription( pht( "Phabricator occasionally shells out to other binaries on the ". - "server. An example of this is the `pygmentize` command, used ". - "to syntax-highlight code written in languages other than PHP. ". - "By default, it is assumed that these binaries are in the \$PATH ". - "of the user running Phabricator (normally 'apache', 'httpd', or ". - "'nobody'). Here you can add extra directories to the \$PATH ". + "server. An example of this is the `%s` command, used to ". + "syntax-highlight code written in languages other than PHP. By ". + "default, it is assumed that these binaries are in the %s of the ". + "user running Phabricator (normally 'apache', 'httpd', or ". + "'nobody'). Here you can add extra directories to the %s ". "environment variable, for when these binaries are in ". "non-standard locations.\n\n". - "Note that you can also put binaries in ". - "`phabricator/support/bin/` (for example, by symlinking them).\n\n". + "Note that you can also put binaries in `%s` (for example, by ". + "symlinking them).\n\n". "The current value of PATH after configuration is applied is:\n\n". " lang=text\n". - " %s", $path)) + " %s", + '$PATH', + '$PATH', + 'phabricator/support/bin/', + $path, + 'pygmentize')) ->setLocked(true) ->addExample('/usr/local/bin', pht('Add One Path')) ->addExample("/usr/bin\n/usr/local/bin", pht('Add Multiple Paths')), @@ -200,7 +208,7 @@ final class PhabricatorCoreConfigOptions ), pht('Applications application')))) ->setDescription( - pht('Array containing list of Uninstalled applications.')), + pht('Array containing list of uninstalled applications.')), $this->newOption('phabricator.application-settings', 'wild', array()) ->setLocked(true) ->setDescription( @@ -261,7 +269,9 @@ final class PhabricatorCoreConfigOptions throw new PhabricatorConfigValidationException( pht( "Config option '%s' is invalid. The URI must start with ". - "'http://' or 'https://'.", + "%s' or '%s'.", + 'http://', + 'https://', $key)); } @@ -269,10 +279,12 @@ final class PhabricatorCoreConfigOptions if (strpos($domain, '.') === false) { throw new PhabricatorConfigValidationException( pht( - "Config option '%s' is invalid. The URI must contain a dot ('.'), ". - "like 'http://example.com/', not just a bare name like ". - "'http://example/'. Some web browsers will not set cookies on ". - "domains with no TLD.", + "Config option '%s' is invalid. The URI must contain a dot ". + "('%s'), like '%s', not just a bare name like '%s'. Some web ". + "browsers will not set cookies on domains with no TLD.", + '.', + 'http://example.com/', + 'http://example/', $key)); } @@ -281,11 +293,11 @@ final class PhabricatorCoreConfigOptions throw new PhabricatorConfigValidationException( pht( "Config option '%s' is invalid. The URI must NOT have a path, ". - "e.g. 'http://phabricator.example.com/' is OK, but ". - "'http://example.com/phabricator/' is not. Phabricator must be ". - "installed on an entire domain; it can not be installed on a ". - "path.", - $key)); + "e.g. '%s' is OK, but '%s' is not. Phabricator must be installed ". + "on an entire domain; it can not be installed on a path.", + $key, + 'http://phabricator.example.com/', + 'http://example.com/phabricator/')); } } @@ -299,16 +311,13 @@ final class PhabricatorCoreConfigOptions throw new PhabricatorConfigValidationException( pht( "Config option '%s' is invalid. The timezone identifier must ". - "be a valid timezone identifier recognized by PHP, like ". - "'America/Los_Angeles'. You can find a list of valid identifiers ". - "here: %s", + "be a valid timezone identifier recognized by PHP, like '%s'. "." + You can find a list of valid identifiers here: %s", $key, + 'America/Los_Angeles', 'http://php.net/manual/timezones.php')); } } - - - } diff --git a/src/applications/config/option/PhabricatorDeveloperConfigOptions.php b/src/applications/config/option/PhabricatorDeveloperConfigOptions.php index c2063ec87c..37cf752f68 100644 --- a/src/applications/config/option/PhabricatorDeveloperConfigOptions.php +++ b/src/applications/config/option/PhabricatorDeveloperConfigOptions.php @@ -52,8 +52,9 @@ final class PhabricatorDeveloperConfigOptions "even for logged-out users. This is only really useful if you ". "need to debug something on a logged-out page. You should not ". "enable this option in production.\n\n". - "You must enable DarkConsole by setting {{darkconsole.enabled}} ". - "before this option will have any effect.")), + "You must enable DarkConsole by setting '%s' ". + "before this option will have any effect.", + 'darkconsole.enabled')), $this->newOption('debug.time-limit', 'int', null) ->setSummary( pht( @@ -170,12 +171,13 @@ final class PhabricatorDeveloperConfigOptions pht('Disable deflate compression'), )) ->setSummary( - pht('Toggle gzdeflate()-based compression for some caches.')) + pht('Toggle %s-based compression for some caches.', 'gzdeflate()')) ->setDescription( pht( - 'Set this to false to disable the use of gzdeflate()-based '. + 'Set this to false to disable the use of %s-based '. 'compression in some caches. This may give you less performant '. - '(but more debuggable) caching.')), + '(but more debuggable) caching.', + 'gzdeflate()')), ); } } diff --git a/src/applications/config/option/PhabricatorMailgunConfigOptions.php b/src/applications/config/option/PhabricatorMailgunConfigOptions.php index 3baf4e6798..aebcba6725 100644 --- a/src/applications/config/option/PhabricatorMailgunConfigOptions.php +++ b/src/applications/config/option/PhabricatorMailgunConfigOptions.php @@ -25,8 +25,9 @@ final class PhabricatorMailgunConfigOptions ->setLocked(true) ->setDescription( pht( - 'Mailgun domain name. See https://mailgun.com/cp/domains')) - ->addExample('mycompany.com', 'Use specific domain'), + 'Mailgun domain name. See %s.', + 'https://mailgun.com/cp/domains')) + ->addExample('mycompany.com', pht('Use specific domain')), $this->newOption('mailgun.api-key', 'string', null) ->setHidden(true) ->setDescription(pht('Mailgun API key.')), diff --git a/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php b/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php index d190f1b393..55c8c5689c 100644 --- a/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php +++ b/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php @@ -24,7 +24,7 @@ final class PhabricatorMetaMTAConfigOptions When a user takes an action which generates an email notification (like commenting on a Differential revision), Phabricator can either send that mail "From" the user's email address (like "alincoln@logcabin.com") or "From" the -'metamta.default-address' address. +'%s' address. The user experience is generally better if Phabricator uses the user's real address as the "From" since the messages are easier to organize when they appear @@ -43,7 +43,8 @@ email on behalf of the "From" domain. Practically, this means: initially, since the risk in turning it on is that your outgoing mail will never arrive. EODOC -)); + , + 'metamta.default-address')); $one_mail_per_recipient_desc = $this->deformat(pht(<<deformat(pht(<<deformat(pht(<<deformat(pht(<<newOption('storage.default-namespace', 'string', 'phabricator') ->setLocked(true) ->setSummary( diff --git a/src/applications/config/option/PhabricatorPHDConfigOptions.php b/src/applications/config/option/PhabricatorPHDConfigOptions.php index b07e62244c..59cb8ea728 100644 --- a/src/applications/config/option/PhabricatorPHDConfigOptions.php +++ b/src/applications/config/option/PhabricatorPHDConfigOptions.php @@ -23,12 +23,10 @@ final class PhabricatorPHDConfigOptions return array( $this->newOption('phd.pid-directory', 'string', '/var/tmp/phd/pid') ->setDescription( - pht( - 'Directory that phd should use to track running daemons.')), + pht('Directory that phd should use to track running daemons.')), $this->newOption('phd.log-directory', 'string', '/var/tmp/phd/log') ->setDescription( - pht( - 'Directory that the daemons should use to store log files.')), + pht('Directory that the daemons should use to store log files.')), $this->newOption('phd.taskmasters', 'int', 4) ->setSummary(pht('Maximum taskmaster daemon pool size.')) ->setDescription( @@ -47,8 +45,10 @@ final class PhabricatorPHDConfigOptions pht( "Launch daemons in 'verbose' mode by default. This creates a lot ". "of output, but can help debug issues. Daemons launched in debug ". - "mode with 'phd debug' are always launched in verbose mode. See ". - "also 'phd.trace'.")), + "mode with '%s' are always launched in verbose mode. ". + "See also '%s'.", + 'phd debug', + 'phd.trace')), $this->newOption('phd.user', 'string', null) ->setLocked(true) ->setSummary(pht('System user to run daemons as.')) @@ -69,8 +69,10 @@ final class PhabricatorPHDConfigOptions pht( "Launch daemons in 'trace' mode by default. This creates an ". "ENORMOUS amount of output, but can help debug issues. Daemons ". - "launched in debug mode with 'phd debug' are always launched in ". - "trace mode. See also 'phd.verbose'.")), + "launched in debug mode with '%s' are always launched in ". + "trace mode. See also '%s'.", + 'phd debug', + 'phd.verbose')), $this->newOption('phd.variant-config', 'list', array()) ->setDescription( pht( diff --git a/src/applications/config/option/PhabricatorPHPMailerConfigOptions.php b/src/applications/config/option/PhabricatorPHPMailerConfigOptions.php index fbe98175d1..b2d5c91e91 100644 --- a/src/applications/config/option/PhabricatorPHPMailerConfigOptions.php +++ b/src/applications/config/option/PhabricatorPHPMailerConfigOptions.php @@ -43,9 +43,12 @@ final class PhabricatorPHPMailerConfigOptions ->setSummary(pht('Configure TLS or SSL for SMTP.')) ->setDescription( pht( - "Using PHPMailer with SMTP, you can set this to one of 'tls' or ". - "'ssl' to use TLS or SSL, respectively. Leave it blank for ". - "vanilla SMTP. If you're sending via Gmail, set it to 'ssl'.")), + "Using PHPMailer with SMTP, you can set this to one of '%s' or ". + "'%s' to use TLS or SSL, respectively. Leave it blank for ". + "vanilla SMTP. If you're sending via Gmail, set it to '%s'.", + 'tls', + 'ssl', + 'ssl')), $this->newOption('phpmailer.smtp-user', 'string', null) ->setLocked(true) ->setDescription(pht('Username for SMTP.')), diff --git a/src/applications/config/option/PhabricatorSMSConfigOptions.php b/src/applications/config/option/PhabricatorSMSConfigOptions.php index 973f5db13e..33b75c263f 100644 --- a/src/applications/config/option/PhabricatorSMSConfigOptions.php +++ b/src/applications/config/option/PhabricatorSMSConfigOptions.php @@ -20,12 +20,10 @@ final class PhabricatorSMSConfigOptions } public function getOptions() { - $adapter_description = $this->deformat(pht(<<newOption( @@ -40,7 +38,7 @@ EODOC 'class', null) ->setBaseClass('PhabricatorSMSImplementationAdapter') - ->setSummary(pht('Control how sms is sent.')) + ->setSummary(pht('Control how SMS is sent.')) ->setDescription($adapter_description), $this->newOption( 'twilio.account-sid', diff --git a/src/applications/config/option/PhabricatorSecurityConfigOptions.php b/src/applications/config/option/PhabricatorSecurityConfigOptions.php index d8a8c85a92..63e43b3081 100644 --- a/src/applications/config/option/PhabricatorSecurityConfigOptions.php +++ b/src/applications/config/option/PhabricatorSecurityConfigOptions.php @@ -92,12 +92,13 @@ final class PhabricatorSecurityConfigOptions "reasonably configure more granular behavior there.\n\n". "IMPORTANT: Phabricator determines if a request is HTTPS or not ". - "by examining the PHP \$_SERVER['HTTPS'] variable. If you run ". + "by examining the PHP `%s` variable. If you run ". "Apache/mod_php this will probably be set correctly for you ". "automatically, but if you run Phabricator as CGI/FCGI (e.g., ". "through nginx or lighttpd), you need to configure your web ". "server so that it passes the value correctly based on the ". - "connection type.")) + "connection type.", + "\$_SERVER['HTTPS']")) ->setBoolOptions( array( pht('Force HTTPS'), @@ -163,7 +164,8 @@ final class PhabricatorSecurityConfigOptions "When users write comments which have URIs, they'll be ". "automatically linked if the protocol appears in this set. This ". "whitelist is primarily to prevent security issues like ". - "javascript:// URIs.")) + "%s URIs.", + 'javascript://')) ->addExample("http\nhttps", pht('Valid Setting')) ->setLocked(true), $this->newOption( @@ -226,7 +228,7 @@ final class PhabricatorSecurityConfigOptions pht('Determines whether or not YouTube videos get embedded.')) ->setDescription( pht( - "If you enable this, linked YouTube videos will be embeded ". + "If you enable this, linked YouTube videos will be embedded ". "inline. This has mild security implications (you'll leak ". "referrers to YouTube) and is pretty silly (but sort of ". "awesome).")), @@ -308,8 +310,10 @@ final class PhabricatorSecurityConfigOptions throw new PhabricatorConfigValidationException( pht( "Config option '%s' is invalid. The URI must start with ". - "'http://' or 'https://'.", - $key)); + "'%s' or '%s'.", + $key, + 'http://', + 'https://')); } $domain = $uri->getDomain(); @@ -317,10 +321,11 @@ final class PhabricatorSecurityConfigOptions throw new PhabricatorConfigValidationException( pht( "Config option '%s' is invalid. The URI must contain a dot ('.'), ". - "like 'http://example.com/', not just a bare name like ". - "'http://example/'. Some web browsers will not set cookies on ". - "domains with no TLD.", - $key)); + "like '%s', not just a bare name like '%s'. ". + "Some web browsers will not set cookies on domains with no TLD.", + $key, + 'http://example.com/', + 'http://example/')); } $path = $uri->getPath(); @@ -328,11 +333,11 @@ final class PhabricatorSecurityConfigOptions throw new PhabricatorConfigValidationException( pht( "Config option '%s' is invalid. The URI must NOT have a path, ". - "e.g. 'http://phabricator.example.com/' is OK, but ". - "'http://example.com/phabricator/' is not. Phabricator must be ". - "installed on an entire domain; it can not be installed on a ". - "path.", - $key)); + "e.g. '%s' is OK, but '%s' is not. Phabricator must be installed ". + "on an entire domain; it can not be installed on a path.", + $key, + 'http://phabricator.example.com/', + 'http://example.com/phabricator/')); } } } diff --git a/src/applications/config/option/PhabricatorSyntaxHighlightingConfigOptions.php b/src/applications/config/option/PhabricatorSyntaxHighlightingConfigOptions.php index 90c1e87906..c2511b0f8e 100644 --- a/src/applications/config/option/PhabricatorSyntaxHighlightingConfigOptions.php +++ b/src/applications/config/option/PhabricatorSyntaxHighlightingConfigOptions.php @@ -34,8 +34,8 @@ final class PhabricatorSyntaxHighlightingConfigOptions pht( 'Phabricator can highlight PHP by default and use Pygments for '. 'other languages if enabled. You can provide a custom '. - 'highlighter engine by extending class '. - 'PhutilSyntaxHighlighterEngine.')), + 'highlighter engine by extending class %s.', + 'PhutilSyntaxHighlighterEngine')), $this->newOption('pygments.enabled', 'bool', false) ->setSummary( pht('Should Phabricator use Pygments to highlight code?')) @@ -128,7 +128,7 @@ final class PhabricatorSyntaxHighlightingConfigOptions 'be tested against the filename. They should map to either an '. 'explicit language as a string value, or a numeric index into '. 'the captured groups as an integer.')) - ->addExample('{"@\\.xyz$@": "php"}', pht('Highlight *.xyz as PHP.')) + ->addExample('{"@\\.xyz$@": "php"}', pht('Highlight %s as PHP.', '*.xyz')) ->addExample( '{"@/httpd\\.conf@": "apacheconf"}', pht('Highlight httpd.conf as "apacheconf".')) diff --git a/src/applications/config/option/PhabricatorTranslationsConfigOptions.php b/src/applications/config/option/PhabricatorTranslationsConfigOptions.php index 007c61d197..aa7b9a2b32 100644 --- a/src/applications/config/option/PhabricatorTranslationsConfigOptions.php +++ b/src/applications/config/option/PhabricatorTranslationsConfigOptions.php @@ -25,10 +25,10 @@ final class PhabricatorTranslationsConfigOptions ->setSummary(pht('Override translations.')) ->setDescription( pht( - "You can use 'translation.override' if you don't want to create ". - "a full translation to give users an option for switching to it ". - "and you just want to override some strings in the default ". - "translation.")) + "You can use '%s' if you don't want to create a full translation ". + "to give users an option for switching to it and you just want to ". + "override some strings in the default translation.", + 'translation.override')) ->addExample( '{"some string": "my alternative"}', pht('Valid Setting')), diff --git a/src/applications/config/option/PhabricatorUIConfigOptions.php b/src/applications/config/option/PhabricatorUIConfigOptions.php index 04896e1a20..8b84a6b4b2 100644 --- a/src/applications/config/option/PhabricatorUIConfigOptions.php +++ b/src/applications/config/option/PhabricatorUIConfigOptions.php @@ -50,8 +50,7 @@ EOJSON; return array( $this->newOption('ui.header-color', 'enum', 'dark') ->setDescription( - pht( - 'Sets the color of the main header.')) + pht('Sets the color of the main header.')) ->setEnumOptions($options), $this->newOption('ui.footer-items', 'list', array()) ->setSummary( diff --git a/src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php b/src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php index 986e8e520c..cd5fa1bff7 100644 --- a/src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php +++ b/src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php @@ -9,10 +9,10 @@ final class ConpherenceQueryThreadConduitAPIMethod public function getMethodDescription() { return pht( - 'Query for conpherence threads for the logged in user. '. - 'You can query by ids or phids for specific conpherence threads. '. - 'Otherwise, specify limit and offset to query the most recently '. - 'updated conpherences for the logged in user.'); + 'Query for Conpherence threads for the logged in user. You can query '. + 'by IDs or PHIDs for specific Conpherence threads. Otherwise, specify '. + 'limit and offset to query the most recently updated Conpherences for '. + 'the logged in user.'); } protected function defineParamTypes() { diff --git a/src/applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php b/src/applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php index 958748a68e..e014dc742a 100644 --- a/src/applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php +++ b/src/applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php @@ -10,9 +10,9 @@ final class ConpherenceQueryTransactionConduitAPIMethod public function getMethodDescription() { return pht( 'Query for transactions for the logged in user within a specific '. - 'conpherence thread. You can specify the thread by id or phid. '. + 'Conpherence thread. You can specify the thread by ID or PHID. '. 'Otherwise, specify limit and offset to query the most recent '. - 'transactions within the conpherence for the logged in user.'); + 'transactions within the Conpherence for the logged in user.'); } protected function defineParamTypes() { @@ -31,7 +31,7 @@ final class ConpherenceQueryTransactionConduitAPIMethod protected function defineErrorTypes() { return array( 'ERR_USAGE_NO_THREAD_ID' => pht( - 'You must specify a thread id or thread phid to query transactions '. + 'You must specify a thread id or thread PHID to query transactions '. 'from.'), ); } diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php index 8d7db7691c..57df50c828 100644 --- a/src/applications/conpherence/controller/ConpherenceUpdateController.php +++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php @@ -208,7 +208,7 @@ final class ConpherenceUpdateController $response_mode = 'ajax'; break; default: - throw new Exception('Unknown action: '.$action); + throw new Exception(pht('Unknown action: %s', $action)); break; } diff --git a/src/applications/conpherence/mail/ConpherenceReplyHandler.php b/src/applications/conpherence/mail/ConpherenceReplyHandler.php index a26c9d3cc6..61f925e150 100644 --- a/src/applications/conpherence/mail/ConpherenceReplyHandler.php +++ b/src/applications/conpherence/mail/ConpherenceReplyHandler.php @@ -14,7 +14,10 @@ final class ConpherenceReplyHandler extends PhabricatorMailReplyHandler { public function validateMailReceiver($mail_receiver) { if (!($mail_receiver instanceof ConpherenceThread)) { - throw new Exception('Mail receiver is not a ConpherenceThread!'); + throw new Exception( + pht( + 'Mail receiver is not a %s!', ' + ConpherenceThread')); } } diff --git a/src/applications/console/plugin/DarkConsoleErrorLogPlugin.php b/src/applications/console/plugin/DarkConsoleErrorLogPlugin.php index 513f4b9905..591904a85f 100644 --- a/src/applications/console/plugin/DarkConsoleErrorLogPlugin.php +++ b/src/applications/console/plugin/DarkConsoleErrorLogPlugin.php @@ -84,8 +84,8 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin { $table = new AphrontTableView($rows); $table->setClassName('error-log'); - $table->setHeaders(array('Error')); - $table->setNoDataString('No errors.'); + $table->setHeaders(array(pht('Error'))); + $table->setNoDataString(pht('No errors.')); return phutil_tag( 'div', diff --git a/src/applications/console/plugin/DarkConsoleEventPlugin.php b/src/applications/console/plugin/DarkConsoleEventPlugin.php index 02dc4e8b78..070227c12d 100644 --- a/src/applications/console/plugin/DarkConsoleEventPlugin.php +++ b/src/applications/console/plugin/DarkConsoleEventPlugin.php @@ -3,11 +3,11 @@ final class DarkConsoleEventPlugin extends DarkConsolePlugin { public function getName() { - return 'Events'; + return pht('Events'); } public function getDescription() { - return 'Information about Phabricator events and event listeners.'; + return pht('Information about Phabricator events and event listeners.'); } public function generateData() { @@ -51,8 +51,8 @@ final class DarkConsoleEventPlugin extends DarkConsolePlugin { $table = new AphrontTableView($rows); $table->setHeaders( array( - 'Internal ID', - 'Listener Class', + pht('Internal ID'), + pht('Listener Class'), )); $table->setColumnClasses( array( @@ -71,7 +71,7 @@ final class DarkConsoleEventPlugin extends DarkConsolePlugin { foreach ($data['events'] as $event) { $rows[] = array( $event['type'], - $event['stopped'] ? 'STOPPED' : null, + $event['stopped'] ? pht('STOPPED') : null, ); } @@ -82,8 +82,8 @@ final class DarkConsoleEventPlugin extends DarkConsolePlugin { )); $table->setHeaders( array( - 'Event Type', - 'Stopped', + pht('Event Type'), + pht('Stopped'), )); $out[] = $table->render(); diff --git a/src/applications/console/plugin/DarkConsoleRequestPlugin.php b/src/applications/console/plugin/DarkConsoleRequestPlugin.php index b354b328c2..8333903131 100644 --- a/src/applications/console/plugin/DarkConsoleRequestPlugin.php +++ b/src/applications/console/plugin/DarkConsoleRequestPlugin.php @@ -3,11 +3,14 @@ final class DarkConsoleRequestPlugin extends DarkConsolePlugin { public function getName() { - return 'Request'; + return pht('Request'); } public function getDescription() { - return 'Information about $_REQUEST and $_SERVER.'; + return pht( + 'Information about %s and %s.', + '$_REQUEST', + '$_SERVER'); } public function generateData() { @@ -47,7 +50,7 @@ final class DarkConsoleRequestPlugin extends DarkConsolePlugin { if (isset($mask[$key])) { $rows[] = array( $key, - phutil_tag('em', array(), '(Masked)'), + phutil_tag('em', array(), pht('(Masked)')), ); } else { $rows[] = array( diff --git a/src/applications/console/plugin/DarkConsoleServicesPlugin.php b/src/applications/console/plugin/DarkConsoleServicesPlugin.php index 7f33f9ba6d..6a59c7e129 100644 --- a/src/applications/console/plugin/DarkConsoleServicesPlugin.php +++ b/src/applications/console/plugin/DarkConsoleServicesPlugin.php @@ -5,11 +5,11 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin { protected $observations; public function getName() { - return 'Services'; + return pht('Services'); } public function getDescription() { - return 'Information about services.'; + return pht('Information about services.'); } public static function getQueryAnalyzerHeader() { @@ -44,7 +44,7 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin { $log[$key]['explain'] = array( 'sev' => 7, 'size' => null, - 'reason' => 'Disabled', + 'reason' => pht('Disabled'), ); // Query analysis is disabled for this request, so don't do any of it. continue; @@ -102,26 +102,26 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin { if (preg_match('/Using where/', $table['Extra'])) { if ($table['rows'] < 256 && !empty($table['possible_keys'])) { $cur_badness = 2; - $cur_reason = 'Small Table Scan'; + $cur_reason = pht('Small Table Scan'); } else { $cur_badness = 6; - $cur_reason = 'TABLE SCAN!'; + $cur_reason = pht('TABLE SCAN!'); } } else { $cur_badness = 3; - $cur_reason = 'Whole Table'; + $cur_reason = pht('Whole Table'); } break; default: if (preg_match('/No tables used/i', $table['Extra'])) { $cur_badness = 1; - $cur_reason = 'No Tables'; + $cur_reason = pht('No Tables'); } else if (preg_match('/Impossible/i', $table['Extra'])) { $cur_badness = 1; - $cur_reason = 'Empty'; + $cur_reason = pht('Empty'); } else { $cur_badness = 4; - $cur_reason = "Can't Analyze"; + $cur_reason = pht("Can't Analyze"); } break; } @@ -198,7 +198,7 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin { $summary[] = array( $type, number_format($counts[$type]), - number_format((int)(1000000 * $totals[$type])).' us', + pht('%d us', number_format((int)(1000000 * $totals[$type]))), sprintf('%.1f%%', 100 * $totals[$type] / $page_total), ); } @@ -212,10 +212,10 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin { )); $summary_table->setHeaders( array( - 'Type', - 'Count', - 'Total Cost', - 'Page Weight', + pht('Type'), + pht('Count'), + pht('Total Cost'), + pht('Page Weight'), )); $results[] = $summary_table->render(); @@ -260,8 +260,8 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin { $rows[] = array( $row['type'], - '+'.number_format(1000 * ($row['begin'] - $data['start'])).' ms', - number_format(1000000 * $row['duration']).' us', + pht('+%d ms', number_format(1000 * ($row['begin'] - $data['start']))), + pht('%d us', number_format(1000000 * $row['duration'])), $info, $analysis, ); @@ -278,11 +278,11 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin { )); $table->setHeaders( array( - 'Event', - 'Start', - 'Duration', - 'Details', - 'Analysis', + pht('Event'), + pht('Start'), + pht('Duration'), + pht('Details'), + pht('Analysis'), )); $results[] = $table->render(); diff --git a/src/applications/console/plugin/DarkConsoleXHProfPlugin.php b/src/applications/console/plugin/DarkConsoleXHProfPlugin.php index 2a0d22f775..f751cc31a5 100644 --- a/src/applications/console/plugin/DarkConsoleXHProfPlugin.php +++ b/src/applications/console/plugin/DarkConsoleXHProfPlugin.php @@ -5,7 +5,7 @@ final class DarkConsoleXHProfPlugin extends DarkConsolePlugin { protected $profileFilePHID; public function getName() { - return 'XHProf'; + return pht('XHProf'); } public function getColor() { @@ -17,7 +17,7 @@ final class DarkConsoleXHProfPlugin extends DarkConsolePlugin { } public function getDescription() { - return 'Provides detailed PHP profiling information through XHProf.'; + return pht('Provides detailed PHP profiling information through XHProf.'); } public function generateData() { @@ -47,14 +47,14 @@ final class DarkConsoleXHProfPlugin extends DarkConsolePlugin { 'href' => $href, 'class' => 'bright-link', ), - 'Installation Guide'); + pht('Installation Guide')); return hsprintf( - '
'. + '
%s
', + pht( 'The "xhprof" PHP extension is not available. Install xhprof '. 'to enable the XHProf console plugin. You can find instructions in '. - 'the %s.'. - '
', - $install_guide); + 'the %s.', + $install_guide)); } $result = array(); diff --git a/src/applications/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php b/src/applications/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php index 5d9723cc4b..3067472cf2 100644 --- a/src/applications/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php +++ b/src/applications/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php @@ -67,7 +67,7 @@ final class DarkConsoleErrorLogPluginAPI { ); break; default: - error_log('Unknown event : '.$event); + error_log(pht('Unknown event: %s', $event)); break; } } diff --git a/src/applications/countdown/controller/PhabricatorCountdownDeleteController.php b/src/applications/countdown/controller/PhabricatorCountdownDeleteController.php index d57534a420..5dfbd18146 100644 --- a/src/applications/countdown/controller/PhabricatorCountdownDeleteController.php +++ b/src/applications/countdown/controller/PhabricatorCountdownDeleteController.php @@ -33,8 +33,9 @@ final class PhabricatorCountdownDeleteController ->setURI('/countdown/'); } - $inst = pht('Are you sure you want to delete the countdown %s?', - $countdown->getTitle()); + $inst = pht( + 'Are you sure you want to delete the countdown %s?', + $countdown->getTitle()); $dialog = new AphrontDialogView(); $dialog->setUser($request->getUser()); diff --git a/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php b/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php index cd549a6844..76d98bda5c 100644 --- a/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php +++ b/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php @@ -50,7 +50,7 @@ final class PhabricatorDaemonConsoleController $rows[] = array( $class, number_format($info['n']), - number_format((int)($info['duration'] / $info['n'])).' us', + pht('%d us', number_format((int)($info['duration'] / $info['n']))), ); } diff --git a/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php b/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php index 17d998fe7c..baab0528e3 100644 --- a/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php +++ b/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php @@ -148,12 +148,10 @@ final class PhabricatorDaemonLogViewController phutil_format_relative_time($wait_time)); break; case PhabricatorDaemonLog::STATUS_EXITING: - $details = pht( - 'This daemon is shutting down gracefully.'); + $details = pht('This daemon is shutting down gracefully.'); break; case PhabricatorDaemonLog::STATUS_EXITED: - $details = pht( - 'This daemon exited normally and is no longer running.'); + $details = pht('This daemon exited normally and is no longer running.'); break; } diff --git a/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php b/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php index c7254de181..57951ccb91 100644 --- a/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php +++ b/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php @@ -95,7 +95,7 @@ final class PhabricatorWorkerTaskDetailController $status = pht('Cancelled'); break; default: - throw new Exception('Unknown task status!'); + throw new Exception(pht('Unknown task status!')); } } else { $status = pht('Queued'); @@ -141,7 +141,7 @@ final class PhabricatorWorkerTaskDetailController $expires); if ($task->isArchived()) { - $duration = number_format($task->getDuration()).' us'; + $duration = pht('%d us', number_format($task->getDuration())); } else { $duration = phutil_tag('em', array(), pht('Not Completed')); } diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php index 23d5a54eeb..e2023ae143 100644 --- a/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php @@ -23,8 +23,10 @@ final class PhabricatorDaemonManagementDebugWorkflow ), array( 'name' => 'as-current-user', - 'help' => 'Run the daemon as the current user '. - 'instead of the configured phd.user', + 'help' => pht( + 'Run the daemon as the current user '. + 'instead of the configured %s', + 'phd.user'), ), array( 'name' => 'autoscale', diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementLogWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementLogWorkflow.php index b32c1439f6..394b4735a5 100644 --- a/src/applications/daemon/management/PhabricatorDaemonManagementLogWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementLogWorkflow.php @@ -17,15 +17,15 @@ final class PhabricatorDaemonManagementLogWorkflow array( 'name' => 'id', 'param' => 'id', - 'help' => 'Show logs for daemon(s) with given ID(s).', + 'help' => pht('Show logs for daemon(s) with given ID(s).'), 'repeat' => true, ), array( 'name' => 'limit', 'param' => 'N', 'default' => 100, - 'help' => 'Show a specific number of log messages '. - '(default 100).', + 'help' => pht( + 'Show a specific number of log messages (default 100).'), ), )); } @@ -87,7 +87,7 @@ final class PhabricatorDaemonManagementLogWorkflow $console->writeOut( "%s\n", - sprintf( + pht( 'Daemon %d %s [%s] %s', $id, $type, diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementReloadWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementReloadWorkflow.php index 4a7d9a764d..fa70231a0a 100644 --- a/src/applications/daemon/management/PhabricatorDaemonManagementReloadWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementReloadWorkflow.php @@ -10,7 +10,8 @@ final class PhabricatorDaemonManagementReloadWorkflow pht( 'Gracefully restart daemon processes in-place to pick up changes '. 'to source. This will not disrupt running jobs. This is an '. - 'advanced workflow; most installs should use __phd restart__.')) + 'advanced workflow; most installs should use __%s__.', + 'phd restart')) ->setArguments( array( array( diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementRestartWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementRestartWorkflow.php index 5d8d6df89e..adb6490f08 100644 --- a/src/applications/daemon/management/PhabricatorDaemonManagementRestartWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementRestartWorkflow.php @@ -6,9 +6,7 @@ final class PhabricatorDaemonManagementRestartWorkflow protected function didConstruct() { $this ->setName('restart') - ->setSynopsis( - pht( - 'Stop, then start the standard daemon loadout.')) + ->setSynopsis(pht('Stop, then start the standard daemon loadout.')) ->setArguments( array( array( diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php index d489dca88b..9a807357a7 100644 --- a/src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php @@ -9,20 +9,21 @@ final class PhabricatorDaemonManagementStartWorkflow ->setSynopsis( pht( 'Start the standard configured collection of Phabricator daemons. '. - 'This is appropriate for most installs. Use **phd launch** to '. - 'customize which daemons are launched.')) + 'This is appropriate for most installs. Use **%s** to '. + 'customize which daemons are launched.', + 'phd launch')) ->setArguments( array( array( 'name' => 'keep-leases', 'help' => pht( - 'By default, **phd start** will free all task leases held by '. - 'the daemons. With this flag, this step will be skipped.'), + 'By default, **%s** will free all task leases held by '. + 'the daemons. With this flag, this step will be skipped.', + 'phd start'), ), array( 'name' => 'force', - 'help' => pht( - 'Start daemons even if daemons are already running.'), + 'help' => pht('Start daemons even if daemons are already running.'), ), $this->getAutoscaleReserveArgument(), )); diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php index 9fc3cc016e..343e42ba63 100644 --- a/src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php @@ -75,7 +75,7 @@ final class PhabricatorDaemonManagementStatusWorkflow if (!$daemon->isRunning()) { $daemon->updateStatus(PhabricatorDaemonLog::STATUS_DEAD); $status = 2; - $name = ' '.$name; + $name = pht(' %s', $name); } $daemon_log = $daemon->getDaemonLog(); diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementStopWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementStopWorkflow.php index e57c617c83..c54a7e9fee 100644 --- a/src/applications/daemon/management/PhabricatorDaemonManagementStopWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementStopWorkflow.php @@ -9,7 +9,8 @@ final class PhabricatorDaemonManagementStopWorkflow ->setSynopsis( pht( 'Stop all running daemons, or specific daemons identified by PIDs. '. - 'Use **phd status** to find PIDs.')) + 'Use **%s** to find PIDs.', + 'phd status')) ->setArguments( array( array( diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php index def781b4a5..63303d6fb7 100644 --- a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php @@ -28,10 +28,15 @@ abstract class PhabricatorDaemonManagementWorkflow list($err) = exec_manual('mkdir -p %s', $path); if ($err) { throw new Exception( - "phd requires the directory '{$path}' to exist, but it does not ". - "exist and could not be created. Create this directory or update ". - "'phd.pid-directory' / 'phd.log-directory' in your configuration ". - "to point to an existing directory."); + pht( + "%s requires the directory '%s' to exist, but it does not exist ". + "and could not be created. Create this directory or update ". + "'%s' / '%s' in your configuration to point to an existing ". + "directory.", + 'phd', + $path, + 'phd.pid-directory', + 'phd.log-directory')); } } return $path; @@ -95,9 +100,9 @@ abstract class PhabricatorDaemonManagementWorkflow if (count($match) == 0) { throw new PhutilArgumentUsageException( pht( - "No daemons match '%s'! Use 'phd list' for a list of available ". - "daemons.", - $substring)); + "No daemons match '%s'! Use '%s' for a list of available daemons.", + $substring, + 'phd list')); } else if (count($match) > 1) { throw new PhutilArgumentUsageException( pht( @@ -130,14 +135,21 @@ abstract class PhabricatorDaemonManagementWorkflow $current_user = $current_user['name']; if ($phd_user && $phd_user != $current_user) { if ($debug) { - throw new PhutilArgumentUsageException(pht( - 'You are trying to run a daemon as a nonstandard user, '. - 'and `phd` was not able to `sudo` to the correct user. '."\n". - 'Phabricator is configured to run daemons as "%s", '. - 'but the current user is "%s". '."\n". - 'Use `sudo` to run as a different user, pass `--as-current-user` '. - 'to ignore this warning, or edit `phd.user` '. - 'to change the configuration.', $phd_user, $current_user)); + throw new PhutilArgumentUsageException( + pht( + "You are trying to run a daemon as a nonstandard user, ". + "and `%s` was not able to `%s` to the correct user. \n". + 'Phabricator is configured to run daemons as "%s", '. + 'but the current user is "%s". '."\n". + 'Use `%s` to run as a different user, pass `%s` to ignore this '. + 'warning, or edit `%s` to change the configuration.', + 'phd', + 'sudo', + $phd_user, + $current_user, + 'sudo', + '--as-current-user', + 'phd.user')); } else { $this->runDaemonsAsUser = $phd_user; $console->writeOut(pht('Starting daemons as %s', $phd_user)."\n"); @@ -213,8 +225,9 @@ abstract class PhabricatorDaemonManagementWorkflow $this->runDaemonsAsUser); } catch (Exception $e) { // Retry without sudo - $console->writeOut(pht( - "sudo command failed. Starting daemon as current user\n")); + $console->writeOut( + "%s\n", + pht('sudo command failed. Starting daemon as current user.')); $this->executeDaemonLaunchCommand( $command, $daemon_script_dir, @@ -270,8 +283,10 @@ abstract class PhabricatorDaemonManagementWorkflow private static function mustHaveExtension($ext) { if (!extension_loaded($ext)) { - echo "ERROR: The PHP extension '{$ext}' is not installed. You must ". - "install it to run daemons on this machine.\n"; + echo pht( + "ERROR: The PHP extension '%s' is not installed. You must ". + "install it to run daemons on this machine.\n", + $ext); exit(1); } @@ -279,8 +294,10 @@ abstract class PhabricatorDaemonManagementWorkflow foreach ($extension->getFunctions() as $function) { $function = $function->name; if (!function_exists($function)) { - echo "ERROR: The PHP function {$function}() is disabled. You must ". - "enable it to run daemons on this machine.\n"; + echo pht( + "ERROR: The PHP function %s is disabled. You must ". + "enable it to run daemons on this machine.\n", + $function.'()'); exit(1); } } @@ -311,11 +328,15 @@ abstract class PhabricatorDaemonManagementWorkflow $message = pht( "phd start: Unable to start daemons because daemons are already ". "running.\n\n". - "You can view running daemons with 'phd status'.\n". - "You can stop running daemons with 'phd stop'.\n". - "You can use 'phd restart' to stop all daemons before starting ". + "You can view running daemons with '%s'.\n". + "You can stop running daemons with '%s'.\n". + "You can use '%s' to stop all daemons before starting ". "new daemons.\n". - "You can force daemons to start anyway with --force."); + "You can force daemons to start anyway with %s.", + 'phd status', + 'phd stop', + 'phd restart', + '--force'); $console->writeErr("%s\n", $message); exit(1); @@ -352,7 +373,7 @@ abstract class PhabricatorDaemonManagementWorkflow $this->launchDaemons($daemons, $is_debug = false); - $console->writeErr(pht('Done.')."\n"); + $console->writeErr("%s\n", pht('Done.')); return 0; } @@ -369,8 +390,9 @@ abstract class PhabricatorDaemonManagementWorkflow if ($gently && $force) { throw new PhutilArgumentUsageException( pht( - 'You can not specify conflicting options --gently and --force '. - 'together.')); + 'You can not specify conflicting options %s and %s together.', + '--gently', + '--force')); } $daemons = $this->loadRunningDaemons(); @@ -383,8 +405,9 @@ abstract class PhabricatorDaemonManagementWorkflow $force); } if (!$survivors) { - $console->writeErr(pht( - 'There are no running Phabricator daemons.')."\n"); + $console->writeErr( + "%s\n", + pht('There are no running Phabricator daemons.')); } return 0; } @@ -392,7 +415,7 @@ abstract class PhabricatorDaemonManagementWorkflow $stop_pids = $this->selectDaemonPIDs($daemons, $pids); if (!$stop_pids) { - $console->writeErr(pht('No daemons to kill.')."\n"); + $console->writeErr("%s\n", pht('No daemons to kill.')); return 0; } @@ -470,12 +493,13 @@ abstract class PhabricatorDaemonManagementWorkflow $survivors = $this->sendStopSignals($rogue_pids, $grace_period); if ($survivors) { $console->writeErr( + "%s\n", pht( 'Unable to stop processes running without PID files. '. - 'Try running this command again with sudo.')."\n"); + 'Try running this command again with sudo.')); } } else if ($warn) { - $console->writeErr($this->getForceStopHint($rogue_daemons)."\n"); + $console->writeErr("%s\n", $this->getForceStopHint($rogue_daemons)); } } @@ -488,11 +512,11 @@ abstract class PhabricatorDaemonManagementWorkflow $debug_output .= $rogue['pid'].' '.$rogue['command']."\n"; } return pht( - 'There are processes running that look like Phabricator daemons but '. - 'have no corresponding PID files:'."\n\n".'%s'."\n\n". - 'Stop these processes by re-running this command with the --force '. - 'parameter.', - $debug_output); + "There are processes running that look like Phabricator daemons but ". + "have no corresponding PID files:\n\n%s\n\n". + "Stop these processes by re-running this command with the %s parameter.", + $debug_output, + '--force'); } private function sendStopSignals($pids, $grace_period) { diff --git a/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php b/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php index b06ebdd7d2..4c0caa6fd7 100644 --- a/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php +++ b/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php @@ -99,7 +99,7 @@ final class PhabricatorDaemonLogEventsView extends AphrontView { array( 'href' => '/daemon/log/'.$event->getLogID().'/', ), - 'Daemon '.$event->getLogID())); + pht('Daemon %s', $event->getLogID()))); } $rows[] = $row; diff --git a/src/applications/dashboard/controller/PhabricatorDashboardEditController.php b/src/applications/dashboard/controller/PhabricatorDashboardEditController.php index cad74f7a5f..26ddd2870a 100644 --- a/src/applications/dashboard/controller/PhabricatorDashboardEditController.php +++ b/src/applications/dashboard/controller/PhabricatorDashboardEditController.php @@ -56,7 +56,7 @@ final class PhabricatorDashboardEditController $button = pht('Create Dashboard'); $cancel_uri = $this->getApplicationURI(); - $crumbs->addTextCrumb('Create Dashboard'); + $crumbs->addTextCrumb(pht('Create Dashboard')); } else { $id = $dashboard->getID(); $cancel_uri = $this->getApplicationURI('manage/'.$id.'/'); @@ -226,11 +226,9 @@ final class PhabricatorDashboardEditController "This is a simple template dashboard. You can edit this panel ". "to change this text and replace it with a welcome message, or ". "leave this placeholder text as-is to give your dashboard a ". - "rustic, authentic feel.". - "\n\n". + "rustic, authentic feel.\n\n". "You can drag, remove, add, and edit panels to customize the ". - "rest of this dashboard to show the information you want.". - "\n\n". + "rest of this dashboard to show the information you want.\n\n". "To install this dashboard on the home page, use the ". "**Install Dashboard** action link above."), )); diff --git a/src/applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php b/src/applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php index af4a947c8e..9909515f06 100644 --- a/src/applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php +++ b/src/applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php @@ -124,10 +124,10 @@ final class PhabricatorDashboardLayoutConfig { ); break; case self::MODE_FULL: - throw new Exception('There is only one column in mode full.'); + throw new Exception(pht('There is only one column in mode full.')); break; default: - throw new Exception('Unknown layout mode!'); + throw new Exception(pht('Unknown layout mode!')); break; } diff --git a/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php b/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php index 9805cc7259..c278ff0c67 100644 --- a/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php +++ b/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php @@ -109,8 +109,7 @@ final class DifferentialParseRenderTestCase extends PhabricatorTestCase { } else if ($type == 'two') { $cparser->setRenderer(new DifferentialChangesetTwoUpTestRenderer()); } else { - throw new Exception( - pht('Unknown renderer type "%s"!', $type)); + throw new Exception(pht('Unknown renderer type "%s"!', $type)); } $parsers[] = $cparser; diff --git a/src/applications/differential/application/PhabricatorDifferentialApplication.php b/src/applications/differential/application/PhabricatorDifferentialApplication.php index 1aca323457..7bbe133427 100644 --- a/src/applications/differential/application/PhabricatorDifferentialApplication.php +++ b/src/applications/differential/application/PhabricatorDifferentialApplication.php @@ -50,11 +50,9 @@ final class PhabricatorDifferentialApplication extends PhabricatorApplication { } public function getOverview() { - return pht(<< 'Revision was not found.', + 'ERR_NOT_FOUND' => pht('Revision was not found.'), ); } diff --git a/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php index fe1d57857d..c5d2bdb9dc 100644 --- a/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php @@ -27,7 +27,7 @@ final class DifferentialCreateCommentConduitAPIMethod protected function defineErrorTypes() { return array( - 'ERR_BAD_REVISION' => 'Bad revision ID.', + 'ERR_BAD_REVISION' => pht('Bad revision ID.'), ); } diff --git a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php index 8839eee6d7..91b5ca8653 100644 --- a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php @@ -8,7 +8,7 @@ final class DifferentialCreateDiffConduitAPIMethod } public function getMethodDescription() { - return 'Create a new Differential diff.'; + return pht('Create a new Differential diff.'); } protected function defineParamTypes() { diff --git a/src/applications/differential/conduit/DifferentialCreateInlineConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateInlineConduitAPIMethod.php index 98a567b0b8..6447385558 100644 --- a/src/applications/differential/conduit/DifferentialCreateInlineConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateInlineConduitAPIMethod.php @@ -8,7 +8,7 @@ final class DifferentialCreateInlineConduitAPIMethod } public function getMethodDescription() { - return 'Add an inline comment to a Differential revision.'; + return pht('Add an inline comment to a Differential revision.'); } protected function defineParamTypes() { @@ -29,11 +29,16 @@ final class DifferentialCreateInlineConduitAPIMethod protected function defineErrorTypes() { return array( - 'ERR-BAD-REVISION' => 'Bad revision ID.', - 'ERR-BAD-DIFF' => 'Bad diff ID, or diff does not belong to revision.', - 'ERR-NEED-DIFF' => 'Neither revision ID nor diff ID was provided.', - 'ERR-NEED-FILE' => 'A file path was not provided.', - 'ERR-BAD-FILE' => "Requested file doesn't exist in this revision.", + 'ERR-BAD-REVISION' => pht( + 'Bad revision ID.'), + 'ERR-BAD-DIFF' => pht( + 'Bad diff ID, or diff does not belong to revision.'), + 'ERR-NEED-DIFF' => pht( + 'Neither revision ID nor diff ID was provided.'), + 'ERR-NEED-FILE' => pht( + 'A file path was not provided.'), + 'ERR-BAD-FILE' => pht( + "Requested file doesn't exist in this revision."), ); } diff --git a/src/applications/differential/conduit/DifferentialCreateRevisionConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateRevisionConduitAPIMethod.php index de0c3e02d5..95b4309c70 100644 --- a/src/applications/differential/conduit/DifferentialCreateRevisionConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateRevisionConduitAPIMethod.php @@ -27,7 +27,7 @@ final class DifferentialCreateRevisionConduitAPIMethod protected function defineErrorTypes() { return array( - 'ERR_BAD_DIFF' => 'Bad diff ID.', + 'ERR_BAD_DIFF' => pht('Bad diff ID.'), ); } diff --git a/src/applications/differential/conduit/DifferentialFindConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialFindConduitAPIMethod.php index 56cb0f08da..92dce067fe 100644 --- a/src/applications/differential/conduit/DifferentialFindConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialFindConduitAPIMethod.php @@ -12,11 +12,11 @@ final class DifferentialFindConduitAPIMethod } public function getMethodStatusDescription() { - return "Replaced by 'differential.query'."; + return pht("Replaced by '%s'.", 'differential.query'); } public function getMethodDescription() { - return 'Query Differential revisions which match certain criteria.'; + return pht('Query Differential revisions which match certain criteria.'); } protected function defineParamTypes() { diff --git a/src/applications/differential/conduit/DifferentialFinishPostponedLintersConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialFinishPostponedLintersConduitAPIMethod.php index 093f06e117..f53340f06b 100644 --- a/src/applications/differential/conduit/DifferentialFinishPostponedLintersConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialFinishPostponedLintersConduitAPIMethod.php @@ -8,8 +8,9 @@ final class DifferentialFinishPostponedLintersConduitAPIMethod } public function getMethodDescription() { - return 'Update diff with new lint messages and mark postponed '. - 'linters as finished.'; + return pht( + 'Update diff with new lint messages and mark postponed '. + 'linters as finished.'); } protected function defineParamTypes() { @@ -25,14 +26,13 @@ final class DifferentialFinishPostponedLintersConduitAPIMethod protected function defineErrorTypes() { return array( - 'ERR-BAD-DIFF' => 'Bad diff ID.', - 'ERR-BAD-LINTER' => 'No postponed linter by the given name', - 'ERR-NO-LINT' => 'No postponed lint field available in diff', + 'ERR-BAD-DIFF' => pht('Bad diff ID.'), + 'ERR-BAD-LINTER' => pht('No postponed linter by the given name.'), + 'ERR-NO-LINT' => pht('No postponed lint field available in diff.'), ); } protected function execute(ConduitAPIRequest $request) { - $diff_id = $request->getValue('diffID'); $linter_map = $request->getValue('linters'); diff --git a/src/applications/differential/conduit/DifferentialGetAllDiffsConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetAllDiffsConduitAPIMethod.php index c4e2d35215..187e1aaaf4 100644 --- a/src/applications/differential/conduit/DifferentialGetAllDiffsConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialGetAllDiffsConduitAPIMethod.php @@ -13,11 +13,12 @@ final class DifferentialGetAllDiffsConduitAPIMethod public function getMethodStatusDescription() { return pht( - 'This method has been deprecated in favor of differential.querydiffs.'); + 'This method has been deprecated in favor of %s.', + 'differential.querydiffs'); } public function getMethodDescription() { - return 'Load all diffs for given revisions from Differential.'; + return pht('Load all diffs for given revisions from Differential.'); } protected function defineParamTypes() { diff --git a/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php index 8d7e71c030..288a8c4ca9 100644 --- a/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php @@ -8,7 +8,7 @@ final class DifferentialGetCommitMessageConduitAPIMethod } public function getMethodDescription() { - return 'Retrieve Differential commit messages or message templates.'; + return pht('Retrieve Differential commit messages or message templates.'); } protected function defineParamTypes() { @@ -27,7 +27,7 @@ final class DifferentialGetCommitMessageConduitAPIMethod protected function defineErrorTypes() { return array( - 'ERR_NOT_FOUND' => 'Revision was not found.', + 'ERR_NOT_FOUND' => pht('Revision was not found.'), ); } diff --git a/src/applications/differential/conduit/DifferentialGetCommitPathsConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetCommitPathsConduitAPIMethod.php index a025cd4983..bdd33b60fd 100644 --- a/src/applications/differential/conduit/DifferentialGetCommitPathsConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialGetCommitPathsConduitAPIMethod.php @@ -8,8 +8,9 @@ final class DifferentialGetCommitPathsConduitAPIMethod } public function getMethodDescription() { - return 'Query which paths should be included when committing a '. - 'Differential revision.'; + return pht( + 'Query which paths should be included when committing a '. + 'Differential revision.'); } protected function defineParamTypes() { @@ -24,7 +25,7 @@ final class DifferentialGetCommitPathsConduitAPIMethod protected function defineErrorTypes() { return array( - 'ERR_NOT_FOUND' => 'No such revision exists.', + 'ERR_NOT_FOUND' => pht('No such revision exists.'), ); } diff --git a/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php index 92d9807dda..a47c9c616b 100644 --- a/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php @@ -24,8 +24,8 @@ final class DifferentialGetDiffConduitAPIMethod public function getMethodDescription() { return pht( - 'Load the content of a diff from Differential by revision id '. - 'or diff id.'); + 'Load the content of a diff from Differential by revision ID '. + 'or diff ID.'); } protected function defineParamTypes() { @@ -41,7 +41,7 @@ final class DifferentialGetDiffConduitAPIMethod protected function defineErrorTypes() { return array( - 'ERR_BAD_DIFF' => 'No such diff exists.', + 'ERR_BAD_DIFF' => pht('No such diff exists.'), ); } diff --git a/src/applications/differential/conduit/DifferentialGetRevisionCommentsConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetRevisionCommentsConduitAPIMethod.php index 6a6770d3e8..1ea23e33a2 100644 --- a/src/applications/differential/conduit/DifferentialGetRevisionCommentsConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialGetRevisionCommentsConduitAPIMethod.php @@ -16,7 +16,7 @@ final class DifferentialGetRevisionCommentsConduitAPIMethod } public function getMethodDescription() { - return 'Retrieve Differential Revision Comments.'; + return pht('Retrieve Differential Revision Comments.'); } protected function defineParamTypes() { diff --git a/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php index 305b071be8..2bf43d295e 100644 --- a/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php @@ -8,7 +8,7 @@ final class DifferentialQueryConduitAPIMethod } public function getMethodDescription() { - return 'Query Differential revisions which match certain criteria.'; + return pht('Query Differential revisions which match certain criteria.'); } protected function defineParamTypes() { @@ -53,7 +53,7 @@ final class DifferentialQueryConduitAPIMethod protected function defineErrorTypes() { return array( - 'ERR-INVALID-PARAMETER' => 'Missing or malformed parameter.', + 'ERR-INVALID-PARAMETER' => pht('Missing or malformed parameter.'), ); } @@ -103,7 +103,9 @@ final class DifferentialQueryConduitAPIMethod } throw id(new ConduitException('ERR-INVALID-PARAMETER')) ->setErrorDescription( - 'Unknown paths: '.implode(', ', $unknown_paths)); + pht( + 'Unknown paths: %s', + implode(', ', $unknown_paths))); } $repos = array(); @@ -118,7 +120,9 @@ final class DifferentialQueryConduitAPIMethod if (!$repos[$callsign]) { throw id(new ConduitException('ERR-INVALID-PARAMETER')) ->setErrorDescription( - 'Unknown repo callsign: '.$callsign); + pht( + 'Unknown repo callsign: %s', + $callsign)); } } $repo = $repos[$callsign]; diff --git a/src/applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php index d79be1363d..f9db11e3fb 100644 --- a/src/applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php @@ -8,7 +8,7 @@ final class DifferentialSetDiffPropertyConduitAPIMethod } public function getMethodDescription() { - return 'Attach properties to Differential diffs.'; + return pht('Attach properties to Differential diffs.'); } protected function defineParamTypes() { @@ -25,7 +25,7 @@ final class DifferentialSetDiffPropertyConduitAPIMethod protected function defineErrorTypes() { return array( - 'ERR_NOT_FOUND' => 'Diff was not found.', + 'ERR_NOT_FOUND' => pht('Diff was not found.'), ); } diff --git a/src/applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php index e8a34fd133..232dbf79b4 100644 --- a/src/applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php @@ -26,10 +26,10 @@ final class DifferentialUpdateRevisionConduitAPIMethod protected function defineErrorTypes() { return array( - 'ERR_BAD_DIFF' => 'Bad diff ID.', - 'ERR_BAD_REVISION' => 'Bad revision ID.', - 'ERR_WRONG_USER' => 'You are not the author of this revision.', - 'ERR_CLOSED' => 'This revision has already been closed.', + 'ERR_BAD_DIFF' => pht('Bad diff ID.'), + 'ERR_BAD_REVISION' => pht('Bad revision ID.'), + 'ERR_WRONG_USER' => pht('You are not the author of this revision.'), + 'ERR_CLOSED' => pht('This revision has already been closed.'), ); } diff --git a/src/applications/differential/conduit/DifferentialUpdateUnitResultsConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialUpdateUnitResultsConduitAPIMethod.php index 0f0c14a6b8..7b1a250666 100644 --- a/src/applications/differential/conduit/DifferentialUpdateUnitResultsConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialUpdateUnitResultsConduitAPIMethod.php @@ -8,7 +8,7 @@ final class DifferentialUpdateUnitResultsConduitAPIMethod } public function getMethodDescription() { - return 'Update arc unit results for a postponed test.'; + return pht('Update arc unit results for a postponed test.'); } protected function defineParamTypes() { @@ -29,13 +29,12 @@ final class DifferentialUpdateUnitResultsConduitAPIMethod protected function defineErrorTypes() { return array( - 'ERR_BAD_DIFF' => 'Bad diff ID.', - 'ERR_NO_RESULTS' => 'Could not find the postponed test', + 'ERR_BAD_DIFF' => pht('Bad diff ID.'), + 'ERR_NO_RESULTS' => pht('Could not find the postponed test'), ); } protected function execute(ConduitAPIRequest $request) { - $diff_id = $request->getValue('diff_id'); if (!$diff_id) { throw new ConduitException('ERR_BAD_DIFF'); diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php index 6169d0df88..2c8f4e0bd9 100644 --- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php +++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php @@ -201,11 +201,12 @@ final class PhabricatorDifferentialConfigOptions )) ->setSummary(pht('Allows any user to reopen a closed revision.')) ->setDescription( - pht('If you set this to true, any user can reopen a revision so '. - 'long as it has been closed. This can be useful if a revision '. - 'is accidentally closed or if a developer changes his or her '. - 'mind after closing a revision. If it is false, reopening '. - 'is not allowed.')), + pht( + 'If you set this to true, any user can reopen a revision so '. + 'long as it has been closed. This can be useful if a revision '. + 'is accidentally closed or if a developer changes his or her '. + 'mind after closing a revision. If it is false, reopening '. + 'is not allowed.')), $this->newOption('differential.close-on-accept', 'bool', false) ->setBoolOptions( array( @@ -242,8 +243,9 @@ final class PhabricatorDifferentialConfigOptions pht("After this many days, a revision will be considered 'stale'.")) ->setDescription( pht( - "Similar to `differential.days-fresh` but marks stale revisions. ". - "If the revision is even older than it is when marked as 'old'.")), + "Similar to `%s` but marks stale revisions. ". + "If the revision is even older than it is when marked as 'old'.", + 'differential.days-fresh')), $this->newOption( 'metamta.differential.subject-prefix', 'string', diff --git a/src/applications/differential/constants/DifferentialAction.php b/src/applications/differential/constants/DifferentialAction.php index 48a263c45a..5b5fa9eb71 100644 --- a/src/applications/differential/constants/DifferentialAction.php +++ b/src/applications/differential/constants/DifferentialAction.php @@ -23,71 +23,88 @@ final class DifferentialAction { public static function getBasicStoryText($action, $author_name) { switch ($action) { case self::ACTION_COMMENT: - $title = pht('%s commented on this revision.', + $title = pht( + '%s commented on this revision.', $author_name); break; case self::ACTION_ACCEPT: - $title = pht('%s accepted this revision.', + $title = pht( + '%s accepted this revision.', $author_name); break; case self::ACTION_REJECT: - $title = pht('%s requested changes to this revision.', + $title = pht( + '%s requested changes to this revision.', $author_name); break; case self::ACTION_RETHINK: - $title = pht('%s planned changes to this revision.', + $title = pht( + '%s planned changes to this revision.', $author_name); break; case self::ACTION_ABANDON: - $title = pht('%s abandoned this revision.', + $title = pht( + '%s abandoned this revision.', $author_name); break; case self::ACTION_CLOSE: - $title = pht('%s closed this revision.', + $title = pht( + '%s closed this revision.', $author_name); break; case self::ACTION_REQUEST: - $title = pht('%s requested a review of this revision.', + $title = pht( + '%s requested a review of this revision.', $author_name); break; case self::ACTION_RECLAIM: - $title = pht('%s reclaimed this revision.', + $title = pht( + '%s reclaimed this revision.', $author_name); break; case self::ACTION_UPDATE: - $title = pht('%s updated this revision.', + $title = pht( + '%s updated this revision.', $author_name); break; case self::ACTION_RESIGN: - $title = pht('%s resigned from this revision.', + $title = pht( + '%s resigned from this revision.', $author_name); break; case self::ACTION_SUMMARIZE: - $title = pht('%s summarized this revision.', + $title = pht( + '%s summarized this revision.', $author_name); break; case self::ACTION_TESTPLAN: - $title = pht('%s explained the test plan for this revision.', + $title = pht( + '%s explained the test plan for this revision.', $author_name); break; case self::ACTION_CREATE: - $title = pht('%s created this revision.', + $title = pht( + '%s created this revision.', $author_name); break; case self::ACTION_ADDREVIEWERS: - $title = pht('%s added reviewers to this revision.', + $title = pht( + '%s added reviewers to this revision.', $author_name); break; case self::ACTION_ADDCCS: - $title = pht('%s added CCs to this revision.', + $title = pht( + '%s added CCs to this revision.', $author_name); break; case self::ACTION_CLAIM: - $title = pht('%s commandeered this revision.', + $title = pht( + '%s commandeered this revision.', $author_name); break; case self::ACTION_REOPEN: - $title = pht('%s reopened this revision.', + $title = pht( + '%s reopened this revision.', $author_name); break; case DifferentialTransaction::TYPE_INLINE: @@ -122,7 +139,7 @@ final class DifferentialAction { if (!empty($verbs[$action])) { return $verbs[$action]; } else { - return 'brazenly '.$action; + return pht('brazenly %s', $action); } } diff --git a/src/applications/differential/constants/DifferentialChangeType.php b/src/applications/differential/constants/DifferentialChangeType.php index 2ce5392165..7e037d29b5 100644 --- a/src/applications/differential/constants/DifferentialChangeType.php +++ b/src/applications/differential/constants/DifferentialChangeType.php @@ -105,7 +105,7 @@ final class DifferentialChangeType { self::TYPE_MESSAGE => pht('Commit Message'), self::TYPE_CHILD => pht('Contents Modified'), ); - return idx($types, coalesce($type, '?'), 'Unknown'); + return idx($types, coalesce($type, '?'), pht('Unknown')); } } diff --git a/src/applications/differential/controller/DifferentialChangesetViewController.php b/src/applications/differential/controller/DifferentialChangesetViewController.php index abc19ab836..0638578f94 100644 --- a/src/applications/differential/controller/DifferentialChangesetViewController.php +++ b/src/applications/differential/controller/DifferentialChangesetViewController.php @@ -372,7 +372,7 @@ final class DifferentialChangesetViewController extends DifferentialController { $inline = new DifferentialInlineComment(); $inline->setChangesetID($changeset->getID()); $inline->setIsNewFile(1); - $inline->setSyntheticAuthor('Lint: '.$msg['name']); + $inline->setSyntheticAuthor(pht('Lint: %s', $msg['name'])); $inline->setLineNumber($msg['line']); $inline->setLineLength(0); diff --git a/src/applications/differential/controller/DifferentialDiffCreateController.php b/src/applications/differential/controller/DifferentialDiffCreateController.php index 7781f22023..1eb4f88b1a 100644 --- a/src/applications/differential/controller/DifferentialDiffCreateController.php +++ b/src/applications/differential/controller/DifferentialDiffCreateController.php @@ -89,7 +89,7 @@ final class DifferentialDiffCreateController extends DifferentialController { 'href' => $arcanist_href, 'target' => '_blank', ), - 'Learn More'); + pht('Learn More')); $cancel_uri = $this->getApplicationURI(); diff --git a/src/applications/differential/controller/DifferentialInlineCommentEditController.php b/src/applications/differential/controller/DifferentialInlineCommentEditController.php index dcb48361dc..13aac1776c 100644 --- a/src/applications/differential/controller/DifferentialInlineCommentEditController.php +++ b/src/applications/differential/controller/DifferentialInlineCommentEditController.php @@ -29,7 +29,7 @@ final class DifferentialInlineCommentEditController $revision = $this->loadRevision(); if (!id(new DifferentialChangeset())->load($changeset_id)) { - throw new Exception('Invalid changeset ID!'); + throw new Exception(pht('Invalid changeset ID!')); } return id(new DifferentialInlineComment()) @@ -59,7 +59,7 @@ final class DifferentialInlineCommentEditController $inline = $this->loadComment($id); if (!$this->canEditInlineComment($user, $inline)) { - throw new Exception('That comment is not editable!'); + throw new Exception(pht('That comment is not editable!')); } return $inline; } diff --git a/src/applications/differential/controller/DifferentialRevisionCloseDetailsController.php b/src/applications/differential/controller/DifferentialRevisionCloseDetailsController.php index 0f797d94d3..25051bcbb5 100644 --- a/src/applications/differential/controller/DifferentialRevisionCloseDetailsController.php +++ b/src/applications/differential/controller/DifferentialRevisionCloseDetailsController.php @@ -55,9 +55,10 @@ final class DifferentialRevisionCloseDetailsController $body_why = array(); if ($revision_match_data['usedURI']) { return pht( - 'We found a "Differential Revision" field with value "%s" in the '. - 'commit message, and the domain on the URI matches this install, so '. + 'We found a "%s" field with value "%s" in the commit message, '. + 'and the domain on the URI matches this install, so '. 'we linked this commit to %s.', + 'Differential Revision', $revision_match_data['foundURI'], phutil_tag( 'a', @@ -67,16 +68,17 @@ final class DifferentialRevisionCloseDetailsController $obj_handle->getName())); } else if ($revision_match_data['foundURI']) { $body_why[] = pht( - 'We found a "Differential Revision" field with value "%s" in the '. - 'commit message, but the domain on this URI did not match the '. - 'configured domain for this install, "%s", so we ignored it under '. + 'We found a "%s" field with value "%s" in the commit message, '. + 'but the domain on this URI did not match the configured '. + 'domain for this install, "%s", so we ignored it under '. 'the assumption that it refers to some third-party revision.', + 'Differential Revision', $revision_match_data['foundURI'], $revision_match_data['validDomain']); } else { $body_why[] = pht( - 'We didn\'t find a "Differential Revision" field in the commit '. - 'message.'); + 'We didn\'t find a "%s" field in the commit message.', + 'Differential Revision'); } switch ($revision_match_data['matchHashType']) { diff --git a/src/applications/differential/controller/DifferentialRevisionEditController.php b/src/applications/differential/controller/DifferentialRevisionEditController.php index ea26693454..1c664f07d2 100644 --- a/src/applications/differential/controller/DifferentialRevisionEditController.php +++ b/src/applications/differential/controller/DifferentialRevisionEditController.php @@ -49,7 +49,8 @@ final class DifferentialRevisionEditController } if ($diff->getRevisionID()) { // TODO: Redirect? - throw new Exception('This diff is already attached to a revision!'); + throw new Exception( + pht('This diff is already attached to a revision!')); } } else { $diff = null; diff --git a/src/applications/differential/controller/DifferentialRevisionLandController.php b/src/applications/differential/controller/DifferentialRevisionLandController.php index 1c8ed0e9d3..e19762b44d 100644 --- a/src/applications/differential/controller/DifferentialRevisionLandController.php +++ b/src/applications/differential/controller/DifferentialRevisionLandController.php @@ -29,10 +29,12 @@ final class DifferentialRevisionLandController extends DifferentialController { $this->pushStrategy = newv($this->strategyClass, array()); } else { throw new Exception( - "Strategy type must be a valid class name and must subclass ". - "DifferentialLandingStrategy. ". - "'{$this->strategyClass}' is not a subclass of ". - "DifferentialLandingStrategy."); + pht( + "Strategy type must be a valid class name and must subclass ". + "%s. '%s' is not a subclass of %s", + 'DifferentialLandingStrategy', + $this->strategyClass, + 'DifferentialLandingStrategy')); } if ($request->isDialogFormPost()) { @@ -91,7 +93,7 @@ final class DifferentialRevisionLandController extends DifferentialController { $prompt = hsprintf('%s

%s', pht( 'This will squash and rebase revision %s, and push it to '. - 'the default / master branch.', + 'the default / master branch.', $revision_id), pht('It is an experimental feature and may not work.')); @@ -109,13 +111,13 @@ final class DifferentialRevisionLandController extends DifferentialController { private function attemptLand($revision, $request) { $status = $revision->getStatus(); if ($status != ArcanistDifferentialRevisionStatus::ACCEPTED) { - throw new Exception('Only Accepted revisions can be landed.'); + throw new Exception(pht('Only Accepted revisions can be landed.')); } $repository = $revision->getRepository(); if ($repository === null) { - throw new Exception('revision is not attached to a repository.'); + throw new Exception(pht('Revision is not attached to a repository.')); } $can_push = PhabricatorPolicyFilter::hasCapability( diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index cdefdd65d7..312d4a7f4e 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -38,7 +38,7 @@ final class DifferentialRevisionViewController extends DifferentialController { if (!$diffs) { throw new Exception( - 'This revision has no diffs. Something has gone quite wrong.'); + pht('This revision has no diffs. Something has gone quite wrong.')); } $revision->attachActiveDiff(last($diffs)); @@ -151,7 +151,7 @@ final class DifferentialRevisionViewController extends DifferentialController { if (count($changesets) > $limit && !$large) { $count = count($changesets); $warning = new PHUIInfoView(); - $warning->setTitle('Very Large Diff'); + $warning->setTitle(pht('Very Large Diff')); $warning->setSeverity(PHUIInfoView::SEVERITY_WARNING); $warning->appendChild(hsprintf( '%s %s', @@ -328,7 +328,7 @@ final class DifferentialRevisionViewController extends DifferentialController { $changeset_view->setRepository($repository); } $changeset_view->setSymbolIndexes($symbol_indexes); - $changeset_view->setTitle('Diff '.$target->getID()); + $changeset_view->setTitle(pht('Diff %s', $target->getID())); $diff_history = id(new DifferentialRevisionUpdateHistoryView()) ->setUser($user) diff --git a/src/applications/differential/customfield/DifferentialBranchField.php b/src/applications/differential/customfield/DifferentialBranchField.php index 5601d66625..35ed809f12 100644 --- a/src/applications/differential/customfield/DifferentialBranchField.php +++ b/src/applications/differential/customfield/DifferentialBranchField.php @@ -45,8 +45,9 @@ final class DifferentialBranchField public function getProTips() { return array( pht( - 'In Git and Mercurial, use a branch like "T123" to automatically '. - 'associate changes with the corresponding task.'), + 'In Git and Mercurial, use a branch like "%s" to automatically '. + 'associate changes with the corresponding task.', + 'T123'), ); } diff --git a/src/applications/differential/customfield/DifferentialConflictsField.php b/src/applications/differential/customfield/DifferentialConflictsField.php index ac5c75326f..590d9fd3a7 100644 --- a/src/applications/differential/customfield/DifferentialConflictsField.php +++ b/src/applications/differential/customfield/DifferentialConflictsField.php @@ -22,8 +22,8 @@ final class DifferentialConflictsField public function getFieldDescription() { return pht( - 'Parses the "Conflicts" field which Git can inject into commit '. - 'messages.'); + 'Parses the "%s" field which Git can inject into commit messages.', + 'Conflicts'); } public function canDisableField() { diff --git a/src/applications/differential/customfield/DifferentialDependsOnField.php b/src/applications/differential/customfield/DifferentialDependsOnField.php index 555cb03688..17156fe240 100644 --- a/src/applications/differential/customfield/DifferentialDependsOnField.php +++ b/src/applications/differential/customfield/DifferentialDependsOnField.php @@ -45,7 +45,8 @@ final class DifferentialDependsOnField return array( pht( 'Create a dependency between revisions by writing '. - '"Depends on D123" in your summary.'), + '"%s" in your summary.', + 'Depends on D123'), ); } diff --git a/src/applications/differential/customfield/DifferentialGitSVNIDField.php b/src/applications/differential/customfield/DifferentialGitSVNIDField.php index a671e10bd6..de45c54c7f 100644 --- a/src/applications/differential/customfield/DifferentialGitSVNIDField.php +++ b/src/applications/differential/customfield/DifferentialGitSVNIDField.php @@ -22,8 +22,8 @@ final class DifferentialGitSVNIDField public function getFieldDescription() { return pht( - 'Parses the "git-svn-id" field which Git/SVN can inject into commit '. - 'messages.'); + 'Parses the "%s" field which Git/SVN can inject into commit messages.', + 'git-svn-id'); } public function canDisableField() { diff --git a/src/applications/differential/customfield/DifferentialLintField.php b/src/applications/differential/customfield/DifferentialLintField.php index 56b7ec3ae6..c43034dd06 100644 --- a/src/applications/differential/customfield/DifferentialLintField.php +++ b/src/applications/differential/customfield/DifferentialLintField.php @@ -83,7 +83,7 @@ final class DifferentialLintField $name = idx($message, 'name'); $description = idx($message, 'description'); - $line_link = 'line '.intval($line); + $line_link = pht('line %d', intval($line)); if (isset($path_changesets[$path])) { $href = '#C'.$path_changesets[$path].'NL'.max(1, $line); @@ -130,7 +130,9 @@ final class DifferentialLintField idx($location, 'path', $path). ($other_line ? ":{$other_line}" : ''); } - $description .= "\nOther locations: ".implode(', ', $locations); + $description .= "\n".pht( + 'Other locations: %s', + implode(', ', $locations)); } if (strlen($description)) { @@ -231,7 +233,9 @@ final class DifferentialLintField } } - return 'Show Full Lint Results ('.implode(', ', $show).')'; + return pht( + 'Show Full Lint Results (%s)', + implode(', ', $show)); } public function getWarningsForDetailView() { diff --git a/src/applications/differential/customfield/DifferentialManiphestTasksField.php b/src/applications/differential/customfield/DifferentialManiphestTasksField.php index b13cfcc304..56803f60c3 100644 --- a/src/applications/differential/customfield/DifferentialManiphestTasksField.php +++ b/src/applications/differential/customfield/DifferentialManiphestTasksField.php @@ -106,8 +106,9 @@ final class DifferentialManiphestTasksField public function getProTips() { return array( pht( - 'Write "Fixes T123" in your summary to automatically close the '. - 'corresponding task when this change lands.'), + 'Write "%s" in your summary to automatically close the '. + 'corresponding task when this change lands.', + 'Fixes T123'), ); } diff --git a/src/applications/differential/customfield/DifferentialProjectReviewersField.php b/src/applications/differential/customfield/DifferentialProjectReviewersField.php index aff5644a52..1eea4f51b9 100644 --- a/src/applications/differential/customfield/DifferentialProjectReviewersField.php +++ b/src/applications/differential/customfield/DifferentialProjectReviewersField.php @@ -61,7 +61,8 @@ final class DifferentialProjectReviewersField return array( pht( 'You can add a project as a subscriber or reviewer by writing '. - '"#projectname" in the appropriate field.'), + '"%s" in the appropriate field.', + '#projectname'), ); } diff --git a/src/applications/differential/customfield/DifferentialRepositoryField.php b/src/applications/differential/customfield/DifferentialRepositoryField.php index 76f40d0957..fc6c88194a 100644 --- a/src/applications/differential/customfield/DifferentialRepositoryField.php +++ b/src/applications/differential/customfield/DifferentialRepositoryField.php @@ -155,7 +155,8 @@ final class DifferentialRepositoryField return; } - $body->addTextSection(pht('REPOSITORY'), + $body->addTextSection( + pht('REPOSITORY'), $repository->getMonogram().' '.$repository->getName()); } diff --git a/src/applications/differential/customfield/DifferentialRevisionIDField.php b/src/applications/differential/customfield/DifferentialRevisionIDField.php index bb54951dc4..9d23cf7658 100644 --- a/src/applications/differential/customfield/DifferentialRevisionIDField.php +++ b/src/applications/differential/customfield/DifferentialRevisionIDField.php @@ -19,8 +19,7 @@ final class DifferentialRevisionIDField public function getFieldDescription() { return pht( - 'Ties commits to revisions and provides a permananent link between '. - 'them.'); + 'Ties commits to revisions and provides a permanent link between them.'); } public function canDisableField() { diff --git a/src/applications/differential/customfield/DifferentialUnitField.php b/src/applications/differential/customfield/DifferentialUnitField.php index cf183bf381..2cc86d2660 100644 --- a/src/applications/differential/customfield/DifferentialUnitField.php +++ b/src/applications/differential/customfield/DifferentialUnitField.php @@ -49,7 +49,7 @@ final class DifferentialUnitField if ($excuse) { $rows[] = array( 'style' => 'excuse', - 'name' => 'Excuse', + 'name' => pht('Excuse'), 'value' => phutil_escape_html_newlines($excuse), 'show' => true, ); @@ -83,8 +83,8 @@ final class DifferentialUnitField $userdata = str_replace("\000", '', $userdata); } $markup_object = id(new PhabricatorMarkupOneOff()) - ->setContent($userdata) - ->setPreserveLinebreaks(true); + ->setContent($userdata) + ->setPreserveLinebreaks(true); $engine->addObject($markup_object, 'default'); $markup_objects[$key] = $markup_object; } @@ -189,12 +189,12 @@ final class DifferentialUnitField )) + $hidden; $noun = array( - ArcanistUnitTestResult::RESULT_BROKEN => 'Broken', - ArcanistUnitTestResult::RESULT_FAIL => 'Failed', - ArcanistUnitTestResult::RESULT_UNSOUND => 'Unsound', - ArcanistUnitTestResult::RESULT_SKIP => 'Skipped', - ArcanistUnitTestResult::RESULT_POSTPONED => 'Postponed', - ArcanistUnitTestResult::RESULT_PASS => 'Passed', + ArcanistUnitTestResult::RESULT_BROKEN => pht('Broken'), + ArcanistUnitTestResult::RESULT_FAIL => pht('Failed'), + ArcanistUnitTestResult::RESULT_UNSOUND => pht('Unsound'), + ArcanistUnitTestResult::RESULT_SKIP => pht('Skipped'), + ArcanistUnitTestResult::RESULT_POSTPONED => pht('Postponed'), + ArcanistUnitTestResult::RESULT_PASS => pht('Passed'), ); $show = array(); @@ -206,7 +206,9 @@ final class DifferentialUnitField } } - return 'Show Full Unit Results ('.implode(', ', $show).')'; + return pht( + 'Show Full Unit Results (%s)', + implode(', ', $show)); } public function getWarningsForDetailView() { diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php index 0a02dec209..6a43f35d5a 100644 --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -908,8 +908,7 @@ final class DifferentialTransactionEditor case DifferentialAction::ACTION_REJECT: if ($actor_is_author) { - return pht( - 'You can not request changes to your own revision.'); + return pht('You can not request changes to your own revision.'); } if ($revision_status == $status_abandoned) { @@ -1484,13 +1483,14 @@ final class DifferentialTransactionEditor $nested_comments = $this->nestCommentHistory( $inline->getComment(), $comments_by_line_number, $authors_by_phid); - $section->addFragment('================') - ->addFragment('Comment at: '.$file.':'.$range) - ->addPlaintextFragment($patch) - ->addHTMLFragment($this->renderPatchHTMLForMail($patch)) - ->addFragment('----------------') - ->addFragment($nested_comments) - ->addFragment(null); + $section + ->addFragment('================') + ->addFragment(pht('Comment at: %s:%s', $file, $range)) + ->addPlaintextFragment($patch) + ->addHTMLFragment($this->renderPatchHTMLForMail($patch)) + ->addFragment('----------------') + ->addFragment($nested_comments) + ->addFragment(null); } } } @@ -1569,8 +1569,7 @@ final class DifferentialTransactionEditor ->executeOne(); if (!$revision) { throw new Exception( - pht( - 'Failed to load revision for Herald adapter construction!')); + pht('Failed to load revision for Herald adapter construction!')); } $adapter = HeraldDifferentialRevisionAdapter::newLegacyAdapter( diff --git a/src/applications/differential/landing/DifferentialGitHubLandingStrategy.php b/src/applications/differential/landing/DifferentialGitHubLandingStrategy.php index 7160743bb9..c805083cd4 100644 --- a/src/applications/differential/landing/DifferentialGitHubLandingStrategy.php +++ b/src/applications/differential/landing/DifferentialGitHubLandingStrategy.php @@ -20,7 +20,7 @@ final class DifferentialGitHubLandingStrategy id(new DifferentialHostedGitLandingStrategy()) ->commitRevisionToWorkspace($revision, $workspace, $viewer); } catch (Exception $e) { - throw new PhutilProxyException('Failed to commit patch', $e); + throw new PhutilProxyException(pht('Failed to commit patch.'), $e); } try { @@ -33,7 +33,9 @@ final class DifferentialGitHubLandingStrategy } // Else, throw what git said. - throw new PhutilProxyException('Failed to push changes upstream', $e); + throw new PhutilProxyException( + pht('Failed to push changes upstream.'), + $e); } } @@ -103,13 +105,14 @@ final class DifferentialGitHubLandingStrategy if (!$this->account) { throw new Exception( - "No matching GitHub account found for {$repo_domain}."); + pht('No matching GitHub account found for %s.', $repo_domain)); } $this->provider = PhabricatorAuthProvider::getEnabledProviderByKey( $this->account->getProviderKey()); if (!$this->provider) { - throw new Exception("GitHub provider for {$repo_domain} is not enabled."); + throw new Exception( + pht('GitHub provider for %s is not enabled.', $repo_domain)); } } @@ -152,8 +155,9 @@ final class DifferentialGitHubLandingStrategy if ($no_permission) { throw new Exception( - "You don't have permission to push to this repository. \n". - "Push permissions for this repository are managed on GitHub."); + pht( + "You don't have permission to push to this repository. ". + "Push permissions for this repository are managed on GitHub.")); } $scopes = BaseHTTPFuture::getHeader($headers, 'X-OAuth-Scopes'); @@ -166,8 +170,8 @@ final class DifferentialGitHubLandingStrategy ->setUser($viewer) ->setTitle(pht('Stronger token needed')) ->appendChild(pht( - 'In order to complete this action, you need a '. - 'stronger GitHub token.')) + 'In order to complete this action, you need a '. + 'stronger GitHub token.')) ->setSubmitURI($refresh_token_uri) ->addCancelButton('/D'.$revision->getId()) ->setDisableWorkflowOnSubmit(true) diff --git a/src/applications/differential/landing/DifferentialHostedGitLandingStrategy.php b/src/applications/differential/landing/DifferentialHostedGitLandingStrategy.php index 68f0980db1..cc0cf97998 100644 --- a/src/applications/differential/landing/DifferentialHostedGitLandingStrategy.php +++ b/src/applications/differential/landing/DifferentialHostedGitLandingStrategy.php @@ -14,13 +14,17 @@ final class DifferentialHostedGitLandingStrategy try { $this->commitRevisionToWorkspace($revision, $workspace, $viewer); } catch (Exception $e) { - throw new PhutilProxyException('Failed to commit patch', $e); + throw new PhutilProxyException( + pht('Failed to commit patch.'), + $e); } try { $this->pushWorkspaceRepository($repository, $workspace, $viewer); } catch (Exception $e) { - throw new PhutilProxyException('Failed to push changes upstream', $e); + throw new PhutilProxyException( + pht('Failed to push changes upstream.'), + $e); } } @@ -45,7 +49,7 @@ final class DifferentialHostedGitLandingStrategy ."0000000000000000000000000000000000000000.." ."0000000000000000000000000000000000000000\n"; if (strpos($raw_diff, $missing_binary) !== false) { - throw new Exception('Patch is missing content for a binary file'); + throw new Exception(pht('Patch is missing content for a binary file')); } $future = $workspace->execFutureLocal('apply --index -'); diff --git a/src/applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php b/src/applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php index 0303be62af..38f7160958 100644 --- a/src/applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php +++ b/src/applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php @@ -15,13 +15,15 @@ final class DifferentialHostedMercurialLandingStrategy try { $this->commitRevisionToWorkspace($revision, $workspace, $viewer); } catch (Exception $e) { - throw new PhutilProxyException('Failed to commit patch', $e); + throw new PhutilProxyException(pht('Failed to commit patch.'), $e); } try { $this->pushWorkspaceRepository($repository, $workspace, $viewer); } catch (Exception $e) { - throw new PhutilProxyException('Failed to push changes upstream', $e); + throw new PhutilProxyException( + pht('Failed to push changes upstream.'), + $e); } } diff --git a/src/applications/differential/landing/DifferentialLandingStrategy.php b/src/applications/differential/landing/DifferentialLandingStrategy.php index c62ca2ce23..d404511ed3 100644 --- a/src/applications/differential/landing/DifferentialLandingStrategy.php +++ b/src/applications/differential/landing/DifferentialLandingStrategy.php @@ -64,7 +64,9 @@ abstract class DifferentialLandingStrategy { try { return DifferentialGetWorkingCopy::getCleanGitWorkspace($repository); } catch (Exception $e) { - throw new PhutilProxyException('Failed to allocate a workspace', $e); + throw new PhutilProxyException( + pht('Failed to allocate a workspace.'), + $e); } } @@ -76,7 +78,9 @@ abstract class DifferentialLandingStrategy { return DifferentialGetWorkingCopy::getCleanMercurialWorkspace( $repository); } catch (Exception $e) { - throw new PhutilProxyException('Failed to allocate a workspace', $e); + throw new PhutilProxyException( + pht('Failed to allocate a workspace.'), + $e); } } diff --git a/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php b/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php index db34f18418..ec346f26ae 100644 --- a/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php +++ b/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php @@ -53,10 +53,10 @@ final class PhabricatorDifferentialRevisionTestDataGenerator $diff = id(new PhabricatorDifferenceEngine()) ->generateRawDiffFromFileContent($code, $newcode); $call = new ConduitCall( - 'differential.createrawdiff', - array( - 'diff' => $diff, - )); + 'differential.createrawdiff', + array( + 'diff' => $diff, + )); $call->setUser($author); $result = $call->execute(); $thediff = id(new DifferentialDiff())->load( diff --git a/src/applications/differential/mail/DifferentialCreateMailReceiver.php b/src/applications/differential/mail/DifferentialCreateMailReceiver.php index d54faffc40..c3198d3642 100644 --- a/src/applications/differential/mail/DifferentialCreateMailReceiver.php +++ b/src/applications/differential/mail/DifferentialCreateMailReceiver.php @@ -3,8 +3,8 @@ final class DifferentialCreateMailReceiver extends PhabricatorMailReceiver { public function isEnabled() { - $app_class = 'PhabricatorDifferentialApplication'; - return PhabricatorApplication::isClassInstalled($app_class); + return PhabricatorApplication::isClassInstalled( + 'PhabricatorDifferentialApplication'); } public function canAcceptMail(PhabricatorMetaMTAReceivedMail $mail) { diff --git a/src/applications/differential/mail/DifferentialReplyHandler.php b/src/applications/differential/mail/DifferentialReplyHandler.php index 660fe7e034..b2d8d05665 100644 --- a/src/applications/differential/mail/DifferentialReplyHandler.php +++ b/src/applications/differential/mail/DifferentialReplyHandler.php @@ -5,7 +5,7 @@ final class DifferentialReplyHandler public function validateMailReceiver($mail_receiver) { if (!($mail_receiver instanceof DifferentialRevision)) { - throw new Exception('Receiver is not a DifferentialRevision!'); + throw new Exception(pht('Receiver is not a %s!', 'DifferentialRevision')); } } diff --git a/src/applications/differential/mail/DifferentialRevisionMailReceiver.php b/src/applications/differential/mail/DifferentialRevisionMailReceiver.php index b211a89ea9..6b27c5a371 100644 --- a/src/applications/differential/mail/DifferentialRevisionMailReceiver.php +++ b/src/applications/differential/mail/DifferentialRevisionMailReceiver.php @@ -4,8 +4,8 @@ final class DifferentialRevisionMailReceiver extends PhabricatorObjectMailReceiver { public function isEnabled() { - $app_class = 'PhabricatorDifferentialApplication'; - return PhabricatorApplication::isClassInstalled($app_class); + return PhabricatorApplication::isClassInstalled( + 'PhabricatorDifferentialApplication'); } protected function getObjectPattern() { diff --git a/src/applications/differential/parser/DifferentialChangesetParser.php b/src/applications/differential/parser/DifferentialChangesetParser.php index 82c0a47519..bca4098ca1 100644 --- a/src/applications/differential/parser/DifferentialChangesetParser.php +++ b/src/applications/differential/parser/DifferentialChangesetParser.php @@ -1154,10 +1154,11 @@ final class DifferentialChangesetParser { * * @return array($gaps, $mask, $depths) */ - private function calculateGapsMaskAndDepths($mask_force, - $feedback_mask, - $range_start, - $range_len) { + private function calculateGapsMaskAndDepths( + $mask_force, + $feedback_mask, + $range_start, + $range_len) { // Calculate gaps and mask first $gaps = array(); @@ -1263,7 +1264,7 @@ final class DifferentialChangesetParser { PhabricatorInlineCommentInterface $comment) { if (!$this->isCommentVisibleOnRenderedDiff($comment)) { - throw new Exception('Comment is not visible on changeset!'); + throw new Exception(pht('Comment is not visible on changeset!')); } $changeset_id = $comment->getChangesetID(); diff --git a/src/applications/differential/parser/DifferentialCommitMessageParser.php b/src/applications/differential/parser/DifferentialCommitMessageParser.php index 5e3c14aa34..00d2fe2c3f 100644 --- a/src/applications/differential/parser/DifferentialCommitMessageParser.php +++ b/src/applications/differential/parser/DifferentialCommitMessageParser.php @@ -73,8 +73,10 @@ final class DifferentialCommitMessageParser { if (!$key_title || !$key_summary || ($label_map === null)) { throw new Exception( pht( - 'Expected labelMap, summaryKey and titleKey to be set before '. - 'parsing a corpus.')); + 'Expected %s, %s and %s to be set before parsing a corpus.', + 'labelMap', + 'summaryKey', + 'titleKey')); } $label_regexp = $this->buildLabelRegexp($label_map); diff --git a/src/applications/differential/parser/DifferentialHunkParser.php b/src/applications/differential/parser/DifferentialHunkParser.php index e381ca8346..d49f4e1e26 100644 --- a/src/applications/differential/parser/DifferentialHunkParser.php +++ b/src/applications/differential/parser/DifferentialHunkParser.php @@ -35,9 +35,7 @@ final class DifferentialHunkParser { } public function getVisibleLinesMask() { if ($this->visibleLinesMask === null) { - throw new Exception( - 'You must generateVisibileLinesMask before accessing this data.' - ); + throw new PhutilInvalidStateException('generateVisibileLinesMask'); } return $this->visibleLinesMask; } @@ -48,9 +46,7 @@ final class DifferentialHunkParser { } public function getIntraLineDiffs() { if ($this->intraLineDiffs === null) { - throw new Exception( - 'You must generateIntraLineDiffs before accessing this data.' - ); + throw new PhutilInvalidStateException('generateIntraLineDiffs'); } return $this->intraLineDiffs; } @@ -61,9 +57,7 @@ final class DifferentialHunkParser { } public function getNewLines() { if ($this->newLines === null) { - throw new Exception( - 'You must parseHunksForLineData before accessing this data.' - ); + throw new PhutilInvalidStateException('parseHunksForLineData'); } return $this->newLines; } @@ -74,9 +68,7 @@ final class DifferentialHunkParser { } public function getOldLines() { if ($this->oldLines === null) { - throw new Exception( - 'You must parseHunksForLineData before accessing this data.' - ); + throw new PhutilInvalidStateException('parseHunksForLineData'); } return $this->oldLines; } @@ -132,8 +124,9 @@ final class DifferentialHunkParser { private function getWhitespaceMode() { if ($this->whitespaceMode === null) { throw new Exception( - 'You must setWhitespaceMode before accessing this data.' - ); + pht( + 'You must %s before accessing this data.', + 'setWhitespaceMode')); } return $this->whitespaceMode; } @@ -173,7 +166,7 @@ final class DifferentialHunkParser { private function getHasChanges($filter) { if ($filter !== 'any' && $filter !== 'text') { - throw new Exception("Unknown change filter '{$filter}'."); + throw new Exception(pht("Unknown change filter '%s'.", $filter)); } $old = $this->getOldLines(); diff --git a/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php b/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php index 8396237bc5..669cfed220 100644 --- a/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php +++ b/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php @@ -18,8 +18,9 @@ final class DifferentialCommitMessageParserTestCase throw new Exception( pht( 'Expected test file "%s" to contain four parts (message, fields, '. - 'output, errors) divided by "~~~~~~~~~~".', - $file)); + 'output, errors) divided by "%s".', + $file, + '~~~~~~~~~~')); } list($message, $fields, $output, $errors) = $parts; diff --git a/src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php b/src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php index 45c7ac9225..d1d2501b94 100644 --- a/src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php +++ b/src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php @@ -37,7 +37,7 @@ final class DifferentialHunkParserTestCase extends PhabricatorTestCase { $parser = new ArcanistDiffParser(); $changes = $parser->parseDiff($data); if (count($changes) !== 1) { - throw new Exception("Expected 1 changeset for '{$name}'!"); + throw new Exception(pht("Expected 1 changeset for '%s'!", $name)); } $diff = DifferentialDiff::newFromRawChanges( @@ -113,10 +113,10 @@ final class DifferentialHunkParserTestCase extends PhabricatorTestCase { public function testInclusionOfNewFileInOldCommentFromStart() { $parser = new DifferentialHunkParser(); $hunks = $this->createSingleChange(2, 3, - "+n1\n". - " e1/2\n". - "-o2\n". - "+n3\n"); + "+n1\n". + " e1/2\n". + "-o2\n". + "+n3\n"); $context = $parser->makeContextDiff( $hunks, 0, @@ -124,18 +124,18 @@ final class DifferentialHunkParserTestCase extends PhabricatorTestCase { 1, 0); $this->assertEqual( - "@@ -1,2 +2,1 @@\n". - " e1/2\n". - "-o2", $context); + "@@ -1,2 +2,1 @@\n". + " e1/2\n". + "-o2", $context); } public function testInclusionOfOldFileInNewCommentFromStart() { $parser = new DifferentialHunkParser(); $hunks = $this->createSingleChange(2, 2, - "-o1\n". - " e2/1\n". - "-o3\n". - "+n2\n"); + "-o1\n". + " e2/1\n". + "-o3\n". + "+n2\n"); $context = $parser->makeContextDiff( $hunks, 1, @@ -143,16 +143,16 @@ final class DifferentialHunkParserTestCase extends PhabricatorTestCase { 1, 0); $this->assertEqual( - "@@ -2,1 +1,2 @@\n". - " e2/1\n". - "+n2", $context); + "@@ -2,1 +1,2 @@\n". + " e2/1\n". + "+n2", $context); } public function testNoNewlineAtEndOfFile() { $parser = new DifferentialHunkParser(); $hunks = $this->createSingleChange(0, 1, - "+a\n". - "\\No newline at end of file"); + "+a\n". + "\\No newline at end of file"); // Note that this only works with additional context. $context = $parser->makeContextDiff( $hunks, @@ -161,23 +161,23 @@ final class DifferentialHunkParserTestCase extends PhabricatorTestCase { 0, 1); $this->assertEqual( - "@@ +1,1 @@\n". - "+a\n". - "\\No newline at end of file", $context); + "@@ +1,1 @@\n". + "+a\n". + "\\No newline at end of file", $context); } public function testMultiLineNewComment() { $parser = new DifferentialHunkParser(); $hunks = $this->createSingleChange(7, 7, - " e1\n". - " e2\n". - "-o3\n". - "-o4\n". - "+n3\n". - " e5/4\n". - " e6/5\n". - "+n6\n". - " e7\n"); + " e1\n". + " e2\n". + "-o3\n". + "-o4\n". + "+n3\n". + " e5/4\n". + " e6/5\n". + "+n6\n". + " e7\n"); $context = $parser->makeContextDiff( $hunks, 1, @@ -185,28 +185,28 @@ final class DifferentialHunkParserTestCase extends PhabricatorTestCase { 4, 0); $this->assertEqual( - "@@ -2,5 +2,5 @@\n". - " e2\n". - "-o3\n". - "-o4\n". - "+n3\n". - " e5/4\n". - " e6/5\n". - "+n6", $context); + "@@ -2,5 +2,5 @@\n". + " e2\n". + "-o3\n". + "-o4\n". + "+n3\n". + " e5/4\n". + " e6/5\n". + "+n6", $context); } public function testMultiLineOldComment() { $parser = new DifferentialHunkParser(); $hunks = $this->createSingleChange(7, 7, - " e1\n". - " e2\n". - "-o3\n". - "-o4\n". - "+n3\n". - " e5/4\n". - " e6/5\n". - "+n6\n". - " e7\n"); + " e1\n". + " e2\n". + "-o3\n". + "-o4\n". + "+n3\n". + " e5/4\n". + " e6/5\n". + "+n6\n". + " e7\n"); $context = $parser->makeContextDiff( $hunks, 0, @@ -214,22 +214,22 @@ final class DifferentialHunkParserTestCase extends PhabricatorTestCase { 4, 0); $this->assertEqual( - "@@ -2,5 +2,4 @@\n". - " e2\n". - "-o3\n". - "-o4\n". - "+n3\n". - " e5/4\n". - " e6/5", $context); + "@@ -2,5 +2,4 @@\n". + " e2\n". + "-o3\n". + "-o4\n". + "+n3\n". + " e5/4\n". + " e6/5", $context); } public function testInclusionOfNewFileInOldCommentFromStartWithContext() { $parser = new DifferentialHunkParser(); $hunks = $this->createSingleChange(2, 3, - "+n1\n". - " e1/2\n". - "-o2\n". - "+n3\n"); + "+n1\n". + " e1/2\n". + "-o2\n". + "+n3\n"); $context = $parser->makeContextDiff( $hunks, 0, @@ -237,19 +237,19 @@ final class DifferentialHunkParserTestCase extends PhabricatorTestCase { 1, 1); $this->assertEqual( - "@@ -1,2 +1,2 @@\n". - "+n1\n". - " e1/2\n". - "-o2", $context); + "@@ -1,2 +1,2 @@\n". + "+n1\n". + " e1/2\n". + "-o2", $context); } public function testInclusionOfOldFileInNewCommentFromStartWithContext() { $parser = new DifferentialHunkParser(); $hunks = $this->createSingleChange(2, 2, - "-o1\n". - " e2/1\n". - "-o3\n". - "+n2\n"); + "-o1\n". + " e2/1\n". + "-o3\n". + "+n2\n"); $context = $parser->makeContextDiff( $hunks, 1, @@ -257,11 +257,11 @@ final class DifferentialHunkParserTestCase extends PhabricatorTestCase { 1, 1); $this->assertEqual( - "@@ -1,3 +1,2 @@\n". - "-o1\n". - " e2/1\n". - "-o3\n". - "+n2", $context); + "@@ -1,3 +1,2 @@\n". + "-o1\n". + " e2/1\n". + "-o3\n". + "+n2", $context); } public function testMissingContext() { diff --git a/src/applications/differential/query/DifferentialHunkQuery.php b/src/applications/differential/query/DifferentialHunkQuery.php index 3c9f898810..09beb0b6f7 100644 --- a/src/applications/differential/query/DifferentialHunkQuery.php +++ b/src/applications/differential/query/DifferentialHunkQuery.php @@ -95,7 +95,9 @@ final class DifferentialHunkQuery if (!$this->changesets) { throw new Exception( - pht('You must load hunks via changesets, with withChangesets()!')); + pht( + 'You must load hunks via changesets, with %s!', + 'withChangesets()')); } $where[] = qsprintf( diff --git a/src/applications/differential/query/DifferentialRevisionQuery.php b/src/applications/differential/query/DifferentialRevisionQuery.php index d49ef34887..69e9477e0d 100644 --- a/src/applications/differential/query/DifferentialRevisionQuery.php +++ b/src/applications/differential/query/DifferentialRevisionQuery.php @@ -820,7 +820,7 @@ final class DifferentialRevisionQuery break; default: throw new Exception( - "Unknown revision status filter constant '{$this->status}'!"); + pht("Unknown revision status filter constant '%s'!", $this->status)); } $where[] = $this->buildWhereClauseParts($conn_r); @@ -1035,7 +1035,7 @@ final class DifferentialRevisionQuery // The author can never have authority unless we allow self-accept. $has_authority = false; } else { - // Otherwise, look up whether th viewer has authority. + // Otherwise, look up whether the viewer has authority. $has_authority = isset($authority[$reviewer_phid]); } diff --git a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php index ce1a35f365..30acc71c88 100644 --- a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php @@ -265,8 +265,7 @@ abstract class DifferentialChangesetHTMLRenderer 'This file was converted from %s for display.', phutil_tag('strong', array(), $encoding)); } else { - $messages[] = pht( - 'This file uses an unknown character encoding.'); + $messages[] = pht('This file uses an unknown character encoding.'); } } } @@ -371,7 +370,11 @@ abstract class DifferentialChangesetHTMLRenderer $force !== 'whitespace' && $force !== 'none' && $force !== 'default') { - throw new Exception("Invalid 'force' parameter '{$force}'!"); + throw new Exception( + pht( + "Invalid '%s' parameter '%s'!", + 'force', + $force)); } $range = "0-{$end}"; @@ -516,7 +519,7 @@ abstract class DifferentialChangesetHTMLRenderer if ($is_last_block) { $text = pht('Show Last %d Line(s)', $block_size); } else { - $text = pht("\xE2\x96\xBC Show %d Line(s)", $block_size); + $text = "\xE2\x96\xBC ".pht('Show %d Line(s)', $block_size); } $links[] = $this->renderShowContextLink( diff --git a/src/applications/differential/render/DifferentialChangesetRenderer.php b/src/applications/differential/render/DifferentialChangesetRenderer.php index 22255ece7e..461ce668bb 100644 --- a/src/applications/differential/render/DifferentialChangesetRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetRenderer.php @@ -599,7 +599,7 @@ abstract class DifferentialChangesetRenderer { } } else { - throw new Exception("Unknown primitive type '{$primitive}'!"); + throw new Exception(pht("Unknown primitive type '%s'!", $primitive)); } } diff --git a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php index 3eb0190664..181e3d1306 100644 --- a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php @@ -299,10 +299,12 @@ final class DifferentialChangesetTwoUpRenderer return $this->wrapChangeInTable(phutil_implode_html('', $html)); } - public function renderFileChange($old_file = null, - $new_file = null, - $id = 0, - $vs = 0) { + public function renderFileChange( + $old_file = null, + $new_file = null, + $id = 0, + $vs = 0) { + $old = null; if ($old_file) { $old = $this->renderImageStage($old_file); diff --git a/src/applications/differential/search/DifferentialSearchIndexer.php b/src/applications/differential/search/DifferentialSearchIndexer.php index 66a89a6fb9..9976503127 100644 --- a/src/applications/differential/search/DifferentialSearchIndexer.php +++ b/src/applications/differential/search/DifferentialSearchIndexer.php @@ -14,7 +14,7 @@ final class DifferentialSearchIndexer ->needReviewerStatus(true) ->executeOne(); if (!$object) { - throw new Exception("Unable to load object by phid '{$phid}'!"); + throw new Exception(pht("Unable to load object by PHID '%s'!", $phid)); } return $object; } diff --git a/src/applications/differential/storage/DifferentialReviewer.php b/src/applications/differential/storage/DifferentialReviewer.php index b5a339efbb..e3b1e0ac20 100644 --- a/src/applications/differential/storage/DifferentialReviewer.php +++ b/src/applications/differential/storage/DifferentialReviewer.php @@ -41,7 +41,7 @@ final class DifferentialReviewer { $viewer_phid = $viewer->getPHID(); if (!array_key_exists($viewer_phid, $this->authority)) { - throw new Exception('You must attachAuthority() first!'); + throw new Exception(pht('You must %s first!', 'attachAuthority()')); } return $this->authority[$viewer_phid]; } diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php index e6baa678e9..7630814882 100644 --- a/src/applications/differential/storage/DifferentialRevision.php +++ b/src/applications/differential/storage/DifferentialRevision.php @@ -316,8 +316,7 @@ final class DifferentialRevision extends DifferentialDAO switch ($capability) { case PhabricatorPolicyCapability::CAN_VIEW: - $description[] = pht( - "A revision's reviewers can always view it."); + $description[] = pht("A revision's reviewers can always view it."); $description[] = pht( 'If a revision belongs to a repository, other users must be able '. 'to view the repository in order to view the revision.'); diff --git a/src/applications/differential/storage/DifferentialTransaction.php b/src/applications/differential/storage/DifferentialTransaction.php index 2857d24272..23f6a45c2a 100644 --- a/src/applications/differential/storage/DifferentialTransaction.php +++ b/src/applications/differential/storage/DifferentialTransaction.php @@ -274,14 +274,11 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction { case self::TYPE_STATUS: switch ($this->getNewValue()) { case ArcanistDifferentialRevisionStatus::ACCEPTED: - return pht( - 'This revision is now accepted and ready to land.'); + return pht('This revision is now accepted and ready to land.'); case ArcanistDifferentialRevisionStatus::NEEDS_REVISION: - return pht( - 'This revision now requires changes to proceed.'); + return pht('This revision now requires changes to proceed.'); case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW: - return pht( - 'This revision now requires review to proceed.'); + return pht('This revision now requires review to proceed.'); } } @@ -595,11 +592,9 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction { 'You can not commandeer this revision because you already own '. 'it.'); case DifferentialAction::ACTION_ACCEPT: - return pht( - 'You have already accepted this revision.'); + return pht('You have already accepted this revision.'); case DifferentialAction::ACTION_REJECT: - return pht( - 'You have already requested changes to this revision.'); + return pht('You have already requested changes to this revision.'); } break; } diff --git a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php index 94b9907ecb..953444a199 100644 --- a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php +++ b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php @@ -137,9 +137,9 @@ final class DifferentialDiffTableOfContentsView extends AphrontView { ($changeset->getOldProperties() === $changeset->getNewProperties()) ? '' : phutil_tag( - 'span', - array('title' => pht('Properties Changed')), - 'M'); + 'span', + array('title' => pht('Properties Changed')), + 'M'); $fname = $changeset->getFilename(); $cov = $this->renderCoverage($coverage, $fname); @@ -246,8 +246,8 @@ final class DifferentialDiffTableOfContentsView extends AphrontView { false, )); $anchor = id(new PhabricatorAnchorView()) - ->setAnchorName('toc') - ->setNavigationMarker(true); + ->setAnchorName('toc') + ->setNavigationMarker(true); return id(new PHUIObjectBoxView()) ->setHeaderText(pht('Table of Contents')) diff --git a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php index 4f99c19c7d..6f8ee6db93 100644 --- a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php +++ b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php @@ -365,7 +365,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView { case DifferentialLintStatus::LINT_POSTPONED: return pht('Lint Postponed'); } - return '???'; + return pht('Unknown'); } public static function getDiffUnitMessage(DifferentialDiff $diff) { @@ -386,7 +386,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView { case DifferentialUnitStatus::UNIT_POSTPONED: return pht('Unit Tests Postponed'); } - return '???'; + return pht('Unknown'); } private static function renderDiffStar($star) { diff --git a/src/applications/differential/view/DifferentialTransactionView.php b/src/applications/differential/view/DifferentialTransactionView.php index 3312f717c7..ea0b2bb893 100644 --- a/src/applications/differential/view/DifferentialTransactionView.php +++ b/src/applications/differential/view/DifferentialTransactionView.php @@ -104,7 +104,7 @@ final class DifferentialTransactionView $inlines[] = $xaction; break; default: - throw new Exception('Unknown grouped transaction type!'); + throw new Exception(pht('Unknown grouped transaction type!')); } } diff --git a/src/applications/diffusion/DiffusionLintSaveRunner.php b/src/applications/diffusion/DiffusionLintSaveRunner.php index 629c887924..7b652cf5f0 100644 --- a/src/applications/diffusion/DiffusionLintSaveRunner.php +++ b/src/applications/diffusion/DiffusionLintSaveRunner.php @@ -172,7 +172,7 @@ final class DiffusionLintSaveRunner { try { $paths = phutil_json_decode($json); } catch (PhutilJSONParserException $ex) { - fprintf(STDERR, pht("Invalid JSON: %s\n", $json)); + fprintf(STDERR, pht('Invalid JSON: %s', $json)."\n"); continue; } diff --git a/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php index f8854ac0f2..e2d3a941bf 100644 --- a/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php @@ -8,9 +8,9 @@ final class DiffusionBrowseQueryConduitAPIMethod } public function getMethodDescription() { - return + return pht( 'File(s) information for a repository at an (optional) path and '. - '(optional) commit.'; + '(optional) commit.'); } protected function defineReturnType() { diff --git a/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php index 8d978e3f25..5543b759d0 100644 --- a/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php @@ -12,9 +12,15 @@ final class DiffusionCreateCommentConduitAPIMethod } public function getMethodDescription() { - return 'Add a comment to a Diffusion commit. By specifying an action of '. - '"concern", "accept", "resign", or "close", auditing actions can '. - 'be triggered. Defaults to "comment".'; + return pht( + 'Add a comment to a Diffusion commit. By specifying an action '. + 'of "%s", "%s", "%s", or "%s", auditing actions can '. + 'be triggered. Defaults to "%s".', + 'concern', + 'accept', + 'resign', + 'close', + 'comment'); } protected function defineParamTypes() { @@ -32,9 +38,9 @@ final class DiffusionCreateCommentConduitAPIMethod protected function defineErrorTypes() { return array( - 'ERR_BAD_COMMIT' => 'No commit found with that PHID', - 'ERR_BAD_ACTION' => 'Invalid action type', - 'ERR_MISSING_MESSAGE' => 'Message is required', + 'ERR_BAD_COMMIT' => pht('No commit found with that PHID.'), + 'ERR_BAD_ACTION' => pht('Invalid action type.'), + 'ERR_MISSING_MESSAGE' => pht('Message is required.'), ); } diff --git a/src/applications/diffusion/conduit/DiffusionDiffQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionDiffQueryConduitAPIMethod.php index 0ec00bc762..19295f2b20 100644 --- a/src/applications/diffusion/conduit/DiffusionDiffQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionDiffQueryConduitAPIMethod.php @@ -10,9 +10,9 @@ final class DiffusionDiffQueryConduitAPIMethod } public function getMethodDescription() { - return + return pht( 'Get diff information from a repository for a specific path at an '. - '(optional) commit.'; + '(optional) commit.'); } protected function defineReturnType() { diff --git a/src/applications/diffusion/conduit/DiffusionExistsQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionExistsQueryConduitAPIMethod.php index d0d5453a34..3c6d09ebda 100644 --- a/src/applications/diffusion/conduit/DiffusionExistsQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionExistsQueryConduitAPIMethod.php @@ -8,7 +8,7 @@ final class DiffusionExistsQueryConduitAPIMethod } public function getMethodDescription() { - return 'Determine if code exists in a version control system.'; + return pht('Determine if code exists in a version control system.'); } protected function defineReturnType() { @@ -51,7 +51,7 @@ final class DiffusionExistsQueryConduitAPIMethod list($err, $stdout) = $repository->execLocalCommand( 'id --rev %s', $commit); - return !$err; + return !$err; } } diff --git a/src/applications/diffusion/conduit/DiffusionFileContentQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionFileContentQueryConduitAPIMethod.php index 9204a84bbc..671ec3ef6f 100644 --- a/src/applications/diffusion/conduit/DiffusionFileContentQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionFileContentQueryConduitAPIMethod.php @@ -8,7 +8,7 @@ final class DiffusionFileContentQueryConduitAPIMethod } public function getMethodDescription() { - return 'Retrieve file content from a repository.'; + return pht('Retrieve file content from a repository.'); } protected function defineReturnType() { diff --git a/src/applications/diffusion/conduit/DiffusionGetCommitsConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionGetCommitsConduitAPIMethod.php index cdc89807cd..15dd1f53f6 100644 --- a/src/applications/diffusion/conduit/DiffusionGetCommitsConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionGetCommitsConduitAPIMethod.php @@ -16,7 +16,7 @@ final class DiffusionGetCommitsConduitAPIMethod } public function getMethodStatusDescription() { - return pht('Obsoleted by diffusion.querycommits.'); + return pht('Obsoleted by %s.', 'diffusion.querycommits'); } protected function defineParamTypes() { diff --git a/src/applications/diffusion/conduit/DiffusionGetRecentCommitsByPathConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionGetRecentCommitsByPathConduitAPIMethod.php index 89e40c69ba..002805ac4e 100644 --- a/src/applications/diffusion/conduit/DiffusionGetRecentCommitsByPathConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionGetRecentCommitsByPathConduitAPIMethod.php @@ -10,7 +10,8 @@ final class DiffusionGetRecentCommitsByPathConduitAPIMethod } public function getMethodDescription() { - return 'Get commit identifiers for recent commits affecting a given path.'; + return pht( + 'Get commit identifiers for recent commits affecting a given path.'); } protected function defineParamTypes() { diff --git a/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php index 939a47ab64..dcc8f56e8f 100644 --- a/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php @@ -10,8 +10,9 @@ final class DiffusionHistoryQueryConduitAPIMethod } public function getMethodDescription() { - return 'Returns history information for a repository at a specific '. - 'commit and path.'; + return pht( + 'Returns history information for a repository at a specific '. + 'commit and path.'); } protected function defineReturnType() { diff --git a/src/applications/diffusion/conduit/DiffusionMergedCommitsQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionMergedCommitsQueryConduitAPIMethod.php index fd618a291e..9d2d6caadc 100644 --- a/src/applications/diffusion/conduit/DiffusionMergedCommitsQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionMergedCommitsQueryConduitAPIMethod.php @@ -8,8 +8,8 @@ final class DiffusionMergedCommitsQueryConduitAPIMethod } public function getMethodDescription() { - return - 'Merged commit information for a specific commit in a repository.'; + return pht( + 'Merged commit information for a specific commit in a repository.'); } protected function defineReturnType() { diff --git a/src/applications/diffusion/conduit/DiffusionQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionQueryConduitAPIMethod.php index 22c4adad45..e9f5681f9f 100644 --- a/src/applications/diffusion/conduit/DiffusionQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionQueryConduitAPIMethod.php @@ -13,7 +13,7 @@ abstract class DiffusionQueryConduitAPIMethod public function getMethodStatusDescription() { return pht( - 'See T2784 - migrating diffusion working copy calls to conduit methods. '. + 'See T2784 - migrating Diffusion working copy calls to conduit methods. '. 'Until that task is completed (and possibly after) these methods are '. 'unstable.'); } diff --git a/src/applications/diffusion/conduit/DiffusionRawDiffQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionRawDiffQueryConduitAPIMethod.php index a7e217d2aa..282dc7eb9b 100644 --- a/src/applications/diffusion/conduit/DiffusionRawDiffQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionRawDiffQueryConduitAPIMethod.php @@ -8,9 +8,9 @@ final class DiffusionRawDiffQueryConduitAPIMethod } public function getMethodDescription() { - return + return pht( 'Get raw diff information from a repository for a specific commit at an '. - '(optional) path.'; + '(optional) path.'); } protected function defineReturnType() { diff --git a/src/applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php index 2d025e9d4a..00bb28b385 100644 --- a/src/applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php @@ -8,8 +8,8 @@ final class DiffusionRefsQueryConduitAPIMethod } public function getMethodDescription() { - return - 'Query a git repository for ref information at a specific commit.'; + return pht( + 'Query a git repository for ref information at a specific commit.'); } protected function defineReturnType() { diff --git a/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php index 5cf91a10f0..16b9762e1d 100644 --- a/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php @@ -8,7 +8,7 @@ final class DiffusionSearchQueryConduitAPIMethod } public function getMethodDescription() { - return 'Search (grep) a repository at a specific path and commit.'; + return pht('Search (grep) a repository at a specific path and commit.'); } protected function defineReturnType() { @@ -27,7 +27,7 @@ final class DiffusionSearchQueryConduitAPIMethod protected function defineCustomErrorTypes() { return array( - 'ERR-GREP-COMMAND' => 'Grep command failed.', + 'ERR-GREP-COMMAND' => pht('Grep command failed.'), ); } diff --git a/src/applications/diffusion/config/PhabricatorDiffusionConfigOptions.php b/src/applications/diffusion/config/PhabricatorDiffusionConfigOptions.php index 644556cd66..28a9e1b670 100644 --- a/src/applications/diffusion/config/PhabricatorDiffusionConfigOptions.php +++ b/src/applications/diffusion/config/PhabricatorDiffusionConfigOptions.php @@ -35,9 +35,10 @@ final class PhabricatorDiffusionConfigOptions pht('Attach Patches'), pht('Do Not Attach Patches'), )) - ->setDescription(pht( - 'Set this to true if you want patches to be attached to commit '. - 'notifications from Diffusion.')), + ->setDescription( + pht( + 'Set this to true if you want patches to be attached to commit '. + 'notifications from Diffusion.')), $this->newOption('metamta.diffusion.inline-patches', 'int', 0) ->setSummary(pht('Include patches in Diffusion mail as body text.')) ->setDescription( @@ -63,10 +64,11 @@ final class PhabricatorDiffusionConfigOptions $this->newOption('bugtraq.url', 'string', null) ->addExample('https://bugs.php.net/%BUGID%', pht('PHP bugs')) ->addExample('/%BUGID%', pht('Local Maniphest URL')) - ->setDescription(pht( - 'URL of external bug tracker used by Diffusion. %s will be '. + ->setDescription( + pht( + 'URL of external bug tracker used by Diffusion. %s will be '. 'substituted by the bug ID.', - '%BUGID%')), + '%BUGID%')), $this->newOption('bugtraq.logregex', 'list', array()) ->addExample(array('/\B#([1-9]\d*)\b/'), pht('Issue #123')) ->addExample( @@ -74,8 +76,9 @@ final class PhabricatorDiffusionConfigOptions pht('Issue #123, #456')) ->addExample(array('/(?addExample('/[A-Z]{2,}-\d+/', pht('JIRA-1234')) - ->setDescription(pht( - 'Regular expression to link external bug tracker. See '. + ->setDescription( + pht( + 'Regular expression to link external bug tracker. See '. 'http://tortoisesvn.net/docs/release/TortoiseSVN_en/'. 'tsvn-dug-bugtracker.html for further explanation.')), $this->newOption('diffusion.allow-http-auth', 'bool', false) diff --git a/src/applications/diffusion/controller/DiffusionBrowseDirectoryController.php b/src/applications/diffusion/controller/DiffusionBrowseDirectoryController.php index 833e108648..0d54aba087 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseDirectoryController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseDirectoryController.php @@ -98,7 +98,9 @@ final class DiffusionBrowseDirectoryController array( 'title' => array( nonempty(basename($drequest->getPath()), '/'), - $drequest->getRepository()->getCallsign().' Repository', + pht( + '%s Repository', + $drequest->getRepository()->getCallsign()), ), )); } diff --git a/src/applications/diffusion/controller/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/DiffusionBrowseFileController.php index 6fcda177a5..c55d217bfe 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseFileController.php @@ -124,13 +124,15 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController { switch ($follow) { case 'first': $notice->appendChild( - pht('Unable to continue tracing the history of this file because '. - 'this commit is the first commit in the repository.')); + pht( + 'Unable to continue tracing the history of this file because '. + 'this commit is the first commit in the repository.')); break; case 'created': $notice->appendChild( - pht('Unable to continue tracing the history of this file because '. - 'this commit created the file.')); + pht( + 'Unable to continue tracing the history of this file because '. + 'this commit created the file.')); break; } $content[] = $notice; @@ -142,7 +144,8 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController { $notice->setSeverity(PHUIInfoView::SEVERITY_NOTICE); $notice->setTitle(pht('File Renamed')); $notice->appendChild( - pht("File history passes through a rename from '%s' to '%s'.", + pht( + "File history passes through a rename from '%s' to '%s'.", $drequest->getPath(), $renamed)); $content[] = $notice; } diff --git a/src/applications/diffusion/controller/DiffusionBrowseSearchController.php b/src/applications/diffusion/controller/DiffusionBrowseSearchController.php index ac0f74e79e..550fe38773 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseSearchController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseSearchController.php @@ -33,7 +33,9 @@ final class DiffusionBrowseSearchController extends DiffusionBrowseController { array( 'title' => array( nonempty(basename($drequest->getPath()), '/'), - $drequest->getRepository()->getCallsign().' Repository', + pht( + '%s Repository', + $drequest->getRepository()->getCallsign()), ), )); } diff --git a/src/applications/diffusion/controller/DiffusionCommitBranchesController.php b/src/applications/diffusion/controller/DiffusionCommitBranchesController.php index 0be218fac8..4f12e17656 100644 --- a/src/applications/diffusion/controller/DiffusionCommitBranchesController.php +++ b/src/applications/diffusion/controller/DiffusionCommitBranchesController.php @@ -39,6 +39,6 @@ final class DiffusionCommitBranchesController extends DiffusionController { } return id(new AphrontAjaxResponse()) - ->setContent($branch_links ? implode(', ', $branch_links) : 'None'); + ->setContent($branch_links ? implode(', ', $branch_links) : pht('None')); } } diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php index 1126cb659d..b30cfb0680 100644 --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -83,10 +83,12 @@ final class DiffusionCommitController extends DiffusionController { $error_panel->setTitle(pht('Commit Not Tracked')); $error_panel->setSeverity(PHUIInfoView::SEVERITY_WARNING); $error_panel->appendChild( - pht("This Diffusion repository is configured to track only one ". - "subdirectory of the entire Subversion repository, and this commit ". - "didn't affect the tracked subdirectory ('%s'), so no ". - "information is available.", $subpath)); + pht( + "This Diffusion repository is configured to track only one ". + "subdirectory of the entire Subversion repository, and this commit ". + "didn't affect the tracked subdirectory ('%s'), so no ". + "information is available.", + $subpath)); $content[] = $error_panel; } else { $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); @@ -238,7 +240,7 @@ final class DiffusionCommitController extends DiffusionController { $change_panel = new PHUIObjectBoxView(); $header = new PHUIHeaderView(); - $header->setHeader('Changes ('.number_format($count).')'); + $header->setHeader(pht('Changes (%d', number_format($count))); $change_panel->setID('toc'); if ($count > self::CHANGES_LIMIT && !$show_all_details) { @@ -253,7 +255,7 @@ final class DiffusionCommitController extends DiffusionController { $warning_view = id(new PHUIInfoView()) ->setSeverity(PHUIInfoView::SEVERITY_WARNING) - ->setTitle('Very Large Commit') + ->setTitle(pht('Very Large Commit')) ->appendChild( pht('This commit is very large. Load each file individually.')); @@ -280,7 +282,7 @@ final class DiffusionCommitController extends DiffusionController { $vcs_supports_directory_changes = false; break; default: - throw new Exception('Unknown VCS.'); + throw new Exception(pht('Unknown VCS.')); } $references = array(); @@ -901,8 +903,8 @@ final class DiffusionCommitController extends DiffusionController { $caption->setSeverity(PHUIInfoView::SEVERITY_NOTICE); $caption->appendChild( pht( - 'This commit merges a very large number of changes. Only the first '. - '%s are shown.', + 'This commit merges a very large number of changes. '. + 'Only the first %s are shown.', new PhutilNumber($limit))); } diff --git a/src/applications/diffusion/controller/DiffusionController.php b/src/applications/diffusion/controller/DiffusionController.php index 0b3e97a097..262223c6f9 100644 --- a/src/applications/diffusion/controller/DiffusionController.php +++ b/src/applications/diffusion/controller/DiffusionController.php @@ -11,7 +11,7 @@ abstract class DiffusionController extends PhabricatorController { protected function getDiffusionRequest() { if (!$this->diffusionRequest) { - throw new Exception('No Diffusion request object!'); + throw new Exception(pht('No Diffusion request object!')); } return $this->diffusionRequest; } diff --git a/src/applications/diffusion/controller/DiffusionExternalController.php b/src/applications/diffusion/controller/DiffusionExternalController.php index c48553842f..4ab698b07c 100644 --- a/src/applications/diffusion/controller/DiffusionExternalController.php +++ b/src/applications/diffusion/controller/DiffusionExternalController.php @@ -75,9 +75,11 @@ final class DiffusionExternalController extends DiffusionController { ->appendChild(phutil_tag( 'p', array(), - pht('This external (%s) does not appear in any tracked '. - 'repository. It may exist in an untracked repository that '. - 'Diffusion does not know about.', $desc))); + pht( + 'This external (%s) does not appear in any tracked '. + 'repository. It may exist in an untracked repository that '. + 'Diffusion does not know about.', + $desc))); } else if (count($commits) == 1) { $commit = head($commits); $repo = $repositories[$commit->getRepositoryID()]; diff --git a/src/applications/diffusion/controller/DiffusionHistoryController.php b/src/applications/diffusion/controller/DiffusionHistoryController.php index 36667c5dfe..887e4cbd2e 100644 --- a/src/applications/diffusion/controller/DiffusionHistoryController.php +++ b/src/applications/diffusion/controller/DiffusionHistoryController.php @@ -168,6 +168,4 @@ final class DiffusionHistoryController extends DiffusionController { return $view; } - - } diff --git a/src/applications/diffusion/controller/DiffusionInlineCommentController.php b/src/applications/diffusion/controller/DiffusionInlineCommentController.php index fb3d87167f..09f5f06ad5 100644 --- a/src/applications/diffusion/controller/DiffusionInlineCommentController.php +++ b/src/applications/diffusion/controller/DiffusionInlineCommentController.php @@ -33,7 +33,7 @@ final class DiffusionInlineCommentController PhabricatorRepository::TABLE_PATH, $path_id); if (!$path) { - throw new Exception('Invalid path ID!'); + throw new Exception(pht('Invalid path ID!')); } return id(new PhabricatorAuditInlineComment()) @@ -55,7 +55,7 @@ final class DiffusionInlineCommentController $inline = $this->loadComment($id); if (!$this->canEditInlineComment($user, $inline)) { - throw new Exception('That comment is not editable!'); + throw new Exception(pht('That comment is not editable!')); } return $inline; } diff --git a/src/applications/diffusion/controller/DiffusionPathValidateController.php b/src/applications/diffusion/controller/DiffusionPathValidateController.php index 1b839aab47..d54ddd7af6 100644 --- a/src/applications/diffusion/controller/DiffusionPathValidateController.php +++ b/src/applications/diffusion/controller/DiffusionPathValidateController.php @@ -58,7 +58,7 @@ final class DiffusionPathValidateController extends DiffusionController { if ($branch) { $message = pht('Not found in %s', $branch); } else { - $message = pht('Not found at HEAD'); + $message = pht('Not found at %s', 'HEAD'); } } else { $message = pht('OK'); diff --git a/src/applications/diffusion/controller/DiffusionRepositoryController.php b/src/applications/diffusion/controller/DiffusionRepositoryController.php index 7eb99b7096..ff81c02ab4 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryController.php @@ -60,8 +60,7 @@ final class DiffusionRepositoryController extends DiffusionController { } } else { $empty_title = pht('Empty Repository'); - $empty_message = pht( - 'This repository does not have any commits yet.'); + $empty_message = pht('This repository does not have any commits yet.'); } } @@ -391,9 +390,9 @@ final class DiffusionRepositoryController extends DiffusionController { $button->setTag('a'); $button->setIcon($icon); $button->setHref($drequest->generateURI( - array( - 'action' => 'branches', - ))); + array( + 'action' => 'branches', + ))); $header->addActionLink($button); $panel->setHeader($header); diff --git a/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php b/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php index d077d031f0..269523915e 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php @@ -71,7 +71,7 @@ final class DiffusionRepositoryCreateController $cancel_uri = $this->getApplicationURI('new/'); break; default: - throw new Exception('Invalid edit operation!'); + throw new Exception(pht('Invalid edit operation!')); } $form = id(new PHUIPagedFormView()) @@ -483,7 +483,7 @@ final class DiffusionRepositoryCreateController $is_mercurial = true; break; default: - throw new Exception('Unsupported VCS!'); + throw new Exception(pht('Unsupported VCS!')); } $has_local = ($is_git || $is_mercurial); @@ -527,7 +527,7 @@ final class DiffusionRepositoryCreateController "repository, use the //Import Only// option at the end of this ". "workflow.)"); } else { - throw new Exception('Unsupported VCS!'); + throw new Exception(pht('Unsupported VCS!')); } $page->addRemarkupInstructions($instructions, 'remoteURI'); @@ -623,7 +623,7 @@ final class DiffusionRepositoryCreateController $remote_uri), 'credential'); } else { - throw new Exception('Unknown URI protocol!'); + throw new Exception(pht('Unknown URI protocol!')); } if ($provides_type) { @@ -734,8 +734,7 @@ final class DiffusionRepositoryCreateController ->setAdjustFormPageCallback(array($this, 'adjustPolicyPage')) ->setUser($viewer) ->addRemarkupInstructions( - pht( - 'Select access policies for this repository.')) + pht('Select access policies for this repository.')) ->addControl($view_policy) ->addControl($edit_policy) ->addControl($push_policy); diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditActionsController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditActionsController.php index 3c149e8cea..2b0bc674be 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditActionsController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditActionsController.php @@ -75,8 +75,7 @@ final class DiffusionRepositoryEditActionsController "new commits. You can disable publishing for this repository by ". "turning off **Notify/Publish**. This will disable notifications, ". "feed, and Herald (including audits and build plans) for this ". - "repository.". - "\n\n". + "repository.\n\n". "When Phabricator discovers a new commit, it can automatically ". "close associated revisions and tasks. If you don't want ". "Phabricator to close objects when it discovers new commits in ". diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php index 986f46cec5..80771f65c4 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php @@ -152,19 +152,25 @@ final class DiffusionRepositoryEditBasicController private function getReadmeInstructions() { return pht(<< $row) { @@ -167,8 +167,7 @@ final class DiffusionRepositoryEditBranchesController $form = id(new AphrontFormView()) ->setUser($viewer) ->appendRemarkupInstructions( - pht( - 'You can choose a **Default Branch** for viewing this repository.')) + pht('You can choose a **Default Branch** for viewing this repository.')) ->appendChild( id(new AphrontFormTextControl()) ->setName('default') @@ -196,7 +195,8 @@ final class DiffusionRepositoryEditBranchesController pht( 'When specifying branches, you should enter one branch name per '. 'line. You can use regular expressions to match branches by '. - 'wrapping an expression in `regexp(...)`. For example:')) + 'wrapping an expression in `%s`. For example:', + 'regexp(...)')) ->appendChild( id(new AphrontFormMarkupControl()) ->setValue($example_table)) diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php index 34a8431651..f39708fe1b 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php @@ -30,8 +30,9 @@ final class DiffusionRepositoryEditDeleteController $command = csprintf( 'phabricator/ $ ./bin/remove destroy %R', $repository->getMonogram()); - $text_2 = pht('Repositories touch many objects and as such deletes are '. - 'prohibitively expensive to run from the web UI.'); + $text_2 = pht( + 'Repositories touch many objects and as such deletes are '. + 'prohibitively expensive to run from the web UI.'); $body = phutil_tag( 'div', array( diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php index 1abbad6521..f71516e6ca 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php @@ -104,8 +104,7 @@ See [[%s | UTF-8 and Character Encoding]] for more information on how Phabricator handles text encodings. EOT , - PhabricatorEnv::getDoclink( - 'User Guide: UTF-8 and Character Encoding')); + PhabricatorEnv::getDoclink('User Guide: UTF-8 and Character Encoding')); } } diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php index a5ad77f87e..905021ab23 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php @@ -819,8 +819,9 @@ final class DiffusionRepositoryEditMainController ->setTarget( pht('Missing Binary %s', phutil_tag('tt', array(), $binary))) ->setNote(pht( - 'Unable to find this binary in `environment.append-paths`. '. + 'Unable to find this binary in `%s`. '. 'You need to configure %s and include %s.', + 'environment.append-paths', $this->getEnvConfigLink(), $path))); } diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditStorageController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditStorageController.php index 07da9a6442..345464a005 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditStorageController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditStorageController.php @@ -57,10 +57,11 @@ final class DiffusionRepositoryEditStorageController ->appendRemarkupInstructions( pht( "You can not adjust the local path for this repository from the ". - "web interface. To edit it, run this command:\n\n". - " phabricator/ $ ./bin/repository edit %s --as %s --local-path ...", - $repository->getCallsign(), - $user->getUsername())) + "web interface. To edit it, run this command:\n\n %s", + sprintf( + 'phabricator/ $ ./bin/repository edit %s --as %s --local-path ...', + $repository->getCallsign(), + $user->getUsername()))) ->appendChild( id(new AphrontFormSubmitControl()) ->addCancelButton($edit_uri, pht('Done'))); diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php index 83cda151d7..b125f26cae 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php @@ -84,11 +84,11 @@ final class DiffusionRepositoryEditSubversionController pht( "You can set the **Repository UUID**, which will help Phabriactor ". "provide better context in some cases. You can find the UUID of a ". - "repository by running `svn info`.". - "\n\n". + "repository by running `%s`.\n\n". "If you want to import only part of a repository, like `trunk/`, ". "you can set a path in **Import Only**. Phabricator will ignore ". - "commits which do not affect this path.")) + "commits which do not affect this path.", + 'svn info')) ->appendChild( id(new AphrontFormTextControl()) ->setName('uuid') diff --git a/src/applications/diffusion/controller/DiffusionRepositoryNewController.php b/src/applications/diffusion/controller/DiffusionRepositoryNewController.php index efab745433..f7fac7b183 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryNewController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryNewController.php @@ -53,11 +53,11 @@ final class DiffusionRepositoryNewController extends DiffusionController { 'import', pht('Import an Existing External Repository'), pht( - 'Import a repository hosted somewhere else, like GitHub, '. - 'Bitbucket, or your organization\'s existing servers. '. - 'Phabricator will read changes from the repository but will '. - 'not host or manage it. The authoritative master version of '. - 'the repository will stay where it is now.'))) + "Import a repository hosted somewhere else, like GitHub, ". + "Bitbucket, or your organization's existing servers. ". + "Phabricator will read changes from the repository but will ". + "not host or manage it. The authoritative master version of ". + "the repository will stay where it is now."))) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue(pht('Continue')) diff --git a/src/applications/diffusion/controller/DiffusionServeController.php b/src/applications/diffusion/controller/DiffusionServeController.php index 2b82bde43d..a76acd704c 100644 --- a/src/applications/diffusion/controller/DiffusionServeController.php +++ b/src/applications/diffusion/controller/DiffusionServeController.php @@ -342,7 +342,11 @@ final class DiffusionServeController extends DiffusionController { // resolve the binary first. $bin = Filesystem::resolveBinary('git-http-backend'); if (!$bin) { - throw new Exception('Unable to find `git-http-backend` in PATH!'); + throw new Exception( + pht( + 'Unable to find `%s` in %s!', + 'git-http-backend', + '$PATH')); } $env = array( @@ -485,7 +489,11 @@ final class DiffusionServeController extends DiffusionController { $bin = Filesystem::resolveBinary('hg'); if (!$bin) { - throw new Exception('Unable to find `hg` in PATH!'); + throw new Exception( + pht( + 'Unable to find `%s` in %s!', + 'hg', + '$PATH')); } $env = $this->getCommonEnvironment($viewer); diff --git a/src/applications/diffusion/data/DiffusionGitBranch.php b/src/applications/diffusion/data/DiffusionGitBranch.php index 925ede568c..8f69645b73 100644 --- a/src/applications/diffusion/data/DiffusionGitBranch.php +++ b/src/applications/diffusion/data/DiffusionGitBranch.php @@ -42,7 +42,10 @@ final class DiffusionGitBranch { continue; } if (!preg_match('/^ *(\S+)\s+([a-z0-9]{40})/', $line, $matches)) { - throw new Exception("Failed to parse {$line}!"); + throw new Exception( + pht( + 'Failed to parse %s!', + $line)); } $remote_branch = $matches[1]; @@ -57,7 +60,9 @@ final class DiffusionGitBranch { $matches = null; if (!preg_match('#^([^/]+)/(.*)$#', $remote_branch, $matches)) { throw new Exception( - "Failed to parse remote branch '{$remote_branch}'!"); + pht( + "Failed to parse remote branch '%s'!", + $remote_branch)); } $remote_name = $matches[1]; $branch_name = $matches[2]; @@ -84,7 +89,10 @@ final class DiffusionGitBranch { foreach ($lines as $line) { $matches = null; if (!preg_match($regex, $line, $matches)) { - throw new Exception("Failed to parse {$line}!"); + throw new Exception( + pht( + 'Failed to parse %s!', + $line)); } $branch = $matches[1]; diff --git a/src/applications/diffusion/data/DiffusionRepositoryTag.php b/src/applications/diffusion/data/DiffusionRepositoryTag.php index 12e71185bf..555e082700 100644 --- a/src/applications/diffusion/data/DiffusionRepositoryTag.php +++ b/src/applications/diffusion/data/DiffusionRepositoryTag.php @@ -72,7 +72,7 @@ final class DiffusionRepositoryTag { public function getMessage() { if ($this->message === false) { - throw new Exception('Message is not attached!'); + throw new Exception(pht('Message is not attached!')); } return $this->message; } diff --git a/src/applications/diffusion/engine/DiffusionCommitHookEngine.php b/src/applications/diffusion/engine/DiffusionCommitHookEngine.php index 13c7127e08..f84eb13bdf 100644 --- a/src/applications/diffusion/engine/DiffusionCommitHookEngine.php +++ b/src/applications/diffusion/engine/DiffusionCommitHookEngine.php @@ -697,7 +697,10 @@ final class DiffusionCommitHookEngine extends Phobject { private function findMercurialChangegroupRefUpdates() { $hg_node = getenv('HG_NODE'); if (!$hg_node) { - throw new Exception(pht('Expected HG_NODE in environment!')); + throw new Exception( + pht( + 'Expected %s in environment!', + 'HG_NODE')); } // NOTE: We need to make sure this is passed to subprocesses, or they won't diff --git a/src/applications/diffusion/exception/DiffusionSetupException.php b/src/applications/diffusion/exception/DiffusionSetupException.php index eecf7a81fc..0ce5994b7e 100644 --- a/src/applications/diffusion/exception/DiffusionSetupException.php +++ b/src/applications/diffusion/exception/DiffusionSetupException.php @@ -3,7 +3,7 @@ final class DiffusionSetupException extends AphrontUsageException { public function __construct($message) { - parent::__construct('Diffusion Setup Exception', $message); + parent::__construct(pht('Diffusion Setup Exception'), $message); } } diff --git a/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php b/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php index 578196ff69..6d52573656 100644 --- a/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php +++ b/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php @@ -28,7 +28,7 @@ final class DiffusionMercurialWireProtocol { ); if (!isset($commands[$command])) { - throw new Exception("Unknown Mercurial command '{$command}!"); + throw new Exception(pht("Unknown Mercurial command '%s!", $command)); } return $commands[$command]; @@ -65,7 +65,7 @@ final class DiffusionMercurialWireProtocol { // on the side of caution and throw if we don't get any data here. This // either indicates a mangled command from the client or a programming // error in our code. - throw new Exception("Expected nonempty 'cmds' specification!"); + throw new Exception(pht("Expected nonempty '%s' specification!", 'cmds')); } // For "batch" we get a "cmds" argument like: diff --git a/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php b/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php index e5645859a4..1cb0f107aa 100644 --- a/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php +++ b/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php @@ -93,7 +93,7 @@ final class DiffusionSubversionWireProtocol extends Phobject { $this->state = 'item'; } } else { - throw new Exception("Invalid state '{$this->state}'!"); + throw new Exception(pht("Invalid state '%s'!", $this->state)); } } @@ -124,7 +124,10 @@ final class DiffusionSubversionWireProtocol extends Phobject { $out[] = self::serializeStruct($value); break; default: - throw new Exception("Unknown SVN wire protocol structure '{$type}'!"); + throw new Exception( + pht( + "Unknown SVN wire protocol structure '%s'!", + $type)); } if ($type != 'list') { $out[] = ' '; @@ -139,7 +142,9 @@ final class DiffusionSubversionWireProtocol extends Phobject { if (empty($struct[0]['type']) || ($struct[0]['type'] != 'word')) { // This isn't what we expect; fail defensively. throw new Exception( - pht("Unexpected command structure, expected '( word ... )'.")); + pht( + "Unexpected command structure, expected '%s'.", + '( word ... )')); } switch ($struct[0]['value']) { diff --git a/src/applications/diffusion/query/DiffusionCachedResolveRefsQuery.php b/src/applications/diffusion/query/DiffusionCachedResolveRefsQuery.php index 8190a035f2..55e86ce879 100644 --- a/src/applications/diffusion/query/DiffusionCachedResolveRefsQuery.php +++ b/src/applications/diffusion/query/DiffusionCachedResolveRefsQuery.php @@ -42,7 +42,7 @@ final class DiffusionCachedResolveRefsQuery $result = $this->resolveSubversionRefs(); break; default: - throw new Exception('Unsupported repository type!'); + throw new Exception(pht('Unsupported repository type!')); } if ($this->types !== null) { diff --git a/src/applications/diffusion/query/DiffusionCommitQuery.php b/src/applications/diffusion/query/DiffusionCommitQuery.php index 23f886154b..93efb1df12 100644 --- a/src/applications/diffusion/query/DiffusionCommitQuery.php +++ b/src/applications/diffusion/query/DiffusionCommitQuery.php @@ -144,7 +144,9 @@ final class DiffusionCommitQuery public function getIdentifierMap() { if ($this->identifierMap === null) { throw new Exception( - 'You must execute() the query before accessing the identifier map.'); + pht( + 'You must %s the query before accessing the identifier map.', + 'execute()')); } return $this->identifierMap; } @@ -491,8 +493,10 @@ final class DiffusionCommitQuery self::AUDIT_STATUS_PARTIAL, ); throw new Exception( - "Unknown audit status '{$status}'! Valid statuses are: ". - implode(', ', $valid)); + pht( + "Unknown audit status '%s'! Valid statuses are: %s.", + $status, + implode(', ', $valid))); } } diff --git a/src/applications/diffusion/query/DiffusionQuery.php b/src/applications/diffusion/query/DiffusionQuery.php index 24f58583bf..a180a61f5a 100644 --- a/src/applications/diffusion/query/DiffusionQuery.php +++ b/src/applications/diffusion/query/DiffusionQuery.php @@ -32,7 +32,7 @@ abstract class DiffusionQuery extends PhabricatorQuery { $name = idx($map, $repository->getVersionControlSystem()); if (!$name) { - throw new Exception('Unsupported VCS!'); + throw new Exception(pht('Unsupported VCS!')); } $class = str_replace('Diffusion', 'Diffusion'.$name, $base_class); diff --git a/src/applications/diffusion/query/filecontent/DiffusionGitFileContentQuery.php b/src/applications/diffusion/query/filecontent/DiffusionGitFileContentQuery.php index ec0729d453..67c6369940 100644 --- a/src/applications/diffusion/query/filecontent/DiffusionGitFileContentQuery.php +++ b/src/applications/diffusion/query/filecontent/DiffusionGitFileContentQuery.php @@ -45,8 +45,10 @@ final class DiffusionGitFileContentQuery extends DiffusionFileContentQuery { // 8220d5d54f6d5d5552a636576cbe9c35f15b65b2 // (Andrew Gallagher 2010-12-03 324) // // Add the lines for trailing context - preg_match('/^\s*?(\S+?)\s*\(\s*(.*?)\s+\d{4}-\d{2}-\d{2}\s+\d+\)(.*)?$/', - $line, $m); + preg_match( + '/^\s*?(\S+?)\s*\(\s*(.*?)\s+\d{4}-\d{2}-\d{2}\s+\d+\)(.*)?$/', + $line, + $m); $rev_id = $m[1]; $author = $m[2]; $text = idx($m, 3); diff --git a/src/applications/diffusion/query/filecontent/DiffusionSvnFileContentQuery.php b/src/applications/diffusion/query/filecontent/DiffusionSvnFileContentQuery.php index d87db3ec87..be7487969b 100644 --- a/src/applications/diffusion/query/filecontent/DiffusionSvnFileContentQuery.php +++ b/src/applications/diffusion/query/filecontent/DiffusionSvnFileContentQuery.php @@ -26,9 +26,10 @@ final class DiffusionSvnFileContentQuery extends DiffusionFileContentQuery { // nuked; Diffusion will think it still exists and try to grab content // at HEAD. throw new Exception( - 'Failed to retrieve file content from Subversion. The file may '. - 'have been recently deleted, or the Diffusion cache may be out of '. - 'date.'); + pht( + 'Failed to retrieve file content from Subversion. The file may '. + 'have been recently deleted, or the Diffusion cache may be out of '. + 'date.')); } else { throw $ex; } diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php index 4aaf85d930..43862ce451 100644 --- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php +++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php @@ -17,8 +17,7 @@ final class DiffusionLowLevelCommitQuery protected function executeQuery() { if (!strlen($this->identifier)) { - throw new Exception( - pht('You must provide an identifier with withIdentifier()!')); + throw new PhutilInvalidStateException('withIdentifier'); } $type = $this->getRepository()->getVersionControlSystem(); diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php index 2b264bc35c..60ee4b5fe2 100644 --- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php +++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php @@ -12,8 +12,7 @@ final class DiffusionLowLevelParentsQuery protected function executeQuery() { if (!strlen($this->identifier)) { - throw new Exception( - pht('You must provide an identifier with withIdentifier()!')); + throw new PhutilInvalidStateException('withIdentifier'); } $type = $this->getRepository()->getVersionControlSystem(); diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php index 3926dbf398..53dc6b30da 100644 --- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php +++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php @@ -42,7 +42,7 @@ final class DiffusionLowLevelResolveRefsQuery $result = $this->resolveSubversionRefs(); break; default: - throw new Exception('Unsupported repository type!'); + throw new Exception(pht('Unsupported repository type!')); } if ($this->types !== null) { @@ -112,7 +112,10 @@ final class DiffusionLowLevelResolveRefsQuery $lines = explode("\n", rtrim($stdout, "\n")); if (count($lines) !== count($unresolved)) { - throw new Exception('Unexpected line count from `git cat-file`!'); + throw new Exception( + pht( + 'Unexpected line count from `%s`!', + 'git cat-file')); } $hits = array(); @@ -122,7 +125,11 @@ final class DiffusionLowLevelResolveRefsQuery foreach ($lines as $ref => $line) { $parts = explode(' ', $line); if (count($parts) < 2) { - throw new Exception("Failed to parse `git cat-file` output: {$line}"); + throw new Exception( + pht( + 'Failed to parse `%s` output: %s', + 'git cat-file', + $line)); } list($identifier, $type) = $parts; @@ -143,7 +150,10 @@ final class DiffusionLowLevelResolveRefsQuery break; default: throw new Exception( - "Unexpected object type from `git cat-file`: {$line}"); + pht( + 'Unexpected object type from `%s`: %s', + 'git cat-file', + $line)); } $hits[] = array( @@ -177,7 +187,10 @@ final class DiffusionLowLevelResolveRefsQuery $alternate = $identifier; $identifier = idx($tag_map, $ref); if (!$identifier) { - throw new Exception("Failed to look up tag '{$ref}'!"); + throw new Exception( + pht( + "Failed to look up tag '%s'!", + $ref)); } } diff --git a/src/applications/diffusion/query/pathid/__tests__/DiffusionPathQueryTestCase.php b/src/applications/diffusion/query/pathid/__tests__/DiffusionPathQueryTestCase.php index b0c6183761..a3ab67e60d 100644 --- a/src/applications/diffusion/query/pathid/__tests__/DiffusionPathQueryTestCase.php +++ b/src/applications/diffusion/query/pathid/__tests__/DiffusionPathQueryTestCase.php @@ -6,19 +6,19 @@ final class DiffusionPathQueryTestCase extends PhabricatorTestCase { $this->assertEqual( '/', DiffusionPathIDQuery::getParentPath('/'), - 'Parent of /'); + pht('Parent of %s', '/')); $this->assertEqual( '/', DiffusionPathIDQuery::getParentPath('x.txt'), - 'Parent of x.txt'); + pht('Parent of %s', 'x.txt')); $this->assertEqual( '/a', DiffusionPathIDQuery::getParentPath('/a/b'), - 'Parent of /a/b'); + pht('Parent of %s', '/a/b')); $this->assertEqual( '/a', DiffusionPathIDQuery::getParentPath('/a///b'), - 'Parent of /a///b'); + pht('Parent of %s', '/a///b')); } public function testExpandEdgeCases() { diff --git a/src/applications/diffusion/request/DiffusionGitRequest.php b/src/applications/diffusion/request/DiffusionGitRequest.php index 48d0761506..6e30886eec 100644 --- a/src/applications/diffusion/request/DiffusionGitRequest.php +++ b/src/applications/diffusion/request/DiffusionGitRequest.php @@ -17,7 +17,7 @@ final class DiffusionGitRequest extends DiffusionRequest { if ($this->repository) { return $this->repository->getDefaultBranch(); } - throw new Exception('Unable to determine branch!'); + throw new Exception(pht('Unable to determine branch!')); } } diff --git a/src/applications/diffusion/request/DiffusionMercurialRequest.php b/src/applications/diffusion/request/DiffusionMercurialRequest.php index 5966ffaaa0..a43cb089dd 100644 --- a/src/applications/diffusion/request/DiffusionMercurialRequest.php +++ b/src/applications/diffusion/request/DiffusionMercurialRequest.php @@ -19,7 +19,7 @@ final class DiffusionMercurialRequest extends DiffusionRequest { return $this->repository->getDefaultBranch(); } - throw new Exception('Unable to determine branch!'); + throw new Exception(pht('Unable to determine branch!')); } } diff --git a/src/applications/diffusion/request/DiffusionRequest.php b/src/applications/diffusion/request/DiffusionRequest.php index e7296e9cc1..2ed8e1f88e 100644 --- a/src/applications/diffusion/request/DiffusionRequest.php +++ b/src/applications/diffusion/request/DiffusionRequest.php @@ -62,13 +62,22 @@ abstract class DiffusionRequest { final public static function newFromDictionary(array $data) { if (isset($data['repository']) && isset($data['callsign'])) { throw new Exception( - "Specify 'repository' or 'callsign', but not both."); + pht( + "Specify '%s' or '%s', but not both.", + 'repository', + 'callsign')); } else if (!isset($data['repository']) && !isset($data['callsign'])) { throw new Exception( - "One of 'repository' and 'callsign' is required."); + pht( + "One of '%s' and '%s' is required.", + 'repository', + 'callsign')); } else if (isset($data['callsign']) && empty($data['user'])) { throw new Exception( - "Parameter 'user' is required if 'callsign' is provided."); + pht( + "Parameter '%s' is required if '%s' is provided.", + 'user', + 'callsign')); } if (isset($data['repository'])) { @@ -147,7 +156,7 @@ abstract class DiffusionRequest { ->executeOne(); if (!$repository) { - throw new Exception("No such repository '{$callsign}'."); + throw new Exception(pht("No such repository '%s'.", $callsign)); } return self::newFromRepository($repository); @@ -174,7 +183,7 @@ abstract class DiffusionRequest { $class = idx($map, $repository->getVersionControlSystem()); if (!$class) { - throw new Exception('Unknown version control system!'); + throw new Exception(pht('Unknown version control system!')); } $object = new $class(); @@ -207,7 +216,9 @@ abstract class DiffusionRequest { $user = idx($data, 'user'); if (!$user) { throw new Exception( - 'You must provide a PhabricatorUser in the dictionary!'); + pht( + 'You must provide a %s in the dictionary!', + 'PhabricatorUser')); } $this->setUser($user); } @@ -409,7 +420,7 @@ abstract class DiffusionRequest { if (!$data) { $data = new PhabricatorRepositoryCommitData(); $data->setCommitMessage( - '(This commit has not been fully parsed yet.)'); + pht('(This commit has not been fully parsed yet.)')); } $this->repositoryCommitData = $data; } @@ -533,12 +544,16 @@ abstract class DiffusionRequest { if ($req_callsign && !strlen($callsign)) { throw new Exception( - "Diffusion URI action '{$action}' requires callsign!"); + pht( + "Diffusion URI action '%s' requires callsign!", + $action)); } if ($req_commit && !strlen($commit)) { throw new Exception( - "Diffusion URI action '{$action}' requires commit!"); + pht( + "Diffusion URI action '%s' requires commit!", + $action)); } switch ($action) { @@ -576,7 +591,7 @@ abstract class DiffusionRequest { $uri = "/r{$callsign}{$commit}"; break; default: - throw new Exception("Unknown Diffusion URI action '{$action}'!"); + throw new Exception(pht("Unknown Diffusion URI action '%s'!", $action)); } if ($action == 'rendering-ref') { @@ -663,7 +678,7 @@ abstract class DiffusionRequest { // Prevent any hyjinx since we're ultimately shipping this to the // filesystem under a lot of workflows. if ($part == '..') { - throw new Exception('Invalid path URI.'); + throw new Exception(pht('Invalid path URI.')); } } @@ -689,21 +704,27 @@ abstract class DiffusionRequest { $host = php_uname('n'); $callsign = $this->getRepository()->getCallsign(); throw new DiffusionSetupException( - "The clone of this repository ('{$callsign}') on the local machine ". - "('{$host}') could not be read. Ensure that the repository is in a ". - "location where the web server has read permissions."); + pht( + "The clone of this repository ('%s') on the local machine ('%s') ". + "could not be read. Ensure that the repository is in a ". + "location where the web server has read permissions.", + $callsign, + $host)); } protected function raiseCloneException() { $host = php_uname('n'); $callsign = $this->getRepository()->getCallsign(); throw new DiffusionSetupException( - "The working copy for this repository ('{$callsign}') hasn't been ". - "cloned yet on this machine ('{$host}'). Make sure you've started the ". - "Phabricator daemons. If this problem persists for longer than a clone ". - "should take, check the daemon logs (in the Daemon Console) to see if ". - "there were errors cloning the repository. Consult the 'Diffusion User ". - "Guide' in the documentation for help setting up repositories."); + pht( + "The working copy for this repository ('%s') hasn't been cloned yet ". + "on this machine ('%s'). Make sure you've started the Phabricator ". + "daemons. If this problem persists for longer than a clone should ". + "take, check the daemon logs (in the Daemon Console) to see if there ". + "were errors cloning the repository. Consult the 'Diffusion User ". + "Guide' in the documentation for help setting up repositories.", + $callsign, + $host)); } private function queryStableCommit() { diff --git a/src/applications/diffusion/request/__tests__/DiffusionURITestCase.php b/src/applications/diffusion/request/__tests__/DiffusionURITestCase.php index a6c9eeb27d..43a2bd3404 100644 --- a/src/applications/diffusion/request/__tests__/DiffusionURITestCase.php +++ b/src/applications/diffusion/request/__tests__/DiffusionURITestCase.php @@ -67,7 +67,7 @@ final class DiffusionURITestCase extends PhutilTestCase { $this->assertEqual( $expect, $actual, - "Parsing '{$input}'"); + pht("Parsing '%s'", $input)); } } diff --git a/src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php b/src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php index b6c22b3a7e..51ffdeb3bd 100644 --- a/src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php +++ b/src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php @@ -35,11 +35,11 @@ final class DiffusionMercurialServeSSHWorkflow $args = $this->getArgs(); if (!$args->getArg('stdio')) { - throw new Exception('Expected `hg ... --stdio`!'); + throw new Exception(pht('Expected `%s`!', 'hg ... --stdio')); } if ($args->getArg('command') !== array('serve')) { - throw new Exception('Expected `hg ... serve`!'); + throw new Exception(pht('Expected `%s`!', 'hg ... serve')); } if ($this->shouldProxy()) { diff --git a/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php b/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php index e82a62a251..5150ef9352 100644 --- a/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php +++ b/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php @@ -207,7 +207,7 @@ final class DiffusionMercurialWireClientSSHProtocolChannel break; } } else { - throw new Exception("Bad parser state '{$this->state}'!"); + throw new Exception(pht("Bad parser state '%s'!", $this->state)); } } diff --git a/src/applications/diffusion/ssh/DiffusionSSHWorkflow.php b/src/applications/diffusion/ssh/DiffusionSSHWorkflow.php index 5190f8d3d1..2b2c820773 100644 --- a/src/applications/diffusion/ssh/DiffusionSSHWorkflow.php +++ b/src/applications/diffusion/ssh/DiffusionSSHWorkflow.php @@ -154,8 +154,7 @@ abstract class DiffusionSSHWorkflow extends PhabricatorSSHWorkflow { if (!preg_match($regex, $path, $matches)) { throw new Exception( pht( - 'Unrecognized repository path "%s". Expected a path like '. - '"%s".', + 'Unrecognized repository path "%s". Expected a path like "%s".', $path, '/diffusion/X/')); } diff --git a/src/applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php b/src/applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php index 4c5fd6740a..4d085302c9 100644 --- a/src/applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php +++ b/src/applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php @@ -83,7 +83,8 @@ final class DiffusionSubversionServeSSHWorkflow if (!$exec_channel->isOpenForReading()) { throw new Exception( pht( - 'svnserve subprocess exited before emitting a protocol frame.')); + '%s subprocess exited before emitting a protocol frame.', + 'svnserve')); } } @@ -141,7 +142,7 @@ final class DiffusionSubversionServeSSHWorkflow $args = $this->getArgs(); if (!$args->getArg('tunnel')) { - throw new Exception('Expected `svnserve -t`!'); + throw new Exception(pht('Expected `%s`!', 'svnserve -t')); } if ($this->shouldProxy()) { @@ -350,8 +351,9 @@ final class DiffusionSubversionServeSSHWorkflow if ($proto !== 'svn+ssh') { throw new Exception( pht( - 'Protocol for URI "%s" MUST be "svn+ssh".', - $uri_string)); + 'Protocol for URI "%s" MUST be "%s".', + $uri_string, + 'svn+ssh')); } $path = $uri->getPath(); @@ -360,7 +362,8 @@ final class DiffusionSubversionServeSSHWorkflow if (preg_match('(/\\.\\./)', $path)) { throw new Exception( pht( - 'String "/../" is invalid in path specification "%s".', + 'String "%s" is invalid in path specification "%s".', + '/../', $uri_string)); } diff --git a/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php b/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php index 694f4cd11d..0154805dd3 100644 --- a/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php +++ b/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php @@ -50,7 +50,7 @@ final class DiffusionMercurialWireSSHTestCase extends PhabricatorTestCase { $this->assertTrue( ($caught instanceof Exception), - "No extra messages for '{$file}'."); + pht("No extra messages for '%s'.", $file)); } } diff --git a/src/applications/diffusion/view/DiffusionEmptyResultView.php b/src/applications/diffusion/view/DiffusionEmptyResultView.php index 798fc7cf07..74a131e9d7 100644 --- a/src/applications/diffusion/view/DiffusionEmptyResultView.php +++ b/src/applications/diffusion/view/DiffusionEmptyResultView.php @@ -55,7 +55,7 @@ final class DiffusionEmptyResultView extends DiffusionView { $title = pht('Path Was Deleted'); $body = pht( 'This path does not exist at %s. It was deleted in %s and last %s '. - 'at %s.', + 'at %s.', $commit, self::linkCommit($drequest->getRepository(), $deleted), $browse, @@ -66,14 +66,15 @@ final class DiffusionEmptyResultView extends DiffusionView { $subdir = $drequest->getRepository()->getDetail('svn-subpath'); $title = pht('Directory Not Tracked'); $body = - pht("This repository is configured to track only one subdirectory ". - "of the entire repository ('%s'), ". - "but you aren't looking at something in that subdirectory, so no ". - "information is available.", $subdir); + pht( + "This repository is configured to track only one subdirectory ". + "of the entire repository ('%s'), but you aren't looking at ". + "something in that subdirectory, so no information is available.", + $subdir); $severity = PHUIInfoView::SEVERITY_WARNING; break; default: - throw new Exception("Unknown failure reason: $reason"); + throw new Exception(pht('Unknown failure reason: %s', $reason)); } $error_view = new PHUIInfoView(); diff --git a/src/applications/diffusion/view/DiffusionView.php b/src/applications/diffusion/view/DiffusionView.php index 44613f05cc..0bc51f8347 100644 --- a/src/applications/diffusion/view/DiffusionView.php +++ b/src/applications/diffusion/view/DiffusionView.php @@ -13,8 +13,11 @@ abstract class DiffusionView extends AphrontView { return $this->diffusionRequest; } - final public function linkChange($change_type, $file_type, $path = null, - $commit_identifier = null) { + final public function linkChange( + $change_type, + $file_type, + $path = null, + $commit_identifier = null) { $text = DifferentialChangeType::getFullNameForChangeType($change_type); if ($change_type == DifferentialChangeType::TYPE_CHILD) { diff --git a/src/applications/diviner/atom/DivinerAtom.php b/src/applications/diviner/atom/DivinerAtom.php index ef1a079a41..adeac36808 100644 --- a/src/applications/diviner/atom/DivinerAtom.php +++ b/src/applications/diviner/atom/DivinerAtom.php @@ -396,7 +396,7 @@ final class DivinerAtom { case self::TYPE_METHOD: return pht('This method is not documented.'); default: - phlog("Need translation for '{$type}'."); + phlog(pht("Need translation for '%s'.", $type)); return pht('This %s is not documented.', $type); } } @@ -427,7 +427,7 @@ final class DivinerAtom { case self::TYPE_METHOD: return pht('Method'); default: - phlog("Need translation for '{$type}'."); + phlog(pht("Need translation for '%s'.", $type)); return ucwords($type); } } diff --git a/src/applications/diviner/atomizer/DivinerArticleAtomizer.php b/src/applications/diviner/atomizer/DivinerArticleAtomizer.php index 62f568d3ef..e973a49447 100644 --- a/src/applications/diviner/atomizer/DivinerArticleAtomizer.php +++ b/src/applications/diviner/atomizer/DivinerArticleAtomizer.php @@ -16,7 +16,7 @@ final class DivinerArticleAtomizer extends DivinerAtomizer { $title = idx($meta, 'title'); if (!strlen($title)) { $title = pht('Untitled Article "%s"', basename($file_name)); - $atom->addWarning('Article has no @title!'); + $atom->addWarning(pht('Article has no %s!', '@title')); $atom->setDocblockMetaValue('title', $title); } diff --git a/src/applications/doorkeeper/worker/DoorkeeperAsanaFeedWorker.php b/src/applications/doorkeeper/worker/DoorkeeperAsanaFeedWorker.php index 7cd7af0b3f..1d293956b3 100644 --- a/src/applications/doorkeeper/worker/DoorkeeperAsanaFeedWorker.php +++ b/src/applications/doorkeeper/worker/DoorkeeperAsanaFeedWorker.php @@ -65,7 +65,7 @@ final class DoorkeeperAsanaFeedWorker extends DoorkeeperFeedWorker { $phid_aid_map = $this->lookupAsanaUserIDs($all_phids); if (!$phid_aid_map) { throw new PhabricatorWorkerPermanentFailureException( - 'No related users have linked Asana accounts.'); + pht('No related users have linked Asana accounts.')); } $owner_asana_id = idx($phid_aid_map, $owner_phid); @@ -86,8 +86,9 @@ final class DoorkeeperAsanaFeedWorker extends DoorkeeperFeedWorker { if (!$oauth_token) { throw new PhabricatorWorkerPermanentFailureException( - 'Unable to find any Asana user with valid credentials to '. - 'pull an OAuth token out of.'); + pht( + 'Unable to find any Asana user with valid credentials to '. + 'pull an OAuth token out of.')); } $etype_main = PhabricatorObjectHasAsanaTaskEdgeType::EDGECONST; @@ -124,21 +125,23 @@ final class DoorkeeperAsanaFeedWorker extends DoorkeeperFeedWorker { $parent_ref = head($refs); if (!$parent_ref) { throw new PhabricatorWorkerPermanentFailureException( - 'DoorkeeperExternalObject could not be loaded.'); + pht('%s could not be loaded.', 'DoorkeeperExternalObject')); } if ($parent_ref->getSyncFailed()) { throw new Exception( - 'Synchronization of parent task from Asana failed!'); + pht('Synchronization of parent task from Asana failed!')); } else if (!$parent_ref->getIsVisible()) { - $this->log("Skipping main task update, object is no longer visible.\n"); + $this->log( + "%s\n", + pht('Skipping main task update, object is no longer visible.')); $extra_data['gone'] = true; } else { $edge_cursor = idx($main_edge['data'], 'cursor', 0); // TODO: This probably breaks, very rarely, on 32-bit systems. if ($edge_cursor <= $story->getChronologicalKey()) { - $this->log("Updating main task.\n"); + $this->log("%s\n", pht('Updating main task.')); $task_id = $parent_ref->getObjectID(); $this->makeAsanaAPICall( @@ -148,7 +151,8 @@ final class DoorkeeperAsanaFeedWorker extends DoorkeeperFeedWorker { $main_data); } else { $this->log( - "Skipping main task update, cursor is ahead of the story.\n"); + "%s\n", + pht('Skipping main task update, cursor is ahead of the story.')); } } } else { @@ -156,7 +160,9 @@ final class DoorkeeperAsanaFeedWorker extends DoorkeeperFeedWorker { // (reviewers or auditors), and we haven't synchronized the object before, // don't synchronize the object. if (!$active_phids && !$passive_phids && !$follow_phids) { - $this->log("Object has no followers or active/passive users.\n"); + $this->log( + "%s\n", + pht('Object has no followers or active/passive users.')); return; } @@ -240,8 +246,10 @@ final class DoorkeeperAsanaFeedWorker extends DoorkeeperFeedWorker { if (!$parent_ref->getIsVisible()) { throw new PhabricatorWorkerPermanentFailureException( - 'DoorkeeperExternalObject has no visible object on the other side; '. - 'this likely indicates the Asana task has been deleted.'); + pht( + '%s has no visible object on the other side; this '. + 'likely indicates the Asana task has been deleted.', + 'DoorkeeperExternalObject')); } // Now, handle the subtasks. @@ -264,7 +272,7 @@ final class DoorkeeperAsanaFeedWorker extends DoorkeeperFeedWorker { foreach ($refs as $ref) { if ($ref->getSyncFailed()) { throw new Exception( - 'Synchronization of child task from Asana failed!'); + pht('Synchronization of child task from Asana failed!')); } if (!$ref->getIsVisible()) { $ref->getExternalObject()->delete(); @@ -283,8 +291,10 @@ final class DoorkeeperAsanaFeedWorker extends DoorkeeperFeedWorker { } $this->log( - "Removing subtask edge to %s, foreign object is not visible.\n", - $sub_phid); + "%s\n", + pht( + 'Removing subtask edge to %s, foreign object is not visible.', + $sub_phid)); $sub_editor->removeEdge($src_phid, $etype_sub, $sub_phid); unset($sub_edges[$sub_phid]); } @@ -448,7 +458,7 @@ final class DoorkeeperAsanaFeedWorker extends DoorkeeperFeedWorker { $provider = PhabricatorAsanaAuthProvider::getAsanaProvider(); if (!$provider) { throw new PhabricatorWorkerPermanentFailureException( - 'No Asana provider configured.'); + pht('No Asana provider configured.')); } $this->provider = $provider; } @@ -500,11 +510,11 @@ final class DoorkeeperAsanaFeedWorker extends DoorkeeperFeedWorker { } private function getSynchronizationWarning() { - return + return pht( "\xE2\x9A\xA0 DO NOT EDIT THIS TASK \xE2\x9A\xA0\n". "\xE2\x98\xA0 Your changes will not be reflected in Phabricator.\n". "\xE2\x98\xA0 Your changes will be destroyed the next time state ". - "is synchronized."; + "is synchronized."); } private function lookupAsanaUserIDs($all_phids) { diff --git a/src/applications/doorkeeper/worker/DoorkeeperFeedWorker.php b/src/applications/doorkeeper/worker/DoorkeeperFeedWorker.php index a280e85fbb..d015b19791 100644 --- a/src/applications/doorkeeper/worker/DoorkeeperFeedWorker.php +++ b/src/applications/doorkeeper/worker/DoorkeeperFeedWorker.php @@ -158,21 +158,23 @@ abstract class DoorkeeperFeedWorker extends FeedPushWorker { */ final protected function doWork() { if (PhabricatorEnv::getEnvConfig('phabricator.silent')) { - $this->log(pht('Phabricator is running in silent mode.')); + $this->log("%s\n", pht('Phabricator is running in silent mode.')); return; } if (!$this->isEnabled()) { - $this->log("Doorkeeper worker '%s' is not enabled.\n", get_class($this)); + $this->log( + "%s\n", + pht("Doorkeeper worker '%s' is not enabled.", get_class($this))); return; } $publisher = $this->loadPublisher(); if (!$publisher) { - $this->log("Story is about an unsupported object type.\n"); + $this->log("%s\n", pht('Story is about an unsupported object type.')); return; } else { - $this->log("Using publisher '%s'.\n", get_class($publisher)); + $this->log("%s\n", pht("Using publisher '%s'.", get_class($publisher))); } $this->publishFeedStory(); diff --git a/src/applications/doorkeeper/worker/DoorkeeperJIRAFeedWorker.php b/src/applications/doorkeeper/worker/DoorkeeperJIRAFeedWorker.php index 3334a3cd7c..7c6f15cf04 100644 --- a/src/applications/doorkeeper/worker/DoorkeeperJIRAFeedWorker.php +++ b/src/applications/doorkeeper/worker/DoorkeeperJIRAFeedWorker.php @@ -34,7 +34,9 @@ final class DoorkeeperJIRAFeedWorker extends DoorkeeperFeedWorker { $object->getPHID(), PhabricatorJiraIssueHasObjectEdgeType::EDGECONST); if (!$jira_issue_phids) { - $this->log("Story is about an object with no linked JIRA issues.\n"); + $this->log( + "%s\n", + pht('Story is about an object with no linked JIRA issues.')); return; } @@ -44,13 +46,17 @@ final class DoorkeeperJIRAFeedWorker extends DoorkeeperFeedWorker { ->execute(); if (!$xobjs) { - $this->log("Story object has no corresponding external JIRA objects.\n"); + $this->log( + "%s\n", + pht('Story object has no corresponding external JIRA objects.')); return; } $try_users = $this->findUsersToPossess(); if (!$try_users) { - $this->log("No users to act on linked JIRA objects.\n"); + $this->log( + "%s\n", + pht('No users to act on linked JIRA objects.')); return; } @@ -89,9 +95,11 @@ final class DoorkeeperJIRAFeedWorker extends DoorkeeperFeedWorker { } catch (HTTPFutureResponseStatus $ex) { phlog($ex); $this->log( - "Failed to update object %s using user %s.\n", - $xobj->getObjectID(), - $account->getUserPHID()); + "%s\n", + pht( + 'Failed to update object %s using user %s.', + $xobj->getObjectID(), + $account->getUserPHID())); } } } @@ -113,7 +121,7 @@ final class DoorkeeperJIRAFeedWorker extends DoorkeeperFeedWorker { $provider = PhabricatorJIRAAuthProvider::getJIRAProvider(); if (!$provider) { throw new PhabricatorWorkerPermanentFailureException( - 'No JIRA provider configured.'); + pht('No JIRA provider configured.')); } $this->provider = $provider; } diff --git a/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php index 223d974541..226815a642 100644 --- a/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php +++ b/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php @@ -36,7 +36,7 @@ abstract class DrydockBlueprintImplementation { $lease = idx($query, $lease_id); if (!$lease) { - throw new Exception("No such lease '{$lease_id}'!"); + throw new Exception(pht("No such lease '%d'!", $lease_id)); } return $lease; @@ -45,7 +45,7 @@ abstract class DrydockBlueprintImplementation { protected function getInstance() { if (!$this->instance) { throw new Exception( - 'Attach the blueprint instance to the implementation.'); + pht('Attach the blueprint instance to the implementation.')); } return $this->instance; @@ -116,7 +116,7 @@ abstract class DrydockBlueprintImplementation { $scope = $this->pushActiveScope($resource, $lease); - $this->log('Trying to Allocate Lease'); + $this->log(pht('Trying to Allocate Lease')); $lease->setStatus(DrydockLeaseStatus::STATUS_ACQUIRING); $lease->setResourceID($resource->getID()); @@ -158,7 +158,7 @@ abstract class DrydockBlueprintImplementation { $this->log('Allocated Lease'); } else { $resource->killTransaction(); - $this->log('Failed to Allocate Lease'); + $this->log(pht('Failed to Allocate Lease')); } if ($allocation_exception) { @@ -221,7 +221,7 @@ abstract class DrydockBlueprintImplementation { $scope = $this->pushActiveScope($resource, $lease); - $this->log('Acquiring Lease'); + $this->log(pht('Acquiring Lease')); $lease->setStatus(DrydockLeaseStatus::STATUS_ACTIVE); $lease->setResourceID($resource->getID()); $lease->attachResource($resource); @@ -237,7 +237,7 @@ abstract class DrydockBlueprintImplementation { $lease->setAttributes($ephemeral_lease->getAttributes()); $lease->save(); - $this->log('Acquired Lease'); + $this->log(pht('Acquired Lease')); } @@ -287,7 +287,7 @@ abstract class DrydockBlueprintImplementation { $lease->saveTransaction(); if (!$released) { - throw new Exception('Unable to release lease: lease not active!'); + throw new Exception(pht('Unable to release lease: lease not active!')); } } @@ -428,9 +428,12 @@ abstract class DrydockBlueprintImplementation { if (!($resource instanceof DrydockResource)) { throw new Exception( - "Blueprint '{$blueprint}' is not properly implemented: ". - "executeAllocateResource() must return an object of type ". - "DrydockResource or throw, but returned something else."); + pht( + "Blueprint '%s' is not properly implemented: %s must return an ". + "object of type %s or throw, but returned something else.", + $blueprint, + 'executeAllocateResource()', + 'DrydockResource')); } $current_status = $resource->getStatus(); @@ -439,10 +442,14 @@ abstract class DrydockBlueprintImplementation { $current_name = DrydockResourceStatus::getNameForStatus($current_status); $req_name = DrydockResourceStatus::getNameForStatus($req_status); throw new Exception( - "Blueprint '{$blueprint}' is not properly implemented: ". - "executeAllocateResource() must return a DrydockResource with ". - "status '{$req_name}', but returned one with status ". - "'{$current_name}'."); + pht( + "Blueprint '%s' is not properly implemented: %s must return a %s ". + "with status '%s', but returned one with status '%s'.", + $blueprint, + 'executeAllocateResource()', + 'DrydockResource', + $req_name, + $current_name)); } } @@ -452,7 +459,7 @@ abstract class DrydockBlueprintImplementation { if (($this->activeResource !== null) || ($this->activeLease !== null)) { - throw new Exception('There is already an active resource or lease!'); + throw new Exception(pht('There is already an active resource or lease!')); } $this->activeResource = $resource; diff --git a/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php index e256ed4bb9..af6a9e5f2f 100644 --- a/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php +++ b/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php @@ -20,7 +20,8 @@ final class DrydockPreallocatedHostBlueprintImplementation } protected function executeAllocateResource(DrydockLease $lease) { - throw new Exception("Preallocated hosts can't be dynamically allocated."); + throw new Exception( + pht("Preallocated hosts can't be dynamically allocated.")); } protected function canAllocateLease( @@ -84,7 +85,9 @@ final class DrydockPreallocatedHostBlueprintImplementation // inaccurate sanity checking since we can't safely escape the path. if (preg_match('/^[A-Z]\\:\\\\[a-zA-Z0-9\\\\\\ ]/', $full_path) === 0) { throw new Exception( - 'Unsafe path detected for Windows platform: "'.$full_path.'".'); + pht( + 'Unsafe path detected for Windows platform: "%s".', + $full_path)); } $cmd->execx('mkdir %C', $full_path); } @@ -120,7 +123,7 @@ final class DrydockPreallocatedHostBlueprintImplementation )); } - throw new Exception("No interface of type '{$type}'."); + throw new Exception(pht("No interface of type '%s'.", $type)); } } diff --git a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php index 3f6adb19b9..54d2b3b0f0 100644 --- a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php +++ b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php @@ -37,7 +37,9 @@ final class DrydockWorkingCopyBlueprintImplementation $repository_id = $lease->getAttribute('repositoryID'); if (!$repository_id) { throw new Exception( - "Lease is missing required 'repositoryID' attribute."); + pht( + "Lease is missing required '%s' attribute.", + 'repositoryID')); } $repository = id(new PhabricatorRepositoryQuery()) @@ -47,14 +49,16 @@ final class DrydockWorkingCopyBlueprintImplementation if (!$repository) { throw new Exception( - "Repository '{$repository_id}' does not exist!"); + pht( + "Repository '%s' does not exist!", + $repository_id)); } switch ($repository->getVersionControlSystem()) { case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: break; default: - throw new Exception('Unsupported VCS!'); + throw new Exception(pht('Unsupported VCS!')); } // TODO: Policy stuff here too. @@ -108,7 +112,7 @@ final class DrydockWorkingCopyBlueprintImplementation ->getInterface($type); } - throw new Exception("No interface of type '{$type}'."); + throw new Exception(pht("No interface of type '%s'.", $type)); } } diff --git a/src/applications/drydock/constants/DrydockResourceStatus.php b/src/applications/drydock/constants/DrydockResourceStatus.php index 7d11d93cba..d653138faf 100644 --- a/src/applications/drydock/constants/DrydockResourceStatus.php +++ b/src/applications/drydock/constants/DrydockResourceStatus.php @@ -17,7 +17,7 @@ final class DrydockResourceStatus extends DrydockConstants { self::STATUS_DESTROYED => pht('Destroyed'), ); - return idx($map, $status, 'Unknown'); + return idx($map, $status, pht('Unknown')); } public static function getAllStatuses() { diff --git a/src/applications/drydock/controller/DrydockConsoleController.php b/src/applications/drydock/controller/DrydockConsoleController.php index 28647c67a9..923e43a44e 100644 --- a/src/applications/drydock/controller/DrydockConsoleController.php +++ b/src/applications/drydock/controller/DrydockConsoleController.php @@ -43,24 +43,19 @@ final class DrydockConsoleController extends DrydockController { ->setHeader(pht('Resources')) ->setHref($this->getApplicationURI('resource/')) ->addAttribute( - pht( - 'View and manage resources Drydock has built, like hosts.'))); + pht('View and manage resources Drydock has built, like hosts.'))); $menu->addItem( id(new PHUIObjectItemView()) ->setHeader(pht('Leases')) ->setHref($this->getApplicationURI('lease/')) - ->addAttribute( - pht( - 'Manage leases on resources.'))); + ->addAttribute(pht('Manage leases on resources.'))); $menu->addItem( id(new PHUIObjectItemView()) ->setHeader(pht('Logs')) ->setHref($this->getApplicationURI('log/')) - ->addAttribute( - pht( - 'View logs.'))); + ->addAttribute(pht('View logs.'))); $crumbs = $this->buildApplicationCrumbs(); diff --git a/src/applications/drydock/controller/DrydockLeaseReleaseController.php b/src/applications/drydock/controller/DrydockLeaseReleaseController.php index 580e0660e4..1779edf1b2 100644 --- a/src/applications/drydock/controller/DrydockLeaseReleaseController.php +++ b/src/applications/drydock/controller/DrydockLeaseReleaseController.php @@ -27,8 +27,11 @@ final class DrydockLeaseReleaseController extends DrydockLeaseController { $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle(pht('Lease Not Active')) - ->appendChild(phutil_tag('p', array(), pht( - 'You can only release "active" leases.'))) + ->appendChild( + phutil_tag( + 'p', + array(), + pht('You can only release "active" leases.'))) ->addCancelButton($lease_uri); return id(new AphrontDialogResponse())->setDialog($dialog); @@ -38,10 +41,14 @@ final class DrydockLeaseReleaseController extends DrydockLeaseController { $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle(pht('Really release lease?')) - ->appendChild(phutil_tag('p', array(), pht( - 'Releasing a lease may cause trouble for the lease holder and '. - 'trigger cleanup of the underlying resource. It can not be '. - 'undone. Continue?'))) + ->appendChild( + phutil_tag( + 'p', + array(), + pht( + 'Releasing a lease may cause trouble for the lease holder and '. + 'trigger cleanup of the underlying resource. It can not be '. + 'undone. Continue?'))) ->addSubmitButton(pht('Release Lease')) ->addCancelButton($lease_uri); diff --git a/src/applications/drydock/controller/DrydockResourceViewController.php b/src/applications/drydock/controller/DrydockResourceViewController.php index 2a534a4d96..0070b9cf56 100644 --- a/src/applications/drydock/controller/DrydockResourceViewController.php +++ b/src/applications/drydock/controller/DrydockResourceViewController.php @@ -20,7 +20,7 @@ final class DrydockResourceViewController extends DrydockResourceController { return new Aphront404Response(); } - $title = 'Resource '.$resource->getID().' '.$resource->getName(); + $title = pht('Resource %s %s', $resource->getID(), $resource->getName()); $header = id(new PHUIHeaderView()) ->setHeader($title); diff --git a/src/applications/drydock/interface/command/DrydockSSHCommandInterface.php b/src/applications/drydock/interface/command/DrydockSSHCommandInterface.php index 1ec2c124f5..e691e0ecff 100644 --- a/src/applications/drydock/interface/command/DrydockSSHCommandInterface.php +++ b/src/applications/drydock/interface/command/DrydockSSHCommandInterface.php @@ -17,14 +17,15 @@ final class DrydockSSHCommandInterface extends DrydockCommandInterface { ->executeOne(); if ($credential === null) { - throw new Exception(pht( - 'There is no credential with ID %d.', - $this->getConfig('credential'))); + throw new Exception( + pht( + 'There is no credential with ID %d.', + $this->getConfig('credential'))); } if ($credential->getProvidesType() !== PassphraseCredentialTypeSSHPrivateKey::PROVIDES_TYPE) { - throw new Exception('Only private key credentials are supported.'); + throw new Exception(pht('Only private key credentials are supported.')); } $this->passphraseSSHKey = PassphraseSSHKey::loadFromPHID( diff --git a/src/applications/drydock/interface/filesystem/DrydockSFTPFilesystemInterface.php b/src/applications/drydock/interface/filesystem/DrydockSFTPFilesystemInterface.php index 6d6265ac69..fe7d2d1cd3 100644 --- a/src/applications/drydock/interface/filesystem/DrydockSFTPFilesystemInterface.php +++ b/src/applications/drydock/interface/filesystem/DrydockSFTPFilesystemInterface.php @@ -17,7 +17,7 @@ final class DrydockSFTPFilesystemInterface extends DrydockFilesystemInterface { if ($credential->getProvidesType() !== PassphraseCredentialTypeSSHPrivateKey::PROVIDES_TYPE) { - throw new Exception('Only private key credentials are supported.'); + throw new Exception(pht('Only private key credentials are supported.')); } $this->passphraseSSHKey = PassphraseSSHKey::loadFromPHID( diff --git a/src/applications/drydock/management/DrydockManagementCloseWorkflow.php b/src/applications/drydock/management/DrydockManagementCloseWorkflow.php index 550b441e85..f20b0e692b 100644 --- a/src/applications/drydock/management/DrydockManagementCloseWorkflow.php +++ b/src/applications/drydock/management/DrydockManagementCloseWorkflow.php @@ -6,7 +6,7 @@ final class DrydockManagementCloseWorkflow protected function didConstruct() { $this ->setName('close') - ->setSynopsis('Close a resource.') + ->setSynopsis(pht('Close a resource.')) ->setArguments( array( array( @@ -22,7 +22,7 @@ final class DrydockManagementCloseWorkflow $ids = $args->getArg('ids'); if (!$ids) { throw new PhutilArgumentUsageException( - 'Specify one or more resource IDs to close.'); + pht('Specify one or more resource IDs to close.')); } $viewer = $this->getViewer(); @@ -35,12 +35,12 @@ final class DrydockManagementCloseWorkflow foreach ($ids as $id) { $resource = idx($resources, $id); if (!$resource) { - $console->writeErr("Resource %d does not exist!\n", $id); + $console->writeErr("%s\n", pht('Resource %d does not exist!', $id)); } else if ($resource->getStatus() != DrydockResourceStatus::STATUS_OPEN) { - $console->writeErr("Resource %d is not 'open'!\n", $id); + $console->writeErr("%s\n", pht("Resource %d is not 'open'!", $id)); } else { $resource->closeResource(); - $console->writeErr("Closed resource %d.\n", $id); + $console->writeErr("%s\n", pht('Closed resource %d.', $id)); } } diff --git a/src/applications/drydock/management/DrydockManagementCreateResourceWorkflow.php b/src/applications/drydock/management/DrydockManagementCreateResourceWorkflow.php index 937a714ea0..8c67aaa908 100644 --- a/src/applications/drydock/management/DrydockManagementCreateResourceWorkflow.php +++ b/src/applications/drydock/management/DrydockManagementCreateResourceWorkflow.php @@ -6,23 +6,23 @@ final class DrydockManagementCreateResourceWorkflow protected function didConstruct() { $this ->setName('create-resource') - ->setSynopsis('Create a resource manually.') + ->setSynopsis(pht('Create a resource manually.')) ->setArguments( array( array( 'name' => 'name', 'param' => 'resource_name', - 'help' => 'Resource name.', + 'help' => pht('Resource name.'), ), array( 'name' => 'blueprint', 'param' => 'blueprint_id', - 'help' => 'Blueprint ID.', + 'help' => pht('Blueprint ID.'), ), array( 'name' => 'attributes', 'param' => 'name=value,...', - 'help' => 'Resource attributes.', + 'help' => pht('Resource attributes.'), ), )); } @@ -33,13 +33,17 @@ final class DrydockManagementCreateResourceWorkflow $resource_name = $args->getArg('name'); if (!$resource_name) { throw new PhutilArgumentUsageException( - 'Specify a resource name with `--name`.'); + pht( + 'Specify a resource name with `%s`.', + '--name')); } $blueprint_id = $args->getArg('blueprint'); if (!$blueprint_id) { throw new PhutilArgumentUsageException( - 'Specify a blueprint ID with `--blueprint`.'); + pht( + 'Specify a blueprint ID with `%s`.', + '--blueprint')); } $attributes = $args->getArg('attributes'); @@ -57,7 +61,7 @@ final class DrydockManagementCreateResourceWorkflow ->executeOne(); if (!$blueprint) { throw new PhutilArgumentUsageException( - 'Specified blueprint does not exist.'); + pht('Specified blueprint does not exist.')); } $resource = id(new DrydockResource()) @@ -70,7 +74,7 @@ final class DrydockManagementCreateResourceWorkflow } $resource->save(); - $console->writeOut("Created Resource %s\n", $resource->getID()); + $console->writeOut("%s\n", pht('Created Resource %s', $resource->getID())); return 0; } diff --git a/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php b/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php index 529376fe00..238177ae62 100644 --- a/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php +++ b/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php @@ -6,18 +6,18 @@ final class DrydockManagementLeaseWorkflow protected function didConstruct() { $this ->setName('lease') - ->setSynopsis('Lease a resource.') + ->setSynopsis(pht('Lease a resource.')) ->setArguments( array( array( 'name' => 'type', 'param' => 'resource_type', - 'help' => 'Resource type.', + 'help' => pht('Resource type.'), ), array( 'name' => 'attributes', 'param' => 'name=value,...', - 'help' => 'Resource specficiation.', + 'help' => pht('Resource specficiation.'), ), )); } @@ -28,7 +28,9 @@ final class DrydockManagementLeaseWorkflow $resource_type = $args->getArg('type'); if (!$resource_type) { throw new PhutilArgumentUsageException( - 'Specify a resource type with `--type`.'); + pht( + 'Specify a resource type with `%s`.', + '--type')); } $attributes = $args->getArg('attributes'); @@ -49,7 +51,7 @@ final class DrydockManagementLeaseWorkflow ->queueForActivation() ->waitUntilActive(); - $console->writeOut("Acquired Lease %s\n", $lease->getID()); + $console->writeOut("%s\n", pht('Acquired Lease %s', $lease->getID())); return 0; } diff --git a/src/applications/drydock/management/DrydockManagementReleaseWorkflow.php b/src/applications/drydock/management/DrydockManagementReleaseWorkflow.php index b59204695c..616a5deb7b 100644 --- a/src/applications/drydock/management/DrydockManagementReleaseWorkflow.php +++ b/src/applications/drydock/management/DrydockManagementReleaseWorkflow.php @@ -6,7 +6,7 @@ final class DrydockManagementReleaseWorkflow protected function didConstruct() { $this ->setName('release') - ->setSynopsis('Release a lease.') + ->setSynopsis(pht('Release a lease.')) ->setArguments( array( array( @@ -22,7 +22,7 @@ final class DrydockManagementReleaseWorkflow $ids = $args->getArg('ids'); if (!$ids) { throw new PhutilArgumentUsageException( - 'Specify one or more lease IDs to release.'); + pht('Specify one or more lease IDs to release.')); } $viewer = $this->getViewer(); @@ -35,15 +35,15 @@ final class DrydockManagementReleaseWorkflow foreach ($ids as $id) { $lease = idx($leases, $id); if (!$lease) { - $console->writeErr("Lease %d does not exist!\n", $id); + $console->writeErr("%s\n", pht('Lease %d does not exist!', $id)); } else if ($lease->getStatus() != DrydockLeaseStatus::STATUS_ACTIVE) { - $console->writeErr("Lease %d is not 'active'!\n", $id); + $console->writeErr("%s\n", pht("Lease %d is not 'active'!", $id)); } else { $resource = $lease->getResource(); $blueprint = $resource->getBlueprint(); $blueprint->releaseLease($resource, $lease); - $console->writeErr("Released lease %d.\n", $id); + $console->writeErr("%s\n", pht('Released lease %d.', $id)); } } diff --git a/src/applications/drydock/storage/DrydockBlueprint.php b/src/applications/drydock/storage/DrydockBlueprint.php index af258e0b1f..bad3f9a2dc 100644 --- a/src/applications/drydock/storage/DrydockBlueprint.php +++ b/src/applications/drydock/storage/DrydockBlueprint.php @@ -56,7 +56,9 @@ final class DrydockBlueprint extends DrydockDAO DrydockBlueprintImplementation::getAllBlueprintImplementations(); if (!isset($implementations[$class])) { throw new Exception( - "Invalid class name for blueprint (got '".$class."')"); + pht( + "Invalid class name for blueprint (got '%s')", + $class)); } return id(new $class())->attachInstance($this); } @@ -148,5 +150,4 @@ final class DrydockBlueprint extends DrydockDAO } - } diff --git a/src/applications/drydock/storage/DrydockLease.php b/src/applications/drydock/storage/DrydockLease.php index 252c922065..39fa59330c 100644 --- a/src/applications/drydock/storage/DrydockLease.php +++ b/src/applications/drydock/storage/DrydockLease.php @@ -100,7 +100,7 @@ final class DrydockLease extends DrydockDAO public function queueForActivation() { if ($this->getID()) { throw new Exception( - 'Only new leases may be queued for activation!'); + pht('Only new leases may be queued for activation!')); } $this->setStatus(DrydockLeaseStatus::STATUS_PENDING); @@ -143,8 +143,9 @@ final class DrydockLease extends DrydockDAO private function assertActive() { if (!$this->isActive()) { throw new Exception( - 'Lease is not active! You can not interact with resources through '. - 'an inactive lease.'); + pht( + 'Lease is not active! You can not interact with resources through '. + 'an inactive lease.')); } } @@ -164,16 +165,16 @@ final class DrydockLease extends DrydockDAO unset($unresolved[$key]); break; case DrydockLeaseStatus::STATUS_RELEASED: - throw new Exception('Lease has already been released!'); + throw new Exception(pht('Lease has already been released!')); case DrydockLeaseStatus::STATUS_EXPIRED: - throw new Exception('Lease has already expired!'); + throw new Exception(pht('Lease has already expired!')); case DrydockLeaseStatus::STATUS_BROKEN: - throw new Exception('Lease has been broken!'); + throw new Exception(pht('Lease has been broken!')); case DrydockLeaseStatus::STATUS_PENDING: case DrydockLeaseStatus::STATUS_ACQUIRING: break; default: - throw new Exception('Unknown status??'); + throw new Exception(pht('Unknown status??')); } } diff --git a/src/applications/drydock/worker/DrydockAllocatorWorker.php b/src/applications/drydock/worker/DrydockAllocatorWorker.php index 6d8e740e18..f9a647a3a8 100644 --- a/src/applications/drydock/worker/DrydockAllocatorWorker.php +++ b/src/applications/drydock/worker/DrydockAllocatorWorker.php @@ -39,7 +39,7 @@ final class DrydockAllocatorWorker extends PhabricatorWorker { protected function doWork() { $lease = $this->loadLease(); - $this->logToDrydock('Allocating Lease'); + $this->logToDrydock(pht('Allocating Lease')); try { $this->allocateLease($lease); @@ -147,8 +147,10 @@ final class DrydockAllocatorWorker extends PhabricatorWorker { $lease->save(); $this->logToDrydock( - "There are no resources of type '{$type}' available, and no ". - "blueprints which can allocate new ones."); + pht( + "There are no resources of type '%s' available, and no ". + "blueprints which can allocate new ones.", + $type)); return; } @@ -174,7 +176,7 @@ final class DrydockAllocatorWorker extends PhabricatorWorker { // and then switch them to "OPEN" only after the allocating lease gets // its grubby mitts on the resource. This might make more sense but // is a bit messy. - throw new Exception('Lost an allocation race?'); + throw new Exception(pht('Lost an allocation race?')); } } diff --git a/src/applications/fact/controller/PhabricatorFactChartController.php b/src/applications/fact/controller/PhabricatorFactChartController.php index 9b6a46b327..92718f47f8 100644 --- a/src/applications/fact/controller/PhabricatorFactChartController.php +++ b/src/applications/fact/controller/PhabricatorFactChartController.php @@ -32,7 +32,7 @@ final class PhabricatorFactChartController extends PhabricatorFactController { if (!$points) { // NOTE: Raphael crashes Safari if you hand it series with no points. - throw new Exception('No data to show!'); + throw new Exception(pht('No data to show!')); } // Limit amount of data passed to browser. diff --git a/src/applications/fact/daemon/PhabricatorFactDaemon.php b/src/applications/fact/daemon/PhabricatorFactDaemon.php index 130bdcde17..d60a77de6a 100644 --- a/src/applications/fact/daemon/PhabricatorFactDaemon.php +++ b/src/applications/fact/daemon/PhabricatorFactDaemon.php @@ -15,7 +15,7 @@ final class PhabricatorFactDaemon extends PhabricatorDaemon { } $this->processAggregates(); - $this->log('Zzz...'); + $this->log(pht('Zzz...')); $this->sleep(60 * 5); } } @@ -35,7 +35,7 @@ final class PhabricatorFactDaemon extends PhabricatorDaemon { } public function processIteratorWithCursor($iterator_name, $iterator) { - $this->log("Processing cursor '{$iterator_name}'."); + $this->log(pht("Processing cursor '%s'.", $iterator_name)); $cursor = id(new PhabricatorFactCursor())->loadOneWhere( 'name = %s', @@ -73,7 +73,7 @@ final class PhabricatorFactDaemon extends PhabricatorDaemon { $raw_facts = array(); foreach ($iterator as $key => $object) { $phid = $object->getPHID(); - $this->log("Processing {$phid}..."); + $this->log(pht('Processing %s...', $phid)); $raw_facts[$phid] = $this->computeRawFacts($object); if (count($raw_facts) > self::RAW_FACT_BUFFER_LIMIT) { $this->updateRawFacts($raw_facts); @@ -91,7 +91,7 @@ final class PhabricatorFactDaemon extends PhabricatorDaemon { } public function processAggregates() { - $this->log('Processing aggregates.'); + $this->log(pht('Processing aggregates.')); $facts = $this->computeAggregateFacts(); $this->updateAggregateFacts($facts); diff --git a/src/applications/fact/engine/PhabricatorFactCountEngine.php b/src/applications/fact/engine/PhabricatorFactCountEngine.php index 133e499267..f24068646d 100644 --- a/src/applications/fact/engine/PhabricatorFactCountEngine.php +++ b/src/applications/fact/engine/PhabricatorFactCountEngine.php @@ -10,9 +10,9 @@ final class PhabricatorFactCountEngine extends PhabricatorFactEngine { foreach ($fact_types as $type) { if (!strncmp($type, '+N:', 3)) { if ($type == '+N:*') { - $name = 'Total Objects'; + $name = pht('Total Objects'); } else { - $name = 'Total Objects of type '.substr($type, 3); + $name = pht('Total Objects of type %s', substr($type, 3)); } $results[] = id(new PhabricatorFactSimpleSpec($type)) @@ -22,9 +22,9 @@ final class PhabricatorFactCountEngine extends PhabricatorFactEngine { if (!strncmp($type, 'N:', 2)) { if ($type == 'N:*') { - $name = 'Objects'; + $name = pht('Objects'); } else { - $name = 'Objects of type '.substr($type, 2); + $name = pht('Objects of type %s', substr($type, 2)); } $results[] = id(new PhabricatorFactSimpleSpec($type)) ->setName($name) diff --git a/src/applications/fact/engine/PhabricatorFactLastUpdatedEngine.php b/src/applications/fact/engine/PhabricatorFactLastUpdatedEngine.php index 39e8781d51..5ea99e6232 100644 --- a/src/applications/fact/engine/PhabricatorFactLastUpdatedEngine.php +++ b/src/applications/fact/engine/PhabricatorFactLastUpdatedEngine.php @@ -10,7 +10,7 @@ final class PhabricatorFactLastUpdatedEngine extends PhabricatorFactEngine { foreach ($fact_types as $type) { if ($type == 'updated') { $results[] = id(new PhabricatorFactSimpleSpec($type)) - ->setName('Facts Last Updated') + ->setName(pht('Facts Last Updated')) ->setUnit(PhabricatorFactSimpleSpec::UNIT_EPOCH); } } diff --git a/src/applications/fact/extract/PhabricatorFactUpdateIterator.php b/src/applications/fact/extract/PhabricatorFactUpdateIterator.php index 302026098a..df77f4dd33 100644 --- a/src/applications/fact/extract/PhabricatorFactUpdateIterator.php +++ b/src/applications/fact/extract/PhabricatorFactUpdateIterator.php @@ -2,7 +2,7 @@ /** * Iterate over objects by update time in a stable way. This iterator only works - * for "normal" Lisk objects: objects with an autoincrement ID and a + * for "normal" Lisk objects: objects with an auto-increment ID and a * dateModified column. */ final class PhabricatorFactUpdateIterator extends PhutilBufferedIterator { diff --git a/src/applications/fact/management/PhabricatorFactManagementAnalyzeWorkflow.php b/src/applications/fact/management/PhabricatorFactManagementAnalyzeWorkflow.php index 461f87379f..6b316f8c75 100644 --- a/src/applications/fact/management/PhabricatorFactManagementAnalyzeWorkflow.php +++ b/src/applications/fact/management/PhabricatorFactManagementAnalyzeWorkflow.php @@ -13,15 +13,15 @@ final class PhabricatorFactManagementAnalyzeWorkflow 'name' => 'iterator', 'param' => 'name', 'repeat' => true, - 'help' => 'Process only iterator __name__.', + 'help' => pht('Process only iterator __name__.'), ), array( 'name' => 'all', - 'help' => 'Analyze from the beginning, ignoring cursors.', + 'help' => pht('Analyze from the beginning, ignoring cursors.'), ), array( 'name' => 'skip-aggregates', - 'help' => 'Skip analysis of aggreate facts.', + 'help' => pht('Skip analysis of aggregate facts.'), ), )); } diff --git a/src/applications/fact/management/PhabricatorFactManagementCursorsWorkflow.php b/src/applications/fact/management/PhabricatorFactManagementCursorsWorkflow.php index 590967bd32..74f35e3ccc 100644 --- a/src/applications/fact/management/PhabricatorFactManagementCursorsWorkflow.php +++ b/src/applications/fact/management/PhabricatorFactManagementCursorsWorkflow.php @@ -16,7 +16,7 @@ final class PhabricatorFactManagementCursorsWorkflow 'name' => 'reset', 'param' => 'cursor', 'repeat' => true, - 'help' => 'Reset cursor __cursor__.', + 'help' => pht('Reset cursor __cursor__.'), ), )); } diff --git a/src/applications/fact/spec/PhabricatorFactSpec.php b/src/applications/fact/spec/PhabricatorFactSpec.php index a0af2420cb..a9646b246a 100644 --- a/src/applications/fact/spec/PhabricatorFactSpec.php +++ b/src/applications/fact/spec/PhabricatorFactSpec.php @@ -33,8 +33,9 @@ abstract class PhabricatorFactSpec { } public function getName() { - $type = $this->getType(); - return "Fact ({$type})"; + return pht( + 'Fact (%s)', + $this->getType()); } public function formatValueForDisplay(PhabricatorUser $user, $value) { diff --git a/src/applications/feed/PhabricatorFeedStoryPublisher.php b/src/applications/feed/PhabricatorFeedStoryPublisher.php index 79b3b6cd55..4e91be8521 100644 --- a/src/applications/feed/PhabricatorFeedStoryPublisher.php +++ b/src/applications/feed/PhabricatorFeedStoryPublisher.php @@ -74,21 +74,29 @@ final class PhabricatorFeedStoryPublisher { public function publish() { $class = $this->storyType; if (!$class) { - throw new Exception('Call setStoryType() before publishing!'); + throw new Exception( + pht( + 'Call %s before publishing!', + 'setStoryType()')); } if (!class_exists($class)) { throw new Exception( - "Story type must be a valid class name and must subclass ". - "PhabricatorFeedStory. ". - "'{$class}' is not a loadable class."); + pht( + "Story type must be a valid class name and must subclass %s. ". + "'%s' is not a loadable class.", + 'PhabricatorFeedStory', + $class)); } if (!is_subclass_of($class, 'PhabricatorFeedStory')) { throw new Exception( - "Story type must be a valid class name and must subclass ". - "PhabricatorFeedStory. ". - "'{$class}' is not a subclass of PhabricatorFeedStory."); + pht( + "Story type must be a valid class name and must subclass %s. ". + "'%s' is not a subclass of %s.", + 'PhabricatorFeedStory', + $class, + 'PhabricatorFeedStory')); } $chrono_key = $this->generateChronologicalKey(); @@ -139,7 +147,10 @@ final class PhabricatorFeedStoryPublisher { private function insertNotifications($chrono_key, array $subscribed_phids) { if (!$this->primaryObjectPHID) { throw new Exception( - 'You must call setPrimaryObjectPHID() if you setSubscribedPHIDs()!'); + pht( + 'You must call %s if you %s!', + 'setPrimaryObjectPHID()', + 'setSubscribedPHIDs()')); } $notif = new PhabricatorFeedStoryNotification(); diff --git a/src/applications/feed/builder/PhabricatorFeedBuilder.php b/src/applications/feed/builder/PhabricatorFeedBuilder.php index 6f78b0dcfa..63ec420771 100644 --- a/src/applications/feed/builder/PhabricatorFeedBuilder.php +++ b/src/applications/feed/builder/PhabricatorFeedBuilder.php @@ -34,7 +34,7 @@ final class PhabricatorFeedBuilder { public function buildView() { if (!$this->user) { - throw new Exception('Call setUser() before buildView()!'); + throw new PhutilInvalidStateException('setUser'); } $user = $this->user; diff --git a/src/applications/feed/conduit/FeedPublishConduitAPIMethod.php b/src/applications/feed/conduit/FeedPublishConduitAPIMethod.php index a082e36fea..5f83e73b3d 100644 --- a/src/applications/feed/conduit/FeedPublishConduitAPIMethod.php +++ b/src/applications/feed/conduit/FeedPublishConduitAPIMethod.php @@ -11,7 +11,7 @@ final class FeedPublishConduitAPIMethod extends FeedConduitAPIMethod { } public function getMethodDescription() { - return 'Publish a story to the feed.'; + return pht('Publish a story to the feed.'); } protected function defineParamTypes() { diff --git a/src/applications/feed/conduit/FeedQueryConduitAPIMethod.php b/src/applications/feed/conduit/FeedQueryConduitAPIMethod.php index 02efb83f73..661b70a7ab 100644 --- a/src/applications/feed/conduit/FeedQueryConduitAPIMethod.php +++ b/src/applications/feed/conduit/FeedQueryConduitAPIMethod.php @@ -11,7 +11,7 @@ final class FeedQueryConduitAPIMethod extends FeedConduitAPIMethod { } public function getMethodDescription() { - return 'Query the feed for stories'; + return pht('Query the feed for stories'); } private function getDefaultLimit() { @@ -30,10 +30,10 @@ final class FeedQueryConduitAPIMethod extends FeedConduitAPIMethod { private function getSupportedViewTypes() { return array( - 'html' => 'Full HTML presentation of story', - 'data' => 'Dictionary with various data of the story', - 'html-summary' => 'Story contains only the title of the story', - 'text' => 'Simple one-line plain text representation of story', + 'html' => pht('Full HTML presentation of story'), + 'data' => pht('Dictionary with various data of the story'), + 'html-summary' => pht('Story contains only the title of the story'), + 'text' => pht('Simple one-line plain text representation of story'), ); } @@ -44,7 +44,9 @@ final class FeedQueryConduitAPIMethod extends FeedConduitAPIMethod { return array( 'ERR-UNKNOWN-TYPE' => - 'Unsupported view type, possibles are: '.$view_types, + pht( + 'Unsupported view type, possibles are: %s', + $view_types), ); } diff --git a/src/applications/feed/query/PhabricatorFeedQuery.php b/src/applications/feed/query/PhabricatorFeedQuery.php index 4ee91859c0..b9c7d099aa 100644 --- a/src/applications/feed/query/PhabricatorFeedQuery.php +++ b/src/applications/feed/query/PhabricatorFeedQuery.php @@ -67,7 +67,8 @@ final class PhabricatorFeedQuery $keys = $this->chronologicalKeys; foreach ($keys as $key) { if (!ctype_digit($key)) { - throw new Exception("Key '{$key}' is not a valid chronological key!"); + throw new Exception( + pht("Key '%s' is not a valid chronological key!", $key)); } } diff --git a/src/applications/feed/story/PhabricatorFeedStory.php b/src/applications/feed/story/PhabricatorFeedStory.php index f94c2601e8..253757b8de 100644 --- a/src/applications/feed/story/PhabricatorFeedStory.php +++ b/src/applications/feed/story/PhabricatorFeedStory.php @@ -215,7 +215,7 @@ abstract class PhabricatorFeedStory case PhabricatorApplicationTransaction::TARGET_TEXT: break; default: - throw new Exception('Unknown rendering target: '.$target); + throw new Exception(pht('Unknown rendering target: %s', $target)); break; } } @@ -229,7 +229,9 @@ abstract class PhabricatorFeedStory $object = idx($this->objects, $phid); if (!$object) { throw new Exception( - "Story is asking for an object it did not request ('{$phid}')!"); + pht( + "Story is asking for an object it did not request ('%s')!", + $phid)); } return $object; } @@ -237,7 +239,7 @@ abstract class PhabricatorFeedStory public function getPrimaryObject() { $phid = $this->getPrimaryObjectPHID(); if (!$phid) { - throw new Exception('Story has no primary object!'); + throw new Exception(pht('Story has no primary object!')); } return $this->getObject($phid); } @@ -308,7 +310,7 @@ abstract class PhabricatorFeedStory $handle = new PhabricatorObjectHandle(); $handle->setPHID($phid); - $handle->setName("Unloaded Object '{$phid}'"); + $handle->setName(pht("Unloaded Object '%s'", $phid)); return $handle; } diff --git a/src/applications/feed/worker/FeedPushWorker.php b/src/applications/feed/worker/FeedPushWorker.php index b406b76ee0..90407f6a75 100644 --- a/src/applications/feed/worker/FeedPushWorker.php +++ b/src/applications/feed/worker/FeedPushWorker.php @@ -13,7 +13,7 @@ abstract class FeedPushWorker extends PhabricatorWorker { if (!$story) { throw new PhabricatorWorkerPermanentFailureException( - 'Feed story does not exist.'); + pht('Feed story does not exist.')); } return $story; diff --git a/src/applications/files/application/PhabricatorFilesApplication.php b/src/applications/files/application/PhabricatorFilesApplication.php index ed4801ace6..b80a8e1ae4 100644 --- a/src/applications/files/application/PhabricatorFilesApplication.php +++ b/src/applications/files/application/PhabricatorFilesApplication.php @@ -59,8 +59,7 @@ final class PhabricatorFilesApplication extends PhabricatorApplication { protected function getCustomCapabilities() { return array( FilesDefaultViewCapability::CAPABILITY => array( - 'caption' => pht( - 'Default view policy for newly created files.'), + 'caption' => pht('Default view policy for newly created files.'), ), ); } diff --git a/src/applications/files/conduit/FileConduitAPIMethod.php b/src/applications/files/conduit/FileConduitAPIMethod.php index 2419303218..420ed65bfb 100644 --- a/src/applications/files/conduit/FileConduitAPIMethod.php +++ b/src/applications/files/conduit/FileConduitAPIMethod.php @@ -74,8 +74,7 @@ abstract class FileConduitAPIMethod extends ConduitAPIMethod { if ($chunk->getDataFilePHID()) { throw new Exception( - pht( - 'Chunk has already been uploaded.')); + pht('Chunk has already been uploaded.')); } return $chunk; diff --git a/src/applications/files/conduit/FileDownloadConduitAPIMethod.php b/src/applications/files/conduit/FileDownloadConduitAPIMethod.php index 67e9d1f25c..3a3867ac9e 100644 --- a/src/applications/files/conduit/FileDownloadConduitAPIMethod.php +++ b/src/applications/files/conduit/FileDownloadConduitAPIMethod.php @@ -7,7 +7,7 @@ final class FileDownloadConduitAPIMethod extends FileConduitAPIMethod { } public function getMethodDescription() { - return 'Download a file from the server.'; + return pht('Download a file from the server.'); } protected function defineParamTypes() { @@ -22,7 +22,7 @@ final class FileDownloadConduitAPIMethod extends FileConduitAPIMethod { protected function defineErrorTypes() { return array( - 'ERR-BAD-PHID' => 'No such file exists.', + 'ERR-BAD-PHID' => pht('No such file exists.'), ); } diff --git a/src/applications/files/conduit/FileInfoConduitAPIMethod.php b/src/applications/files/conduit/FileInfoConduitAPIMethod.php index 7b8cecbdf1..5f1bb6e936 100644 --- a/src/applications/files/conduit/FileInfoConduitAPIMethod.php +++ b/src/applications/files/conduit/FileInfoConduitAPIMethod.php @@ -7,7 +7,7 @@ final class FileInfoConduitAPIMethod extends FileConduitAPIMethod { } public function getMethodDescription() { - return 'Get information about a file.'; + return pht('Get information about a file.'); } protected function defineParamTypes() { @@ -23,7 +23,7 @@ final class FileInfoConduitAPIMethod extends FileConduitAPIMethod { protected function defineErrorTypes() { return array( - 'ERR-NOT-FOUND' => 'No such file exists.', + 'ERR-NOT-FOUND' => pht('No such file exists.'), ); } diff --git a/src/applications/files/conduit/FileUploadConduitAPIMethod.php b/src/applications/files/conduit/FileUploadConduitAPIMethod.php index 594b53bcce..ac93b7d39a 100644 --- a/src/applications/files/conduit/FileUploadConduitAPIMethod.php +++ b/src/applications/files/conduit/FileUploadConduitAPIMethod.php @@ -7,7 +7,7 @@ final class FileUploadConduitAPIMethod extends FileConduitAPIMethod { } public function getMethodDescription() { - return 'Upload a file to the server.'; + return pht('Upload a file to the server.'); } protected function defineParamTypes() { diff --git a/src/applications/files/conduit/FileUploadHashConduitAPIMethod.php b/src/applications/files/conduit/FileUploadHashConduitAPIMethod.php index 2ab13dc350..135e018a2f 100644 --- a/src/applications/files/conduit/FileUploadHashConduitAPIMethod.php +++ b/src/applications/files/conduit/FileUploadHashConduitAPIMethod.php @@ -8,7 +8,7 @@ final class FileUploadHashConduitAPIMethod extends FileConduitAPIMethod { } public function getMethodDescription() { - return 'Upload a file to the server using content hash.'; + return pht('Upload a file to the server using content hash.'); } protected function defineParamTypes() { diff --git a/src/applications/files/config/PhabricatorFilesConfigOptions.php b/src/applications/files/config/PhabricatorFilesConfigOptions.php index ac62d410fe..e9d899f658 100644 --- a/src/applications/files/config/PhabricatorFilesConfigOptions.php +++ b/src/applications/files/config/PhabricatorFilesConfigOptions.php @@ -101,35 +101,37 @@ final class PhabricatorFilesConfigOptions pht('Configure which MIME types are viewable in the browser.')) ->setDescription( pht( - 'Configure which uploaded file types may be viewed directly '. - 'in the browser. Other file types will be downloaded instead '. - 'of displayed. This is mainly a usability consideration, since '. - 'browsers tend to freak out when viewing enormous binary files.'. + "Configure which uploaded file types may be viewed directly ". + "in the browser. Other file types will be downloaded instead ". + "of displayed. This is mainly a usability consideration, since ". + "browsers tend to freak out when viewing enormous binary files.". "\n\n". - 'The keys in this map are vieweable MIME types; the values are '. - 'the MIME types they are delivered as when they are viewed in '. - 'the browser.')), + "The keys in this map are viewable MIME types; the values are ". + "the MIME types they are delivered as when they are viewed in ". + "the browser.")), $this->newOption('files.image-mime-types', 'set', $image_default) ->setLocked(true) ->setSummary(pht('Configure which MIME types are images.')) ->setDescription( pht( - 'List of MIME types which can be used as the `src` for an '. - '`` tag.')), + 'List of MIME types which can be used as the `%s` for an `%s` tag.', + 'src', + '')), $this->newOption('files.audio-mime-types', 'set', $audio_default) ->setLocked(true) ->setSummary(pht('Configure which MIME types are audio.')) ->setDescription( pht( - 'List of MIME types which can be used to render an '. - '`