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


PHP ResultWrapper::numRows方法代码示例

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


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

示例1: showContributions

 /**
  * Render the contributions of user to page
  * @param ResultWrapper $res
  */
 protected function showContributions(ResultWrapper $res)
 {
     $numRows = $res->numRows();
     $rev = null;
     $out = $this->getOutput();
     $revs = array();
     $prevRevs = array();
     foreach ($res as $row) {
         $rev = new Revision($row);
         $revs[] = $rev;
         if ($res->key() <= self::LIMIT + 1 && $rev->getParentId()) {
             $prevRevs[] = $rev->getParentId();
         }
     }
     $this->prevLengths = Revision::getParentLengths(wfGetDB(DB_SLAVE), $prevRevs);
     if ($numRows > 0) {
         $count = 0;
         foreach ($revs as $rev) {
             if ($count++ < self::LIMIT) {
                 $this->showContributionsRow($rev);
             }
         }
         $out->addHtml('</ul>');
         // Captured 1 more than we should have done so if the number of
         // results is greater than the limit there are more to show.
         if ($numRows > self::LIMIT) {
             $out->addHtml($this->getMoreButton($rev->getTimestamp()));
         }
     } else {
         // For users who exist but have not made any edits
         $out->addHtml(MobileUI::warningBox($this->msg('mobile-frontend-history-no-results')));
     }
 }
开发者ID:micha6554,项目名称:mediawiki-extensions-MobileFrontend,代码行数:37,代码来源:SpecialMobileContributions.php

