public function execute() { global $wgTitle; $dbr = wfGetDB(DB_SLAVE); $pages = $dbr->select('page', array('page_id', 'page_latest')); while ($page = $pages->fetchObject()) { $title = Title::newFromID($page->page_id); // some extensions, like Semantic Forms, need $wgTitle // set as well $wgTitle = $title; if (ApprovedRevs::pageIsApprovable($title) && !ApprovedRevs::hasApprovedRevision($title)) { ApprovedRevs::setApprovedRevID($title, $page->page_latest, true); $this->output(wfTimestamp(TS_DB) . ' Approved the last revision of page "' . $title->getFullText() . '".'); } } $this->output("\n Finished setting all current revisions to approved. \n"); }
/** * Handle the 'approve' action, defined for ApprovedRevs - * mark the revision as approved, log it, and show a message to * the user. */ static function setAsApproved($action, $article) { // return "true" if the call failed (meaning, pass on handling // of the hook to others), and "false" otherwise if ($action != 'approve') { return true; } $title = $article->getTitle(); if (!ApprovedRevs::pageIsApprovable($title)) { return true; } if (!$title->userCan('approverevisions')) { return true; } global $wgRequest; if (!$wgRequest->getCheck('oldid')) { return true; } $revision_id = $wgRequest->getVal('oldid'); ApprovedRevs::setApprovedRevID($title, $revision_id); global $wgOut; $wgOut->addHTML(' ' . Xml::element('div', array('class' => 'successbox'), wfMsg('approvedrevs-approvesuccess')) . "\n"); $wgOut->addHTML(' ' . Xml::element('p', array('style' => 'clear: both')) . "\n"); // show the revision, instead of the history page $article->doPurge(); $article->view(); return false; }
/** * Handle the 'approve' action, defined for ApprovedRevs - * mark the revision as approved, log it, and show a message to * the user. */ static function setAsApproved($action, $article) { // Return "true" if the call failed (meaning, pass on handling // of the hook to others), and "false" otherwise. if ($action != 'approve') { return true; } $title = $article->getTitle(); if (!ApprovedRevs::pageIsApprovable($title)) { return true; } if (!ApprovedRevs::userCanApprove($title)) { return true; } global $wgRequest; if (!$wgRequest->getCheck('oldid')) { return true; } $revisionID = $wgRequest->getVal('oldid'); ApprovedRevs::setApprovedRevID($title, $revisionID); 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"); // doPurge() causes semantic data to not be set when using SMW 1.9.0 // due to a bug in SMW. This was fixed in SMW 1.9.1. Approved Revs // accounted for this bug in versions prior to v1.0.0 (see commits // e80ac09f and c5370dd4), but doing so caused cache issues: the // history page would not show updated approvals without a hard // refresh. *** Approved Revs now DOES NOT support SMW 1.9.0 *** $article->doPurge(); $article->view(); return false; }
/** * Handle the 'approve' action, defined for ApprovedRevs - * mark the revision as approved, log it, and show a message to * the user. */ static function setAsApproved($action, $article) { // Return "true" if the call failed (meaning, pass on handling // of the hook to others), and "false" otherwise. if ($action != 'approve') { return true; } $title = $article->getTitle(); if (!ApprovedRevs::pageIsApprovable($title)) { return true; } if (!ApprovedRevs::userCanApprove($title)) { return true; } global $wgRequest; if (!$wgRequest->getCheck('oldid')) { return true; } $revisionID = $wgRequest->getVal('oldid'); ApprovedRevs::setApprovedRevID($title, $revisionID); 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. if (defined('SMW_VERSION') && version_compare(SMW_VERSION, '1.9', '<')) { // Call this only for SMW < 1.9 - it causes semantic // data to not be set when using SMW 1.9 (a bug fixed // in SMW 1.9.1), but thankfully it doesn't seem to be // needed, in any case. $article->doPurge(); } $article->view(); return false; }