@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Change migrations to not rely on "arcanist project" classes

Summary: Ref T7604. Change two migrations to query arcanist project information using `queryfx` directly to avoid the need for the `LiskDAO` fields to exist.

Test Plan:
Ran the following commands to verify that things weren't majorly broken:

- `./bin/storage upgrade --apply phabricator:20150503.repositorysymbols.2.php`
- `./bin/storage upgrade --no-quickstart --namespace test`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7604

Differential Revision: https://secure.phabricator.com/D13011

+12 -41
+11 -8
resources/sql/autopatches/20150503.repositorysymbols.2.php
··· 1 1 <?php 2 2 3 - $projects = id(new PhabricatorRepositoryArcanistProjectQuery()) 4 - ->setViewer(PhabricatorUser::getOmnipotentUser()) 5 - ->needRepositories(true) 6 - ->execute(); 7 - 8 3 $table = new PhabricatorRepositorySymbol(); 9 4 $conn_w = $table->establishConnection('w'); 5 + 6 + $projects = queryfx_all( 7 + $conn_w, 8 + 'SELECT * FROM %T', 9 + 'repository_arcanistproject'); 10 10 11 11 foreach ($projects as $project) { 12 - $repo = $project->getRepository(); 12 + $repo = id(new PhabricatorRepositoryQuery()) 13 + ->setViewer(PhabricatorUser::getOmnipotentUser()) 14 + ->withIDs(array($project['repository'])) 15 + ->executeOne(); 13 16 14 17 if (!$repo) { 15 18 continue; 16 19 } 17 20 18 - echo pht("Migrating symbols for '%s' project...\n", $project->getName()); 21 + echo pht("Migrating symbols for '%s' project...\n", $project['name']); 19 22 20 23 queryfx( 21 24 $conn_w, 22 25 'UPDATE %T SET repositoryPHID = %s WHERE arcanistProjectID = %d', 23 26 $table->getTableName(), 24 27 $repo->getPHID(), 25 - $project->getID()); 28 + $project['id']); 26 29 }
+1 -33
resources/sql/patches/131.migraterevisionquery.php
··· 1 1 <?php 2 2 3 - $table = new DifferentialRevision(); 4 - $table->openTransaction(); 5 - $table->beginReadLocking(); 6 - $conn_w = $table->establishConnection('w'); 7 - 8 - echo pht('Migrating revisions')."\n"; 9 - do { 10 - $revisions = $table->loadAllWhere('branchName IS NULL LIMIT 1000'); 11 - 12 - foreach ($revisions as $revision) { 13 - echo '.'; 14 - 15 - $diff = $revision->loadActiveDiff(); 16 - if (!$diff) { 17 - continue; 18 - } 19 - 20 - $branch_name = $diff->getBranch(); 21 - $arc_project_phid = $diff->getArcanistProjectPHID(); 22 - 23 - queryfx( 24 - $conn_w, 25 - 'UPDATE %T SET branchName = %s, arcanistProjectPHID = %s WHERE id = %d', 26 - $table->getTableName(), 27 - $branch_name, 28 - $arc_project_phid, 29 - $revision->getID()); 30 - } 31 - } while (count($revisions) == 1000); 32 - 33 - $table->endReadLocking(); 34 - $table->saveTransaction(); 35 - echo "\n".pht('Done.')."\n"; 3 + // This migration has been dropped, see T7604 for details.