From: Aaron Date: Tue, 15 May 2012 20:05:46 +0000 (-0700) Subject: [FileBackend] Avoid infinite loops when populating missing metadata in Swift. X-Git-Tag: 1.31.0-rc.0~23600^2 X-Git-Url: http://git.cyclocoop.org/%27.parametre_url%28%20%20%20generer_action_auteur%28%27charger_plugin%27%2C%20%27update_flux%27%29%2C%27update_flux%27%2C%20%27oui%27%29.%27?a=commitdiff_plain;h=634c3be2bba6a46e28aa997d7ab388ebf90b36a6;p=lhc%2Fweb%2Fwiklou.git [FileBackend] Avoid infinite loops when populating missing metadata in Swift. Change-Id: Ief13048256ee11caf3494d934eb5267f5eb71e8b --- diff --git a/includes/filerepo/backend/SwiftFileBackend.php b/includes/filerepo/backend/SwiftFileBackend.php index 0def61fc04..1eb8a34b0a 100644 --- a/includes/filerepo/backend/SwiftFileBackend.php +++ b/includes/filerepo/backend/SwiftFileBackend.php @@ -612,7 +612,8 @@ class SwiftFileBackend extends FileBackendStore { $status = Status::newGood(); $scopeLockS = $this->getScopedFileLocks( array( $path ), LockManager::LOCK_UW, $status ); if ( $status->isOK() ) { - $tmpFile = $this->getLocalCopy( array( 'src' => $path, 'latest' => 1 ) ); + # Do not stat the file in getLocalCopy() to avoid infinite loops + $tmpFile = $this->getLocalCopy( array( 'src' => $path, 'latest' => 1, 'nostat' => 1 ) ); if ( $tmpFile ) { $hash = $tmpFile->getSha1Base36(); if ( $hash !== false ) { @@ -848,7 +849,8 @@ class SwiftFileBackend extends FileBackendStore { return null; } - if ( !$this->fileExists( $params ) ) { + # Check the recursion guard to avoid loops when filling metadata + if ( empty( $params['nostat'] ) && !$this->fileExists( $params ) ) { return null; }