Merge branch 'master' into blender-tweaks

This commit is contained in:
2019-04-04 11:21:47 +02:00
628 changed files with 19135 additions and 6476 deletions

View File

@@ -1,11 +1,3 @@
<?php
$table = new PhabricatorOwnersPackage();
foreach (new LiskMigrationIterator($table) as $package) {
PhabricatorSearchWorker::queueDocumentForIndexing(
$package->getPHID(),
array(
'force' => true,
));
}
// This was an old reindexing migration that has been obsoleted. See T13253.

View File

@@ -1,11 +1,3 @@
<?php
$table = new AlmanacDevice();
foreach (new LiskMigrationIterator($table) as $device) {
PhabricatorSearchWorker::queueDocumentForIndexing(
$device->getPHID(),
array(
'force' => true,
));
}
// This was an old reindexing migration that has been obsoleted. See T13253.

View File

@@ -1,11 +1,3 @@
<?php
$table = new AlmanacService();
foreach (new LiskMigrationIterator($table) as $service) {
PhabricatorSearchWorker::queueDocumentForIndexing(
$service->getPHID(),
array(
'force' => true,
));
}
// This was an old reindexing migration that has been obsoleted. See T13253.

View File

@@ -1,11 +1,3 @@
<?php
$table = new AlmanacNetwork();
foreach (new LiskMigrationIterator($table) as $network) {
PhabricatorSearchWorker::queueDocumentForIndexing(
$network->getPHID(),
array(
'force' => true,
));
}
// This was an old reindexing migration that has been obsoleted. See T13253.

View File

@@ -1,11 +1,3 @@
<?php
$table = new HarbormasterBuildPlan();
foreach (new LiskMigrationIterator($table) as $plan) {
PhabricatorSearchWorker::queueDocumentForIndexing(
$plan->getPHID(),
array(
'force' => true,
));
}
// This was an old reindexing migration that has been obsoleted. See T13253.

View File

@@ -1,11 +1,3 @@
<?php
$table = new DrydockBlueprint();
foreach (new LiskMigrationIterator($table) as $blueprint) {
PhabricatorSearchWorker::queueDocumentForIndexing(
$blueprint->getPHID(),
array(
'force' => true,
));
}
// This was an old reindexing migration that has been obsoleted. See T13253.

View File

@@ -1,11 +1,3 @@
<?php
$table = new NuanceSource();
foreach (new LiskMigrationIterator($table) as $source) {
PhabricatorSearchWorker::queueDocumentForIndexing(
$source->getPHID(),
array(
'force' => true,
));
}
// This was an old reindexing migration that has been obsoleted. See T13253.

View File

@@ -1,11 +1,3 @@
<?php
$table = new PhabricatorBadgesBadge();
foreach (new LiskMigrationIterator($table) as $badge) {
PhabricatorSearchWorker::queueDocumentForIndexing(
$badge->getPHID(),
array(
'force' => true,
));
}
// This was an old reindexing migration that has been obsoleted. See T13253.

View File

@@ -1,11 +1,3 @@
<?php
$table = new PhabricatorPhurlURL();
foreach (new LiskMigrationIterator($table) as $url) {
PhabricatorSearchWorker::queueDocumentForIndexing(
$url->getPHID(),
array(
'force' => true,
));
}
// This was an old reindexing migration that has been obsoleted. See T13253.

View File

@@ -1,11 +1,3 @@
<?php
$table = new ConpherenceThread();
foreach (new LiskMigrationIterator($table) as $thread) {
PhabricatorSearchWorker::queueDocumentForIndexing(
$thread->getPHID(),
array(
'force' => true,
));
}
// This was an old reindexing migration that has been obsoleted. See T13253.

View File

@@ -1,21 +1,3 @@
<?php
$table_db = new PhabricatorDashboard();
foreach (new LiskMigrationIterator($table_db) as $dashboard) {
PhabricatorSearchWorker::queueDocumentForIndexing(
$dashboard->getPHID(),
array(
'force' => true,
));
}
$table_dbp = new PhabricatorDashboardPanel();
foreach (new LiskMigrationIterator($table_dbp) as $panel) {
PhabricatorSearchWorker::queueDocumentForIndexing(
$panel->getPHID(),
array(
'force' => true,
));
}
// This was an old reindexing migration that has been obsoleted. See T13253.

