Page MenuHomePhabricator
Paste P2284

collision check script
ActivePublic

Authored by Mattflaschen-WMF on Nov 5 2015, 11:31 PM.
Referenced Files
F2920386: collision check script
Nov 5 2015, 11:31 PM
Subscribers
None
<?php
require_once ( getenv( 'MW_INSTALL_PATH' ) !== false
? getenv( 'MW_INSTALL_PATH' ) . '/maintenance/Maintenance.php'
: dirname( __FILE__ ) . '/../../../maintenance/Maintenance.php' );
class CollisionScript extends Maintenance {
public function execute() {
$timestamp = wfTimestamp();
$usedUUIDs = array();
$i = 0;
do {
$uuid = Flow\Import\HistoricalUIDGenerator::historicalTimestampedUID88( $timestamp );
$duplicate = isset( $usedUUIDs[$uuid] );
$usedUUIDs[$uuid] = true;
$i++;
if ( $i % 1000 === 0 ) {
echo "$i UIDs generated.\n";
}
} while( !$duplicate );
echo "Duplicate found after $i iterations\n";
}
}
$maintClass = 'CollisionScript';
require_once RUN_MAINTENANCE_IF_MAIN;

Event Timeline

Mattflaschen-WMF changed the title of this paste from untitled to collision check script.
Mattflaschen-WMF updated the paste's language from autodetect to php.