Index: trunk/extensions/CodeReview/CodeReview.php |
— | — | @@ -101,5 +101,11 @@ |
102 | 102 | // The name of a repo which represents the code running on this wiki, used to highlight active revisions |
103 | 103 | $wgWikiSVN = 'MediaWiki'; |
104 | 104 | |
| 105 | +// If you are running a closed svn, fill the following two lines with the username and password |
| 106 | +// of a user allowed to access it. Otherwise, leave it false. |
| 107 | +// This is only necessary if using the shell method to access Subversion |
| 108 | +$wgSubversionUser = false; |
| 109 | +$wgSubversionPassword = false; |
| 110 | + |
105 | 111 | // Leave this off by default until it works right |
106 | 112 | $wgCodeReviewENotif = false; |
Index: trunk/extensions/CodeReview/Subversion.php |
— | — | @@ -98,7 +98,8 @@ |
99 | 99 | if( $rev ) |
100 | 100 | $path .= "@$rev"; |
101 | 101 | $command = sprintf( |
102 | | - "svn cat %s", |
| 102 | + "svn cat %s %s", |
| 103 | + $this->getExtraArgs(), |
103 | 104 | wfEscapeShellArg( $this->mRepo . $path ) ); |
104 | 105 | |
105 | 106 | return wfShellExec( $command ); |
— | — | @@ -106,9 +107,10 @@ |
107 | 108 | |
108 | 109 | function getDiff( $path, $rev1, $rev2 ) { |
109 | 110 | $command = sprintf( |
110 | | - "svn diff -r%d:%d %s", |
| 111 | + "svn diff -r%d:%d %s %s", |
111 | 112 | intval( $rev1 ), |
112 | 113 | intval( $rev2 ), |
| 114 | + $this->getExtraArgs(), |
113 | 115 | wfEscapeShellArg( $this->mRepo . $path ) ); |
114 | 116 | |
115 | 117 | return wfShellExec( $command ); |
— | — | @@ -116,9 +118,10 @@ |
117 | 119 | |
118 | 120 | function getLog( $path, $startRev=null, $endRev=null ) { |
119 | 121 | $command = sprintf( |
120 | | - "svn log -v -r%s:%s --non-interactive %s", |
| 122 | + "svn log -v -r%s:%s --non-interactive %s %s", |
121 | 123 | wfEscapeShellArg( $this->_rev( $startRev, 'BASE' ) ), |
122 | 124 | wfEscapeShellArg( $this->_rev( $endRev, 'HEAD' ) ), |
| 125 | + $this->getExtraArgs(), |
123 | 126 | wfEscapeShellArg( $this->mRepo . $path ) ); |
124 | 127 | |
125 | 128 | $lines = explode( "\n", wfShellExec( $command ) ); |
— | — | @@ -210,8 +213,9 @@ |
211 | 214 | |
212 | 215 | function getDirList( $path, $rev = null ) { |
213 | 216 | $command = sprintf( |
214 | | - "svn list --xml -r%s --non-interactive %s", |
| 217 | + "svn list --xml -r%s --non-interactive %s %s", |
215 | 218 | wfEscapeShellArg( $this->_rev( $rev, 'HEAD' ) ), |
| 219 | + $this->getExtraArgs(), |
216 | 220 | wfEscapeShellArg( $this->mRepo . $path ) ); |
217 | 221 | $document = new DOMDocument(); |
218 | 222 | |
— | — | @@ -252,6 +256,18 @@ |
253 | 257 | } |
254 | 258 | return $result; |
255 | 259 | } |
| 260 | + |
| 261 | + /** |
| 262 | + * Returns a string of extra arguments to be passed into the shell commands |
| 263 | + */ |
| 264 | + private function getExtraArgs() { |
| 265 | + global $wgSubversionUser, $wgSubversionPassword; |
| 266 | + if($wgSubversionUser && $wgSubversionPassword) { |
| 267 | + return '--username ' . wfEscapeShellArg($wgSubversionUser) |
| 268 | + . ' --password ' . wfEscapeShellArg($wgSubversionPassword); |
| 269 | + } |
| 270 | + return ''; |
| 271 | + } |
256 | 272 | } |
257 | 273 | |
258 | 274 | /** |