r113369 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113368‎ | r113369 | r113370 >
Date:16:35, 8 March 2012
Author:reedy
Status:ok
Tags:
Comment:
Fix all trailing whitespace
Modified paths:
  • /trunk/extensions/ExtensionDistributor/ExtensionDistributor_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ExtensionDistributor/ExtensionDistributor_body.php
@@ -2,7 +2,7 @@
33
44 /**
55 * Special page that allows users to download extensions as tar archives.
6 - *
 6+ *
77 * @author Tim Starling
88 */
99 class ExtensionDistributorPage extends SpecialPage {
@@ -24,17 +24,17 @@
2525
2626 if ( $subpage ) {
2727 $parts = explode( '/', $subpage, 2 );
28 -
 28+
2929 if ( count( $parts ) == 1 ) {
3030 $parts[] = false;
3131 }
32 -
 32+
3333 list( $extension, $version ) = $parts;
3434 } else {
3535 $extension = $wgRequest->getVal( 'extdist_extension' );
3636 $version = $wgRequest->getVal( 'extdist_version' );
3737 }
38 -
 38+
3939 if ( !$extension ) {
4040 $this->showExtensionSelector();
4141 return;
@@ -68,46 +68,46 @@
6969 }
7070
7171 $this->extensionList = array();
72 -
 72+
7373 foreach ( $wgExtDistBranches as $branchPath => $branch ) {
7474 $wc = "$wgExtDistWorkingCopy/$branchPath/extensions";
7575 $dir = opendir( $wc );
76 -
 76+
7777 if ( !$dir ) {
7878 return false;
7979 }
8080
8181 $this->extensionList[$branchPath] = array();
82 -
 82+
8383 while ( false !== ( $file = readdir( $dir ) ) ) {
8484 if ( substr( $file, 0, 1 ) == '.' ) {
8585 continue;
8686 }
87 -
 87+
8888 if ( !is_dir( "$wc/$file" ) ) {
8989 continue;
9090 }
91 -
 91+
9292 if ( file_exists( "$wc/$file/NO-DIST" ) ) {
9393 continue;
9494 }
95 -
 95+
9696 $this->extensionList[$branchPath][] = $file;
9797 }
98 -
 98+
9999 natcasesort( $this->extensionList[$branchPath] );
100100 }
101 -
 101+
102102 return $this->extensionList;
103103 }
104104
105105 protected function getBranchName( $path ) {
106106 global $wgExtDistBranches;
107 -
 107+
108108 if ( !isset( $wgExtDistBranches[$path] ) ) {
109109 return false;
110110 }
111 -
 111+
112112 if ( isset( $wgExtDistBranches[$path]['msgName'] ) ) {
113113 return wfMsg( $wgExtDistBranches[$path]['msgName'] );
114114 } else {
@@ -119,12 +119,12 @@
120120 global $wgOut;
121121
122122 $extensions = $this->getExtensionList();
123 -
 123+
124124 if ( $extensions === false ) {
125125 $wgOut->addWikiMsg( 'extdist-wc-missing' );
126126 return;
127127 }
128 -
 128+
129129 if ( !$extensions['trunk'] ) {
130130 $wgOut->addWikiMsg( 'extdist-wc-empty' );
131131 return;
@@ -152,11 +152,11 @@
153153
154154 protected function showVersionSelector( $extensionName ) {
155155 global $wgOut, $wgExtDistBranches;
156 -
 156+
157157 $extensions = $this->getExtensionList();
158158
159159 $versions = array();
160 -
 160+
161161 foreach ( $wgExtDistBranches as $branchPath => $branch ) {
162162 if ( !in_array( $extensionName, $extensions[$branchPath] ) ) {
163163 continue;
@@ -167,7 +167,7 @@
168168 } else {
169169 $branchName = $branch['name'];
170170 }
171 -
 171+
172172 $versions[$branchPath] = $branchName;
173173 }
174174
@@ -185,15 +185,15 @@
186186 Xml::element( 'input' , array( 'type' => 'hidden',
187187 'name' => 'extdist_extension', 'value' => $extensionName ) ) .
188188 "<select name=\"extdist_version\">\n" );
189 -
 189+
190190 $selected = 0;
191 -
 191+
192192 foreach ( $versions as $branchPath => $branchName ) {
193193 $wgOut->addHTML( Xml::option( $branchName, $branchPath, ($selected == 1) ) );
194 -
 194+
195195 $selected++;
196196 }
197 -
 197+
198198 $wgOut->addHTML(
199199 Xml::closeElement( 'select' ) . ' ' .
200200 Xml::submitButton( wfMsg( 'extdist-submit-version' ), array( 'name' => 'extdist_submit' ) ) .
@@ -210,7 +210,7 @@
211211 } else {
212212 $rev = $this->updateAndGetRevisionLocal( $extension, $version );
213213 }
214 -
 214+
215215 if ( $rev === false ) {
216216 // Error already displayed
217217 return;
@@ -241,10 +241,10 @@
242242 ' ' . wfEscapeShellArg( $extension ) .
243243 ( $needEF ? ' ExtensionFunctions.php' : '' ) .
244244 ' 2>&1';
245 -
 245+
246246 $retval = - 1;
247247 $result = wfShellExec( $cmd, $retval );
248 -
 248+
249249 if ( $retval ) {
250250 $wgOut->addWikiMsg( 'extdist-tar-error', $retval );
251251 $wgOut->addHTML( '<pre>' . htmlspecialchars( $result ) . '</pre>' );
@@ -267,15 +267,15 @@
268268
269269 protected function updateAndGetRevisionLocal( $extension, $version ) {
270270 global $wgExtDistWorkingCopy, $wgOut;
271 -
 271+
272272 // svn up
273273 $dir = "$wgExtDistWorkingCopy/$version/extensions/$extension";
274 -
 274+
275275 $cmd = "svn up --non-interactive " . wfEscapeShellArg( $dir ) . " 2>&1";
276276 $retval = - 1;
277 -
 277+
278278 $result = wfShellExec( $cmd, $retval );
279 -
 279+
280280 if ( $retval ) {
281281 $wgOut->addWikiMsg( 'extdist-svn-error', $result );
282282 return false;
@@ -285,7 +285,7 @@
286286 $cmd = "svn info --non-interactive --xml " . wfEscapeShellArg( $dir );
287287 $retval = - 1;
288288 $result = wfShellExec( $cmd, $retval );
289 -
 289+
290290 if ( $retval ) {
291291 $wgOut->addWikiMsg( 'extdist-svn-error', $result );
292292 return false;
@@ -293,7 +293,7 @@
294294
295295 $sx = new SimpleXMLElement( $result );
296296 $rev = $sx->entry->commit['revision'];
297 -
 297+
298298 if ( !$rev || strpos( $rev, '/' ) !== false || strpos( $rev, "\000" ) !== false ) {
299299 $wgOut->addWikiMsg( 'extdist-svn-parse-error', $result );
300300 return false;
@@ -304,14 +304,14 @@
305305
306306 protected function updateAndGetRevisionRemote( $extension, $version ) {
307307 global $wgExtDistRemoteClient, $wgOut;
308 -
 308+
309309 $cmd = json_encode( array( 'extension' => $extension, 'version' => $version ) );
310310 $cmd = str_replace( "\000", '', $cmd );
311 -
 311+
312312 list( $host, $port ) = explode( ':', $wgExtDistRemoteClient, 2 );
313 -
 313+
314314 $sock = fsockopen( $host, $port );
315 -
 315+
316316 if ( !$sock ) {
317317 $wgOut->addWikiMsg( 'extdist-no-remote' );
318318 return false;
@@ -324,21 +324,21 @@
325325 $encResponse .= fread( $sock, 8192 );
326326 }
327327 fclose( $sock );
328 -
 328+
329329 $response = json_decode( $encResponse );
330 -
 330+
331331 if ( isset( $response->error ) ) {
332332 $info = isset( $response->errorInfo ) ? $response->errorInfo : '';
333333 $wgOut->addWikiMsg( $response->error, $info );
334334 return false;
335335 }
336 -
 336+
337337 if ( !isset( $response->revision ) ) {
338338 $wgOut->addWikiMsg( 'extdist-remote-invalid-response' );
339339 return false;
340340 }
341 -
 341+
342342 return $response->revision;
343343 }
344 -
 344+
345345 }
\ No newline at end of file

Status & tagging log