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

Add LiskRawMigrationIterator

Summary: Ref T2222. I need this to migrate the Differential comment tables, because they are large. We have the similar `LiskMigrationIterator` already, but it won't work here because I intend to destroy the original objects after migrating them.

Test Plan:
Wrote a script to iterate over the `differential_comment` table, got reasonable output:

{P869}

Reviewers: btrahan

Reviewed By: btrahan

CC: chad, aran

Maniphest Tasks: T2222

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

+41
+2
src/__phutil_library_map__.php
··· 626 626 'LiskIsolationTestDAO' => 'infrastructure/storage/lisk/__tests__/LiskIsolationTestDAO.php', 627 627 'LiskIsolationTestDAOException' => 'infrastructure/storage/lisk/__tests__/LiskIsolationTestDAOException.php', 628 628 'LiskMigrationIterator' => 'infrastructure/storage/lisk/LiskMigrationIterator.php', 629 + 'LiskRawMigrationIterator' => 'infrastructure/storage/lisk/LiskRawMigrationIterator.php', 629 630 'ManiphestAction' => 'applications/maniphest/constants/ManiphestAction.php', 630 631 'ManiphestAuxiliaryFieldDefaultSpecification' => 'applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldDefaultSpecification.php', 631 632 'ManiphestAuxiliaryFieldSpecification' => 'applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldSpecification.php', ··· 2476 2477 'LiskIsolationTestDAO' => 'LiskDAO', 2477 2478 'LiskIsolationTestDAOException' => 'Exception', 2478 2479 'LiskMigrationIterator' => 'PhutilBufferedIterator', 2480 + 'LiskRawMigrationIterator' => 'PhutilBufferedIterator', 2479 2481 'ManiphestAction' => 'ManiphestConstants', 2480 2482 'ManiphestAuxiliaryFieldDefaultSpecification' => 'ManiphestAuxiliaryFieldSpecification', 2481 2483 'ManiphestAuxiliaryFieldSpecification' => 'PhabricatorMarkupInterface',
+39
src/infrastructure/storage/lisk/LiskRawMigrationIterator.php
··· 1 + <?php 2 + 3 + final class LiskRawMigrationIterator extends PhutilBufferedIterator { 4 + 5 + private $conn; 6 + private $table; 7 + private $cursor; 8 + private $column = 'id'; 9 + 10 + public function __construct(AphrontDatabaseConnection $conn, $table) { 11 + $this->conn = $conn; 12 + $this->table = $table; 13 + } 14 + 15 + protected function didRewind() { 16 + $this->cursor = 0; 17 + } 18 + 19 + public function key() { 20 + return idx($this->current(), $this->column); 21 + } 22 + 23 + protected function loadPage() { 24 + $page = queryfx_all( 25 + $this->conn, 26 + 'SELECT * FROM %T WHERE %C > %d ORDER BY ID ASC LIMIT %d', 27 + $this->table, 28 + $this->column, 29 + $this->cursor, 30 + $this->getPageSize()); 31 + 32 + if ($page) { 33 + $this->cursor = idx(last($page), $this->column); 34 + } 35 + 36 + return $page; 37 + } 38 + 39 + }