Lines Matching defs:file
12 * Convert a file to text and metainfos
19 * @var array maps extensions to parsers. A parser may be a local cli tool (file is passed as argument)
57 * Parse the given file
64 * ext - the extension of the file
65 * language - the language code the file is written in
68 * Returns false if the file can not be parsed and thus should not be indexed
70 * @param string $file
74 public function parse($file)
76 if (!file_exists($file)) {
77 throw new RuntimeException('File ' . $file . 'does not exist');
79 list($ext, $mime) = mimetype($file);
81 throw new RuntimeException('Cannot parse file with unidentified extension');
87 $result = $this->runParser($file, $this->parsers[$ext]);
94 'title' => basename($file),
99 'created' => date('Y-m-d\TH:i:s\Z', filemtime($file)),
112 * Execute the parser on the given file
116 * @param string $file
120 protected function runParser($file, $parser)
125 $ok = $http->sendRequest($parser, io_readFile($file, false), 'PUT');
133 exec(str_replace('%in%', escapeshellarg($file), $parser), $output, $ok);