當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。