PiRSquared17 has submitted this change and it was merged.

Change subject: Various changes to wmt-ko
......................................................................


Various changes to wmt-ko

Change-Id: Ia2a4db5ab84eb6848dccaf7c8a1b7300bbf23882
---
M slaves/bot-wmt-ko.php
A slaves/bot-wmt-ko.php.orig
2 files changed, 154 insertions(+), 3 deletions(-)

Approvals:
  PiRSquared17: Verified; Looks good to me, approved



diff --git a/slaves/bot-wmt-ko.php b/slaves/bot-wmt-ko.php
index c38d063..7772853 100755
--- a/slaves/bot-wmt-ko.php
+++ b/slaves/bot-wmt-ko.php
@@ -106,19 +106,39 @@
                        $project = $matches[1];
                        $user = $matches[2];
                        
-                       $irc->send($bot_channel,"\0036New user account : 
$user\003 
\00315http://$project.org/wiki/Special:Contributions/".urlencode(str_replace(' 
','_',$user))."\003");
+                       $irc->send($bot_channel,"\0036새 계정이 생성되었습니다: $user\003 
\00315http://$project/wiki/Special:Contribs/".urlencode(str_replace(' 
','_',$user))."\003");
                }
                // + modifications non patrouill饳
-               elseif (preg_match('#^([^ ]+) :14\[\[07([^\]]+)14\]\]4 
[MNB!]*10 02([^\*]+) 5\* 03(.+) 5\* \([\+-]([0-9]+)\) 10(.*)$#', 
$data, $matches))
+               elseif (preg_match('#^([^ ]+) :14\[\[07([^\]]+)14\]\]4 
[MNB!]*10 02([^\*]+) 5\* 03(.+) 5\* \(([\+-][0-9]+)\) 10(.*)$#', 
$data, $matches))
                {
                        $project = $matches[1];
                        $page = $matches[2];
                        $patrollink = $matches[3];
                        $user = $matches[4];
+                       $sizediff = str_replace("\002",'',$matches[5]);
+                       $diffcolor = '';
+                       $diffend = '';
+                       if (((int) $sizediff) > 499) {
+                               $diffcolor = "\002";
+                               $diffend = "\002";
+                       }
+                       if (((int) $sizediff) < -499) {
+                               $diffcolor = "\002";
+                               $diffend = "\002";
+                       }
+                       if (((int) $sizediff) > 999) {
+                               $diffcolor = "\0033\002";
+                               $diffend = "\002\003";
+                       }
+                       if (((int) $sizediff) < -999) {
+                               $diffcolor = "\0034\002";
+                               $diffend = "\002\003";
+                       }
+                       $bytediff = "$diffcolor($sizediff)$diffend";
                        $comment = $matches[6];
                        $commentfoo = (!empty($comment)) ? " - 
\00315$comment\003" : "";
                        
-                       $irc->send($bot_channel, "\00313$project\003 : 
\002$user\002 edited \00310$page\003$commentfoo - \0032$patrollink\003");
+                       $irc->send($bot_channel, "\00313$project\003 : 
\002$user\002 편집함 \00310$page\003 $bytediff $commentfoo - 
\0032$patrollink\003");
                }
        }
        
diff --git a/slaves/bot-wmt-ko.php.orig b/slaves/bot-wmt-ko.php.orig
new file mode 100755
index 0000000..c38d063
--- /dev/null
+++ b/slaves/bot-wmt-ko.php.orig
@@ -0,0 +1,131 @@
+#!/usr/bin/php
+<?php
+
+/*   ---------------------------------------------
+
+Author : Quentinv57
+
+Licence : GNU General Public License v3
+                       (see http://www.gnu.org/licenses/)
+                       
+Date of creation : 2011-12-31
+Last modified : 2012-05-19
+
+script of the bot that monitors #wmt-ko
+
+---------------------------------------------   */
+
+
+
+####                            ####
+###### INCLUDES ET CONSTANTES ######
+####                            ####
+$prefix = '/data/project/quentinv57-common/data/';
+include $prefix.'class/socket.class.php';
+include $prefix.'class/Irc.class.php';
+include '/data/project/irc-wmt/bots/include/config/irc_conf.php';
+
+$bot_channel_bots = "#wmt-bots";
+$bot_channel = "#wmt-ko";
+$irc_user .= '-10';
+
+$arr_sock = array ('wikiset'=>'ko');
+
+
+####                 ####
+######  FUNCTIONS  ######
+####                 ####
+
+
+
+
+
+####                               ####
+###### INITIALISATION DU BOT !!! ######
+####                               ####
+
+// Connexion au serveur rcfeed
+$sock_dir = "/data/project/irc-wmt/bots/tmp/sockets/";
+$sock = new Socket_client ($sock_dir.'wmt-ko.sock', $sock_dir.'server.sock', 
$arr_sock);
+
+
+// Configs - settings [le bot r飵p貥 les configs dans le fichier]
+#$configdata = get_data_from_file(SAVEFILE);
+
+// Connexion au serveur IRC Freenode
+$irc = new Irc ( $irc_freenodeserver , $irc_port , $irc_user , $irc_pwd ) ;
+$irc-> identify ( $irc_pwd ) ; sleep(5);
+$irc-> join ( $bot_channel_bots );
+$irc-> join ( $bot_channel);
+
+sleep(1);
+$irc->send($bot_channel_bots, "I just restarted and joined $bot_channel with 
success.");
+
+// variables :
+$lastusers_array_names = array();
+$lastusers_array_types = array();
+$lastusers_nb = 0; // to keep only max X entries in the array
+
+while (1)
+{
+       // -------------------------------
+       //  Freenode Script
+       // -------------------------------
+       if ($data = $irc-> getdata ())
+       {
+               $tab = explode (' ', $data);
+
+               if (!empty($data))
+               {
+                       // Init freenode script
+                       if ( $tab[0] == "PING" )
+                       {
+                               $irc-> AutreCommande ( "PONG $tab[1]" ) ;
+                               echo "PING PONG OK\n" ;
+                       }
+               
+                       if ( $tab[0] == "ERROR" )
+                       {
+                               // Restarts the current process
+                               $irc->quit() ;
+                               $wm->quit() ;
+                               # Removed the system instruction - the file 
will be automatically restarted by daemon
+                               exit(3); 
+                       }
+               }
+       }
+       
+       // -------------------------------
+       //  Wikirc Script
+       // -------------------------------
+       elseif ($data = $sock->read())
+       {
+               // channel : #wmt-ko
+               if (preg_match('#^([^ ]+) .*4 create10 02 5\* 03(.+) 
5\*#',$data, $matches))
+               {
+                       $project = $matches[1];
+                       $user = $matches[2];
+                       
+                       $irc->send($bot_channel,"\0036New user account : 
$user\003 
\00315http://$project.org/wiki/Special:Contributions/".urlencode(str_replace(' 
','_',$user))."\003");
+               }
+               // + modifications non patrouill饳
+               elseif (preg_match('#^([^ ]+) :14\[\[07([^\]]+)14\]\]4 
[MNB!]*10 02([^\*]+) 5\* 03(.+) 5\* \([\+-]([0-9]+)\) 10(.*)$#', 
$data, $matches))
+               {
+                       $project = $matches[1];
+                       $page = $matches[2];
+                       $patrollink = $matches[3];
+                       $user = $matches[4];
+                       $comment = $matches[6];
+                       $commentfoo = (!empty($comment)) ? " - 
\00315$comment\003" : "";
+                       
+                       $irc->send($bot_channel, "\00313$project\003 : 
\002$user\002 edited \00310$page\003$commentfoo - \0032$patrollink\003");
+               }
+       }
+       
+       
+       else usleep(500000); // wait 0.5 seconds
+       
+       unset($data); // free memory
+}
+
+?> 

-- 
To view, visit https://gerrit.wikimedia.org/r/120206
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia2a4db5ab84eb6848dccaf7c8a1b7300bbf23882
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/WMT
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <gerritpatchuploa...@gmail.com>
Gerrit-Reviewer: Gerrit Patch Uploader <gerritpatchuploa...@gmail.com>
Gerrit-Reviewer: PiRSquared17 <pirsquare...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to