function addNewTitles($articles) { global $wgDBname; $dbw = wfGetDB(DB_MASTER); $errors = array(); $articles = array_map("urldecode", $articles); $pages = Misc::getPagesFromURLs($articles); foreach ($pages as $page) { $languageCode = $page['lang']; if ($languageCode == "en") { //first add this article to the english db $this->addIntlArticle($dbw, "en", $page['page_id']); //now get all the translations self::processTranslations($dbw, $page['page_id']); } else { self::addIntlArticle($dbw, $languageCode, $page['page_id']); } } //Find ones that didn't work and tell user about them foreach ($articles as $article) { if (!array_key_exists($article, $pages)) { $errors[] = $article; } } $dbw->selectDB($wgDBname); //reset memcache since we just changed a lot of values wikihowAds::resetAllAdExclusionCaches(); return $errors; }