Commit dd0e1dab authored by Tobias Zeuch's avatar Tobias Zeuch

Bug 1468156: Change plugin type of plugin multirecipientnotification to module

To change the plugin type from artefact to module, the code is moved and the
superclass reference is changed to PluginModule. Obsolete classes for the
former unused artefact types are deleted. The references to the old script
paths are changed. Plugin Tables are renamed and references updated.
The new plugin mustn't be installed when the old plugin is still active, but on
upgrade, the database tables are renamed and references in artefact_installed
and artefact_event_subscription and the triggers are changed.

Change-Id: Id5f1198b780ffb92181f7d60785aad9ffe2259da
Signed-off-by: default avatarTobias Zeuch <tobias.zeuch@rwth-aachen.de>
parent 2a1b1adb
......@@ -140,7 +140,13 @@ function delete_all_notifications_submit() {
db_commit();
$SESSION->add_ok_msg(get_string('deletednotifications1', 'activity', $count));
redirect(get_config('wwwroot') . 'account/activity/index.php?type='.$type);
safe_require('module', 'multirecipientnotification');
if (PluginModuleMultirecipientnotification::is_active()) {
redirect(get_config('wwwroot') . 'module/multirecipientnotification/inbox.php?type='.$type);
}
else {
redirect(get_config('wwwroot') . 'account/activity/index.php?type='.$type);
}
}
$smarty = smarty(array('paginator'));
......
<?php
/**
*
* @package mahara
* @subpackage artefact-multirecipientnotification
* @author David Ballhausen, Tobias Zeuch
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
/**
* artefacttype - plugin class. Used for corresponding with the Mahara API and containing all needed functionality for Multirecipientnotification function
*/
class ArtefactTypeMultiRecipientNotification extends ArtefactType {
/**
* API-Function. This Artefact does not provide any blocks or items to render
* @see ArtefactType::render_self()
*/
public function render_self($options) {
return get_string('nothingtorender', 'artefact.multirecipientnotification');
}
/**
* API-Function. Get Plugin-Artefacttype Icon. Here (No icon provided)
* @param string $options
*/
public static function get_icon($options=null) {
}
/**
* API-Function. Is it possible to use more Artefacttypes than one of this type? Here: No!
*/
public static function is_singular() {
return true;
}
/**
* API-Function: Get plugin-Artefacttype specific links: Here: None
* @param integer $id
*/
public static function get_links($id) {
}
} // ArtefactTypeMultiRecipientNotification
<?php
/**
*
* @package mahara
* @subpackage artefact-multirecipientnotification
* @author David Ballhausen, Tobias Zeuch
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
/**
* artefacttype - plugin class. Used for corresponding with the Mahara API and containing all needed functionality for Multirecipientnotification function
*/
class ArtefactTypeOutbox extends ArtefactType {
/**
* API-Function. This Artefact does not provide any blocks or items to render
* @see ArtefactType::render_self()
*/
public function render_self($options) {
return get_string('nothingtorender', 'artefact.multirecipientnotification');
}
/**
* API-Function. Get Plugin-Artefacttype Icon. Here (No icon provided)
* @param string $options
*/
public static function get_icon($options=null) {
}
/**
* API-Function. Is it possible to use more Artefacttypes than one of this type? Here: No!
*/
public static function is_singular() {
return true;
}
/**
* API-Function: Get plugin-Artefacttype specific links: Here: None
* @param integer $id
*/
public static function get_links($id) {
}
} // ArtefactTypeOutbox
......@@ -30,7 +30,13 @@ class PluginBlocktypeInbox extends SystemBlocktype {
}
public static function get_link(BlockInstance $instance) {
$data = get_config('wwwroot') . 'account/activity/index.php';
safe_require('module', 'multirecipientnotification');
if (PluginModuleMultirecipientnotification::is_active()) {
$data = get_config('wwwroot') . 'module/multirecipientnotification/inbox.php';
}
else {
$data = get_config('wwwroot') . 'account/activity/index.php';
}
return sanitize_url($data);
}
......
......@@ -1450,10 +1450,18 @@ function activitylist_html($type='all', $limit=10, $offset=0) {
$values = array($userid);
$count = count_records_sql('SELECT COUNT(*)' . $from, $values);
safe_require('module', 'multirecipientnotification');
if (PluginModuleMultirecipientnotification::is_active()) {
$paginationurl = get_config('wwwroot') . 'module/multirecipientnotification/inbox.php?type=' . $type;
}
else {
$paginationurl = get_config('wwwroot') . 'account/activity/index.php?type=' . $type;
}
$pagination = build_pagination(array(
'id' => 'activitylist_pagination',
'url' => get_config('wwwroot') . 'account/activity/index.php?type=' . $type,
'url' => $paginationurl,
'jsonscript' => 'account/activity/index.json.php',
'datatable' => 'activitylist',
'count' => $count,
......
......@@ -4082,5 +4082,39 @@ function xmldb_core_upgrade($oldversion=0) {
change_field_precision($table, $field);
}
if ($oldversion < 2015072000) {
log_debug('Change installation of artefact plugin multirecipentNotification to plugin module');
// first, drop the old triggers
db_drop_trigger('update_unread_insert2', 'artefact_multirecipient_userrelation');
db_drop_trigger('update_unread_update2', 'artefact_multirecipient_userrelation');
db_drop_trigger('update_unread_delete2', 'artefact_multirecipient_userrelation');
// rename tables artefact_multirecipientnotifiaction_notification and
// Table: artefact_multirecipient_userrelation to module-prefix
execute_sql("ALTER TABLE artefact_multirecipient_notification RENAME TO module_multirecipient_notification");
execute_sql("ALTER TABLE artefact_multirecipient_userrelation RENAME TO module_multirecipient_userrelation");
//move event_subscrition entries for artefact plugin
//multirecipientnotification to table module_event_subscription
$subscriptions = get_records_array('artefact_event_subscription', 'plugin', 'multirecipientnotification');
delete_records('artefact_event_subscription', 'plugin', 'multirecipientnotification');
delete_records('artefact_installed_type', 'plugin', 'multirecipientnotification');
$installrecord = get_record('artefact_installed', 'name', 'multirecipientnotification');
if (is_object($installrecord)) {
insert_record('module_installed', $installrecord);
delete_records('artefact_installed', 'name', 'multirecipientnotification');
}
if (is_array($subscriptions)) {
foreach ($subscriptions as $subscription) {
insert_record('module_event_subscription', $subscription, 'id');
}
}
// recreate trigger
safe_require('module', 'multirecipientnotification');
PluginModuleMultirecipientnotification::postinst(0);
}
return $status;
}
......@@ -1920,8 +1920,9 @@ function build_userlist_html(&$data, $page, $admingroups) {
$resultcounttextsingular = get_string('user', 'group');
$resultcounttextplural = get_string('users', 'group');
}
$smarty->assign('admingroups', $admingroups);
safe_require('module', 'multirecipientnotification');
$smarty->assign('mrmoduleactive', PluginModuleMultirecipientnotification::is_active());
$data['tablerows'] = $smarty->fetch('user/userresults.tpl');
$pagination = build_pagination(array(
'id' => 'friendslist_pagination',
......@@ -1997,6 +1998,8 @@ function build_stafflist_html(&$data, $page, $listtype, $inst='mahara') {
else {
$smarty->assign('data', isset($data) ? $data : null);
}
safe_require('module', 'multirecipientnotification');
$smarty->assign('mrmoduleactive', PluginModuleMultirecipientnotification::is_active());
$data['tablerows'] = $smarty->fetch('institution/stafflist.tpl');
}
......
......@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/index.php/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2015071500;
$config->version = 2015072000;
$config->series = '15.10';
$config->release = '15.10dev';
$config->minupgradefrom = 2009022600;
......
......@@ -2,21 +2,22 @@
# for developing/testing scenarios when you want to remove/reinstall the
# script without reinstalling the complete database
drop table IF EXISTS `multirecipientnotification_internal_recipients`;
drop table IF EXISTS `multirecipientnotification_internal_activity`;
DELETE FROM `artefact_cron` WHERE plugin='notificationoutbox';
DELETE FROM `artefact_event_subscription` WHERE plugin='notificationoutbox';
DELETE FROM `artefact_config` WHERE `plugin`='notificationoutbox';
delete from `artefact_installed_type` where plugin='notificationoutbox';
delete from `artefact_installed` where name='notificationoutbox';
# delete the old plugin installed as artefact
drop table IF EXISTS `artefact_multirecipient_userrelation`;
drop table IF EXISTS `artefact_multirecipient_notification`;
DELETE FROM `artefact_cron` WHERE plugin='multirecipientnotification';
DELETE FROM `artefact_event_subscription` WHERE plugin='multirecipientnotification';
DELETE FROM `artefact_config` WHERE `plugin`='multirecipientnotification';
delete from `artefact_installed_type` where plugin='multirecipientnotification';
delete from `artefact_installed` where name='multirecipientnotification';
DELETE FROM `artefact_installed_type` WHERE plugin='multirecipientnotification';
DELETE FROM `artefact_installed` WHERE name='multirecipientnotification';
# delete the new script installed as module
drop table IF EXISTS `module_multirecipient_userrelation`;
drop table IF EXISTS `module_multirecipient_notification`;
DELETE FROM `module_cron` WHERE plugin='multirecipientnotification';
DELETE FROM `module_event_subscription` WHERE plugin='multirecipientnotification';
DELETE FROM `module_config` WHERE `plugin`='multirecipientnotification';
DELETE FROM `module_installed_type` WHERE plugin='multirecipientnotification';
DELETE FROM `module_installed` WHERE name='multirecipientnotification';
......@@ -4,7 +4,7 @@
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="artefact_multirecipient_notification" COMMENT="notifications to (potentially) multiple recipients ">
<TABLE NAME="module_multirecipient_notification" COMMENT="notifications to (potentially) multiple recipients ">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" COMMENT="Primary Key"/>
<FIELD NAME="type" TYPE="int" LENGTH="10" NOTNULL="false" COMMENT="The type of message, e.g. notification"/>
......@@ -16,13 +16,13 @@
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="typefk" TYPE="foreign" FIELDS="type" REFTABLE="activity_type" REFFIELDS="id"/>
<KEY NAME="parentfk" TYPE="foreign" FIELDS="parent" REFTABLE="artefact_multirecipient_notification" REFFIELDS="id"/>
<KEY NAME="parentfk" TYPE="foreign" FIELDS="parent" REFTABLE="module_multirecipient_notification" REFFIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="ctimeix" FIELDS="ctime" UNIQUE="false"/>
</INDEXES>
</TABLE>
<TABLE NAME="artefact_multirecipient_userrelation" COMMENT="notifications to (potentially) multiple recipients ">
<TABLE NAME="module_multirecipient_userrelation" COMMENT="notifications to (potentially) multiple recipients ">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" COMMENT="Primary Key"/>
<FIELD NAME="role" TYPE="char" LENGTH="9" ENUM="true" ENUMVALUES="'sender','recipient'" NOTNULL="true" DEFAULT="recipient" COMMENT="the role of user-relation"/>
......@@ -33,7 +33,7 @@
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="notificationfk" TYPE="foreign" FIELDS="notification" REFTABLE="artefact_multirecipient_notification" REFFIELDS="id"/>
<KEY NAME="notificationfk" TYPE="foreign" FIELDS="notification" REFTABLE="module_multirecipient_notification" REFFIELDS="id"/>
<KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id"/>
</KEYS>
</TABLE>
......
......@@ -2,7 +2,7 @@
/**
*
* @package mahara
* @subpackage artefact-multirecipientnotification
* @subpackage module-multirecipientnotification
* @author David Ballhausen, Tobias Zeuch
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
......@@ -11,19 +11,29 @@
define('INTERNAL', 1);
define('MENUITEM', 'inbox');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINTYPE', 'module');
define('SECTION_PLUGINNAME', 'multirecipientnotification');
define('SECTION_PAGE', 'inbox');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
safe_require('artefact', 'multirecipientnotification');
safe_require('module', 'multirecipientnotification');
global $USER;
global $THEME;
if (!PluginModuleMultirecipientnotification::is_active()) {
$redirTarget = get_config('wwwroot') . 'account/activity/inbox.php';
if (!empty($_SERVER['QUERY_STRING'])) {
// change path
$redirTarget .='?' . $_SERVER['QUERY_STRING'];
}
redirect($redirTarget);
exit;
}
// Add new title
define('TITLE', get_string('notification', 'artefact.multirecipientnotification'));
define('TITLE', get_string('notification', 'module.multirecipientnotification'));
// Make sure the unread message count is up to date whenever the
// user hits this page.
......@@ -145,8 +155,8 @@ function delete_all_notifications_submit() {
}
$query = 'SELECT msg.id AS id
FROM {artefact_multirecipient_notification} as msg
INNER JOIN {artefact_multirecipient_userrelation} as rel
FROM {module_multirecipient_notification} as msg
INNER JOIN {module_multirecipient_userrelation} as rel
ON msg.id = rel.notification
AND rel.usr = ?
AND rel.role = ?
......@@ -205,7 +215,7 @@ function delete_all_notifications_submit() {
db_commit();
$SESSION->add_ok_msg(get_string('deletednotifications1', 'activity', $count));
redirect(get_config('wwwroot') . 'artefact/multirecipientnotification/inbox.php?type=' . $type);
redirect(get_config('wwwroot') . 'module/multirecipientnotification/inbox.php?type=' . $type);
}
$smarty = smarty(array('paginator'));
......@@ -215,14 +225,14 @@ $smarty->assign('INLINEJAVASCRIPT', $paginationjavascript);
// Adding the links to out- and inbox
$smarty->assign('PAGEHEADING', TITLE);
$smarty->assign('subsectionheading', get_string('labelinbox', 'artefact.multirecipientnotification'));
$smarty->assign('subsectionheading', get_string('labelinbox', 'module.multirecipientnotification'));
// show urls and titles
define('NOTIFICATION_SUBPAGE', 'inbox');
$smarty->assign('SUBPAGENAV', PluginArtefactMultirecipientnotification::submenu_items());
$smarty->assign('SUBPAGENAV', PluginModuleMultirecipientnotification::submenu_items());
$smarty->assign('deleteall', $deleteall);
$smarty->assign('activitylist', $activitylist);
// Changed to new tpl
$smarty->display('artefact:multirecipientnotification:indexin.tpl');
$smarty->display('module:multirecipientnotification:indexin.tpl');
......@@ -2,7 +2,7 @@
/**
*
* @package mahara
* @subpackage artefact-multirecipientnotification
* @subpackage module-multirecipientnotification
* @author David Ballhausen, Tobias Zeuch
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
......@@ -13,7 +13,7 @@ define('INTERNAL', 1);
define('JSON', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
safe_require('artefact', 'multirecipientnotification');
safe_require('module', 'multirecipientnotification');
global $USER;
global $THEME;
......@@ -28,7 +28,7 @@ if ($readone) {
if ('notification_internal_activity' === $list) {
set_field($list, 'read', 1, 'id', $readone, 'usr', $USER->get('id'));
}
else if ('artefact_multirecipient_notification' === $list) {
else if ('module_multirecipient_notification' === $list) {
mark_as_read_mr(array($readone), $USER->get('id'));
}
$unread = $USER->add_unread(-1);
......@@ -58,8 +58,8 @@ if ($markasread) {
}
foreach ($ids as $list => $idsperlist) {
if ($idsperlist) {
if ('artefact_multirecipient_notification' === $list) {
$list = 'artefact_multirecipient_userrelation';
if ('module_multirecipient_notification' === $list) {
$list = 'module_multirecipient_userrelation';
$column = 'notification';
}
else {
......@@ -91,7 +91,7 @@ else if ($delete) {
db_begin();
$countdeleted = 0;
foreach ($ids as $list => $idsperlist) {
if ('artefact_multirecipient_notification' === $list) {
if ('module_multirecipient_notification' === $list) {
delete_messages_mr($idsperlist, $USER->get('id'));
}
else if ('notification_internal_activity' === $list) {
......
......@@ -2,7 +2,7 @@
/**
*
* @package mahara
* @subpackage artefact-multirecipientnotification
* @subpackage module-multirecipientnotification
* @author David Ballhausen, Tobias Zeuch
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
......@@ -13,7 +13,7 @@ define('INTERNAL', 1);
define('JSON', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
safe_require('artefact', 'multirecipientnotification');
safe_require('module', 'multirecipientnotification');
global $USER;
global $THEME;
......
......@@ -2,7 +2,7 @@
* Multi-Recipient Notification Send Message
*
* @package mahara
* @subpackage artefact-multirecipientnotification
* @subpackage module-multirecipientnotification
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
......
......@@ -2,7 +2,7 @@
/**
*
* @package mahara
* @subpackage artefact-multirecipientnotification
* @subpackage module-multirecipientnotification
* @author David Ballhausen, Tobias Zeuch
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
......
......@@ -2,7 +2,7 @@
/**
*
* @package mahara
* @subpackage artefact-multirecipientnotification
* @subpackage module-multirecipientnotification
* @author David Ballhausen, Tobias Zeuch
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
......@@ -12,13 +12,13 @@
defined('INTERNAL') || die();
require_once(dirname(dirname(dirname(__FILE__))) . '/lib/group.php');
require_once(dirname(__FILE__) . '/lib/multirecipientnotification.php');
require_once(get_config('docroot') . '/artefact/multirecipientnotification/lib/activityextend.php');
require_once(get_config('docroot') . '/module/multirecipientnotification/lib/activityextend.php');
/**
* artefact plugin class. Used for registering the plugin and his functions.
* module plugin class. Used for registering the plugin and his functions.
*/
class PluginArtefactMultirecipientnotification extends PluginArtefact {
class PluginModuleMultirecipientnotification extends PluginModule {
/**
* the maximum length of a userstring in the list of senders/recipients
* in the inbox or outbox view
......@@ -31,30 +31,12 @@ class PluginArtefactMultirecipientnotification extends PluginArtefact {
*/
public static function is_active() {
$active = false;
if (get_field('artefact_installed', 'active', 'name', 'multirecipientnotification')) {
if (get_field('module_installed', 'active', 'name', 'multirecipientnotification')) {
$active = true;
}
return $active;
}
/**
* API-Function get the provided artefacttypes. Here is it 'Multirecipientnotification'.
*
* @return array array with the provided artefacttypes
*/
public static function get_artefact_types() {
return array('Multirecipientnotification');
}
/**
* API-Function get the provided blocktypes. Here None.
*
* @return array array with the provided blocktypes
*/
public static function get_block_types() {
return array();
}
/**
* API-Function get the Plugin ShortName
*
......@@ -64,53 +46,36 @@ class PluginArtefactMultirecipientnotification extends PluginArtefact {
return 'multirecipientnotification';
}
/**
* API-Function to allow the artefact to be counted in progress bar
* @return bool
*/
public static function has_progressbar_options() {
return false;
}
/**
* API-Function get the provided Menus. It is possible to overwrite existing menuentries
* by redefining them with the same path, title and weight.
*
* @return array fully descripted new menuitems with menupath, title, url, etc.
*/
public static function menu_items() {
$menuExtensions = array();
public static function right_nav_menu_items() {
global $USER;
global $THEME;
safe_require('notification', 'internal');
$unread = $USER->get('unread');
$menuExtensions = array(
'inbox' => array(
'path' => 'inbox',
'url' => 'module/multirecipientnotification/inbox.php',
'alt' => get_string('inbox'),
'count' => $unread,
'countclass' => 'unreadmessagecount',
'linkid' => 'mail',
'weight' => 20,
'iconclass' => 'envelope'
),);
// Templates
if (PluginArtefactMultirecipientnotification::is_active()) {
// search for path
$searchFor = 'lib/activity.php';
if (!(strpos($_SERVER['REQUEST_URI'], $searchFor) === false)) {
// set new path
$redirTarget = get_config('wwwroot') . 'artefact/multirecipientnotification/lib/activity.php';
if (!empty($_SERVER['QUERY_STRING'])) {
// change path
$redirTarget .= '?' . $_SERVER['QUERY_STRING'];
}
redirect($redirTarget);
exit;
}
// search for path
$searchFor = '/account\/activity\/($|index.php)/';
if ((preg_match($searchFor, $_SERVER['REQUEST_URI'])) == 1) {
// set new path
$redirTarget = get_config('wwwroot') . 'artefact/multirecipientnotification/inbox.php';
if (!empty($_SERVER['QUERY_STRING'])) {
// change path
$redirTarget .='?' . $_SERVER['QUERY_STRING'];
}
redirect($redirTarget);
exit;
}
if (PluginModuleMultirecipientnotification::is_active()) {
// search for path
$searchFor = '/user\/sendmessage.php/';
if ((preg_match($searchFor, $_SERVER['REQUEST_URI'])) == 1) {
// set new path
$redirTarget = get_config('wwwroot') . 'artefact/multirecipientnotification/sendmessage.php';
$redirTarget = get_config('wwwroot') . 'module/multirecipientnotification/sendmessage.php';
if (!empty($_SERVER['QUERY_STRING'])) {
// change path
$redirTarget .= '?' . $_SERVER['QUERY_STRING'];
......@@ -131,15 +96,15 @@ class PluginArtefactMultirecipientnotification extends PluginArtefact {
$tabs = array(
'inbox' => array(
'iconclass' => 'icon icon-inbox',
'url' => 'artefact/multirecipientnotification/inbox.php',
'title' => get_string('labelinbox', 'artefact.multirecipientnotification'),
'tooltip' => get_string('inboxdesc1', 'artefact.multirecipientnotification'),
'url' => 'module/multirecipientnotification/inbox.php',
'title' => get_string('labelinbox', 'module.multirecipientnotification'),
'tooltip' => get_string('inboxdesc1', 'module.multirecipientnotification'),
),
'outbox' => array(
'iconclass' => 'icon icon-paper-plane',
'url' => 'artefact/multirecipientnotification/outbox.php',
'title' => get_string('labeloutbox1', 'artefact.multirecipientnotification'),
'tooltip' => get_string('outboxdesc', 'artefact.multirecipientnotification'),
'url' => 'module/multirecipientnotification/outbox.php',
'title' => get_string('labeloutbox1', 'module.multirecipientnotification'),
'tooltip' => get_string('outboxdesc', 'module.multirecipientnotification'),
)
);
if (defined('NOTIFICATION_SUBPAGE') && isset($tabs[NOTIFICATION_SUBPAGE])) {
......@@ -151,17 +116,17 @@ class PluginArtefactMultirecipientnotification extends PluginArtefact {
public static function postinst($prevversion) {
if ($prevversion < 20131010) {
// Add triggers to update user unread message count when updating
// artefact_multirecipient_userrelation
// module_multirecipient_userrelation
db_create_trigger(
'update_unread_insert2',
'AFTER', 'INSERT', 'artefact_multirecipient_userrelation', '
'AFTER', 'INSERT', 'module_multirecipient_userrelation', '
IF NEW.role = \'recipient\' AND NEW.read = \'0\' THEN
UPDATE {usr} SET unread = unread + 1 WHERE id = NEW.usr;