Extension talk:AutoWatch
Add topic--TDeeming 10:32, 6 December 2007 (UTC)
- Your AutoWatch extension is just the extension I need. I am using Mediawiki 1.93 and when I try to use it, I get the following error.
Parse error: syntax error, unexpected T_VARIABLE in C:\Programme\xampp\htdocs\wiki\extensions\AutoWatch.php on line 26
- Have any ideas what the problem could be?
--Bricel 21:27, 7 December 2007 (UTC)
- what is the value of your $wgMultiWatchUserIDs ?
$wgMultiWatchUserIDs= array (4,5,6);
I believe that the problem has something to do with the mTitle not being recognized.
- --TDeeming 09:25, 10 December 2007 (UTC) ... I think I found the problem.... at least I'm not getting an error anymore.
- I copied your recent changes.. and it started working. Closer investigation showed that the "old" line 25
old line 25: user=User::newFromId($value) new line 25: user=User::newFromId($value);
- was missing a semi-colon at the end of the line. In your latest upload a semi-colon was present and it worked. You can trace the change in the history.
Error Missing argument 8 for finAddToWatch()
[edit]I get some error messages after saving an article or change something.
Warning: Missing argument 8 for finAddToWatch() in C:\Inetpub\wwwroot\sintranet\components\com_mambowiki\extensions\AutoWatch.php on line 20 Warning: Missing argument 9 for finAddToWatch() in C:\Inetpub\wwwroot\sintranet\components\com_mambowiki\extensions\AutoWatch.php on line 20 Fatal Error: Call to undefined method User: newfromid() in C:\Inetpub\wwwroot\sintranet\components\com_mambowiki\extensions\AutoWatch.php on line 24
Can someone help me?
How to watch all IDs except of wikisysop?
[edit]I would like to have ability to watch all ID except of mine (wikisysop). How I can do it? When new user have registered on wiki I must change LocalSettings.php to add new id. I don't want to do it for every new user.
So, Can I add all users with ID > 2 (for example) --Dnikitin 15:39, 4 December 2008 (UTC)
dont watch file-uploads
[edit]Hi,
its possible to disable the AutoWatch for uploaded files ?
Thx & Bye, BitH...
Solution
[edit]You could insert an additional if-part in the source. if ($article->mTitle->getNamespace() == 0) {} Namespace 0 is only for normal articles. No file uploads, special pages, etc.
Or if ($article->mTitle->getNamespace()Â != 6) {} This would mean mail everything instead of file uploads.
Large sending time - wiki stops for a while
[edit]After creating a new page my wiki hangs for a couple of seconds until the notification e-mails are send. Everything works fine, but how can we change the code that notification e-mails are send in parallel as a job and do not longer disturb? --Jostar 08:41, 12 November 2009 (UTC)
new version
[edit]Hi, this work for me on mv 1.17.0
<?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");
#
########################################################################
$wgExtensionCredits['other'][] = array(
'name' => 'AutoWatch',
'version' => '1.0',
'author' => 'Brice Lenfant',
'description' => 'Add any new edited/created page to the watch list of defined users',
'url' => 'http://www.mediawiki.org/wiki/Extension:AutoWatch',
);
$wgHooks['ArticleSaveComplete'][] = 'fnAddToWatch';
function fnAddToWatch( &$article, &$user, $text, $summary, $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId, &$redirect ) {
global $wgMultiWatchUserIDs;
foreach ($wgMultiWatchUserIDs as $value){
#If not watched - add to watch and email
$user = User::newFromId($value);
if( $user->isWatched($article->mTitle) == false ){
$user->addWatch( $article->mTitle );
$eTitle = "Page changed or created in Wiki - ".$article->mTitle->getNsText().':'.$article->mTitle->getDBkey();
$eBody = $article->mTitle->GetFullURL();
$user->sendMail($eTitle, $eBody );
}
}
return true;
}
--Pastakhov 04:42, 2 November 2011 (UTC)
Use this to inform all users, instead of the ones in the list
[edit]<?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");
#
########################################################################
$wgExtensionCredits['other'][] = array(
'name' => 'AutoWatch',
'version' => '1.0',
'author' => 'Brice Lenfant',
'description' => 'Add any new edited/created page to the watch list of defined users',
'url' => 'http://www.mediawiki.org/wiki/Extension:AutoWatch',
);
$wgHooks['ArticleSaveComplete'][] = 'fnAddToWatch';
function fnAddToWatch( &$article, &$user, $text, $summary, $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId, &$redirect ) {
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select(
'user',
array( 'user_id' )
);
foreach ($res as $row){
#If not watched - add to watch and email
$user = User::newFromId($row->user_id);
if( $user->isWatched($article->mTitle) == false ){
$user->addWatch( $article->mTitle );
// $eTitle = "Page changed or created in Wiki - ".$article->mTitle->getNsText().':'.$article->mTitle->getDBkey();
// $eBody = $article->mTitle->GetFullURL();
// $user->sendMail($eTitle, $eBody );
}
}
$dbr->freeResult( $res );
return true;
}