public function __construct(Di $oDi, $aConfig, JobQueueEntity $oJobQueueEntity)
 {
     parent::__construct($oDi);
     $this->sXMLExportPath = $aConfig['path.xml.export'];
     $this->sMwImporterPath = $aConfig['path.mw.importer'];
     $this->sProcess = 'import_mw';
     $this->sPreviousProcess = 'export';
     $this->oJobQueueEntity = $oJobQueueEntity;
     $this->iJobQueueId = $oJobQueueEntity->getId();
 }
 public function __construct(Di $oDi, $aConfig, JobQueueEntity $oJobQueueEntity)
 {
     parent::__construct($oDi);
     $this->sXMLExportPath = $aConfig['path.xml.export'];
     $this->sArchivePath = $aConfig['path.archive'];
     $this->oMapper = $oDi->get('Classes\\Mappers\\JobItemsToMwXml');
     $this->sProcess = 'export';
     $this->sPreviousProcess = 'slice';
     $this->iJobQueueId = $oJobQueueEntity->getId();
 }
 public function __construct(Di $oDi, $aConfig, JobQueueEntity $oJobQueueEntity)
 {
     parent::__construct($oDi);
     $this->oJobQueueEntity = $oJobQueueEntity;
     /* @var MediaWikiDb */
     $this->oMediaWikiDb = $oDi->get('Classes\\Db\\MediaWiki');
     $this->sProcess = 'verify';
     $this->sPreviousProcess = 'import_mw';
     $this->sPagePrefix = $aConfig['page.prefix'];
     $this->iJobQueueId = $oJobQueueEntity->getId();
 }
 public function __construct(Di $oDi, $aConfig, JobQueueEntity $oJobQueueEntity)
 {
     parent::__construct($oDi);
     $this->sProcess = 'archive';
     $this->sPreviousProcess = 'verify';
     $this->sArchivePath = $aConfig['path.archive'];
     $this->sXMLExportPath = $aConfig['path.xml.export'];
     $this->sImageImportPath = $aConfig['path.image.import'];
     $this->sBoxPrefix = $aConfig['box.prefix'];
     $this->sTokenSeperator = $aConfig['tokenseperator'];
     $this->oJobQueueEntity = $oJobQueueEntity;
     $this->iJobQueueId = $oJobQueueEntity->getId();
 }
 public function __construct(Di $oDi, CsvRowToFolioEntity $oCsvRowToFolioEntityMapper, $aConfig, JobQueueEntity $oJobQueueEntity)
 {
     parent::__construct($oDi);
     $this->oCsvRowToFolioEntityMapper = $oCsvRowToFolioEntityMapper;
     $this->sCsvFilePath = $aConfig['path.csv.import'];
     $this->sImageImportPath = $aConfig['path.image.import'];
     $this->sArchivePath = $aConfig['path.archive'];
     $this->sBoxPrefix = $aConfig['box.prefix'];
     $this->sRegexBox = $aConfig['regex.box'];
     $this->sRegexFolio = $aConfig['regex.folio'];
     $this->sRegexItem = $aConfig['regex.item'];
     $this->sBoxLimit = $aConfig['import_box_limit'];
     $this->sTokenSeperator = $aConfig['tokenseperator'];
     $this->iJobQueueId = $oJobQueueEntity->getId();
     $this->oBoxEntity = new BoxEntity();
     $this->oFolioEntity = new FolioEntity();
     $this->oItemEntity = new ItemEntity();
     $this->sProcess = 'import';
     $this->oJobQueueEntity = $oJobQueueEntity;
     $this->iJobQueueId = $oJobQueueEntity->getId();
     $this->sRegex = '/(' . $this->sRegexBox . ')' . $this->sTokenSeperator . '(' . $this->sRegexFolio . ')' . $this->sTokenSeperator . '(' . $this->sRegexItem . ')' . '.jpg' . '/';
 }
 protected function ProcessBoxes(JobQueueEntity $oJobQueueEntity)
 {
     $iJobQueueId = $oJobQueueEntity->getId();
     $rBoxes = $this->GetBoxes($iJobQueueId);
     if ($rBoxes->count() < 1) {
         $this->oLogger->Log('ProcessBoxes(): No boxes could be found with ' . $this->sPreviousProcess . ' completed');
         exit;
     }
     /* @var $oBoxEntity BoxEntity */
     while ($oBoxEntity = $rBoxes->getResource()->fetchObject('Classes\\Entities\\Box')) {
         $iBoxId = $oBoxEntity->getId();
         $this->oBoxDb->UpdateProcessStatus($iBoxId, $this->sProcess, 'started');
         $this->oBoxDb->ClearErrorLog($iBoxId);
         try {
             $this->ProcessFolios($oBoxEntity);
         } catch (ImporterException $oException) {
             $this->HandleError($oException, $oBoxEntity);
         }
         $this->oBoxDb->UpdateProcessStatus($iBoxId, $this->sProcess, 'completed');
     }
 }
 private function IsProcessStillRunning(JobQueueEntity $oJobQueueEntity)
 {
     $sJobId = $oJobQueueEntity->getId();
     $iOldPid = $oJobQueueEntity->getPid();
     if ($iOldPid === null) {
         return false;
     }
     $bIsProcessStillRunning = $this->oFile->PidExists($iOldPid);
     // Exit if it is still running
     if ($bIsProcessStillRunning) {
         $sLogData = $sJobId . ' . is still running with pid ' . $iOldPid;
         $this->oLogger->Log($sLogData);
         return true;
     }
     return false;
 }
Exemplo n.º 8
0
    public function UpdateJobQueue(JobQueueEntity $oJobQueueEntity)
    {
        $iId = $oJobQueueEntity->getId();
        $iUserId = $oJobQueueEntity->getUserId();
        $sStatus = $oJobQueueEntity->getStatus();
        $sJobStartTime = '';
        $sJobEndTime = 'NULL';
        if ($sStatus === 'started') {
            $sJobStartTime = 'job_start_time = NOW(),';
        }
        if ($sStatus === 'completed') {
            $sJobEndTime = 'NOW()';
        }
        $sSql = 'UPDATE
					' . $this->sTableName . '

				SET
				  ' . $sJobStartTime . '
					  job_status       = ?
				    , job_end_time     = ' . $sJobEndTime . '
				WHERE
				    id                 = ?';
        $aBindArray = array($sStatus, $iId);
        $this->Execute($sSql, $aBindArray);
    }