Translated using Weblate (Chinese (Traditional))
[phpmyadmin.git] / libraries / display_git_revision.lib.php
bloba57022b0ccc6d95ef201bd6dcec78fcee6346cd9
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Displays form for password change
6 * @package PhpMyAdmin
7 */
8 use PMA\libraries\Response;
10 /**
11 * Prints details about the current Git commit revision
13 * @return void
15 function PMA_printGitRevision()
17 if (! $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT')) {
18 $response = Response::getInstance();
19 $response->setRequestStatus(false);
20 return;
23 // load revision data from repo
24 $GLOBALS['PMA_Config']->checkGitRevision();
26 // if using a remote commit fast-forwarded, link to GitHub
27 $commit_hash = substr(
28 $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_COMMITHASH'),
32 $commit_hash = '<strong title="'
33 . htmlspecialchars($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_MESSAGE'))
34 . '">' . $commit_hash . '</strong>';
35 if ($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_ISREMOTECOMMIT')) {
36 $commit_hash = '<a href="'
37 . PMA_linkURL(
38 'https://github.com/phpmyadmin/phpmyadmin/commit/'
39 . $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_COMMITHASH')
41 . '" rel="noopener noreferrer" target="_blank">' . $commit_hash . '</a>';
44 $branch = $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_BRANCH');
45 if ($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_ISREMOTEBRANCH')) {
46 $branch = '<a href="'
47 . PMA_linkURL(
48 'https://github.com/phpmyadmin/phpmyadmin/tree/'
49 . $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_BRANCH')
51 . '" rel="noopener noreferrer" target="_blank">' . $branch . '</a>';
53 if ($branch !== false) {
54 $branch = sprintf(__('%1$s from %2$s branch'), $commit_hash, $branch);
55 } else {
56 $branch = $commit_hash . ' (' . __('no branch') . ')';
59 $committer = $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_COMMITTER');
60 $author = $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_AUTHOR');
61 PMA_printListItem(
62 __('Git revision:') . ' '
63 . $branch . ',<br /> '
64 . sprintf(
65 __('committed on %1$s by %2$s'),
66 PMA\libraries\Util::localisedDate(strtotime($committer['date'])),
67 '<a href="' . PMA_linkURL(
68 'mailto:' . htmlspecialchars($committer['email'])
69 ) . '">'
70 . htmlspecialchars($committer['name']) . '</a>'
72 . ($author != $committer
73 ? ', <br />'
74 . sprintf(
75 __('authored on %1$s by %2$s'),
76 PMA\libraries\Util::localisedDate(strtotime($author['date'])),
77 '<a href="' . PMA_linkURL(
78 'mailto:' . htmlspecialchars($author['email'])
79 ) . '">'
80 . htmlspecialchars($author['name']) . '</a>'
82 : ''),
83 'li_pma_version_git', null, null, null