View File

@@ -1,11 +1,3 @@
<?php
$table = new PhabricatorProject();
foreach (new LiskMigrationIterator($table) as $project) {
PhabricatorSearchWorker::queueDocumentForIndexing(
$project->getPHID(),
array(
'force' => true,
));
}
// This was an old reindexing migration that has been obsoleted. See T13253.

View File

@@ -1,11 +1,3 @@
<?php
$table = new PonderQuestion();
foreach (new LiskMigrationIterator($table) as $question) {
PhabricatorSearchWorker::queueDocumentForIndexing(
$question->getPHID(),
array(
'force' => true,
));
}
// This was an old reindexing migration that has been obsoleted. See T13253.

View File

@@ -0,0 +1,2 @@
UPDATE {$NAMESPACE}_legalpad.legalpad_documentsignature
SET signerPHID = NULL WHERE signerPHID LIKE 'PHID-XUSR-%';

View File

@@ -0,0 +1,2 @@
DELETE FROM {$NAMESPACE}_user.user_externalaccount
WHERE accountType = 'email';

View File

@@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_user.user_externalaccount
ADD providerConfigPHID VARBINARY(64) NOT NULL;

View File

@@ -0,0 +1,36 @@
<?php
$account_table = new PhabricatorExternalAccount();
$account_conn = $account_table->establishConnection('w');
$table_name = $account_table->getTableName();
$config_table = new PhabricatorAuthProviderConfig();
$config_conn = $config_table->establishConnection('w');
foreach (new LiskRawMigrationIterator($account_conn, $table_name) as $row) {
if (strlen($row['providerConfigPHID'])) {
continue;
}
$config_row = queryfx_one(
$config_conn,
'SELECT phid
FROM %R
WHERE providerType = %s AND providerDomain = %s
LIMIT 1',
$config_table,
$row['accountType'],
$row['accountDomain']);
if (!$config_row) {
continue;
}
queryfx(
$account_conn,
'UPDATE %R
SET providerConfigPHID = %s
WHERE id = %d',
$account_table,
$config_row['phid'],
$row['id']);
}

View File

@@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_owners.owners_package
ADD auditingState VARCHAR(32) NOT NULL COLLATE {$COLLATE_TEXT};

View File

@@ -0,0 +1,2 @@
UPDATE {$NAMESPACE}_owners.owners_package
SET auditingState = IF(auditingEnabled = 0, 'none', 'audit');

View File

@@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_owners.owners_package
DROP auditingEnabled;

View File

@@ -0,0 +1,41 @@
<?php
$table = new PhabricatorOwnersPackageTransaction();
$conn = $table->establishConnection('w');
$iterator = new LiskRawMigrationIterator($conn, $table->getTableName());
// Migrate "Auditing State" transactions for Owners Packages from old values
// (which were "0" or "1", as JSON integer literals, without quotes) to new
// values (which are JSON strings, with quotes).
foreach ($iterator as $row) {
if ($row['transactionType'] !== 'owners.auditing') {
continue;
}
$old_value = (int)$row['oldValue'];
$new_value = (int)$row['newValue'];
if (!$old_value) {
$old_value = 'none';
} else {
$old_value = 'audit';
}
if (!$new_value) {
$new_value = 'none';
} else {
$new_value = 'audit';
}
$old_value = phutil_json_encode($old_value);
$new_value = phutil_json_encode($new_value);
queryfx(
$conn,
'UPDATE %R SET oldValue = %s, newValue = %s WHERE id = %d',
$table,
$old_value,
$new_value,
$row['id']);
}

View File

@@ -0,0 +1,21 @@
<?php
// See T6615. We're about to change the nullability on the "dataID" column,
// but it may have a UNIQUE KEY on it. Make sure we get rid of this key first
// so we don't run into trouble.
// There's no "IF EXISTS" modifier for "ALTER TABLE" so run this as a PHP patch
// instead of an SQL patch.
$table = new PhabricatorWorkerActiveTask();
$conn = $table->establishConnection('w');
try {
queryfx(
$conn,
'ALTER TABLE %R DROP KEY %T',
$table,
'dataID');
} catch (AphrontQueryException $ex) {
// Ignore.
}

View File

