From f5ebacbe2588eefdaeb6dae55b44e3fca7c5883e Mon Sep 17 00:00:00 2001 From: RazeSoldier Date: Thu, 25 Jan 2018 12:58:06 +0800 Subject: [PATCH 1/1] Convert the sha1 value from base-36 to base-16 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 | 2 +- includes/actions/InfoAction.php | 3 ++- languages/i18n/qqq.json | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31 index 5e14aeed83..6a10a86a07 100644 --- a/RELEASE-NOTES-1.31 +++ b/RELEASE-NOTES-1.31 @@ -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 === diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index 3d3340600b..1165a268ef 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -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 diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 6621e72a4f..0aecf83ade 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -3249,7 +3249,7 @@ "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}}", -- 2.20.1