[MediaWiki-commits] [Gerrit] mediawiki...CategoryWatch[master]: Fix up
Seanchenldap has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/370773 ) Change subject: Fix up .. Fix up * Trim long lines. * Add copyright notice. * Fix up config variable prefix in extension.json. * Use a protected class variable instead of a global variable for storing instance. * Move comments providing documentation for globals to README. * Fix up doc comments to comply with coding conventions. Change-Id: I33ae7ce52c371c54d002862ae984863283193e9a --- M CategoryWatch.php M README.md M extension.json 3 files changed, 242 insertions(+), 133 deletions(-) Approvals: Seanchenldap: Looks good to me, approved jenkins-bot: Verified diff --git a/CategoryWatch.php b/CategoryWatch.php index e576d63..cfd3fca 100644 --- a/CategoryWatch.php +++ b/CategoryWatch.php @@ -1,11 +1,32 @@ https://www.mediawiki.org/Extension:CategoryWatch for installation and usage details - * See http://www.organicdesign.co.nz/Extension_talk:CategoryWatch for development notes and disucssion + * Copyright (C) 2008 Aran Dunkley + * Copyright (C) 2017 Sean Chen + * Copyright (C) 2017 Mark A. Hershberger + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + * + * See https://www.mediawiki.org/Extension:CategoryWatch + * for installation and usage details + * See http://www.organicdesign.co.nz/Extension_talk:CategoryWatch + * for development notes and disucssion * * @file * @ingroup Extensions @@ -14,125 +35,138 @@ * @licence GNU General Public Licence 2.0 or later */ -# Whether or not to also send notificaton to the person -# who made the change -# The default value is set in file extension.json -//$wgCategoryWatchNotifyEditor = true; - -# Set this to give every user a unique category that -# they're automatically watching -# - the format of the category name is defined on the -# "categorywatch-autocat" localisation message -# The default value is set in file extension.json -//$wgCategoryWatchUseAutoCat = false; - -# Set this to make the categorisation work by realname -# instead of username -# The default value is set in file extension.json -//$wgCategoryWatchUseAutoCatRealName = false; - class CategoryWatch { + // Instance + protected static $watcher; /** * The extension function. * It has to be the static function in a class now. */ - public static function wfSetupCategoryWatch() { - wfDebugLog('CategoryWatch', 'loading extension...'); - global $wgCategoryWatch; + public static function setupCategoryWatch() { + wfDebugLog( 'CategoryWatch', 'loading extension...' ); - # Instantiate the CategoryWatch singleton now -# that the environment is prepared - $wgCategoryWatch = new CategoryWatch(); - } - - function __construct() { - # the constructor will do nothing now. - # New extension register process will use the file - # extension.json to set hooks. + # Instantiate the CategoryWatch singleton now + # that the environment is prepared + self::$watcher = new CategoryWatch(); } /** -* Get a list of categories before article updated -* Since MediaWiki version 1.25.x, we have to use static function -* for hooks. -* the hook has different signatures. +* Get a list of categories before article updated Since MediaWiki +* version 1.25.x, we have to use static function for hooks. the +* hook has different signatures. +* @param WikiPage $wikiPage the page +* @param User $user who is modifying +* @param Content $content the new article content +* @param string $summary the article summary (comment) +* @param bool $isMinor minor flag +* @param bool $isWatch watch flag (not used, aka always null) +* @param int $section section number (not used, aka always null) +* @param int $flags see WikiPage::doEditContent documentation for flags' definition +* @param Status $status Status (object) */ - public static function onPageContentSave( &$wikiPage,
[MediaWiki-commits] [Gerrit] mediawiki...CategoryWatch[master]: Fix up
MarkAHershberger has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/370773 ) Change subject: Fix up .. Fix up * Trim long lines. * Add copyright notice. * Fix up config variable prefix in extension.json. * Use a protected class variable instead of a global variable for storing instance. * Move comments providing documentation for globals to README. * Fix up doc comments to comply with coding conventions. Change-Id: I33ae7ce52c371c54d002862ae984863283193e9a --- M CategoryWatch.php M README.md M extension.json 3 files changed, 242 insertions(+), 133 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CategoryWatch refs/changes/73/370773/1 diff --git a/CategoryWatch.php b/CategoryWatch.php index e576d63..cfd3fca 100644 --- a/CategoryWatch.php +++ b/CategoryWatch.php @@ -1,11 +1,32 @@ https://www.mediawiki.org/Extension:CategoryWatch for installation and usage details - * See http://www.organicdesign.co.nz/Extension_talk:CategoryWatch for development notes and disucssion + * Copyright (C) 2008 Aran Dunkley + * Copyright (C) 2017 Sean Chen + * Copyright (C) 2017 Mark A. Hershberger + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + * + * See https://www.mediawiki.org/Extension:CategoryWatch + * for installation and usage details + * See http://www.organicdesign.co.nz/Extension_talk:CategoryWatch + * for development notes and disucssion * * @file * @ingroup Extensions @@ -14,125 +35,138 @@ * @licence GNU General Public Licence 2.0 or later */ -# Whether or not to also send notificaton to the person -# who made the change -# The default value is set in file extension.json -//$wgCategoryWatchNotifyEditor = true; - -# Set this to give every user a unique category that -# they're automatically watching -# - the format of the category name is defined on the -# "categorywatch-autocat" localisation message -# The default value is set in file extension.json -//$wgCategoryWatchUseAutoCat = false; - -# Set this to make the categorisation work by realname -# instead of username -# The default value is set in file extension.json -//$wgCategoryWatchUseAutoCatRealName = false; - class CategoryWatch { + // Instance + protected static $watcher; /** * The extension function. * It has to be the static function in a class now. */ - public static function wfSetupCategoryWatch() { - wfDebugLog('CategoryWatch', 'loading extension...'); - global $wgCategoryWatch; + public static function setupCategoryWatch() { + wfDebugLog( 'CategoryWatch', 'loading extension...' ); - # Instantiate the CategoryWatch singleton now -# that the environment is prepared - $wgCategoryWatch = new CategoryWatch(); - } - - function __construct() { - # the constructor will do nothing now. - # New extension register process will use the file - # extension.json to set hooks. + # Instantiate the CategoryWatch singleton now + # that the environment is prepared + self::$watcher = new CategoryWatch(); } /** -* Get a list of categories before article updated -* Since MediaWiki version 1.25.x, we have to use static function -* for hooks. -* the hook has different signatures. +* Get a list of categories before article updated Since MediaWiki +* version 1.25.x, we have to use static function for hooks. the +* hook has different signatures. +* @param WikiPage $wikiPage the page +* @param User $user who is modifying +* @param Content $content the new article content +* @param string $summary the article summary (comment) +* @param bool $isMinor minor flag +* @param bool $isWatch watch flag (not used, aka always null) +* @param int $section section number (not used, aka always null) +* @param int $flags see WikiPage::doEditContent documentation for flags' definition +* @param Status $status Status (object) */ - public static function