Extension:AutoWatch/ml

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Extension:AutoWatch and the translation is 27% complete.

Other languages:
Deutsch • ‎English • ‎dansk • ‎español • ‎français • ‎polski • ‎sicilianu • ‎മലയാളം • ‎中文 • ‎日本語
MediaWiki extensions manual
OOjs UI icon advanced.svg
AutoWatch
Release status: stable
Implementation User interface
Description ഏതെങ്കിലും പുതിയ സംവാദം താളിലെ + ഏതെങ്കിലും ഒരു പുതിയ തിരുത്തൽ പേജ് കാണുന്നതിന് ഉപയോക്താവിൻറെ ഇച്ഛാനുസൃത നിർവ്വചിച്ച ലിസ്റ്റ് ചേർക്കുക
Author(s) Brice Lenfant (Briceltalk)
Latest version 1.0 (2007-11-21)
MediaWiki 1.10+
Database changes No
License GNU General Public License 2.0 or later
Download ഡൌൺലോഡ്
Parameters
$wgMultiWatchUserIDs
Hooks used
ArticleSaveComplete
Translate the AutoWatch extension if it is available at translatewiki.net
Check usage and version matrix.

The AutoWatch extension adds a custom list of users to watch any new or edited page plus send an email on any new talk page.

Usage

Save the code below to AutoWatch.php in MediaWiki's extensions folder.

Add the following line in the LocalSettings.php file:

$wgMultiWatchUserIDs = array(5, 3, 2, 6, 64, 9); #This is the list of your users' IDs to include in this mailing list
require_once("extensions/AutoWatch.php");

Code

This code has been tested on MediaWiki 1.12.

History:

  • 2007-11-21 -- Version 1.1 -- First release.
<?php
#########################################################################
# Installation notes, add array $wgMultiWatchUserIDs to LocalSettings.php with all uses ID's to include
# Example
#                     $wgMultiWatchUserIDs = array(5, 3, 2, 6);
# then add the line:  require_once("extensions/AutoWatch.php");
#
########################################################################
// Protect against register_globals
if ( !defined( 'MEDIAWIKI' ) ) {
    echo "Not a valid entry point";
    exit( 1 );
}

$wgExtensionCredits['other'][] = array(
	'name' => 'AutoWatch',
	'version' => '1.0',
	'author' => 'Brice Lenfant',
	'description' => 'Adds any new edited/created page to the watch list of defined users',
	'url' => 'https://www.mediawiki.org/wiki/Extension:AutoWatch',
);

$wgHooks['ArticleSaveComplete'][] = 'fnAddToWatch';

function fnAddToWatch(&$article, &$user, &$text, &$summary, &$minoredit, &$watchthis, &$sectionanchor, &$flags, $revision) {
	global $wgMultiWatchUserIDs;
	foreach ($wgMultiWatchUserIDs as $value){
		#Add to watch
		$user = User::newFromId($value);
		$user->addWatch( $article->mTitle );
		#Send email if it's a new talk 
		if ( $article->mTitle->isTalkPage ()){
			$eTitle = "Talk Page changed or created in Wiki  - ".$article->mTitle->getTalkNsText().':'.$article->mTitle->getDBkey();
			$eBody = $article->mTitle->GetFullURL();
			$user->sendMail($eTitle, $eBody );
		}
	}
	return true;
}