Convert the sha1 value from base-36 to base-16
authorRazeSoldier <liguangjie4399@hotmail.com>
Thu, 25 Jan 2018 04:58:06 +0000 (12:58 +0800)
committer星耀晨曦 <razesoldier@outlook.com>
Thu, 25 Jan 2018 19:34:51 +0000 (19:34 +0000)
Convert the sha1 value displayed on the file info page from base-36 to
base-16

Bug: T181651
Change-Id: I39d6d5d68973c9e67959b2bbbe77937f4ccca76a

RELEASE-NOTES-1.31
includes/actions/InfoAction.php
languages/i18n/qqq.json

index 5e14aee..6a10a86 100644 (file)
@@ -42,7 +42,7 @@ production.
   the ParserOutput::getText() post-cache transformations.
 * Added a hook, UploadForm:getInitialPageText, to allow extensions to alter the
   initial page text for file uploads.
-* (T181651) The info page for File pages now displays the file's base-36 SHA1
+* (T181651) The info page for File pages now displays the file's base-16 SHA1
   hash value in the table of basic information.
 
 === External library changes in 1.31 ===
index 3d33406..1165a26 100644 (file)
@@ -441,7 +441,8 @@ class InfoAction extends FormlessAction {
                if ( $title->inNamespace( NS_FILE ) ) {
                        $fileObj = wfFindFile( $title );
                        if ( $fileObj !== false ) {
-                               $output = $fileObj->getSha1();
+                               // Convert the base-36 sha1 value obtained from database to base-16
+                               $output = Wikimedia\base_convert( $fileObj->getSha1(), 36, 16, 40 );
                                $pageInfo['header-basic'][] = [
                                        $this->msg( 'pageinfo-file-hash' ),
                                        $output
index 6621e72..0aecf83 100644 (file)
        "pageinfo-category-subcats": "See also:\n* {{msg-mw|Pageinfo-category-pages}}\n* {{msg-mw|Pageinfo-category-files}}",
        "pageinfo-category-files": "See also:\n* {{msg-mw|Pageinfo-category-pages}}\n* {{msg-mw|Pageinfo-category-subcats}}",
        "pageinfo-user-id": "The numeric ID for a user\n{{Identical|User ID}}",
-       "pageinfo-file-hash": "Base-36 SHA-1 value of the file",
+       "pageinfo-file-hash": "Base-16 SHA-1 value of the file",
        "markaspatrolleddiff": "{{doc-actionlink}}\nSee also:\n* {{msg-mw|Markaspatrolledtext}}\n{{Identical|Mark as patrolled}}",
        "markaspatrolledlink": "{{notranslate}}\nParameters:\n* $1 - link which has text {{msg-mw|Markaspatrolledtext}}",
        "markaspatrolledtext": "{{doc-actionlink}}\nSee also:\n* {{msg-mw|Markaspatrolleddiff}}",