Page MenuHomePhabricator

D19497.diff
No OneTemporary

D19497.diff

diff --git a/resources/sql/autopatches/20180809.repo_identities.activity.php b/resources/sql/autopatches/20180809.repo_identities.activity.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20180809.repo_identities.activity.php
@@ -0,0 +1,20 @@
+<?php
+
+// Advise installs to rebuild the repository identities.
+
+// If the install has no commits (or no commits that lack an
+// authorIdentityPHID), don't require a rebuild.
+$commits = id(new PhabricatorRepositoryCommit())
+ ->loadAllWhere('authorIdentityPHID IS NULL LIMIT 1');
+
+if (!$commits) {
+ return;
+}
+
+try {
+ id(new PhabricatorConfigManualActivity())
+ ->setActivityType(PhabricatorConfigManualActivity::TYPE_IDENTITIES)
+ ->save();
+} catch (AphrontDuplicateKeyQueryException $ex) {
+ // If we've already noted that this activity is required, just move on.
+}
diff --git a/src/applications/config/check/PhabricatorManualActivitySetupCheck.php b/src/applications/config/check/PhabricatorManualActivitySetupCheck.php
--- a/src/applications/config/check/PhabricatorManualActivitySetupCheck.php
+++ b/src/applications/config/check/PhabricatorManualActivitySetupCheck.php
@@ -13,63 +13,134 @@
foreach ($activities as $activity) {
$type = $activity->getActivityType();
- // For now, there is only one type of manual activity. It's not clear
- // if we're really going to have too much more of this stuff so this
- // is a bit under-designed for now.
-
- $activity_name = pht('Rebuild Search Index');
- $activity_summary = pht(
- 'The search index algorithm has been updated and the index needs '.
- 'be rebuilt.');
-
- $message = array();
-
- $message[] = pht(
- 'The indexing algorithm for the fulltext search index has been '.
- 'updated and the index needs to be rebuilt. Until you rebuild the '.
- 'index, global search (and other fulltext search) will not '.
- 'function correctly.');
-
- $message[] = pht(
- 'You can rebuild the search index while Phabricator is running.');
-
- $message[] = pht(
- 'To rebuild the index, run this command:');
-
- $message[] = phutil_tag(
- 'pre',
- array(),
- (string)csprintf(
- 'phabricator/ $ ./bin/search index --all --force --background'));
-
- $message[] = pht(
- 'You can find more information about rebuilding the search '.
- 'index here: %s',
- phutil_tag(
- 'a',
- array(
- 'href' => 'https://phurl.io/u/reindex',
- 'target' => '_blank',
- ),
- 'https://phurl.io/u/reindex'));
-
- $message[] = pht(
- 'After rebuilding the index, run this command to clear this setup '.
- 'warning:');
-
- $message[] = phutil_tag(
- 'pre',
- array(),
- (string)csprintf('phabricator/ $ ./bin/config done %R', $type));
-
- $activity_message = phutil_implode_html("\n\n", $message);
-
- $this->newIssue('manual.'.$type)
- ->setName($activity_name)
- ->setSummary($activity_summary)
- ->setMessage($activity_message);
+ switch ($type) {
+ case PhabricatorConfigManualActivity::TYPE_REINDEX:
+ $this->raiseSearchReindexIssue();
+ break;
+
+ case PhabricatorConfigManualActivity::TYPE_IDENTITIES:
+ $this->raiseRebuildIdentitiesIssue();
+ break;
+
+ default:
+ }
}
+ }
+
+ private function raiseSearchReindexIssue() {
+ $activity_name = pht('Rebuild Search Index');
+ $activity_summary = pht(
+ 'The search index algorithm has been updated and the index needs '.
+ 'be rebuilt.');
+
+ $message = array();
+
+ $message[] = pht(
+ 'The indexing algorithm for the fulltext search index has been '.
+ 'updated and the index needs to be rebuilt. Until you rebuild the '.
+ 'index, global search (and other fulltext search) will not '.
+ 'function correctly.');
+
+ $message[] = pht(
+ 'You can rebuild the search index while Phabricator is running.');
+
+ $message[] = pht(
+ 'To rebuild the index, run this command:');
+
+ $message[] = phutil_tag(
+ 'pre',
+ array(),
+ (string)csprintf(
+ 'phabricator/ $ ./bin/search index --all --force --background'));
+
+ $message[] = pht(
+ 'You can find more information about rebuilding the search '.
+ 'index here: %s',
+ phutil_tag(
+ 'a',
+ array(
+ 'href' => 'https://phurl.io/u/reindex',
+ 'target' => '_blank',
+ ),
+ 'https://phurl.io/u/reindex'));
+
+ $message[] = pht(
+ 'After rebuilding the index, run this command to clear this setup '.
+ 'warning:');
+
+ $message[] = phutil_tag(
+ 'pre',
+ array(),
+ 'phabricator/ $ ./bin/config done reindex');
+
+ $activity_message = phutil_implode_html("\n\n", $message);
+
+ $this->newIssue('manual.reindex')
+ ->setName($activity_name)
+ ->setSummary($activity_summary)
+ ->setMessage($activity_message);
+ }
+ private function raiseRebuildIdentitiesIssue() {
+ $activity_name = pht('Rebuild Repository Identities');
+ $activity_summary = pht(
+ 'The mapping from VCS users to Phabricator users has changed '.
+ 'and must be rebuilt.');
+
+ $message = array();
+
+ $message[] = pht(
+ 'The way Phabricator attributes VCS activity to Phabricator users '.
+ 'has changed. There is a new indirection layer between the strings '.
+ 'that appear as VCS authors and committers (such as "John Developer '.
+ '<johnd@bigcorp.com>") and the Phabricator user that gets associated '.
+ 'with VCS commits. This is to support situations where users '.
+ 'are incorrectly associated with commits by Phabricator making bad '.
+ 'guesses about the identity of the corresponding Phabricator user. '.
+ 'This also helps with situations where existing repositories are '.
+ 'imported without having created accounts for all the committers to '.
+ 'that repository. Until you rebuild these repository identities, you '.
+ 'are likely to encounter problems with future Phabricator features '.
+ 'which will rely on the existence of these identities.');
+
+ $message[] = pht(
+ 'You can rebuild repository identities while Phabricator is running.');
+
+ $message[] = pht(
+ 'To rebuild identities, run this command:');
+
+ $message[] = phutil_tag(
+ 'pre',
+ array(),
+ (string)csprintf(
+ 'phabricator/ $ ./bin/repository rebuild-identities --all'));
+
+ $message[] = pht(
+ 'You can find more information about this new identity mapping '.
+ 'here: %s',
+ phutil_tag(
+ 'a',
+ array(
+ 'href' => 'https://phurl.io/u/repoIdentities',
+ 'target' => '_blank',
+ ),
+ 'https://phurl.io/u/repoIdentities'));
+
+ $message[] = pht(
+ 'After rebuilding repository identities, run this command to clear '.
+ 'this setup warning:');
+
+ $message[] = phutil_tag(
+ 'pre',
+ array(),
+ 'phabricator/ $ ./bin/config done identities');
+
+ $activity_message = phutil_implode_html("\n\n", $message);
+
+ $this->newIssue('manual.identities')
+ ->setName($activity_name)
+ ->setSummary($activity_summary)
+ ->setMessage($activity_message);
}
}
diff --git a/src/applications/config/storage/PhabricatorConfigManualActivity.php b/src/applications/config/storage/PhabricatorConfigManualActivity.php
--- a/src/applications/config/storage/PhabricatorConfigManualActivity.php
+++ b/src/applications/config/storage/PhabricatorConfigManualActivity.php
@@ -7,6 +7,8 @@
protected $parameters = array();
const TYPE_REINDEX = 'reindex';
+ const TYPE_IDENTITIES = 'identities';
+
protected function getConfiguration() {
return array(

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 13, 9:03 AM (16 h, 49 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7613778
Default Alt Text
D19497.diff (7 KB)

Event Timeline