Ori.livneh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/51636
Change subject: Remove Git SHA1 logging functionality
......................................................................
Remove Git SHA1 logging functionality
It's a bit out-of-scope for EventLogging to be mucking about the call stack and
file paths. My initial enthusiasm for the idea has waned. If we got serious
about adding this functionality, we should do it the Right Way: by improving
GitInfo.php in core (it should be able to search up a path for a .git dir, for
example). If we went that route and reached a point at which adding this
information to server-side events could be done simply and reliably by invoking
functionality in core, I'd be interested in re-introducing it. But it's just
too much stuff to pile into EventLogging.
Change-Id: I6fb205830eb21a05a8f5d4594ad875468cb78377
---
M EventLogging.php
1 file changed, 0 insertions(+), 47 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EventLogging
refs/changes/36/51636/1
diff --git a/EventLogging.php b/EventLogging.php
index 121d09e..2ffa165 100644
--- a/EventLogging.php
+++ b/EventLogging.php
@@ -78,42 +78,9 @@
*/
$wgEventLoggingDBname = false;
-/**
- * @var bool: Whether to log SHA1 of Git HEAD of caller.
- */
-$wgEventLoggingLogSHA1 = false;
// Helpers
-
-/**
- * Gets the SHA1 of HEAD for the Git repository at a given path.
- * If path does not contain a Git repository, moves up the directory
- * tree searching for one, stopping at $IP. Returns false if no Git
- * repository found of if unable to determine SHA1 of HEAD.
- *
- * @param string $path: Starts search at this path. Must be a sub-path
- * of $IP (or equal to $IP).
- * @return string|bool: SHA1 of HEAD if repository discovery is
- * successful. False otherwise.
- */
-function efPathGitHeadSHA1( $path ) {
- global $IP;
-
- if ( is_file( $path ) ) {
- $path = pathinfo( $path, PATHINFO_DIRNAME );
- }
-
- while ( strpos( $path, $IP ) === 0 ) {
- if ( file_exists( $path . '/.git' ) ) {
- $gitInfo = new GitInfo( $path );
- return $gitInfo->getHeadSHA1();
- }
- $path = dirname( $path );
- }
- return false;
-}
-
/**
* Writes an event to a file descriptor or socket.
@@ -155,20 +122,6 @@
'recvFrom' => gethostname(),
'timestamp' => $_SERVER[ 'REQUEST_TIME' ],
);
-
- if ( $wgEventLoggingLogSHA1 ) {
- // Attempt to get the SHA1 of HEAD of caller.
- if ( version_compare( PHP_VERSION, '5.4.0', '>=' ) ) {
- // PHP 5.4.0 added a second parameter to
debug_backtrace, 'limit',
- // which specifies the number of stack frames to return.
- $backtrace = debug_backtrace(
DEBUG_BACKTRACE_IGNORE_ARGS, 1 );
- } else {
- $backtrace = debug_backtrace(
DEBUG_BACKTRACE_IGNORE_ARGS );
- }
- $caller = array_shift( $backtrace );
- $sha1 = substr( efPathGitHeadSHA1( $caller[ 'file' ] ), 0, 6 );
- $encapsulated[ 'HEAD' ] = $sha1 ?: NULL;
- }
// To make the resultant JSON easily extracted from a row of
// space-separated values, we replace literal spaces with unicode
--
To view, visit https://gerrit.wikimedia.org/r/51636
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6fb205830eb21a05a8f5d4594ad875468cb78377
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EventLogging
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits