build: Upgrade mediawiki-codesniffer from 26.0.0 to 28.0.0
[lhc/web/wiklou.git] / includes / filerepo / LocalRepo.php
index 5ed937f..84c0a61 100644 (file)
@@ -32,6 +32,7 @@ use Wikimedia\Rdbms\IDatabase;
  * in the wiki's own database. This is the most commonly used repository class.
  *
  * @ingroup FileRepo
+ * @method LocalFile|null newFile( $title, $time = false )
  */
 class LocalRepo extends FileRepo {
        /** @var callable */
@@ -180,7 +181,11 @@ class LocalRepo extends FileRepo {
         * @return string
         */
        public static function getHashFromKey( $key ) {
-               return strtok( $key, '.' );
+               $sha1 = strtok( $key, '.' );
+               if ( is_string( $sha1 ) && strlen( $sha1 ) === 32 && $sha1[0] === '0' ) {
+                       $sha1 = substr( $sha1, 1 );
+               }
+               return $sha1;
        }
 
        /**