public function doAction() { $this->project_data = getProjectJobData($this->project_id); try { if (empty($this->project_data)) { throw new Exception("No Project Found.", -1); } $pManager = new ProjectManager(); $pStruct = $pManager->getProjectStructure(); switch ($this->exec) { case 'merge': $this->checkMergeAccess(); $pStruct['job_to_merge'] = $this->job_id; $pManager->mergeALL($pStruct); break; case 'check': $this->checkSplitAccess(); $pStruct['job_to_split'] = $this->job_id; $pStruct['job_to_split_pass'] = $this->job_pass; $pManager->getSplitData($pStruct, $this->num_split, $this->split_values); break; case 'apply': $this->checkSplitAccess(); $pStruct['job_to_split'] = $this->job_id; $pStruct['job_to_split_pass'] = $this->job_pass; $pManager->getSplitData($pStruct, $this->num_split, $this->split_values); $pManager->applySplit($pStruct); break; } $this->result["data"] = $pStruct['split_result']; } catch (Exception $e) { $this->result['errors'][] = array("code" => $e->getCode(), "message" => $e->getMessage()); } }
$job_pass = $argv[2]; $num_split = $argv[3]; $apply_split = isset($argv[4]) && $argv[4] == "--apply"; @INIT::obtain(); include_once INIT::$UTILS_ROOT . '/CatUtils.php'; include_once INIT::$UTILS_ROOT . '/Utils.php'; include_once INIT::$UTILS_ROOT . '/Log.php'; include_once INIT::$MODEL_ROOT . '/queries.php'; ini_set('error_reporting', E_ALL); $db = Database::obtain(INIT::$DB_SERVER, INIT::$DB_USER, INIT::$DB_PASS, INIT::$DB_DATABASE); $db->debug = INIT::$DEBUG; $db->connect(); include INIT::$UTILS_ROOT . '/RecursiveArrayObject.php'; include INIT::$UTILS_ROOT . '/ProjectManager.php'; error_reporting(E_ALL & ~E_DEPRECATED); $pm = new ProjectManager(); /* http://matecat.local/translate/ESPANOL_VERY_BIG_2900_segs.sdlxliff/en-US-fr-FR/5294-e01e940bdca8 */ $pStruct = $pm->getProjectStructure(); $pStruct['job_to_split'] = $job_num; $pStruct['job_to_split_pass'] = $job_pass; $pm->getSplitData($pStruct, $num_split); if ($apply_split) { $pm->applySplit($pStruct); } var_export(json_encode($pStruct['split_result'])); echo "\n"; echo "\n"; echo "\n"; var_export($pStruct['split_result']->getArrayCopy());