diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index ad1b08d1e6..3924ee8e35 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -626,6 +626,7 @@ phutil_register_library_map(array( 'LiskIsolationTestDAO' => 'infrastructure/storage/lisk/__tests__/LiskIsolationTestDAO.php', 'LiskIsolationTestDAOException' => 'infrastructure/storage/lisk/__tests__/LiskIsolationTestDAOException.php', 'LiskMigrationIterator' => 'infrastructure/storage/lisk/LiskMigrationIterator.php', + 'LiskRawMigrationIterator' => 'infrastructure/storage/lisk/LiskRawMigrationIterator.php', 'ManiphestAction' => 'applications/maniphest/constants/ManiphestAction.php', 'ManiphestAuxiliaryFieldDefaultSpecification' => 'applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldDefaultSpecification.php', 'ManiphestAuxiliaryFieldSpecification' => 'applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldSpecification.php', @@ -2476,6 +2477,7 @@ phutil_register_library_map(array( 'LiskIsolationTestDAO' => 'LiskDAO', 'LiskIsolationTestDAOException' => 'Exception', 'LiskMigrationIterator' => 'PhutilBufferedIterator', + 'LiskRawMigrationIterator' => 'PhutilBufferedIterator', 'ManiphestAction' => 'ManiphestConstants', 'ManiphestAuxiliaryFieldDefaultSpecification' => 'ManiphestAuxiliaryFieldSpecification', 'ManiphestAuxiliaryFieldSpecification' => 'PhabricatorMarkupInterface', diff --git a/src/infrastructure/storage/lisk/LiskRawMigrationIterator.php b/src/infrastructure/storage/lisk/LiskRawMigrationIterator.php new file mode 100644 index 0000000000..a7edbd7f91 --- /dev/null +++ b/src/infrastructure/storage/lisk/LiskRawMigrationIterator.php @@ -0,0 +1,39 @@ +conn = $conn; + $this->table = $table; + } + + protected function didRewind() { + $this->cursor = 0; + } + + public function key() { + return idx($this->current(), $this->column); + } + + protected function loadPage() { + $page = queryfx_all( + $this->conn, + 'SELECT * FROM %T WHERE %C > %d ORDER BY ID ASC LIMIT %d', + $this->table, + $this->column, + $this->cursor, + $this->getPageSize()); + + if ($page) { + $this->cursor = idx(last($page), $this->column); + } + + return $page; + } + +}