public function __construct()
 {
     parent::__construct();
     $this->delete_request_repository = new SapphireDupeMemberDeleteRequestRepository();
     $this->merge_request_repository = new SapphireDupeMemberMergeRequestRepository();
     $this->manager = new DupesMembersManager(new SapphireDupesMemberRepository(), new DupeMemberMergeRequestFactory(), new DupeMemberDeleteRequestFactory(), $this->merge_request_repository, $this->delete_request_repository, new SapphireDeletedDupeMemberRepository(), new DeletedDupeMemberFactory(), new SapphireCandidateNominationRepository(), new SapphireNotMyAccountActionRepository(), new NotMyAccountActionFactory(), SapphireTransactionManager::getInstance(), SapphireBulkQueryRegistry::getInstance());
 }
 /**
  * @return IBulkQueryRegistry
  */
 public static function getInstance()
 {
     if (!is_object(self::$instance)) {
         self::$instance = new SapphireBulkQueryRegistry();
     }
     return self::$instance;
 }
 /**
  * @return void
  */
 public function run()
 {
     try {
         $batch_size = 15;
         if (isset($_GET['batch_size'])) {
             $batch_size = intval(trim(Convert::raw2sql($_GET['batch_size'])));
         }
         $manager = new DupesMembersManager(new SapphireDupesMemberRepository(), new DupeMemberMergeRequestFactory(), new DupeMemberDeleteRequestFactory(), new SapphireDupeMemberMergeRequestRepository(), new SapphireDupeMemberDeleteRequestRepository(), new SapphireDeletedDupeMemberRepository(), new DeletedDupeMemberFactory(), new SapphireCandidateNominationRepository(), new SapphireNotMyAccountActionRepository(), new NotMyAccountActionFactory(), SapphireTransactionManager::getInstance(), SapphireBulkQueryRegistry::getInstance());
         $manager->purgeActionRequests($batch_size);
         return 'OK';
     } catch (Exception $ex) {
         SS_Log::log($ex, SS_Log::ERR);
         echo $ex->getMessage();
     }
 }
 private function commit()
 {
     if ($this->transactions == 1) {
         $queries = SapphireBulkQueryRegistry::getInstance()->getPreQueries();
         foreach ($queries as $q) {
             foreach ($q->toSQL() as $sql) {
                 DB::query($sql);
             }
         }
         UnitOfWork::getInstance()->commit();
         $queries = SapphireBulkQueryRegistry::getInstance()->getPostQueries();
         foreach ($queries as $q) {
             foreach ($q->toSQL() as $sql) {
                 DB::query($sql);
             }
         }
         DB::getConn()->transactionEnd();
     }
     --$this->transactions;
 }