示例2: length

 /**
  * Get the number of items in the list.
  * @return int
  */
 public function length()
 {
     if (!$this->res) {
         return 0;
     } else {
         return $this->res->numRows();
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:12,代码来源:RevisionList.php

示例3: preprocessResults

 /**
  * Pre-fill the link cache
  *
  * @param DatabaseBase $db
  * @param ResultWrapper $res
  */
 function preprocessResults($db, $res)
 {
     if ($res->numRows() > 0) {
         $linkBatch = new LinkBatch();
         foreach ($res as $row) {
             $linkBatch->add($row->namespace, $row->title);
         }
         $res->seek(0);
         $linkBatch->execute();
     }
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:17,代码来源:SpecialListDuplicatedFiles.php

示例4: preprocessResults

 /**
  * Run a LinkBatch to pre-cache LinkCache information,
  * like page existence and information for stub color and redirect hints.
  * This should be done for live data and cached data.
  *
  * @param IDatabase $db
  * @param ResultWrapper $res
  */
 public function preprocessResults($db, $res)
 {
     if (!$res->numRows()) {
         return;
     }
     $batch = new LinkBatch();
     foreach ($res as $row) {
         $batch->add($row->namespace, $row->title);
     }
     $batch->execute();
     $res->seek(0);
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:20,代码来源:PageQueryPage.php

示例5: preprocessResults

 /**
  * Fetch user page links and cache their existence
  *
  * @param IDatabase $db
  * @param ResultWrapper $res
  */
 function preprocessResults($db, $res)
 {
     if (!$res->numRows()) {
         return;
     }
     $batch = new LinkBatch();
     foreach ($res as $row) {
         $batch->add(NS_CATEGORY, $row->title);
     }
     $batch->execute();
     // Back to start for display
     $res->seek(0);
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:19,代码来源:SpecialMostlinkedcategories.php

示例6: preprocessResults

 /**
  * @param IDatabase $db
  * @param ResultWrapper $res
  */
 function preprocessResults($db, $res)
 {
     # There's no point doing a batch check if we aren't caching results;
     # the page must exist for it to have been pulled out of the table
     if (!$this->isCached() || !$res->numRows()) {
         return;
     }
     $batch = new LinkBatch();
     foreach ($res as $row) {
         $batch->add($row->namespace, $row->title);
     }
     $batch->execute();
     $res->seek(0);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:18,代码来源:SpecialMostcategories.php

示例7: preprocessResults

 /**
  * Cache page existence for performance
  *
  * @param DatabaseBase $db
  * @param ResultWrapper $res
  */
 function preprocessResults($db, $res)
 {
     $batch = new LinkBatch();
     foreach ($res as $row) {
         $batch->add($row->namespace, $row->title);
         $batch->addObj($this->getRedirectTarget($row));
     }
     $batch->execute();
     // Back to start for display
     if ($res->numRows() > 0) {
         // If there are no rows we get an error seeking.
         $db->dataSeek($res, 0);
     }
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:20,代码来源:SpecialListredirects.php

示例8: preprocessResults

 /**
  * Cache page existence for performance
  *
  * @param IDatabase $db
  * @param ResultWrapper $res
  */
 function preprocessResults($db, $res)
 {
     if (!$res->numRows()) {
         return;
     }
     $batch = new LinkBatch();
     foreach ($res as $row) {
         $batch->add($row->namespace, $row->title);
         $batch->addObj($this->getRedirectTarget($row));
     }
     $batch->execute();
     // Back to start for display
     $res->seek(0);
 }
开发者ID:D66Ha,项目名称:mediawiki,代码行数:20,代码来源:SpecialListredirects.php

示例9: count

 /**
  * @return int
  */
 public function count()
 {
     return $this->res->numRows();
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:7,代码来源:TitleArray.php

示例10: showList

 /**
  * Generic list of deleted pages
  *
  * @param ResultWrapper $result
  * @return bool
  */
 private function showList($result)
 {
     $out = $this->getOutput();
     if ($result->numRows() == 0) {
         $out->addWikiMsg('undelete-no-results');
         return false;
     }
     $out->addWikiMsg('undeletepagetext', $this->getLanguage()->formatNum($result->numRows()));
     $undelete = $this->getPageTitle();
     $out->addHTML("<ul>\n");
     foreach ($result as $row) {
         $title = Title::makeTitleSafe($row->ar_namespace, $row->ar_title);
         if ($title !== null) {
             $item = Linker::linkKnown($undelete, htmlspecialchars($title->getPrefixedText()), array(), array('target' => $title->getPrefixedText()));
         } else {
             // The title is no longer valid, show as text
             $item = Html::element('span', array('class' => 'mw-invalidtitle'), Linker::getInvalidTitleDescription($this->getContext(), $row->ar_namespace, $row->ar_title));
         }
         $revs = $this->msg('undeleterevisions')->numParams($row->count)->parse();
         $out->addHTML("<li>{$item} ({$revs})</li>\n");
     }
     $result->free();
     $out->addHTML("</ul>\n");
     return true;
 }
开发者ID:raymondzhangl,项目名称:mediawiki,代码行数:31,代码来源:SpecialUndelete.php

示例11: preprocessResults

 /**
  * Cache page content model and gender distinction for performance
  *
  * @param IDatabase $db
  * @param ResultWrapper $res
  */
 function preprocessResults($db, $res)
 {
     if (!$res->numRows()) {
         return;
     }
     $batch = new LinkBatch();
     foreach ($res as $row) {
         $batch->add($row->namespace, $row->title);
         if (isset($row->nsb)) {
             // lazy loaded when using cached results
             $batch->add($row->nsb, $row->tb);
         }
         if (isset($row->iwc) && !$row->iwc) {
             // lazy loaded when using cached result, not added when interwiki link
             $batch->add($row->nsc, $row->tc);
         }
     }
     $batch->execute();
     // Back to start for display
     $res->seek(0);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:27,代码来源:SpecialDoubleRedirects.php

示例12: executeLBFromResultWrapper

 /**
  * Creates a new LinkBatch object, adds all pages from the passed ResultWrapper (MUST include
  * title and optional the namespace field) and executes the batch. This operation will pre-cache
  * LinkCache information like page existence and information for stub color and redirect hints.
  *
  * @param ResultWrapper $res The ResultWrapper object to process. Needs to include the title
  *  field and namespace field, if the $ns parameter isn't set.
  * @param null $ns Use this namespace for the given titles in the ResultWrapper object,
  *  instead of the namespace value of $res.
  */
 protected function executeLBFromResultWrapper(ResultWrapper $res, $ns = null)
 {
     if (!$res->numRows()) {
         return;
     }
     $batch = new LinkBatch();
     foreach ($res as $row) {
         $batch->add($ns !== null ? $ns : $row->namespace, $row->title);
     }
     $batch->execute();
     $res->seek(0);
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:22,代码来源:QueryPage.php

示例13: showHistory

 /**
  * Render the history list
  * @see showRow()
  * @see doQuery()
  * @param ResultWrapper $res The result of doQuery
  */
 protected function showHistory(ResultWrapper $res)
 {
     $numRows = $res->numRows();
     $rev1 = $rev2 = null;
     $out = $this->getOutput();
     if ($numRows > 0) {
         foreach ($res as $row) {
             $rev1 = new Revision($row);
             if ($rev2) {
                 $this->showRow($rev2, $rev1);
             }
             $rev2 = $rev1;
         }
         if ($rev1 && $numRows < self::LIMIT + 1) {
             $this->showRow($rev1, null);
         }
         $out->addHtml('</ul>');
         // Captured 1 more than we should have done so if the number of
         // results is greater than the limit there are more to show.
         if ($numRows > self::LIMIT) {
             $out->addHtml($this->getMoreButton($rev1->getTimestamp()));
         }
     } else {
         // Edge case.
         // I suspect this is here because revisions may exist but may have been hidden.
         $out->addHtml(MobileUI::warningBox($this->msg('mobile-frontend-history-no-results')));
     }
 }
开发者ID:micha6554,项目名称:mediawiki-extensions-MobileFrontend,代码行数:34,代码来源:SpecialMobileHistory.php

示例14: partitionResult

 /**
  * Partition a DB result with backlinks in it into batches
  * @param ResultWrapper $res Database result
  * @param int $batchSize
  * @param bool $isComplete Whether $res includes all the backlinks
  * @throws MWException
  * @return array
  */
 protected function partitionResult($res, $batchSize, $isComplete = true)
 {
     $batches = array();
     $numRows = $res->numRows();
     $numBatches = ceil($numRows / $batchSize);
     for ($i = 0; $i < $numBatches; $i++) {
         if ($i == 0 && $isComplete) {
             $start = false;
         } else {
             $rowNum = $i * $batchSize;
             $res->seek($rowNum);
             $row = $res->fetchObject();
             $start = (int) $row->page_id;
         }
         if ($i == $numBatches - 1 && $isComplete) {
             $end = false;
         } else {
             $rowNum = min($numRows - 1, ($i + 1) * $batchSize - 1);
             $res->seek($rowNum);
             $row = $res->fetchObject();
             $end = (int) $row->page_id;
         }
         # Sanity check order
         if ($start && $end && $start > $end) {
             throw new MWException(__METHOD__ . ': Internal error: query result out of order');
         }
         $batches[] = array($start, $end);
     }
     return array('numRows' => $numRows, 'batches' => $batches);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:38,代码来源:BacklinkCache.php

示例15: getNumRows

	/**
	 * Get the number of rows in the result set
	 *
	 * @return Integer
	 */
	function getNumRows() {
		if ( !$this->mQueryDone ) {
			$this->doQuery();
		}
		return $this->mResult->numRows();
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:11,代码来源:Pager.php


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