Wikinaut has uploaded a new change for review.
https://gerrit.wikimedia.org/r/59373
Change subject: (bug 47264) Show date of last time updates where checked in
special version
......................................................................
(bug 47264) Show date of last time updates where checked in special version
Change-Id: Ic852bf89c558835315a11814d523a858b733e09c
---
M includes/GitInfo.php
M includes/specials/SpecialVersion.php
2 files changed, 37 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/73/59373/2
diff --git a/includes/GitInfo.php b/includes/GitInfo.php
index bf3bff7..e925318 100644
--- a/includes/GitInfo.php
+++ b/includes/GitInfo.php
@@ -147,6 +147,35 @@
}
/**
+ * Return the last local (reflog) update date of HEAD entry of the git
code repository
+ *
+ * @return int|bool Last local update date (UNIX timestamp) or false
+ */
+ public function getLocalUpdateDate() {
+ global $wgGitBin;
+
+ if ( !is_file( $wgGitBin ) || !is_executable( $wgGitBin ) ) {
+ return false;
+ }
+
+ $environment = array( "GIT_DIR" => $this->basedir );
+ $cmd = wfEscapeShellArg( $wgGitBin ) . " reflog --date=raw |
head -1";
+ $retc = false;
+ $out = wfShellExec( $cmd, $retc, $environment );
+
+ if ( $retc !== 0 ) {
+ return false;
+ } else {
+ if ( preg_match( "!\{(\d+) [+-\d]+\}!", $out, $res ) ) {
+ return (int)$res[1];
+ } else {
+ return false;
+ }
+ }
+
+ }
+
+ /**
* Return the name of the current branch, or HEAD if not found
* @return string The branch name, HEAD, or false
*/
diff --git a/includes/specials/SpecialVersion.php
b/includes/specials/SpecialVersion.php
index d375316..38c57bc 100644
--- a/includes/specials/SpecialVersion.php
+++ b/includes/specials/SpecialVersion.php
@@ -294,8 +294,12 @@
}
$gitHeadCommitDate = $gitInfo->getHeadCommitDate();
+ $gitLocalUpdateDate = $gitInfo->getLocalUpdateDate();
if ( $gitHeadCommitDate ) {
$shortSHA1 .= "<br/>" . $wgLang->timeanddate(
$gitHeadCommitDate, true );
+ }
+ if ( $gitLocalUpdateDate ) {
+ $shortSHA1 .= "<br/>" . $wgLang->timeanddate(
$gitLocalUpdateDate, true );
}
return self::getwgVersionLinked() . " $shortSHA1";
@@ -485,9 +489,13 @@
$vcsText = "[$gitViewerUrl $vcsText]";
}
$gitHeadCommitDate =
$gitInfo->getHeadCommitDate();
+ $gitLocalUpdateDate =
$gitInfo->getLocalUpdateDate();
if ( $gitHeadCommitDate ) {
$vcsText .= "<br/>" .
$wgLang->timeanddate( $gitHeadCommitDate, true );
}
+ if ( $gitLocalUpdateDate ) {
+ $vcsText .= "<br/>" .
$wgLang->timeanddate( $gitLocalUpdateDate, true );
+ }
} else {
$svnInfo = self::getSvnInfo( dirname(
$extension['path'] ) );
# Make subversion text/link.
--
To view, visit https://gerrit.wikimedia.org/r/59373
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic852bf89c558835315a11814d523a858b733e09c
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Wikinaut <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits