/** * Add a default video description if one doesn't already exist * * @param $file - The file object for the video * @return bool - Returns true if successful, false otherwise */ public function addDefaultVideoDescription(File $file) { wfProfileIn(__METHOD__); $title = $file->getTitle(); // Get the file page for this file $page = WikiPage::factory($title); // Get the description and strip the H2 header $text = $this->stripDescriptionHeader($page->getText()); // Strip out the category tags that might be part of the content $text = FilePageHelper::stripCategoriesFromDescription($text); // If there is no description, pull the description from metadata, // otherwise do nothing if (trim($text) == '') { $text = $file->getMetaDescription(); wfProfileOut(__METHOD__); return $this->setVideoDescription($title, $text); } else { wfProfileOut(__METHOD__); return true; } }