https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113549

Revision: 113549
Author:   reedy
Date:     2012-03-09 23:53:10 +0000 (Fri, 09 Mar 2012)
Log Message:
-----------
Code documentation

Some code simplification

Remove trailing whitespace

Remove someone unused variables

Modified Paths:
--------------
    trunk/extensions/ExtensionDistributor/ExtensionDistributor_body.php
    trunk/extensions/ExtensionDistributor/svn-invoker.php

Modified: trunk/extensions/ExtensionDistributor/ExtensionDistributor_body.php
===================================================================
--- trunk/extensions/ExtensionDistributor/ExtensionDistributor_body.php 
2012-03-09 23:33:42 UTC (rev 113548)
+++ trunk/extensions/ExtensionDistributor/ExtensionDistributor_body.php 
2012-03-09 23:53:10 UTC (rev 113549)
@@ -12,6 +12,9 @@
                parent::__construct( 'ExtensionDistributor' );
        }
 
+       /**
+        * @param $subpage string
+        */
        public function execute( $subpage ) {
                global $wgExtDistTarDir, $wgExtDistWorkingCopy, $wgOut, 
$wgRequest;
 
@@ -60,6 +63,9 @@
                $this->doDownload( $extension, $version );
        }
 
+       /**
+        * @return bool
+        */
        protected function getExtensionList() {
                global $wgExtDistWorkingCopy, $wgExtDistBranches;
 
@@ -101,6 +107,10 @@
                return $this->extensionList;
        }
 
+       /**
+        * @param $path string
+        * @return bool|String
+        */
        protected function getBranchName( $path ) {
                global $wgExtDistBranches;
 
@@ -150,6 +160,10 @@
                );
        }
 
+       /**
+        * @param $extensionName string
+        * @return mixed
+        */
        protected function showVersionSelector( $extensionName ) {
                global $wgOut, $wgExtDistBranches;
 
@@ -201,6 +215,10 @@
                );
        }
 
+       /**
+        * @param $extension string
+        * @param $version string
+        */
        protected function doDownload( $extension, $version ) {
                global $wgExtDistWorkingCopy, $wgExtDistTarDir, 
$wgExtDistBranches,
                        $wgOut, $wgExtDistTarUrl, $wgExtDistRemoteClient;
@@ -265,6 +283,11 @@
                header( 'Refresh: 5;url=' . $url );
        }
 
+       /**
+        * @param $extension string
+        * @param $version string
+        * @return bool|string
+        */
        protected function updateAndGetRevisionLocal( $extension, $version ) {
                global $wgExtDistWorkingCopy, $wgOut;
 
@@ -302,6 +325,11 @@
                return $rev;
        }
 
+       /**
+        * @param $extension string
+        * @param $version string
+        * @return bool|string
+        */
        protected function updateAndGetRevisionRemote( $extension, $version ) {
                global $wgExtDistRemoteClient, $wgOut;
 

Modified: trunk/extensions/ExtensionDistributor/svn-invoker.php
===================================================================
--- trunk/extensions/ExtensionDistributor/svn-invoker.php       2012-03-09 
23:33:42 UTC (rev 113548)
+++ trunk/extensions/ExtensionDistributor/svn-invoker.php       2012-03-09 
23:53:10 UTC (rev 113549)
@@ -20,13 +20,19 @@
 
 svnExecute();
 
+/**
+ * @param $s string
+ * @return bool
+ */
 function svnValidate( $s ) {
-       if ( strpos( $s, '..' ) !== false ) {
-               return false;
-       }
-       return true;
+       return strpos( $s, '..' ) === false;
 }
 
+/**
+ * @param $cmd
+ * @param $retval
+ * @return string
+ */
 function svnShellExec( $cmd, &$retval ) {
        $retval = 1; // error by default?
        ob_start();
@@ -36,6 +42,10 @@
        return $output;
 }
 
+/**
+ * @param $msg
+ * @param bool $info
+ */
 function svnError( $msg, $info = false ) {
        echo json_encode( array( 'error' => $msg, 'errorInfo' => $info ) );
 }
@@ -67,7 +77,6 @@
                }
                $timeout = 3;
                for ( $i = 0; $i < $timeout; $i++ ) {
-                       $wouldBlock = false;
                        if ( flock( $lockFile, LOCK_EX | LOCK_NB ) ) {
                                break;
                        }
@@ -100,13 +109,13 @@
        if ( !$localRev ) {
                return;
        }
-               
+
        // Determine last changed revision in the repo
        $remoteRev = svnGetRev( $remoteDir );
        if ( !$remoteRev ) {
                return;
        }
-       
+
        if ( $remoteRev != $localRev ) {
                // Bad luck, we need to svn up
                $cmd = "svn up --non-interactive " . escapeshellarg( $dir ) . " 
2>&1";
@@ -117,15 +126,19 @@
                        return;
                }
        }
-       
+
        echo json_encode( array( 'revision' => $remoteRev ) );
 }
 
-// Returns the last changed revision or false
-// @param $dir Path or url of the folder
-// Output param $url Remote location of the folder
+/**
+ * Returns the last changed revision or false
+ *
+ * @param $dir string
+ * @param $url null|string Output param $url Remote location of the folder
+ * @return bool|string
+ */
 function svnGetRev( $dir, &$url = null ) {
-       
+
        $cmd = "svn info --non-interactive --xml " . escapeshellarg( $dir );
        $retval = - 1;
        $result = svnShellExec( $cmd, $retval );
@@ -145,6 +158,6 @@
                svnError( 'extdist-svn-parse-error', $result );
                return false;
        }
-       
+
        return $rev;
 }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to