Code Duplication    Length = 12-12 lines in 2 locations

includes/jobqueue/jobs/HTMLCacheUpdateJob.php 1 location

@@ 120-131 (lines=12) @@
117
		$ticket = $factory->getEmptyTransactionTicket( __METHOD__ );
118
		// Update page_touched (skipping pages already touched since the root job).
119
		// Check $wgUpdateRowsPerQuery for sanity; batch jobs are sized by that already.
120
		foreach ( array_chunk( $pageIds, $wgUpdateRowsPerQuery ) as $batch ) {
121
			$factory->commitAndWaitForReplication( __METHOD__, $ticket );
122
123
			$dbw->update( 'page',
124
				[ 'page_touched' => $dbw->timestamp( $touchTimestamp ) ],
125
				[ 'page_id' => $batch,
126
					// don't invalidated pages that were already invalidated
127
					"page_touched < " . $dbw->addQuotes( $dbw->timestamp( $touchTimestamp ) )
128
				],
129
				__METHOD__
130
			);
131
		}
132
		// Get the list of affected pages (races only mean something else did the purge)
133
		$titleArray = TitleArray::newFromResult( $dbw->select(
134
			'page',

includes/jobqueue/utils/PurgeJobUtils.php 1 location

@@ 64-75 (lines=12) @@
61
62
				$batchSize = $services->getMainConfig()->get( 'UpdateRowsPerQuery' );
63
				$ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
64
				foreach ( array_chunk( $ids, $batchSize ) as $idBatch ) {
65
					$dbw->update(
66
						'page',
67
						[ 'page_touched' => $now ],
68
						[
69
							'page_id' => $idBatch,
70
							'page_touched < ' . $dbw->addQuotes( $now ) // handle races
71
						],
72
						__METHOD__
73
					);
74
					$lbFactory->commitAndWaitForReplication( __METHOD__, $ticket );
75
				}
76
			},
77
			__METHOD__
78
		);