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


PHP LinkBatch::addObj方法代码示例

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


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

示例1: wfMsgForContent

	/**
	 * Return a clause with the list of disambiguation templates.
	 * This function was copied verbatim from specials/SpecialDisambiguations.php
	 */
	function disambiguation_templates( $dbr ) {
		$dMsgText = wfMsgForContent('disambiguationspage');

		$linkBatch = new LinkBatch;

		# If the text can be treated as a title, use it verbatim.
		# Otherwise, pull the titles from the links table
		$dp = Title::newFromText($dMsgText);
		if( $dp ) {
			if($dp->getNamespace() != NS_TEMPLATE) {
				# FIXME we assume the disambiguation message is a template but
				# the page can potentially be from another namespace :/
				wfDebug("Mediawiki:disambiguationspage message does not refer to a template!\n");
			}
			$linkBatch->addObj( $dp );
		} else {
			# Get all the templates linked from the Mediawiki:Disambiguationspage
			$disPageObj = Title::makeTitleSafe( NS_MEDIAWIKI, 'disambiguationspage' );
			$res = $dbr->select(
				array('pagelinks', 'page'),
				'pl_title',
				array('page_id = pl_from', 'pl_namespace' => NS_TEMPLATE,
					'page_namespace' => $disPageObj->getNamespace(), 'page_title' => $disPageObj->getDBkey()),
				__METHOD__ );

			foreach ( $res as $row ) {
				$linkBatch->addObj( Title::makeTitle( NS_TEMPLATE, $row->pl_title ));
			}
		}
		return $linkBatch->constructSet( 'tl', $dbr );
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:35,代码来源:SpecialPagesWithoutScans.php

示例2: getQueryInfo

 function getQueryInfo()
 {
     $dbr = wfGetDB(DB_SLAVE);
     $dMsgText = wfMsgForContent('disambiguationspage');
     $linkBatch = new LinkBatch();
     # If the text can be treated as a title, use it verbatim.
     # Otherwise, pull the titles from the links table
     $dp = Title::newFromText($dMsgText);
     if ($dp) {
         if ($dp->getNamespace() != NS_TEMPLATE) {
             # @todo FIXME: We assume the disambiguation message is a template but
             # the page can potentially be from another namespace :/
             wfDebug("Mediawiki:disambiguationspage message does not refer to a template!\n");
         }
         $linkBatch->addObj($dp);
     } else {
         # Get all the templates linked from the Mediawiki:Disambiguationspage
         $disPageObj = Title::makeTitleSafe(NS_MEDIAWIKI, 'disambiguationspage');
         $res = $dbr->select(array('pagelinks', 'page'), 'pl_title', array('page_id = pl_from', 'pl_namespace' => NS_TEMPLATE, 'page_namespace' => $disPageObj->getNamespace(), 'page_title' => $disPageObj->getDBkey()), __METHOD__);
         foreach ($res as $row) {
             $linkBatch->addObj(Title::makeTitle(NS_TEMPLATE, $row->pl_title));
         }
     }
     $set = $linkBatch->constructSet('tl', $dbr);
     if ($set === false) {
         # We must always return a valid SQL query, but this way
         # the DB will always quickly return an empty result
         $set = 'FALSE';
         wfDebug("Mediawiki:disambiguationspage message does not link to any templates!\n");
     }
     // @todo FIXME: What are pagelinks and p2 doing here?
     return array('tables' => array('templatelinks', 'p1' => 'page', 'pagelinks', 'p2' => 'page'), 'fields' => array('p1.page_namespace AS namespace', 'p1.page_title AS title', 'pl_from AS value'), 'conds' => array($set, 'p1.page_id = tl_from', 'pl_namespace = p1.page_namespace', 'pl_title = p1.page_title', 'p2.page_id = pl_from', 'p2.page_namespace' => MWNamespace::getContentNamespaces()));
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:33,代码来源:SpecialDisambiguations.php

示例3: getSQL

 function getSQL()
 {
     $dbr =& wfGetDB(DB_SLAVE);
     list($page, $pagelinks, $templatelinks) = $dbr->tableNamesN('page', 'pagelinks', 'templatelinks');
     $dMsgText = wfMsgForContent('disambiguationspage');
     $linkBatch = new LinkBatch();
     # If the text can be treated as a title, use it verbatim.
     # Otherwise, pull the titles from the links table
     $dp = Title::newFromText($dMsgText);
     if ($dp) {
         if ($dp->getNamespace() != NS_TEMPLATE) {
             # FIXME we assume the disambiguation message is a template but
             # the page can potentially be from another namespace :/
             wfDebug("Mediawiki:disambiguationspage message does not refer to a template!\n");
         }
         $linkBatch->addObj($dp);
     } else {
         # Get all the templates linked from the Mediawiki:Disambiguationspage
         $disPageObj = $this->getDisambiguationPageObj();
         $res = $dbr->select(array('pagelinks', 'page'), 'pl_title', array('page_id = pl_from', 'pl_namespace' => NS_TEMPLATE, 'page_namespace' => $disPageObj->getNamespace(), 'page_title' => $disPageObj->getDBkey()), 'DisambiguationsPage::getSQL');
         while ($row = $dbr->fetchObject($res)) {
             $linkBatch->addObj(Title::makeTitle(NS_TEMPLATE, $row->pl_title));
         }
         $dbr->freeResult($res);
     }
     $set = $linkBatch->constructSet('lb.tl', $dbr);
     if ($set === false) {
         $set = 'FALSE';
         # We must always return a valid sql query, but this way DB will always quicly return an empty result
         wfDebug("Mediawiki:disambiguationspage message does not link to any templates!\n");
     }
     $sql = "SELECT 'Disambiguations' AS \"type\", pb.page_namespace AS namespace," . " pb.page_title AS title, la.pl_from AS value" . " FROM {$templatelinks} AS lb, {$page} AS pb, {$pagelinks} AS la, {$page} AS pa" . " WHERE {$set}" . ' AND pa.page_id = la.pl_from' . ' AND pa.page_namespace = ' . NS_MAIN . ' AND pb.page_id = lb.tl_from' . ' AND pb.page_namespace = la.pl_namespace' . ' AND pb.page_title = la.pl_title' . ' ORDER BY lb.tl_namespace, lb.tl_title';
     return $sql;
 }
开发者ID:negabaro,项目名称:alfresco,代码行数:34,代码来源:SpecialDisambiguations.php

示例4: preprocessResults

 function preprocessResults(&$dbo, &$res)
 {
     # Do a batch existence check on the user and talk pages
     $linkBatch = new LinkBatch();
     while ($row = $dbo->fetchObject($res)) {
         $linkBatch->addObj(Title::makeTitleSafe(NS_USER, $row->user_text));
         $linkBatch->addObj(Title::makeTitleSafe(NS_USER_TALK, $row->user_text));
     }
     $linkBatch->execute();
     # Seek to start
     if ($dbo->numRows($res) > 0) {
         $dbo->dataSeek($res, 0);
     }
 }
开发者ID:puring0815,项目名称:OpenKore,代码行数:14,代码来源:SpecialNewpages.php

示例5: execute

 /**
  * Main execution point
  *
  * @param string $subpage
  */
 public function execute($subpage)
 {
     $this->rcSubpage = $subpage;
     $this->setHeaders();
     $this->outputHeader();
     $this->addModules();
     $rows = $this->getRows();
     $opts = $this->getOptions();
     if ($rows === false) {
         if (!$this->including()) {
             $this->doHeader($opts, 0);
             $this->getOutput()->setStatusCode(404);
         }
         return;
     }
     $batch = new LinkBatch();
     foreach ($rows as $row) {
         $batch->add(NS_USER, $row->rc_user_text);
         $batch->add(NS_USER_TALK, $row->rc_user_text);
         $batch->add($row->rc_namespace, $row->rc_title);
         if ($row->rc_source === RecentChange::SRC_LOG) {
             $formatter = LogFormatter::newFromRow($row);
             foreach ($formatter->getPreloadTitles() as $title) {
                 $batch->addObj($title);
             }
         }
     }
     $batch->execute();
     $this->webOutput($rows, $opts);
     $rows->free();
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:36,代码来源:ChangesListSpecialPage.php

示例6: preprocessResults

 protected function preprocessResults($results)
 {
     $names = array();
     foreach ($results as $result) {
         $names[] = $result->utr_name;
     }
     if (!$names) {
         return;
     }
     $dbr = wfGetDB(DB_SLAVE);
     $res = $dbr->select(array('user', 'ipblocks'), User::selectFields(), array('user_name' => array_unique($names), 'ipb_deleted IS NULL OR ipb_deleted = 0'), __METHOD__, array(), array('ipblocks' => array('LEFT JOIN', 'user_id = ipb_user')));
     $userArray = UserArray::newFromResult($res);
     $lb = new LinkBatch();
     foreach ($userArray as $user) {
         $this->users[$user->getName()] = $user;
         $lb->addObj($user->getUserPage());
         $lb->addObj($user->getTalkPage());
     }
     $lb->execute();
 }
开发者ID:NDKilla,项目名称:mediawiki-extensions-CentralAuth,代码行数:20,代码来源:SpecialUsersWhoWillBeRenamed.php

示例7: getBody

 public function getBody()
 {
     $batch = new LinkBatch();
     $this->mResult->rewind();
     while ($row = $this->mResult->fetchObject()) {
         $batch->addObj(Title::makeTitleSafe(NS_CATEGORY, $row->cat_title));
     }
     $batch->execute();
     $this->mResult->rewind();
     return parent::getBody();
 }
开发者ID:rocLv,项目名称:conference,代码行数:11,代码来源:SpecialCategories.php

示例8: preprocessResults

 /**
  * Pre-fill the link cache
  */
 function preprocessResults(&$db, &$res)
 {
     if ($db->numRows($res) > 0) {
         $linkBatch = new LinkBatch();
         while ($row = $db->fetchObject($res)) {
             $linkBatch->addObj(Title::makeTitleSafe($row->namespace, $row->title));
         }
         $db->dataSeek($res, 0);
         $linkBatch->execute();
     }
 }
开发者ID:negabaro,项目名称:alfresco,代码行数:14,代码来源:SpecialMostlinked.php

示例9: getBody

 public function getBody()
 {
     $batch = new LinkBatch();
     $this->mResult->rewind();
     foreach ($this->mResult as $row) {
         $batch->addObj(Title::makeTitleSafe(NS_CATEGORY, $row->cat_title));
     }
     $batch->execute();
     $this->mResult->rewind();
     return parent::getBody();
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:11,代码来源:CategoryPager.php

示例10: preprocessResults

 /**
  * Pre-cache page existence to speed up link generation
  *
  * @param Database $dbr Database connection
  * @param int $res Result pointer
  */
 public function preprocessResults($dbr, $res)
 {
     $batch = new LinkBatch();
     while ($row = $dbr->fetchObject($res)) {
         $title = Title::makeTitleSafe($row->namespace, $row->title);
         $batch->addObj($title);
     }
     $batch->execute();
     if ($dbr->numRows($res) > 0) {
         $dbr->dataSeek($res, 0);
     }
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:18,代码来源:SpecialMostlinkedtemplates.php

示例11: preprocessResults

 /**
  * Fetch user page links and cache their existence
  */
 function preprocessResults(&$db, &$res)
 {
     $batch = new LinkBatch();
     while ($row = $db->fetchObject($res)) {
         $batch->addObj(Title::makeTitleSafe($row->namespace, $row->title));
     }
     $batch->execute();
     // Back to start for display
     if ($db->numRows($res) > 0) {
         // If there are no rows we get an error seeking.
         $db->dataSeek($res, 0);
     }
 }
开发者ID:negabaro,项目名称:alfresco,代码行数:16,代码来源:SpecialWantedcategories.php

示例12: getStartBody

 function getStartBody()
 {
     # Do a link batch query
     $this->mResult->seek(0);
     $batch = new LinkBatch();
     # Give some pointers to make (last) links
     $this->mForm->prevId = [];
     foreach ($this->mResult as $row) {
         $batch->addObj(Title::makeTitleSafe(NS_USER, $row->user_name));
         $batch->addObj(Title::makeTitleSafe(NS_USER_TALK, $row->user_name));
         $rev_id = isset($rev_id) ? $rev_id : $row->rev_id;
         if ($rev_id > $row->rev_id) {
             $this->mForm->prevId[$rev_id] = $row->rev_id;
         } elseif ($rev_id < $row->rev_id) {
             $this->mForm->prevId[$row->rev_id] = $rev_id;
         }
         $rev_id = $row->rev_id;
     }
     $batch->execute();
     $this->mResult->seek(0);
     return '';
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:22,代码来源:MergeHistoryPager.php

示例13: execute

 function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $this->getOutput()->allowClickjacking();
     $this->getOutput()->addHTML(Html::openElement('table', ['class' => 'mw-datatable', 'id' => 'mw-trackingcategories-table']) . "\n" . "<thead><tr>\n\t\t\t<th>" . $this->msg('trackingcategories-msg')->escaped() . "\n\t\t\t</th>\n\t\t\t<th>" . $this->msg('trackingcategories-name')->escaped() . "</th>\n\t\t\t<th>" . $this->msg('trackingcategories-desc')->escaped() . "\n\t\t\t</th>\n\t\t\t</tr></thead>");
     $trackingCategories = $this->prepareTrackingCategoriesData();
     $batch = new LinkBatch();
     foreach ($trackingCategories as $catMsg => $data) {
         $batch->addObj($data['msg']);
         foreach ($data['cats'] as $catTitle) {
             $batch->addObj($catTitle);
         }
     }
     $batch->execute();
     foreach ($trackingCategories as $catMsg => $data) {
         $allMsgs = [];
         $catDesc = $catMsg . '-desc';
         $catMsgTitleText = Linker::link($data['msg'], htmlspecialchars($catMsg));
         foreach ($data['cats'] as $catTitle) {
             $catTitleText = Linker::link($catTitle, htmlspecialchars($catTitle->getText()));
             $allMsgs[] = $catTitleText;
         }
         # Extra message, when no category was found
         if (!count($allMsgs)) {
             $allMsgs[] = $this->msg('trackingcategories-disabled')->parse();
         }
         /*
          * Show category description if it exists as a system message
          * as category-name-desc
          */
         $descMsg = $this->msg($catDesc);
         if ($descMsg->isBlank()) {
             $descMsg = $this->msg('trackingcategories-nodesc');
         }
         $this->getOutput()->addHTML(Html::openElement('tr') . Html::openElement('td', ['class' => 'mw-trackingcategories-name']) . $this->getLanguage()->commaList(array_unique($allMsgs)) . Html::closeElement('td') . Html::openElement('td', ['class' => 'mw-trackingcategories-msg']) . $catMsgTitleText . Html::closeElement('td') . Html::openElement('td', ['class' => 'mw-trackingcategories-desc']) . $descMsg->parse() . Html::closeElement('td') . Html::closeElement('tr'));
     }
     $this->getOutput()->addHTML(Html::closeElement('table'));
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:39,代码来源:SpecialTrackingCategories.php

示例14: 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

示例15: getBody

 function getBody()
 {
     if (!$this->mQueryDone) {
         $this->doQuery();
     }
     $batch = new LinkBatch();
     $this->mResult->rewind();
     while ($row = $this->mResult->fetchObject()) {
         $batch->addObj(Title::makeTitleSafe(NS_CATEGORY, $row->cl_to));
     }
     $batch->execute();
     $this->mResult->rewind();
     return parent::getBody();
 }
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:14,代码来源:SpecialCategories.php


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