'Text' ); /** * Tries to parse the file contents if a FileTextExtractor class exists to handle the file type, and returns the text. * The value is also cached into the File record itself. * * @param $forceParse If false, the file content is only parsed on demand. If true, the content parsing is forced, bypassing the * cached version * @return String */ function extractFileAsText($forceParse = false) { if (!$forceParse && $this->owner->FileContentCache) return $this->owner->FileContentCache; // Determine which extractor can process this file. $extractor = FileTextExtractor::for_file($this->owner); if (!$extractor) return null; $text = $extractor->getContent($this->owner); if (!$text) return null; $this->owner->FileContentCache = $text; $this->owner->write(); return $text; } } ?>