@@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_worker.worker_activetask
CHANGE dataID dataID INT UNSIGNED NOT NULL;

View File

@@ -0,0 +1,6 @@
CREATE TABLE {$NAMESPACE}_harbormaster.harbormaster_string (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
stringIndex BINARY(12) NOT NULL,
stringValue LONGTEXT NOT NULL,
UNIQUE KEY `key_string` (stringIndex)
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};

View File

@@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_harbormaster.harbormaster_buildunitmessage
ADD nameIndex BINARY(12) NOT NULL;

View File

@@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_worker.worker_archivetask
ADD archivedEpoch INT UNSIGNED NULL;

View File

@@ -0,0 +1,3 @@
ALTER TABLE {$NAMESPACE}_worker.worker_activetask
ADD dateCreated int unsigned NOT NULL,
ADD dateModified int unsigned NOT NULL;

View File

@@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_harbormaster.harbormaster_buildplan
ADD properties LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT};

View File

@@ -0,0 +1,2 @@
UPDATE {$NAMESPACE}_harbormaster.harbormaster_buildplan
SET properties = '{}' WHERE properties = '';

View File

@@ -0,0 +1 @@
DROP TABLE {$NAMESPACE}_herald.herald_ruletransaction_comment;

View File

@@ -0,0 +1,9 @@
CREATE TABLE {$NAMESPACE}_project.project_trigger (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
phid VARBINARY(64) NOT NULL,
name VARCHAR(255) NOT NULL COLLATE {$COLLATE_TEXT},
editPolicy VARBINARY(64) NOT NULL,
ruleset LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT},
dateCreated INT UNSIGNED NOT NULL,
dateModified INT UNSIGNED NOT NULL
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};

View File

@@ -0,0 +1,19 @@
CREATE TABLE {$NAMESPACE}_project.project_triggertransaction (
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) NOT NULL,
oldValue LONGTEXT NOT NULL,
newValue LONGTEXT NOT NULL,
contentSource LONGTEXT NOT NULL,
metadata LONGTEXT NOT NULL,
dateCreated INT UNSIGNED NOT NULL,
dateModified INT UNSIGNED NOT NULL,
UNIQUE KEY `key_phid` (`phid`),
KEY `key_object` (`objectPHID`)
) ENGINE=InnoDB DEFAULT CHARSET={$CHARSET} COLLATE {$COLLATE_TEXT};

View File

@@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_project.project_column
ADD triggerPHID VARBINARY(64);

View File

@@ -0,0 +1,8 @@
CREATE TABLE {$NAMESPACE}_project.project_triggerusage (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
triggerPHID VARBINARY(64) NOT NULL,
examplePHID VARBINARY(64),
columnCount INT UNSIGNED NOT NULL,
activeColumnCount INT UNSIGNED NOT NULL,
UNIQUE KEY `key_trigger` (triggerPHID)
) ENGINE=InnoDB DEFAULT CHARSET={$CHARSET} COLLATE {$COLLATE_TEXT};

View File

@@ -0,0 +1,11 @@
CREATE TABLE {$NAMESPACE}_dashboard.dashboard_portal (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
phid VARBINARY(64) NOT NULL,
name VARCHAR(255) NOT NULL COLLATE {$COLLATE_TEXT},
status VARCHAR(32) NOT NULL COLLATE {$COLLATE_TEXT},
viewPolicy VARBINARY(64) NOT NULL,
editPolicy VARBINARY(64) NOT NULL,
properties LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT},
dateCreated INT UNSIGNED NOT NULL,
dateModified INT UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET={$CHARSET} COLLATE {$COLLATE_TEXT};

View File

@@ -0,0 +1,19 @@
CREATE TABLE {$NAMESPACE}_dashboard.dashboard_portaltransaction (
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) NOT NULL,
oldValue LONGTEXT NOT NULL,
newValue LONGTEXT NOT NULL,
contentSource LONGTEXT NOT NULL,
metadata LONGTEXT NOT NULL,
dateCreated INT UNSIGNED NOT NULL,
dateModified INT UNSIGNED NOT NULL,
UNIQUE KEY `key_phid` (`phid`),
KEY `key_object` (`objectPHID`)
) ENGINE=InnoDB DEFAULT CHARSET={$CHARSET} COLLATE {$COLLATE_TEXT};

