【问题标题】:What tools are available to summarize changes to a MediaWiki?有哪些工具可用于总结对 MediaWiki 的更改?
【发布时间】:2011-07-07 17:18:11
【问题描述】:

我们在工作中使用 MediaWiki,为了鼓励更多使用,我想设置每周对条目的最近更改的摘要电子邮件,但我在网上找不到任何内容。是否有现有工具可用于收集一周对 wiki 的更改并对其进行总结?

我想设置一个脚本来收集前 5 个已编辑页面、后 5 个已编辑页面,也许还有 3 个随机页面。希望人们会看到他们不知道的新事物,或者更新可能不太受关注的页面。

【问题讨论】:

标签: wiki mediawiki


【解决方案1】:

您可以在 MediaWiki 中设置 RSS 提要和相应的消费者(大多数浏览器都有 RSS 提要阅读器),然后为您的每周电子邮件汇总有趣的事件。

我编辑维基百科,并使用 RSS 来跟踪我的关注列表中的项目。效果很好!

【讨论】:

    【解决方案2】:

    前几天我扔的东西。快速而肮脏,只需读取最近的更改,并将指向顶部填写数字的链接发送给在数据库中有电子邮件地址的每个人。设置为 cron 作业。显然,我弄乱了公司 URL、数据库名称、用户和密码。

    #!/usr/local/bin/php.cli
    <?php
    /*
    *   File                :
    *   Function(s)         :
    *   Calls/Invokes       :
    *   Called By           :
    *   Parameters/Input    : 
    *   Requires            : 
    *   Purpose             : 
    *   Date                : 
    *
    */
    
    $ToAddr = 'thedeveloper@somewhere.com';
    $subject = 'Wiki - Recent Changes Notice';
    $dtFormat = "Y/m/d H:i:s";
    $message = 'Hello from somewhere.com at ' . date($dtFormat) . "\n\n";
    
        $headers = 'From: DontReply@somewhere.com' . "\n" .
        'Reply-To: webmaster@somewhere.com' . "\n" .
        'X-Mailer: PHP/' . phpversion();
    
        $host = 'localhost';
    
    
        $db   = 'name_of_database_wikidb';
        $rc_Table = 'recentchanges';    
        $user = 'tester';   
        $pass = 'password'; // to mySql
        $link_preface = 'http://www.somewhere.com/wiki/';
        $NumDays = 5;
    
        $output = '';
        $output = '<html><head><title>SQL Mail Test</title></head><body>';
    
        $link = mysql_connect($host, $user, $pass);
        if ( !$link ) { return "<hr><b>Error while connecting to host \"$host\" !</b><hr>"; }
        mysql_select_db($db, $link);
    
    
        $theList = get_Email_List($query, $link);
    
            $query = 'SELECT rc_title AS Page, rc_user_text AS Editor, 
                      DATE_FORMAT(rc_timestamp,"%d/%m/%Y %T") AS "When", 
                      rc_comment AS Notes FROM ' . $rc_Table . ' 
                      WHERE DATE_SUB(CURDATE(),INTERVAL ' . $NumDays . ' DAY) <= date(rc_timestamp) 
                      and rc_title not like "Junk%"
                      and rc_title not like "Sandbox"
                      GROUP BY Page 
                      ORDER BY rc_timestamp DESC';
    
            $result = mysql_query($query, $link);
            if (!$result){
                $message  = 'Invalid query: ' . mysql_error() . "\n";
                $message .= 'Whole query: ' . $query;
                die($message);
            }
    
            if (mysql_num_rows($result) <> 0) {
                $output .= "<table>";
                $output .= "<tr>";
                $output .= "<td width=\"300px\">";
                $output .= "</td>";
                $output .= "<td>";
                $output .= "<br>";
                $output .= "<table border=1>";
                $output .= "<th><b>Page</b></th>";
                $output .= "<th><b>Editor</b></th>";
                $output .= "<th><b>When</b></th>";
                $output .= "<th><b>Notes</b></th>";
    
    
                $fp = @fopen('specialnotice.txt', 'r');
                if (!$fp) {
                    //$message .=  "\n" .' No Special Notice Today.';
                }
                else {
                    clearstatcache();
                    $message .= 'Special Notice:' . "\n\n";             
                    while (!feof($fp)) {
                        $message .=  fgets($fp, 4096);          
                    }           
                    echo '</textarea>';
                    fclose($fp);
                    $message .= "\n";               
                }
    
                $message .= "\n" .'This is your daily notice of Recently Changed or New pages for the past ' . $NumDays . ' days:' . "\n\n";
    
                $line = mysql_fetch_array($result, MYSQL_ASSOC);        
                mysql_data_seek($result, 0);
                while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
                    $output .= "<tr>";        
                    $numf = mysql_num_fields($result);
                    for ($i=0; $i < $numf; $i++); {
                        $output .= "<td><a href=" . '"' . $link_preface . "$line[Page]". '"' .">$line[Page]</a></td>";
                        $output .= "<td>$line[Editor]</td>";                    
                        $output .= "<td>$line[When]</td>";
                        $output .= "<td>$line[Notes]</td>";
    
                        $message .= $link_preface . "$line[Page]";                  
                        /*
                        $message .= '<html><body><a href=';
                        $message .= '"'. $link_preface . $line[Page].'">';
                        $message .=  $line[Page] .  '</a></body></html>';
                        */
                        $message .= ' by ' . $line[Editor] .',';                    
                        $message .= ' At: ' . $line[When];                  
                        $message .= ' Notes: ' . $line[Notes];
                        $message .= "\n";
                    }            
                    $output .= "</tr>";
                }           
                $output .= "</table>";
                $output .= "<br>";          
                $output .= "</td>";
                $output .= "</tr>";
                $output .= "</table>";
                $output .= '</body></html>';
    
            }
            else {
                $output .= "Sorry, nada. ";
    
            }   
        #echo $output;    
    
        mysql_close($link);
    
    #   $message = $output; // check html output
        $result = 'Failure';
        $dummy = mail($theList, $subject, $message, $headers); // send regular article list to mailing list
    #   $dummy = mail($ToAddr, $subject, $message, $headers);  // send regular article list to developer
    #   $dummy = mail($ToAddr, $subject, $theList, $headers);  // send mailing list to developer
        if ($dummy){
            $result = 'Success';
        }   
        $output2 = '    ';
        $output2 .= '   
        <html>
        <head>
          <title>Mail Test</title>
        </head>
        <body>';
          $output2 .= $result;
          $output2 .= ' at ' . date($dtFormat);
          $output2 .= '
        </body>
        </html>
        ';
        echo $output2;    
    
        function get_Email_List($query, $link) {
    
            $query = 'SELECT CAST(user_email AS CHAR(100) CHARACTER SET utf8) as addr FROM `user` WHERE 1';
            $result = mysql_query($query, $link);
            $emails = ' ';
            if (!$result){
                $message  = 'Invalid query: ' . mysql_error() . "\n";
                $message .= 'Whole query: ' . $query;
                die($message);
            }
    
            if (mysql_num_rows($result) <> 0) {     
                $line = mysql_fetch_array($result, MYSQL_ASSOC);        
                mysql_data_seek($result, 0);
                while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
                    if (!empty($line[addr])) {
                       $emails .= $line[addr] . ',';
                    }
                }       
                $emails = rtrim($emails, ',');          
                $emails = ltrim($emails, ',');          
            }
            return $emails;
        }
    ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-25
      • 1970-01-01
      • 2013-07-04
      • 2013-02-25
      • 1970-01-01
      相关资源
      最近更新 更多