Code Duplication    Length = 13-14 lines in 2 locations

includes/api/ApiQueryCategoryMembers.php 1 location

@@ 115-127 (lines=13) @@
112
			// Include in ORDER BY for uniqueness
113
			$this->addWhereRange( 'cl_from', $dir, null, null );
114
115
			if ( !is_null( $params['continue'] ) ) {
116
				$cont = explode( '|', $params['continue'] );
117
				$this->dieContinueUsageIf( count( $cont ) != 2 );
118
				$op = ( $dir === 'newer' ? '>' : '<' );
119
				$db = $this->getDB();
120
				$continueTimestamp = $db->addQuotes( $db->timestamp( $cont[0] ) );
121
				$continueFrom = (int)$cont[1];
122
				$this->dieContinueUsageIf( $continueFrom != $cont[1] );
123
				$this->addWhere( "cl_timestamp $op $continueTimestamp OR " .
124
					"(cl_timestamp = $continueTimestamp AND " .
125
					"cl_from $op= $continueFrom)"
126
				);
127
			}
128
129
			$this->addOption( 'USE INDEX', 'cl_timestamp' );
130
		} else {

includes/api/ApiQueryRecentChanges.php 1 location

@@ 155-168 (lines=14) @@
152
		$this->addTables( 'recentchanges' );
153
		$this->addTimestampWhereRange( 'rc_timestamp', $params['dir'], $params['start'], $params['end'] );
154
155
		if ( !is_null( $params['continue'] ) ) {
156
			$cont = explode( '|', $params['continue'] );
157
			$this->dieContinueUsageIf( count( $cont ) != 2 );
158
			$db = $this->getDB();
159
			$timestamp = $db->addQuotes( $db->timestamp( $cont[0] ) );
160
			$id = intval( $cont[1] );
161
			$this->dieContinueUsageIf( $id != $cont[1] );
162
			$op = $params['dir'] === 'older' ? '<' : '>';
163
			$this->addWhere(
164
				"rc_timestamp $op $timestamp OR " .
165
				"(rc_timestamp = $timestamp AND " .
166
				"rc_id $op= $id)"
167
			);
168
		}
169
170
		$order = $params['dir'] === 'older' ? 'DESC' : 'ASC';
171
		$this->addOption( 'ORDER BY', [