Nischayn22 has submitted this change and it was merged. Change subject: Added checks and updated README ......................................................................
Added checks and updated README added an extra check, otherwise a NOTICE would show on user creation. Updated readme to add missing step: update.php Change-Id: I0dcf6a5ee489c4b9c7e834fbb9cccd0ab895e70d --- M PageCreationNotif.hooks.php M README 2 files changed, 16 insertions(+), 11 deletions(-) Approvals: Nischayn22: Verified; Looks good to me, approved diff --git a/PageCreationNotif.hooks.php b/PageCreationNotif.hooks.php index 0131d92..20a0e9c 100644 --- a/PageCreationNotif.hooks.php +++ b/PageCreationNotif.hooks.php @@ -46,17 +46,19 @@ public static function onUserSaveOptions( User $user, array &$options ) { $dbw = wfGetDB( DB_MASTER ); - $dbw->replace( - 'pcn_users', - array( - 'pcn_user_id' - ), - array( - 'pcn_user_id' => $user->getId(), - 'pcn_notify' => $options['page_creation_notif'] ? 1 : 0 - ), - __METHOD__ - ); + if ( $user && isset( $options['page_creation_notif'] ) ) { + $dbw->replace( + 'pcn_users', + array( + 'pcn_user_id' + ), + array( + 'pcn_user_id' => $user->getId(), + 'pcn_notify' => $options['page_creation_notif'] ? 1 : 0 + ), + __METHOD__ + ); + } return true; diff --git a/README b/README index 69e1ded..aea1d64 100644 --- a/README +++ b/README @@ -33,6 +33,9 @@ include_once("$IP/extensions/PageCreationNotif/PageCreationNotif.php"); +Then run the update script: + php maintenance/update.php + == 4. Configuration == The behaviour of the extension can be tweaked using configuration -- To view, visit https://gerrit.wikimedia.org/r/97357 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0dcf6a5ee489c4b9c7e834fbb9cccd0ab895e70d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/PageCreationNotif Gerrit-Branch: master Gerrit-Owner: Nischayn22 <nischay...@gmail.com> Gerrit-Reviewer: Nischayn22 <nischay...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits