type = $type; } public function open() { $prog = Config::getVar('search', 'index[' . $this->type . ']'); if (isset($prog)) { $this->command = sprintf($prog, escapeshellarg($this->getFilePath())); if (!($this->fp = @popen($this->command, 'r'))) { throw new Exception("Failed to parse file {$this->getFilePath()} through the command: {$this->command}\nLast error: " . error_get_last()); } return true; } return false; } public function close() { if ($this->fp && ($exitCode = pclose($this->fp))) { throw new Exception("The indexation process exited with the code \"{$exitCode}\", perhaps the command failed: {$this->command}"); } } } if (!PKP_STRICT_MODE) { class_alias('\PKP\search\SearchHelperParser', '\SearchHelperParser'); }