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


PHP Revision::newFromConds方法代码示例

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


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

示例1: newFromTitle

 /**
  * Load either the current, or a specified, revision
  * that's attached to a given title. If not attached
  * to that title, will return null.
  *
  * @param Title $title
  * @param int $id
  * @return Revision
  * @access public
  * @static
  */
 static function newFromTitle(&$title, $id = 0)
 {
     if ($id) {
         $matchId = intval($id);
     } else {
         $matchId = 'page_latest';
     }
     return Revision::newFromConds(array("rev_id={$matchId}", 'page_id=rev_page', 'page_namespace' => $title->getNamespace(), 'page_title' => $title->getDbkey()));
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:20,代码来源:Revision.php

示例2: newFromTitle

 /**
  * Load either the current, or a specified, revision
  * that's attached to a given title. If not attached
  * to that title, will return null.
  *
  * @param Title $title
  * @param int $id
  * @return Revision
  */
 public static function newFromTitle($title, $id = 0)
 {
     $conds = array('page_namespace' => $title->getNamespace(), 'page_title' => $title->getDBkey());
     if ($id) {
         // Use the specified ID
         $conds['rev_id'] = $id;
     } elseif (wfGetLB()->getServerCount() > 1) {
         // Get the latest revision ID from the master
         $dbw = wfGetDB(DB_MASTER);
         $latest = $dbw->selectField('page', 'page_latest', $conds, __METHOD__);
         $conds['rev_id'] = $latest;
     } else {
         // Use a join to get the latest revision
         $conds[] = 'rev_id=page_latest';
     }
     $conds[] = 'page_id=rev_page';
     return Revision::newFromConds($conds);
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:27,代码来源:Revision.php

示例3: newFromPageId

 /**
  * Load either the current, or a specified, revision
  * that's attached to a given page ID.
  * Returns null if no such revision can be found.
  *
  * @param $revId Integer
  * @param $pageId Integer (optional)
  * @return Revision or null
  */
 public static function newFromPageId($pageId, $revId = 0)
 {
     $conds = array('page_id' => $pageId);
     if ($revId) {
         $conds['rev_id'] = $revId;
     } elseif (wfGetLB()->getServerCount() > 1) {
         // Get the latest revision ID from the master
         $dbw = wfGetDB(DB_MASTER);
         $latest = $dbw->selectField('page', 'page_latest', $conds, __METHOD__);
         if ($latest === false) {
             return null;
             // page does not exist
         }
         $conds['rev_id'] = $latest;
     } else {
         $conds[] = 'rev_id = page_latest';
     }
     return Revision::newFromConds($conds);
 }
开发者ID:laiello,项目名称:media-wiki-law,代码行数:28,代码来源:Revision.php


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