filebackend: Add normalization for stat errors
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 4 Oct 2018 18:54:36 +0000 (19:54 +0100)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 4 Oct 2018 23:00:48 +0000 (23:00 +0000)
Bug: T205567
Change-Id: I75f1eb6dc2cbff0ea0dc0706cca0ad79c54fc612

includes/libs/filebackend/FileBackendStore.php

index e2d56b0..0403725 100644 (file)
@@ -663,9 +663,13 @@ abstract class FileBackendStore extends FileBackend {
                        $this->cheapCache->setField( $path, 'stat', $latest ? 'NOT_EXIST_LATEST' : 'NOT_EXIST' );
                        $this->cheapCache->setField( $path, 'xattr', [ 'map' => false, 'latest' => $latest ] );
                        $this->cheapCache->setField( $path, 'sha1', [ 'hash' => false, 'latest' => $latest ] );
-                       $this->logger->debug( __METHOD__ . ": File $path does not exist.\n" );
+                       $this->logger->debug( __METHOD__ . ': File {path} does not exist', [
+                               'path' => $path,
+                       ] );
                } else { // an error occurred
-                       $this->logger->warning( __METHOD__ . ": Could not stat file $path.\n" );
+                       $this->logger->warning( __METHOD__ . ': Could not stat file {path}', [
+                               'path' => $path,
+                       ] );
                }
 
                return $stat;
@@ -1341,10 +1345,14 @@ abstract class FileBackendStore extends FileBackend {
                                        [ 'map' => false, 'latest' => $latest ] );
                                $this->cheapCache->setField( $path, 'sha1',
                                        [ 'hash' => false, 'latest' => $latest ] );
-                               $this->logger->debug( __METHOD__ . ": File $path does not exist.\n" );
+                               $this->logger->debug( __METHOD__ . ': File {path} does not exist', [
+                                       'path' => $path,
+                               ] );
                        } else { // an error occurred
                                $success = false;
-                               $this->logger->warning( __METHOD__ . ": Could not stat file $path.\n" );
+                               $this->logger->warning( __METHOD__ . ': Could not stat file {path}', [
+                                       'path' => $path,
+                               ] );
                        }
                }