/** * Final method called at the end of the handler process. * @return void */ public function cleanup() { $duration = microtime( true ) - $this->startDate; XMLImportMonitor::pushStatistic( 'file_completed', $this->fileHandler->dataSourcesCompleted ); XMLImportMonitor::pushStatistic( 'file_in_error', ( $this->fileHandler->dataSourcesCount - $this->fileHandler->dataSourcesCompleted ) ); XMLImportMonitor::pushStatistic( 'process_duration', $duration ); XMLImportMonitor::pushStatistic( 'end_date', time() ); $this->sendAlert(); unset( $this->xmlParser, $this->fileHandler->dataSources ); }
/** * @param $list */ function processList( $list ) { $rootImport = $this->importINI->variable( 'XMLImportSettings', 'RootImport' ); $publisherFolder = array(); $files = array(); foreach ( array_keys( $list ) as $key ) { if ( self::$modeUAT ) { $archiveFile = "$rootImport/{$this->rootImportFolder}/{$list[$key]['publisher']}/archived/{$list[$key]['file']}"; $errorFile = "$rootImport/{$this->rootImportFolder}/{$list[$key]['publisher']}/errors/{$list[$key]['file']}"; if ( file_exists( $archiveFile ) || file_exists( $errorFile ) ) { unset($list[$key]); continue; } } $publisherFolder[$key] = $list[$key]['publisher']; $files[$key] = $list[$key]['file']; } array_multisort( $publisherFolder, SORT_ASC, $files, SORT_ASC, $list ); unset( $publisherFolder, $files ); $invalidCount = 0; foreach ( $list as $row ) { $publisherId = $this->getPublisherIdFromFolderName($row['publisher']); if ( !$publisherId ) { XMLImportMonitor::log( 'Publisher doesn\'t exists : {' . $row['publisher'] . '}', 'warning' ); $invalidCount++; } else $this->dataSources[] = $row; } XMLImportMonitor::pushStatistic( 'invalid_publisher', $invalidCount ); }