http://www.mediawiki.org/wiki/Special:Code/MediaWiki/65347

Revision: 65347
Author:   siebrand
Date:     2010-04-20 22:06:12 +0000 (Tue, 20 Apr 2010)

Log Message:
-----------
stylize.php, trailing whitespace removed, indentation updated

Modified Paths:
--------------
    trunk/extensions/CategoryWatch/CategoryWatch.i18n.php
    trunk/extensions/CategoryWatch/CategoryWatch.php

Modified: trunk/extensions/CategoryWatch/CategoryWatch.i18n.php
===================================================================
--- trunk/extensions/CategoryWatch/CategoryWatch.i18n.php       2010-04-20 
22:00:34 UTC (rev 65346)
+++ trunk/extensions/CategoryWatch/CategoryWatch.i18n.php       2010-04-20 
22:06:12 UTC (rev 65347)
@@ -3,7 +3,7 @@
  * Internationalisation file for extension CategoryWatch.
  *
  * @addtogroup Extensions
-*/
+ */
 
 $messages = array();
 

Modified: trunk/extensions/CategoryWatch/CategoryWatch.php
===================================================================
--- trunk/extensions/CategoryWatch/CategoryWatch.php    2010-04-20 22:00:34 UTC 
(rev 65346)
+++ trunk/extensions/CategoryWatch/CategoryWatch.php    2010-04-20 22:06:12 UTC 
(rev 65347)
@@ -13,9 +13,9 @@
  * @licence GNU General Public Licence 2.0 or later
  */
 
-if ( !defined('MEDIAWIKI' ) ) die( 'Not an entry point.' );
+if ( !defined( 'MEDIAWIKI' ) ) die( 'Not an entry point.' );
 
-define( 'CATEGORYWATCH_VERSION', '1.1.0, 2009-04-21' );
+define( 'CATEGORYWATCH_VERSION', '1.1.1, 2010-04-21' );
 
 $wgCategoryWatchNotifyEditor = true;
 $wgCategoryWatchUseAutoCat   = false;
@@ -30,10 +30,9 @@
        'version'        => CATEGORYWATCH_VERSION,
 );
 
-$wgExtensionMessagesFiles['CategoryWatch'] =  dirname(__FILE__) . 
'/CategoryWatch.i18n.php';
+$wgExtensionMessagesFiles['CategoryWatch'] =  dirname( __FILE__ ) . 
'/CategoryWatch.i18n.php';
 
 class CategoryWatch {
-
        function __construct() {
                global $wgHooks;
                $wgHooks['ArticleSave'][] = $this;
@@ -45,7 +44,7 @@
         */
        function onArticleSave( &$article, &$user, &$text ) {
                global $wgCategoryWatchUseAutoCat;
-               
+
                $this->before = array();
                $dbr  = wfGetDB( DB_SLAVE );
                $cl   = $dbr->tableName( 'categorylinks' );
@@ -64,7 +63,7 @@
                        $wtbl = $dbr->tableName( 'watchlist' );
                        $sql = "SELECT user_id FROM $utbl LEFT JOIN $wtbl ON 
user_id=wl_user AND wl_title LIKE '%$like%' WHERE wl_user IS NULL";
                        $res = $dbr->query( $sql );
-                       
+
                        # Insert an entry into watchlist for each
                        while ( $row = $dbr->fetchRow( $res ) ) {
                                $uname = User::newFromId( $row[0] )->getName();
@@ -72,7 +71,7 @@
                                $dbr->insert( $wtbl, array( 'wl_user' => 
$row[0], 'wl_namespace' => NS_CATEGORY, 'wl_title' => $wl_title ) );
                        }
                        $dbr->freeResult( $res );
-               }               
+               }
 
                return true;
        }
