Siebrand has uploaded a new change for review.
https://gerrit.wikimedia.org/r/77647
Change subject: Moved logfilter.php here from Translate repo
......................................................................
Moved logfilter.php here from Translate repo
Also update rakkauspipe.sh so it knows the new location of the script.
Change-Id: Ia9142e15e43efb0b424472e5992f3b9c800659c1
---
A irc-relay/logfilter.php
M irc-relay/rakkauspipe.sh
2 files changed, 52 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/translatewiki
refs/changes/47/77647/1
diff --git a/irc-relay/logfilter.php b/irc-relay/logfilter.php
new file mode 100644
index 0000000..b59912b
--- /dev/null
+++ b/irc-relay/logfilter.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * A script to forward error log messages with some rate limiting.
+ *
+ * @author Niklas Laxstrom
+ *
+ * @copyright Copyright © 2010, Niklas Laxström
+ * @license GPL-2.0+
+ * @file
+ */
+
+if( isset( $_SERVER['argv'][1] ) ) {
+ $file = $_SERVER['argv'][1];
+} else {
+ exit( "OMG\n" );
+}
+
+if ( !is_readable( $file ) ) {
+ exit( "OMG\n" );
+}
+
+$handle = fopen( $file, "rt" );
+fseek( $handle, 0, SEEK_END );
+while ( true ) {
+ $count = 0;
+ $line = false;
+ while ( !feof( $handle ) ) {
+ $count++;
+ $input = fgets( $handle );
+ if ( $input !== false ) {
+ $line = $input;
+ }
+ }
+
+ // I don't know why this is needed
+ fseek( $handle, 0, SEEK_END );
+
+ if ( $line !== false ) {
+ $prefix = '';
+ if ( $count > 2 ) {
+ $count -= 2;
+ $prefix = "($count lines skipped) ";
+ }
+ if ( mb_strlen( $line ) > 400 ) {
+ $line = mb_substr( $line, 0, 400 ) . '...';
+ }
+ echo trim( $prefix . $line ) . "\n";
+ }
+
+ sleep( 30 );
+}
diff --git a/irc-relay/rakkauspipe.sh b/irc-relay/rakkauspipe.sh
index 10f3810..91263e6 100755
--- a/irc-relay/rakkauspipe.sh
+++ b/irc-relay/rakkauspipe.sh
@@ -1,3 +1,3 @@
#!/bin/sh
WIKI=/www/translatewiki.net/w
-php ${WIKI}/extensions/Translate/scripts/logfilter.php ${WIKI}/logs/error_php
| nc -u localhost 8966
+php /home/betawiki/config/irc-relay/logfilter.php ${WIKI}/logs/error_php | nc
-u localhost 8966
--
To view, visit https://gerrit.wikimedia.org/r/77647
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia9142e15e43efb0b424472e5992f3b9c800659c1
Gerrit-PatchSet: 1
Gerrit-Project: translatewiki
Gerrit-Branch: master
Gerrit-Owner: Siebrand <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits