Merge "Fix a rather fatal typo in rebuildrecentchanges.php"
[lhc/web/wiklou.git] / includes / api / ApiStashEdit.php
index a3e3e57..17c8040 100644 (file)
@@ -174,6 +174,7 @@ class ApiStashEdit extends ApiBase {
 
                $title = $page->getTitle();
                $key = self::getStashKey( $title, self::getContentHash( $content ), $user );
+               $fname = __METHOD__;
 
                // Use the master DB to allow for fast blocking locks on the "save path" where this
                // value might actually be used to complete a page edit. If the edit submission request
@@ -182,13 +183,13 @@ class ApiStashEdit extends ApiBase {
                // need to duplicate parsing of the same content/user/summary bundle, so try to avoid
                // blocking at all here.
                $dbw = wfGetDB( DB_MASTER );
-               if ( !$dbw->lock( $key, __METHOD__, 0 ) ) {
+               if ( !$dbw->lock( $key, $fname, 0 ) ) {
                        // De-duplicate requests on the same key
                        return self::ERROR_BUSY;
                }
                /** @noinspection PhpUnusedLocalVariableInspection */
-               $unlocker = new ScopedCallback( function () use ( $dbw, $key ) {
-                       $dbw->unlock( $key, __METHOD__ );
+               $unlocker = new ScopedCallback( function () use ( $dbw, $key, $fname ) {
+                       $dbw->unlock( $key, $fname );
                } );
 
                $cutoffTime = time() - self::PRESUME_FRESH_TTL_SEC;
@@ -234,6 +235,7 @@ class ApiStashEdit extends ApiBase {
                                        return self::ERROR_CACHE;
                                }
                        } else {
+                               // @todo Doesn't seem reachable, see @todo in buildStashValue
                                $logger->info( "Uncacheable parser output for key '{cachekey}' ('{title}') [{code}].",
                                        [ 'cachekey' => $key, 'title' => $titleStr, 'code' => $code ] );
                                return self::ERROR_UNCACHEABLE;
@@ -410,6 +412,9 @@ class ApiStashEdit extends ApiBase {
                }
 
                if ( $ttl <= 0 ) {
+                       // @todo It doesn't seem like this can occur, because it would mean an entry older than
+                       // getCacheExpiry() seconds, which is much longer than PRESUME_FRESH_TTL_SEC, and
+                       // anything older than PRESUME_FRESH_TTL_SEC will have been thrown out already.
                        return [ null, 0, 'no_ttl' ];
                }