@@ -81,7 +80,6 @@
         * Find changes in categorisation and send messages to watching users
         */
        function onArticleSaveComplete( &$article, &$user, &$text, &$summary, 
&$medit ) {
-
                # Get cats after update
                $this->after = array();
                $dbr  = wfGetDB( DB_SLAVE );
@@ -97,12 +95,11 @@
 
                # Notify watchers of each cat about the addition or removal of 
this article
                if ( count( $add ) > 0 || count( $sub ) > 0 ) {
-                       
                        $page     = $article->getTitle();
                        $pagename = $page->getPrefixedText();
                        $pageurl  = $page->getFullUrl();
                        $page     = "$pagename ($pageurl)";
-                       
+
                        if ( count( $add ) == 1 && count( $sub ) == 1 ) {
                                $add = array_shift( $add );
                                $sub = array_shift( $sub );
@@ -111,23 +108,21 @@
                                $message = wfMsg( 'categorywatch-catmovein', 
$page, $this->friendlyCat( $add ), $this->friendlyCat( $sub ) );
                                $this->notifyWatchers( $title, $user, $message, 
$summary, $medit );
 
-                               #$title   = Title::newFromText( $sub, 
NS_CATEGORY );
-                               #$message = wfMsg( 'categorywatch-catmoveout', 
$page, $this->friendlyCat( $sub ), $this->friendlyCat( $add ) );
-                               #$this->notifyWatchers( $title, $user, 
$message, $summary, $medit );
-                       }
-                       else {
-
+                               # $title   = Title::newFromText( $sub, 
NS_CATEGORY );
+                               # $message = wfMsg( 'categorywatch-catmoveout', 
$page, $this->friendlyCat( $sub ), $this->friendlyCat( $add ) );
+                               # $this->notifyWatchers( $title, $user, 
$message, $summary, $medit );
+                       } else {
                                foreach ( $add as $cat ) {
                                        $title   = Title::newFromText( $cat, 
NS_CATEGORY );
                                        $message = wfMsg( 
'categorywatch-catadd', $page, $this->friendlyCat( $cat ) );
                                        $this->notifyWatchers( $title, $user, 
$message, $summary, $medit );
                                }
 
-                               #foreach ( $sub as $cat ) {
+                               # foreach ( $sub as $cat ) {
                                #       $title   = Title::newFromText( $cat, 
NS_CATEGORY );
                                #       $message = wfMsg( 
'categorywatch-catsub', $page, $this->friendlyCat( $cat ) );
                                #       $this->notifyWatchers( $title, $user, 
$message, $summary, $medit );
-                               #}
+                               # }
                        }
                }
 
@@ -151,7 +146,7 @@
                # Get list of users watching this category
                $dbr = wfGetDB( DB_SLAVE );
                $conds = array( 'wl_title' => $title->getDBkey(), 
'wl_namespace' => $title->getNamespace() );
-               if ( !$wgCategoryWatchNotifyEditor) $conds[] = 'wl_user <> ' . 
intval( $editor->getId() );
+               if ( !$wgCategoryWatchNotifyEditor ) $conds[] = 'wl_user <> ' . 
intval( $editor->getId() );
                $res = $dbr->select( 'watchlist', array( 'wl_user' ), $conds, 
__METHOD__ );
 
                # Wrap message with common body and send to each watcher
@@ -164,8 +159,8 @@
                        $watchingUser   = User::newFromId( $row[0] );
                        $timecorrection = $watchingUser->getOption( 
'timecorrection' );
                        $editdate       = $wgLang->timeanddate( 
wfTimestampNow(), true, false, $timecorrection );
+
                        if ( $watchingUser->getOption( 'enotifwatchlistpages' ) 
&& $watchingUser->isEmailConfirmed() ) {
-                               
                                $to      = new MailAddress( $watchingUser );
                                $subject = wfMsg( 'categorywatch-emailsubject', 
$page );
                                $body    = wfMsgForContent( 'enotif_body' );
@@ -218,8 +213,11 @@
                                # Replace keys, wrap text and send
                                $body = strtr( $body, $keys );
                                $body = wordwrap( $body, 72 );
-                               if ( function_exists( 'userMailer' ) ) 
userMailer( $to, $from, $subject, $body, $replyto );
-                               else UserMailer::send( $to, $from, $subject, 
$body, $replyto );
+                               if ( function_exists( 'userMailer' ) ) {
+                                       userMailer( $to, $from, $subject, 
$body, $replyto );
+                               } else {
+                                       UserMailer::send( $to, $from, $subject, 
$body, $replyto );
+                               }
                        }
                }
 
@@ -239,5 +237,4 @@
 
        # Instantiate the CategoryWatch singleton now that the environment is 
prepared
        $wgCategoryWatch = new CategoryWatch();
-
 }



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to