当前位置: 首页>>代码示例>>PHP>>正文


PHP Title::newFromRow方法代码示例

本文整理汇总了PHP中Title::newFromRow方法的典型用法代码示例。如果您正苦于以下问题:PHP Title::newFromRow方法的具体用法?PHP Title::newFromRow怎么用?PHP Title::newFromRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Title的用法示例。


在下文中一共展示了Title::newFromRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: reconcile

 public static function reconcile()
 {
     global $wgLanguageCode;
     // Add titles missing from our system with associated keywords
     $dbr = wfGetDB(DB_SLAVE);
     $sql = "select page.* from page left join dedup.title_query on tq_page_id=page_id AND tq_lang=" . $dbr->addQuotes($wgLanguageCode) . " where page_namespace=0 and page_is_redirect=0 and tq_title is NULL group by page.page_id";
     $res = $dbr->query($sql, __METHOD__);
     $missingTitles = array();
     foreach ($res as $row) {
         $missingTitles[] = $row;
     }
     foreach ($missingTitles as $title) {
         print "Adding title to system " . $title->page_title . "\n";
         $t = Title::newFromRow($title);
         DedupQuery::addTitle($t, $wgLanguageCode);
     }
     //Deal with titles turned into deletes or redirects
     $dbr = wfGetDB(DB_SLAVE);
     $sql = "select tq_title from dedup.title_query left join page on tq_page_id=page_id where page_namespace=0 and page_is_redirect=0 and page_title is NULL";
     $res = $dbr->query($sql, __METHOD__);
     $deletedTitles = array();
     foreach ($res as $row) {
         $deletedTitles[] = $row->page_title;
     }
     foreach ($deletedTitles as $title) {
         print "Removing title from system " . $row->page_title . "\n";
         DedupQuery::removeTitle($row->page_title, $wgLanguageCode);
     }
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:29,代码来源:titleReconcile.php

示例2: cycleThroughAllArticles

 /**
  * Grab all the articles
  */
 private static function cycleThroughAllArticles()
 {
     $csv = fopen(self::CSV_FILE, 'a');
     if (!$csv) {
         print "error: opening a file\n";
         exit;
     }
     fputcsv($csv, array('url', 'type', 'old', 'new'), chr(9));
     $res = DatabaseHelper::batchSelect('page', array('page_title'), array('page_namespace' => NS_MAIN, 'page_is_redirect' => 0));
     print 'articles: ' . count($res) . "\n";
     $count = 0;
     $num = 1;
     foreach ($res as $row) {
         //print $num.' - ';
         $title = Title::newFromRow($row);
         if ($title) {
             //print $title->getDBKey();
             if (self::processSubheaders($title, $csv)) {
                 $count++;
             }
             if ($count >= 5000) {
                 break;
             }
         }
         //print "\n";
         $num++;
     }
     print "\nchanged: " . $count . "\n";
     return;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:33,代码来源:reformatSubHeaders.php

示例3: formatRow

 public function formatRow($row)
 {
     $title = Title::newFromRow($row);
     $link = Linker::link($title);
     # Link to page
     $dirmark = $this->getLanguage()->getDirMark();
     # Direction mark
     $stxt = '';
     # Size (bytes)
     if (!is_null($size = $row->page_len)) {
         if ($size == 0) {
             $stxt = ' <small>' . $this->msg('historyempty')->escaped() . '</small>';
         } else {
             $stxt = ' <small>' . $this->msg('historysize')->numParams($size)->escaped() . '</small>';
         }
     }
     # Link to list of reviewed versions for page
     $list = Linker::linkKnown(SpecialPage::getTitleFor('ReviewedVersions'), $this->msg('reviewedpages-all')->escaped(), array(), 'page=' . $title->getPrefixedUrl());
     # Link to highest tier rev
     $best = '';
     if (FlaggedRevs::qualityVersions()) {
         $best = Linker::linkKnown($title, $this->msg('reviewedpages-best')->escaped(), array(), 'stableid=best');
         $best = " [{$best}]";
     }
     return "<li>{$link} {$dirmark} {$stxt} ({$list}){$best}</li>";
 }
开发者ID:crippsy14,项目名称:orange-smorange,代码行数:26,代码来源:ReviewedPages_body.php

示例4: formatRow

 public function formatRow($row)
 {
     $title = Title::newFromRow($row);
     # Link to page
     $link = Linker::link($title);
     # Link to page configuration
     $config = Linker::linkKnown(SpecialPage::getTitleFor('Stabilization'), wfMsgHtml('configuredpages-config'), array(), 'page=' . $title->getPrefixedUrl());
     # Show which version is the default (stable or draft)
     if (intval($row->fpc_override)) {
         $default = wfMsgHtml('configuredpages-def-stable');
     } else {
         $default = wfMsgHtml('configuredpages-def-draft');
     }
     # Autoreview/review restriction level
     $restr = '';
     if ($row->fpc_level != '') {
         $restr = 'autoreview=' . htmlspecialchars($row->fpc_level);
         $restr = "[{$restr}]";
     }
     # When these configuration settings expire
     if ($row->fpc_expiry != 'infinity' && strlen($row->fpc_expiry)) {
         $expiry_description = " (" . wfMsgForContent('protect-expiring', $this->getLang()->timeanddate($row->fpc_expiry), $this->getLang()->date($row->fpc_expiry), $this->getLang()->time($row->fpc_expiry)) . ")";
     } else {
         $expiry_description = "";
     }
     return "<li>{$link} ({$config}) <b>[{$default}]</b> " . "{$restr}<i>{$expiry_description}</i></li>";
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:27,代码来源:ConfiguredPages_body.php

示例5: execute

 function execute()
 {
     global $wgParser;
     $wgParser->parse(' ', Title::newMainPage(), new ParserOptions());
     $dbr = wfGetDB(DB_SLAVE);
     $res = $dbr->select('page', '*', array('page_namespace' => HACL_NS_ACL), __METHOD__);
     $titles = array();
     foreach ($res as $row) {
         $titles[] = Title::newFromRow($row);
     }
     $quiet = $this->hasOption('quiet');
     $seen = array();
     foreach ($titles as $title) {
         $page = new WikiPage($title);
         $pf = IACLParserFunctions::instance($title);
         IACLParserFunctions::parse($page->getText(), $title);
         $errors = $pf->consistencyCheckStatus(false);
         $errors = array_merge($errors, $pf->errors);
         if ($pf->def) {
             if (isset($seen[$pf->def['key']])) {
                 $errors[] = "Duplicate definition! Previous one is " . $seen[$pf->def['key']];
             }
             $seen[$pf->def['key']] = "{$title}";
         }
         IACLParserFunctions::destroyInstance($pf);
         if ($errors) {
             print "Errors on {$title}:\n";
             foreach ($errors as $e) {
                 print "\t{$e}\n";
             }
         } elseif (!$quiet) {
             print "OK {$title}\n";
         }
     }
 }
开发者ID:hermannschwaerzlerUIBK,项目名称:IntraACL,代码行数:35,代码来源:checkErrors.php

示例6: setCurrent

 /**
  * @param $row ResultWrapper
  * @return void
  */
 protected function setCurrent($row)
 {
     if ($row === false) {
         $this->current = false;
     } else {
         $this->current = Title::newFromRow($row);
     }
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:12,代码来源:TitleArray.php

示例7: makeTitle

 protected function makeTitle($name)
 {
     $t = Title::newFromText($name);
     $row = new stdClass();
     $row->page_id = 1;
     $row->page_title = $t->getDBkey();
     $row->page_namespace = $t->getNamespace();
     return Title::newFromRow($row);
 }
开发者ID:felixonmars,项目名称:mediawiki-extensions-MobileFrontend,代码行数:9,代码来源:ApiMobileViewTest.php

示例8: execute

 public function execute()
 {
     global $wgGlobalUsageDatabase;
     $dbr = wfGetDB(DB_SLAVE);
     $dbw = wfGetDB(DB_MASTER, array(), $wgGlobalUsageDatabase);
     $gu = new GlobalUsage(wfWikiId(), $dbw);
     $lastPageId = intval($this->getOption('start-page', 0));
     $lastIlTo = $this->getOption('start-image');
     $limit = 500;
     $maxlag = intval($this->getOption('maxlag', 5));
     do {
         $this->output("Querying links after (page_id, il_to) = ({$lastPageId}, {$lastIlTo})\n");
         # Query all pages and any imagelinks associated with that
         $quotedLastIlTo = $dbr->addQuotes($lastIlTo);
         $res = $dbr->select(array('page', 'imagelinks', 'image'), array('page_id', 'page_namespace', 'page_title', 'il_to', 'img_name'), "(page_id = {$lastPageId} AND il_to > {$quotedLastIlTo})" . " OR page_id > {$lastPageId}", __METHOD__, array('ORDER BY' => $dbr->implicitOrderBy() ? 'page_id' : 'page_id, il_to', 'LIMIT' => $limit), array('imagelinks' => array('LEFT JOIN', 'page_id = il_from'), 'image' => array('LEFT JOIN', 'il_to = img_name')));
         # Build up a tree per pages
         $pages = array();
         $lastRow = null;
         foreach ($res as $row) {
             if (!isset($pages[$row->page_id])) {
                 $pages[$row->page_id] = array();
             }
             # Add the imagelinks entry to the pages array if the image
             # does not exist locally
             if (!is_null($row->il_to) && is_null($row->img_name)) {
                 $pages[$row->page_id][$row->il_to] = $row;
             }
             $lastRow = $row;
         }
         # Insert the imagelinks data to the global table
         foreach ($pages as $pageId => $rows) {
             # Delete all original links if this page is not a continuation
             # of last iteration.
             if ($pageId != $lastPageId) {
                 $gu->deleteLinksFromPage($pageId);
             }
             if ($rows) {
                 $title = Title::newFromRow(reset($rows));
                 $images = array_keys($rows);
                 # Since we have a pretty accurate page_id, don't specify
                 # Title::GAID_FOR_UPDATE
                 $gu->insertLinks($title, $images, 0);
             }
         }
         if ($lastRow) {
             # We've processed some rows in this iteration, so save
             # continuation variables
             $lastPageId = $lastRow->page_id;
             $lastIlTo = $lastRow->il_to;
             # Be nice to the database
             $dbw->commit();
             wfWaitForSlaves($maxlag, $wgGlobalUsageDatabase);
         }
     } while (!is_null($lastRow));
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:55,代码来源:refreshGlobalimagelinks.php

示例9: autoreview_current

 protected function autoreview_current(User $user)
 {
     $this->output("Auto-reviewing all current page versions...\n");
     if (!$user->getID()) {
         $this->output("Invalid user specified.\n");
         return;
     } elseif (!$user->isAllowed('review')) {
         $this->output("User specified (id: {$user->getID()}) does not have \"review\" rights.\n");
         return;
     }
     $db = wfGetDB(DB_MASTER);
     $this->output("Reviewer username: " . $user->getName() . "\n");
     $start = $db->selectField('page', 'MIN(page_id)', false, __METHOD__);
     $end = $db->selectField('page', 'MAX(page_id)', false, __METHOD__);
     if (is_null($start) || is_null($end)) {
         $this->output("...page table seems to be empty.\n");
         return;
     }
     # Do remaining chunk
     $end += $this->mBatchSize - 1;
     $blockStart = $start;
     $blockEnd = $start + $this->mBatchSize - 1;
     $count = 0;
     $changed = 0;
     $flags = FlaggedRevs::quickTags(FR_CHECKED);
     // Assume basic level
     while ($blockEnd <= $end) {
         $this->output("...doing page_id from {$blockStart} to {$blockEnd}\n");
         $res = $db->select(array('page', 'revision'), '*', array("page_id BETWEEN {$blockStart} AND {$blockEnd}", 'page_namespace' => FlaggedRevs::getReviewNamespaces(), 'rev_id = page_latest'), __METHOD__);
         # Go through and autoreview the current version of every page...
         foreach ($res as $row) {
             $title = Title::newFromRow($row);
             $rev = Revision::newFromRow($row);
             # Is it already reviewed?
             $frev = FlaggedRevision::newFromTitle($title, $row->page_latest, FR_MASTER);
             # Rev should exist, but to be safe...
             if (!$frev && $rev) {
                 $article = new Article($title);
                 $db->begin();
                 FlaggedRevs::autoReviewEdit($article, $user, $rev, $flags, true);
                 FlaggedRevs::HTMLCacheUpdates($article->getTitle());
                 $db->commit();
                 $changed++;
             }
             $count++;
         }
         $db->freeResult($res);
         $blockStart += $this->mBatchSize - 1;
         $blockEnd += $this->mBatchSize - 1;
         // XXX: Don't let deferred jobs array get absurdly large (bug 24375)
         DeferredUpdates::doUpdates('commit');
         wfWaitForSlaves(5);
     }
     $this->output("Auto-reviewing of all pages complete ..." . "{$count} rows [{$changed} changed]\n");
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:55,代码来源:reviewAllPages.php

示例10: run

 private function run($resultPageSet = null)
 {
     $params = $this->extractRequestParams();
     // Construct SQL Query
     $this->addTables(array('page', 'flaggedpage_config', 'flaggedpages'));
     if (isset($params['namespace'])) {
         $this->addWhereFld('page_namespace', $params['namespace']);
     }
     if (isset($params['default'])) {
         // Convert readable 'stable'/'latest' to 0/1 (DB format)
         $override = $params['default'] === 'stable' ? 1 : 0;
         $this->addWhereFld('fpc_override', $override);
     }
     if (isset($params['autoreview'])) {
         // Convert readable 'none' to '' (DB format)
         $level = $params['autoreview'] === 'none' ? '' : $params['autoreview'];
         $this->addWhereFld('fpc_level', $level);
     }
     $this->addWhereRange('fpc_page_id', $params['dir'], $params['start'], $params['end']);
     $this->addJoinConds(array('flaggedpage_config' => array('INNER JOIN', 'page_id=fpc_page_id'), 'flaggedpages' => array('LEFT JOIN', 'page_id=fp_page_id')));
     $this->addOption('USE INDEX', array('flaggedpage_config' => 'PRIMARY'));
     if (is_null($resultPageSet)) {
         $this->addFields(array('page_id', 'page_namespace', 'page_title', 'page_len', 'page_latest', 'fpc_page_id', 'fpc_override', 'fpc_level', 'fpc_expiry', 'fp_stable'));
     } else {
         $this->addFields($resultPageSet->getPageTableFields());
         $this->addFields('fpc_page_id');
     }
     $limit = $params['limit'];
     $this->addOption('LIMIT', $limit + 1);
     $res = $this->select(__METHOD__);
     $data = array();
     $count = 0;
     foreach ($res as $row) {
         if (++$count > $limit) {
             // We've reached the one extra which shows that there are
             // additional pages to be had. Stop here...
             $this->setContinueEnumParameter('start', $row->fpc_page_id);
             break;
         }
         if (is_null($resultPageSet)) {
             $title = Title::newFromRow($row);
             $data[] = array('pageid' => intval($row->page_id), 'ns' => intval($row->page_namespace), 'title' => $title->getPrefixedText(), 'last_revid' => intval($row->page_latest), 'stable_revid' => intval($row->fp_stable), 'stable_is_default' => intval($row->fpc_override), 'autoreview' => $row->fpc_level, 'expiry' => $row->fpc_expiry === 'infinity' ? 'infinity' : wfTimestamp(TS_ISO_8601, $row->fpc_expiry));
         } else {
             $resultPageSet->processDbRow($row);
         }
     }
     if (is_null($resultPageSet)) {
         $result = $this->getResult();
         $result->setIndexedTagName($data, 'p');
         $result->addValue('query', $this->getModuleName(), $data);
     }
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:52,代码来源:ApiQueryConfiguredPages.php

示例11: run

 private function run($resultPageSet = null)
 {
     $params = $this->extractRequestParams();
     // Construct SQL Query
     $this->addTables(array('page', 'flaggedpages'));
     $this->addWhereFld('page_namespace', $params['namespace']);
     if ($params['filterredir'] == 'redirects') {
         $this->addWhereFld('page_is_redirect', 1);
     }
     if ($params['filterredir'] == 'nonredirects') {
         $this->addWhereFld('page_is_redirect', 0);
     }
     if ($params['filterlevel'] !== null) {
         $this->addWhereFld('fp_quality', $params['filterlevel']);
     }
     $this->addWhereRange('fp_page_id', $params['dir'], $params['start'], $params['end']);
     $this->addWhere('page_id=fp_page_id');
     $this->addOption('USE INDEX', array('flaggedpages' => 'PRIMARY'));
     if (is_null($resultPageSet)) {
         $this->addFields(array('page_id', 'page_namespace', 'page_title', 'page_len', 'page_latest', 'fp_page_id', 'fp_quality', 'fp_stable'));
     } else {
         $this->addFields($resultPageSet->getPageTableFields());
         $this->addFields('fp_page_id');
     }
     $limit = $params['limit'];
     $this->addOption('LIMIT', $limit + 1);
     $res = $this->select(__METHOD__);
     $data = array();
     $count = 0;
     foreach ($res as $row) {
         if (++$count > $limit) {
             // We've reached the one extra which shows that there are
             // additional pages to be had. Stop here...
             $this->setContinueEnumParameter('start', $row->fp_page_id);
             break;
         }
         if (is_null($resultPageSet)) {
             $title = Title::newFromRow($row);
             $data[] = array('pageid' => intval($row->page_id), 'ns' => intval($title->getNamespace()), 'title' => $title->getPrefixedText(), 'revid' => intval($row->page_latest), 'stable_revid' => intval($row->fp_stable), 'flagged_level' => intval($row->fp_quality), 'flagged_level_text' => FlaggedRevs::getQualityLevelText($row->fp_quality));
         } else {
             $resultPageSet->processDbRow($row);
         }
     }
     if (is_null($resultPageSet)) {
         $result = $this->getResult();
         $result->setIndexedTagName($data, 'p');
         $result->addValue('query', $this->getModuleName(), $data);
     }
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:49,代码来源:ApiQueryReviewedpages.php

示例12: run

    private function run($resultPageSet = null)
    {
        global $wgMemc;
        $params = $this->extractRequestParams();
        // Construct SQL Query
        $this->addTables(array('page', 'flaggedpages'));
        $this->addWhereFld('page_namespace', $params['namespace']);
        if ($params['filterredir'] == 'redirects') {
            $this->addWhereFld('page_is_redirect', 1);
        }
        if ($params['filterredir'] == 'nonredirects') {
            $this->addWhereFld('page_is_redirect', 0);
        }
        $dir = $params['dir'] == 'descending' ? 'older' : 'newer';
        $this->addWhereRange('page_title', $dir, $params['start'], $params['end']);
        $this->addJoinConds(array('flaggedpages' => array('LEFT JOIN', 'fp_page_id=page_id')));
        $this->addWhere('fp_page_id IS NULL OR
			fp_quality < ' . intval($params['filterlevel']));
        $this->addOption('USE INDEX', array('page' => 'name_title', 'flaggedpages' => 'PRIMARY'));
        if (is_null($resultPageSet)) {
            $this->addFields(array('page_id', 'page_namespace', 'page_title', 'page_len', 'page_latest'));
        } else {
            $this->addFields($resultPageSet->getPageTableFields());
        }
        $limit = $params['limit'];
        $this->addOption('LIMIT', $limit + 1);
        $res = $this->select(__METHOD__);
        $data = array();
        $count = 0;
        foreach ($res as $row) {
            if (++$count > $limit) {
                // We've reached the one extra which shows that there are
                // additional pages to be had. Stop here...
                $this->setContinueEnumParameter('start', $row->page_title);
                break;
            }
            if (is_null($resultPageSet)) {
                $title = Title::newFromRow($row);
                $data[] = array('pageid' => intval($row->page_id), 'ns' => intval($title->getNamespace()), 'title' => $title->getPrefixedText(), 'revid' => intval($row->page_latest), 'under_review' => FRUserActivity::pageIsUnderReview($row->page_id));
            } else {
                $resultPageSet->processDbRow($row);
            }
        }
        if (is_null($resultPageSet)) {
            $result = $this->getResult();
            $result->setIndexedTagName($data, 'p');
            $result->addValue('query', $this->getModuleName(), $data);
        }
    }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:49,代码来源:ApiQueryUnreviewedpages.php

示例13: execute

 public function execute()
 {
     global $wgUser;
     $dbr = wfGetDB(DB_SLAVE);
     $ret = $dbr->select(array('flaggedpages', 'revision', 'page'), array_merge(Revision::selectFields(), array($dbr->tableName('page') . '.*')), array('fp_pending_since IS NOT NULL', 'page_id = fp_page_id', 'rev_page = fp_page_id', 'rev_timestamp >= fp_pending_since'), __METHOD__, array('ORDER BY' => 'fp_pending_since DESC'));
     foreach ($ret as $row) {
         $title = Title::newFromRow($row);
         $article = new Article($title);
         $rev = new Revision($row);
         // Trigger cache regeneration
         $start = microtime(true);
         FRInclusionCache::getRevIncludes($article, $rev, $wgUser, 'regen');
         $elapsed = intval((microtime(true) - $start) * 1000);
         $this->cachePendingRevsLog($title->getPrefixedDBkey() . " rev:" . $rev->getId() . " {$elapsed}ms");
     }
 }
开发者ID:crippsy14,项目名称:orange-smorange,代码行数:16,代码来源:cachePendingRevs.php

示例14: execute

 public function execute()
 {
     $pages = $this->getOption('maxpages');
     $dbr = $this->getDB(DB_REPLICA);
     $totalsec = 0.0;
     $scanned = 0;
     $withcache = 0;
     $withdiff = 0;
     while ($pages-- > 0) {
         $row = $dbr->selectRow('page', '*', ['page_namespace' => $this->getOption('namespace'), 'page_is_redirect' => 0, 'page_random >= ' . wfRandom()], __METHOD__, ['ORDER BY' => 'page_random']);
         if (!$row) {
             continue;
         }
         ++$scanned;
         $title = Title::newFromRow($row);
         $page = WikiPage::factory($title);
         $revision = $page->getRevision();
         $content = $revision->getContent(Revision::RAW);
         $parserOptions = $page->makeParserOptions('canonical');
         $parserOutputOld = ParserCache::singleton()->get($page, $parserOptions);
         if ($parserOutputOld) {
             $t1 = microtime(true);
             $parserOutputNew = $content->getParserOutput($title, $revision->getId(), $parserOptions, false);
             $sec = microtime(true) - $t1;
             $totalsec += $sec;
             $this->output("Parsed '{$title->getPrefixedText()}' in {$sec} seconds.\n");
             $this->output("Found cache entry found for '{$title->getPrefixedText()}'...");
             $oldHtml = trim(preg_replace('#<!-- .+-->#Us', '', $parserOutputOld->getText()));
             $newHtml = trim(preg_replace('#<!-- .+-->#Us', '', $parserOutputNew->getText()));
             $diff = wfDiff($oldHtml, $newHtml);
             if (strlen($diff)) {
                 $this->output("differences found:\n\n{$diff}\n\n");
                 ++$withdiff;
             } else {
                 $this->output("No differences found.\n");
             }
             ++$withcache;
         } else {
             $this->output("No parser cache entry found for '{$title->getPrefixedText()}'.\n");
         }
     }
     $ave = $totalsec ? $totalsec / $scanned : 0;
     $this->output("Checked {$scanned} pages; {$withcache} had prior cache entries.\n");
     $this->output("Pages with differences found: {$withdiff}\n");
     $this->output("Average parse time: {$ave} sec\n");
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:46,代码来源:compareParserCache.php

示例15: list_reviewable_pages

 protected function list_reviewable_pages($fileHandle)
 {
     global $wgFlaggedRevsNamespaces, $wgUseSquid, $wgUseFileCache;
     $this->output("Building list of all reviewable pages to purge ...\n");
     if (!$wgUseSquid && !$wgUseFileCache) {
         $this->output("Squid/file cache not enabled ... nothing to purge.\n");
         return;
     } elseif (empty($wgFlaggedRevsNamespaces)) {
         $this->output("There are no reviewable namespaces ... nothing to purge.\n");
         return;
     }
     $db = wfGetDB(DB_MASTER);
     $start = $db->selectField('page', 'MIN(page_id)', false, __FUNCTION__);
     $end = $db->selectField('page', 'MAX(page_id)', false, __FUNCTION__);
     if (is_null($start) || is_null($end)) {
         $this->output("... page table seems to be empty.\n");
         return;
     }
     # Do remaining chunk
     $end += $this->mBatchSize - 1;
     $blockStart = $start;
     $blockEnd = $start + $this->mBatchSize - 1;
     $count = 0;
     while ($blockEnd <= $end) {
         $this->output("... doing page_id from {$blockStart} to {$blockEnd}\n");
         $res = $db->select('page', '*', array("page_id BETWEEN {$blockStart} AND {$blockEnd}", 'page_namespace' => $wgFlaggedRevsNamespaces), __FUNCTION__);
         # Go through and append each purgeable page...
         foreach ($res as $row) {
             $title = Title::newFromRow($row);
             $fa = FlaggableWikiPage::getTitleInstance($title);
             if ($fa->isReviewable()) {
                 # Need to purge this page - add to list
                 fwrite($fileHandle, $title->getPrefixedDBKey() . "\n");
                 $count++;
             }
         }
         $db->freeResult($res);
         $blockStart += $this->mBatchSize - 1;
         $blockEnd += $this->mBatchSize - 1;
         wfWaitForSlaves(5);
         // not really needed
     }
     $this->output("List of reviewable pages to purge complete ... {$count} pages\n");
 }
开发者ID:crippsy14,项目名称:orange-smorange,代码行数:44,代码来源:purgeReviewablePages.php


注:本文中的Title::newFromRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。