r77785 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77784‎ | r77785 | r77786 >
Date:10:01, 5 December 2010
Author:vasilievvv
Status:ok (Comments)
Tags:
Comment:
Instead of hardcoding 20000 revs limit on the path search, make it configurable variable.
Modified paths:
  • /trunk/extensions/CodeReview/CodeReview.php (modified) (history)
  • /trunk/extensions/CodeReview/backend/CodeRepository.php (modified) (history)
  • /trunk/extensions/CodeReview/backend/CodeRevision.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionListView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeReview.php
@@ -157,6 +157,12 @@
158158 $wgCodeReviewMaxDiffSize = 500000;
159159
160160 /**
 161+ * Limit of the revisions accessible to the search by path.
 162+ * Set to 0 to disable the limit.
 163+ */
 164+$wgCodeReviewPathSearchHorizon = 20000;
 165+
 166+/**
161167 * Key is repository name. Value is an array of regexes
162168 *
163169 * Any base paths matching regular expressions in these arrays will have their
Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -934,7 +934,7 @@
935935 'cp_repo_id' => $this->mRepoId,
936936 'cp_path ' . $dbr->buildLike( $path, $dbr->anyString() ),
937937 // performance
938 - 'cp_rev_id > ' . ( $this->mRepo->getLastStoredRev() - 20000 ),
 938+ 'cp_rev_id > ' . $this->mRepo->getPathSearchHorizon(),
939939 // join conds
940940 'cr_repo_id = cp_repo_id',
941941 'cr_id = cp_rev_id'
Index: trunk/extensions/CodeReview/backend/CodeRepository.php
@@ -140,6 +140,15 @@
141141 return intval( $row );
142142 }
143143
 144+ public function getPathSearchHorizon() {
 145+ global $wgCodeReviewPathSearchHorizon;
 146+
 147+ if( $wgCodeReviewPathSearchHorizon )
 148+ return $this->getLastStoredRev() - $wgCodeReviewPathSearchHorizon;
 149+ else
 150+ return 0;
 151+ }
 152+
144153 public function getAuthorList() {
145154 global $wgMemc;
146155 $key = wfMemcKey( 'codereview', 'authors', $this->getId() );
Index: trunk/extensions/CodeReview/ui/CodeRevisionListView.php
@@ -200,7 +200,7 @@
201201 'cr_id = cp_rev_id',
202202 ' cp_path' . $dbr->buildLike( $this->mPath, $dbr->anyString() ),
203203 // Performance
204 - ' cp_rev_id > ' . ( $this->mRepo->getLastStoredRev() - 20000 )
 204+ ' cp_rev_id > ' . $this->mRepo->getPathSearchHorizon()
205205 );
206206 // No path; count of code_rev
207207 } else {
@@ -252,7 +252,7 @@
253253 'cp_repo_id' => $this->mRepo->getId(),
254254 'cp_path ' . $this->mDb->buildLike( $this->getSVNPath(), $this->mDb->anyString() ),
255255 // performance
256 - 'cp_rev_id > ' . ( $this->mRepo->getLastStoredRev() - 20000 )
 256+ 'cp_rev_id > ' . $this->mRepo->getPathSearchHorizon()
257257 ),
258258 'options' => array( 'GROUP BY' => 'cp_rev_id', 'USE INDEX' => array( 'code_path' => 'cp_repo_id' ) ),
259259 'join_conds' => array(

Comments

#Comment by Nikerabbit (talk | contribs)   10:07, 5 December 2010

Braces around if and else bodies would be nice. Without the context I would have no idea what horizon is supposed to mean.

Status & tagging log