- if ( isset( self::$tempTables[$key] ) ) {
- if ( array_key_exists( "{$key}_pk", $row ) ) {
- if ( !$db ) {
- throw new InvalidArgumentException(
- "\$row does not contain fields needed for comment $key and getComment(), but "
- . "does have fields for getCommentLegacy()"
- );
- }
- $t = self::$tempTables[$key];
- $id = $row["{$key}_pk"];
- $row2 = $db->selectRow(
- [ $t['table'], 'comment' ],
- [ 'comment_id', 'comment_text', 'comment_data' ],
- [ $t['pk'] => $id ],
- __METHOD__,
- [],
- [ 'comment' => [ 'JOIN', [ "comment_id = {$t['field']}" ] ] ]
+ $tempTableStage = isset( $this->tempTables[$key] )
+ ? $this->tempTables[$key]['stage'] : MIGRATION_NEW;
+ $row2 = null;
+ if ( $tempTableStage > MIGRATION_OLD && array_key_exists( "{$key}_id", $row ) ) {
+ if ( !$db ) {
+ throw new InvalidArgumentException(
+ "\$row does not contain fields needed for comment $key and getComment(), but "
+ . "does have fields for getCommentLegacy()"