/** * Handle the 'approvefile' action, defined for ApprovedRevs - * mark the revision as approved, log it, and show a message to * the user. */ public static function setFileAsApproved($action, $article) { // Return "true" if the call failed (meaning, pass on handling // of the hook to others), and "false" otherwise. if ($action != 'approvefile') { return true; } $title = $article->getTitle(); if (!ApprovedRevs::mediaIsApprovable($title)) { return true; } if (!ApprovedRevs::userCanApprove($title)) { return true; } global $wgRequest; if (!$wgRequest->getCheck('ts') || !$wgRequest->getCheck('sha1')) { die('check query string'); return true; } $revisionID = $wgRequest->getVal('ts'); ApprovedRevs::SetApprovedFileInDB($title, $wgRequest->getVal('ts'), $wgRequest->getVal('sha1')); global $wgOut; $wgOut->addHTML("\t\t" . Xml::element('div', array('class' => 'successbox'), wfMessage('approvedrevs-approvesuccess')->text()) . "\n"); $wgOut->addHTML("\t\t" . Xml::element('p', array('style' => 'clear: both')) . "\n"); // show the revision, instead of the history page $article->doPurge(); $article->view(); return false; }