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"); }
/** * If user is looking at a revision through a main 'view' URL (no * revision specified), have the 'edit' tab link to the basic * 'action=edit' URL (i.e., the latest revision), no matter which * revision they're actually on. */ static function changeEditLink($skin, &$contentActions) { global $wgRequest; if ($wgRequest->getCheck('oldid')) { return true; } $title = $skin->getTitle(); if (ApprovedRevs::hasApprovedRevision($title)) { // the URL is the same regardless of whether the tab // is 'edit' or 'view source', but the "action" is // different if (array_key_exists('edit', $contentActions)) { $contentActions['edit']['href'] = $title->getLocalUrl(array('action' => 'edit')); } if (array_key_exists('viewsource', $contentActions)) { $contentActions['viewsource']['href'] = $title->getLocalUrl(array('action' => 'edit')); } } return true; }
/** * If this page is approvable, but has no approved revision, display * a header message stating that, if the setting to display this * message is activated. */ public static function displayNotApprovedHeader(Article &$article, &$outputDone, &$useParserCache) { global $egApprovedRevsShowNotApprovedMessage; if (!$egApprovedRevsShowNotApprovedMessage) { return true; } $title = $article->getTitle(); if (!ApprovedRevs::pageIsApprovable($title)) { return true; } if (!ApprovedRevs::hasApprovedRevision($title)) { $text = wfMessage('approvedrevs-noapprovedrevision')->text(); global $wgOut; if ($wgOut->getSubtitle() != '') { $wgOut->addSubtitle('<br />' . $text); } else { $wgOut->setSubtitle($text); } } return true; }