コード例 #1
0
 private function updateCollectionStats()
 {
     if ($this->dbMetadata) {
         //Do some more cleaning of the data after it haas been indexed in the omoccurrences table
         $occurUtil = new OccurrenceUtilities();
         $this->logOrEcho('Cleaning house...');
         if (!$occurUtil->generalOccurrenceCleaning()) {
             $errorArr = $occurUtil->getErrorArr();
             foreach ($errorArr as $errorStr) {
                 $this->logOrEcho($errorStr, 1);
             }
         }
         $this->logOrEcho('Protecting sensitive species...');
         if (!$occurUtil->protectRareSpecies()) {
             $errorArr = $occurUtil->getErrorArr();
             foreach ($errorArr as $errorStr) {
                 $this->logOrEcho($errorStr, 1);
             }
         }
         $this->logOrEcho('Updating statistics...');
         foreach ($this->collProcessedArr as $collid) {
             if (!$occurUtil->updateCollectionStats($collid)) {
                 $errorArr = $occurUtil->getErrorArr();
                 foreach ($errorArr as $errorStr) {
                     $this->logOrEcho($errorStr, 1);
                 }
             }
         }
         $this->logOrEcho('Populating global unique identifiers (GUIDs) for all records...');
         $uuidManager = new UuidFactory();
         $uuidManager->setSilent(1);
         $uuidManager->populateGuids();
     }
     $this->logOrEcho("Stats update completed");
 }
コード例 #2
0
 public function updateStatistics($verbose = false)
 {
     $occurUtil = new OccurrenceUtilities();
     if ($verbose) {
         echo '<ul>';
         $occurUtil->setVerbose(true);
         echo '<li>General cleaning in preparation for collecting stats...</li>';
         flush();
         ob_flush();
     }
     $occurUtil->generalOccurrenceCleaning();
     if ($verbose) {
         echo '<li>Updating statistics...</li>';
         flush();
         ob_flush();
     }
     $occurUtil->updateCollectionStats($this->collid, true);
     if ($verbose) {
         echo '<li>Finished updating collection statistics</li>';
         flush();
         ob_flush();
     }
 }
コード例 #3
0
 private function cleanHouse($collList)
 {
     $this->logOrEcho('Updating collection statistics...', 1);
     $occurUtil = new OccurrenceUtilities();
     $this->logOrEcho('General cleaning...', 2);
     $collString = implode(',', $collList);
     if (!$occurUtil->generalOccurrenceCleaning($collString)) {
         $errorArr = $occurUtil->getErrorArr();
         foreach ($errorArr as $errorStr) {
             $this->logOrEcho($errorStr, 1);
         }
     }
     $this->logOrEcho('Protecting sensitive species...', 2);
     if (!$occurUtil->protectRareSpecies()) {
         $errorArr = $occurUtil->getErrorArr();
         foreach ($errorArr as $errorStr) {
             $this->logOrEcho($errorStr, 1);
         }
     }
     if ($collList) {
         $this->logOrEcho('Updating collection statistics...', 2);
         foreach ($collList as $collid) {
             if (!$occurUtil->updateCollectionStats($collid)) {
                 $errorArr = $occurUtil->getErrorArr();
                 foreach ($errorArr as $errorStr) {
                     $this->logOrEcho($errorStr, 1);
                 }
             }
         }
     }
     $this->logOrEcho('Populating global unique identifiers (GUIDs) for all records...', 2);
     $uuidManager = new UuidFactory();
     $uuidManager->setSilent(1);
     $uuidManager->populateGuids();
 }
