Merge "mwdocgen.php: Exit with exit code of passthru(doxygen)"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 15 Mar 2013 07:57:14 +0000 (07:57 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 15 Mar 2013 07:57:14 +0000 (07:57 +0000)
includes/cache/MessageCache.php
includes/upload/UploadFromChunks.php
maintenance/mwdocgen.php

index 6e9d413..7425978 100644 (file)
@@ -327,31 +327,39 @@ class MessageCache {
                        $where[] = 'cache is empty';
                        $where[] = 'loading from database';
 
-                       $this->lock( $cacheKey );
+                       if ( $this->lock( $cacheKey ) ) {
+                               $that = $this;
+                               $osc = new ScopedCallback( function() use ( $that, $cacheKey ) {
+                                       $that->unlock( $cacheKey );
+                               } );
+                       }
                        # Limit the concurrency of loadFromDB to a single process
                        # This prevents the site from going down when the cache expires
                        $statusKey = wfMemcKey( 'messages', $code, 'status' );
                        $success = $this->mMemc->add( $statusKey, 'loading', MSG_LOAD_TIMEOUT );
                        if ( $success ) { // acquired lock
+                               $cache = $this->mMemc;
+                               $isc = new ScopedCallback( function() use ( $cache, $statusKey ) {
+                                       $cache->delete( $statusKey );
+                               } );
                                $cache = $this->loadFromDB( $code );
                                $success = $this->setCache( $cache, $code );
                                if ( $success ) { // messages loaded
                                        $success = $this->saveToCaches( $cache, true, $code );
-                                       if ( $success ) {
-                                               $this->mMemc->delete( $statusKey );
-                                       } else {
+                                       $isc = null; // unlock
+                                       if ( !$success ) {
                                                $this->mMemc->set( $statusKey, 'error', 60 * 5 );
                                                wfDebug( __METHOD__ . ": set() error: restart memcached server!\n" );
                                                $exception = new MWException( "Could not save cache for '$code'." );
                                        }
                                } else {
-                                       $this->mMemc->delete( $statusKey );
+                                       $isc = null; // unlock
                                        $exception = new MWException( "Could not load cache from DB for '$code'." );
                                }
                        } else {
                                $exception = new MWException( "Could not acquire '$statusKey' lock." );
                        }
-                       $this->unlock( $cacheKey );
+                       $osc = null; // unlock
                }
 
                if ( !$success ) {
index fb0c786..e784e51 100644 (file)
@@ -66,7 +66,7 @@ class UploadFromChunks extends UploadFromFile {
         *
         * @return UploadStashFile stashed file
         */
-       public function stashFile() {
+       public function stashFile( User $user = null ) {
                // Stash file is the called on creating a new chunk session:
                $this->mChunkIndex = 0;
                $this->mOffset = 0;
index 4e41a0d..4fad7a7 100644 (file)
@@ -63,6 +63,8 @@ $doxygenInputFilter = "php {$mwPath}maintenance/mwdoc-filter.php";
 /** where Phpdoc should output documentation */
 $doxyOutput = $mwPath . 'docs' . DIRECTORY_SEPARATOR ;
 
+$doxyVersion = 'master';
+
 /** MediaWiki subpaths */
 $mwPathI = $mwPath . 'includes/';
 $mwPathL = $mwPath . 'languages/';
@@ -164,6 +166,12 @@ if ( is_array( $argv ) ) {
                                $doxyOutput = realpath( $argv[$i] );
                        }
                        break;
+               case '--version':
+                       $i++;
+                       if ( isset( $argv[$i] ) ) {
+                               $doxyVersion = $argv[$i];
+                       }
+                       break;
                case '--generate-man':
                        $doxyGenerateMan = true;
                        break;
@@ -183,8 +191,9 @@ Commands:
 If no command is given, you will be prompted.
 
 Other options:
-    --output <dir>  Set output directory (default $doxyOutput)
+    --output <dir>  Set output directory (default: $doxyOutput)
     --generate-man  Generates man page documentation
+    --version       Project version to display in the outut (default: $doxyVersion)
     --help          Show this help and exit.
 
 
@@ -234,14 +243,11 @@ case 6:
        $excludePatterns = 'extensions';
 }
 
-// @todo FIXME to work on git
-$version = 'master';
-
 // Generate path exclusions
 $excludedPaths = $mwPath . join( " $mwPath", $mwExcludePaths );
 print "EXCLUDE: $excludedPaths\n\n";
 
-$generatedConf = generateConfigFile( $doxygenTemplate, $doxyOutput, $mwPath, $version, $input, $excludedPaths, $excludePatterns, $doxyGenerateMan, $doxygenInputFilter );
+$generatedConf = generateConfigFile( $doxygenTemplate, $doxyOutput, $mwPath, $doxyVersion, $input, $excludedPaths, $excludePatterns, $doxyGenerateMan, $doxygenInputFilter );
 $command = $doxygenBin . ' ' . $generatedConf;
 
 echo <<<TEXT