/** * Update quiz */ public static function updateQuiz() { wfProfileIn(__METHOD__); $wgRequest = F::app()->getGlobal('wgRequest'); $wgUser = F::app()->getGlobal('wgUser'); $res = array(); $quizId = $wgRequest->getInt('quizId'); $quiz = WikiaQuiz::newFromId($quizId); if (empty($quiz) || !$quiz->exists()) { $res = array('success' => false, 'error' => F::app()->renderView('Error', 'Index', array(wfMsg('wikiaquiz-error-invalid-quiz')))); } else { $error = null; $content = self::parseCreateEditQuizRequest($wgRequest, $quiz, $error); if ($error) { $res = array('success' => false, 'error' => F::app()->renderView('Error', 'Index', array($error))); } else { $article = Article::newFromID($quizId); $status = $article->doEdit($content, 'Quiz Updated', EDIT_UPDATE, false, $wgUser); $title_object = $article->getTitle(); // @todo check status object $res = array('success' => true, 'quizId' => $article->getID(), 'url' => $title_object->getLocalUrl(), 'title' => $title_object->getPrefixedText()); } } wfProfileOut(__METHOD__); return $res; }