View File

@@ -1,2 +1,2 @@
ALTER IGNORE TABLE `{$NAMESPACE}_file`.`file_imagemacro`
ADD UNIQUE `name` (`name`);
ALTER TABLE `{$NAMESPACE}_file`.`file_imagemacro`
ADD UNIQUE KEY `name` (`name`);

View File

@@ -1,66 +1,14 @@
<?php
// NOTE: We aren't using PhabricatorUserOAuthInfo anywhere here because it is
// getting nuked in a future diff.
$table = new PhabricatorUser();
$conn = $table->establishConnection('w');
$table_name = 'user_oauthinfo';
$conn_w = $table->establishConnection('w');
$xaccount = new PhabricatorExternalAccount();
echo pht('Migrating OAuth to %s...', 'ExternalAccount')."\n";
$domain_map = array(
'disqus' => 'disqus.com',
'facebook' => 'facebook.com',
'github' => 'github.com',
'google' => 'google.com',
);
try {
$phabricator_oauth_uri = new PhutilURI(
PhabricatorEnv::getEnvConfig('phabricator.oauth-uri'));
$domain_map['phabricator'] = $phabricator_oauth_uri->getDomain();
} catch (Exception $ex) {
// Ignore; this likely indicates that we have removed `phabricator.oauth-uri`
// in some future diff.
foreach (new LiskRawMigrationIterator($conn, $table_name) as $row) {
throw new Exception(
pht(
'Your Phabricator install has ancient OAuth account data and is '.
'too old to upgrade directly to a modern version of Phabricator. '.
'Upgrade to a version released between June 2013 and February 2019 '.
'first, then upgrade to a modern version.'));
}
$rows = queryfx_all(
$conn_w,
'SELECT * FROM user_oauthinfo');
foreach ($rows as $row) {
echo pht('Migrating row ID #%d.', $row['id'])."\n";
$user = id(new PhabricatorUser())->loadOneWhere(
'id = %d',
$row['userID']);
if (!$user) {
echo pht('Bad user ID!')."\n";
continue;
}
$domain = idx($domain_map, $row['oauthProvider']);
if (empty($domain)) {
echo pht('Unknown OAuth provider!')."\n";
continue;
}
$xaccount = id(new PhabricatorExternalAccount())
->setUserPHID($user->getPHID())
->setAccountType($row['oauthProvider'])
->setAccountDomain($domain)
->setAccountID($row['oauthUID'])
->setAccountURI($row['accountURI'])
->setUsername($row['accountName'])
->setDateCreated($row['dateCreated']);
try {
$xaccount->save();
} catch (Exception $ex) {
phlog($ex);
}
}
echo pht('Done.')."\n";

View File

@@ -1,41 +1,14 @@
<?php
// NOTE: We aren't using PhabricatorUserLDAPInfo anywhere here because it is
// being nuked by this change
$table = new PhabricatorUser();
$conn = $table->establishConnection('w');
$table_name = 'user_ldapinfo';
$conn_w = $table->establishConnection('w');
$xaccount = new PhabricatorExternalAccount();
echo pht('Migrating LDAP to %s...', 'ExternalAccount')."\n";
$rows = queryfx_all($conn_w, 'SELECT * FROM %T', $table_name);
foreach ($rows as $row) {
echo pht('Migrating row ID #%d.', $row['id'])."\n";
$user = id(new PhabricatorUser())->loadOneWhere(
'id = %d',
$row['userID']);
if (!$user) {
echo pht('Bad user ID!')."\n";
continue;
}
$xaccount = id(new PhabricatorExternalAccount())
->setUserPHID($user->getPHID())
->setAccountType('ldap')
->setAccountDomain('self')
->setAccountID($row['ldapUsername'])
->setUsername($row['ldapUsername'])
->setDateCreated($row['dateCreated']);
try {
$xaccount->save();
} catch (Exception $ex) {
phlog($ex);
}
foreach (new LiskRawMigrationIterator($conn, $table_name) as $row) {
throw new Exception(
pht(
'Your Phabricator install has ancient LDAP account data and is '.
'too old to upgrade directly to a modern version of Phabricator. '.
'Upgrade to a version released between June 2013 and February 2019 '.
'first, then upgrade to a modern version.'));
}
echo pht('Done.')."\n";