コード例 #4
0
 protected function finalCleanup()
 {
     $this->outputMsg('<li>Transfer process complete</li>');
     //Update uploaddate
     $sql = 'UPDATE omcollectionstats SET uploaddate = CURDATE() WHERE collid = ' . $this->collId;
     $this->conn->query($sql);
     //Remove records from occurrence temp table (uploadspectemp)
     $sql = 'DELETE FROM uploadspectemp WHERE (collid = ' . $this->collId . ') OR (initialtimestamp < DATE_SUB(CURDATE(),INTERVAL 3 DAY))';
     $this->conn->query($sql);
     //Optimize table to reset indexes
     $this->conn->query('OPTIMIZE TABLE uploadspectemp');
     //Remove records from determination temp table (uploaddetermtemp)
     $sql = 'DELETE FROM uploaddetermtemp WHERE (collid = ' . $this->collId . ') OR (initialtimestamp < DATE_SUB(CURDATE(),INTERVAL 3 DAY))';
     $this->conn->query($sql);
     //Optimize table to reset indexes
     $this->conn->query('OPTIMIZE TABLE uploaddetermtemp');
     //Remove records from image temp table (uploadimagetemp)
     $sql = 'DELETE FROM uploadimagetemp WHERE (collid = ' . $this->collId . ') OR (initialtimestamp < DATE_SUB(CURDATE(),INTERVAL 3 DAY))';
     $this->conn->query($sql);
     //Optimize table to reset indexes
     $this->conn->query('OPTIMIZE TABLE uploadimagetemp');
     //Do some more cleaning of the data after it haas been indexed in the omoccurrences table
     $occurUtil = new OccurrenceUtilities();
     $this->outputMsg('<li>Cleaning house</li>');
     ob_flush();
     flush();
     if (!$occurUtil->generalOccurrenceCleaning($this->collId)) {
         $errorArr = $occurUtil->getErrorArr();
         foreach ($errorArr as $errorStr) {
             echo '<li style="margin-left:20px;">' . $errorStr . '</li>';
         }
     }
     $this->outputMsg('<li style="margin-left:10px;">Protecting sensitive species...</li>');
     ob_flush();
     flush();
     if (!$occurUtil->protectRareSpecies($this->collId)) {
         $errorArr = $occurUtil->getErrorArr();
         foreach ($errorArr as $errorStr) {
             echo '<li style="margin-left:20px;">' . $errorStr . '</li>';
         }
     }
     $this->outputMsg('<li style="margin-left:10px;">Updating statistics...</li>');
     ob_flush();
     flush();
     if (!$occurUtil->updateCollectionStats($this->collId)) {
         $errorArr = $occurUtil->getErrorArr();
         foreach ($errorArr as $errorStr) {
             echo '<li style="margin-left:20px;">' . $errorStr . '</li>';
         }
     }
     /*
     $this->outputMsg('<li style="margin-left:10px;">Searching for duplicate Catalog Numbers... ');
     ob_flush();
     flush();
     $sql = 'SELECT catalognumber FROM omoccurrences GROUP BY catalognumber, collid '.
     	'HAVING Count(*)>1 AND collid = '.$this->collId.' AND catalognumber IS NOT NULL';
     $rs = $this->conn->query($sql);
     if($rs->num_rows){
     	$this->outputMsg('<span style="color:red;">Duplicate Catalog Numbers exist</span></li>');
     	$this->outputMsg('<li style="margin-left:10px;">');
     	$this->outputMsg('Open <a href="../cleaning/occurrencecleaner.php?collid='.$this->collId.'&action=listdupscatalog" target="_blank">Occurrence Cleaner</a> to resolve this issue');
     	$this->outputMsg('</li>');
     }
     else{
     	$this->outputMsg('All good!</li>');
     }
     $rs->free();
     */
     $this->outputMsg('<li style="margin-left:10px;">Populating global unique identifiers (GUIDs) for all records... </li>');
     ob_flush();
     flush();
     $uuidManager = new UuidFactory();
     $uuidManager->setSilent(1);
     $uuidManager->populateGuids();
     if ($this->imageTransferCount) {
         $this->outputMsg('<li style="margin-left:10px;">Building thumbnails for ' . $this->imageTransferCount . ' specimen images... </li>');
         ob_flush();
         flush();
         //Clean and populate null basic url and thumbnailurl fields
         $imgManager = new ImageCleaner();
         $imgManager->setVerbose(0);
         $imgManager->buildThumbnailImages($this->collId);
     }
 }