@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.

Correct a bug where milestone "spacePHID" columns could become desynchronized

Summary:
Depends on D20041. See PHI1046. If you do this:

- Create a parent project called "Crab" in Space 1.
- Create a milestone called "Left Claw".
- Shift "Crab" to Space 2.
- Create a milestone called "Right Claw".

...you currently end up with "Left Claw" in the wrong `spacePHID` in the database. At the application level it's in the correct space, but when we `WHERE ... AND spacePHID IN (...)` we can incorrectly filter it out.

Test Plan:
- Did the above setup.
- Saved "Crab", saw the space fix itself.
- Put things back in the broken state.
- Ran the migration script, saw things fix themselves again.

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: aeiser, PHID-OPKG-gm6ozazyms6q6i22gyam

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

+29
+18
resources/sql/autopatches/20190129.project.01.spaces.php
··· 1 + <?php 2 + 3 + // See PHI1046. The "spacePHID" column for milestones may have fallen out of 4 + // sync; correct all existing values. 5 + 6 + $table = new PhabricatorProject(); 7 + $conn = $table->establishConnection('w'); 8 + $table_name = $table->getTableName(); 9 + 10 + foreach (new LiskRawMigrationIterator($conn, $table_name) as $project_row) { 11 + queryfx( 12 + $conn, 13 + 'UPDATE %R SET spacePHID = %ns 14 + WHERE parentProjectPHID = %s AND milestoneNumber IS NOT NULL', 15 + $table, 16 + $project_row['spacePHID'], 17 + $project_row['phid']); 18 + }
+11
src/applications/project/editor/PhabricatorProjectTransactionEditor.php
··· 249 249 ->rematerialize($new_parent); 250 250 } 251 251 252 + // See PHI1046. Milestones are always in the Space of their parent project. 253 + // Synchronize the database values to match the application values. 254 + $conn = $object->establishConnection('w'); 255 + queryfx( 256 + $conn, 257 + 'UPDATE %R SET spacePHID = %ns 258 + WHERE parentProjectPHID = %s AND milestoneNumber IS NOT NULL', 259 + $object, 260 + $object->getSpacePHID(), 261 + $object->getPHID()); 262 + 252 263 return parent::applyFinalEffects($object, $xactions); 253 264 } 254 265