Remove internal message script

The remove_internal_message.php script removes internal messages from the Matrix system.

This script is located in the /scripts directory of your Matrix system and allows you to specify the period, source, destination, type and status of messages to remove.

The usage of this script is as follows:

Example
$ php remove_internal_message.php

USAGE: remove_internal_message.php -s [system_root] -p [period] [-f userfrom] [-t userto] [-y msg type] [-u status] [--show-query-only] [--quiet]

-p The period to remove internal messages before
-f The userid that the message is sent from, e.g. all or 7, 229*, 229*:323*:7
-t The userid that the message is sent to, e.g. all or 7, 229*, 229*:323*:7
-y The type of internal message to remove, e.g. asset.linking.create, cron.*
-u The status of internal message to remove, e.g. U(nread), R(ead), D(eleted) or multiple like U:R or R:D
-a The assetid that message belongs to, e.g. 7, 12, 111:222. This option can be specified multiple times e.g. "-a 7 -a 12".
--show-query-only The script only prints the query without running it.
--quiet No output will be sent
(For -p, the period is in the format nx where n is the number of units and x is one of:
 h - hours
 d - days
 w - weeks
 m - months
 y - years)

(For -f and -t, the userid can take different formats which is one of:
 all            - internal messages that are sent from/to other than system, i.e. not equal to 0
 single id      - for example, 7 for public user or 221* for LDAP bridge(#221) users
 multiple ids   - more than one of the above single ids, for example, 7:221*:328* for Public or LDAP bridge(#221) or IPB bridge(#328) users)

Some example of its usage are given below:

  • Remove all internal messages that are over two days old.

$ php remove_internal_message.php -s [system_root] -p 2d
  • Remove all internal messages that are over two days old, sent to LDAP Bridge (#221) and IPB Bridge (#328) users.

$ php remove_internal_message.php -s [system_root] -p 2d -t 221*:328*
  • Remove all internal messages that are over a month old, with a message type beginning with asset.

$ php remove_internal_message.php -s [system_root] -p 1m -f 0 -y asset.*
  • Remove all internal messages over three days old, sent to a user who has been deleted.

$ php remove_internal_message.php -s [system_root] -p 3d -t all -u D

Some inbox message examples are given below:

  • Remove all read and deleted inbox messages (sent and inbox) that are over three days old.

$ php remove_internal_message.php -s [system_root] -p 3d -y inbox.* -u R:D
  • Remove all read inbox sent messages that are over three days old.

$ php remove_internal_message.php -s [system_root] -p 3d -y inbox.sent -u R
  • Remove all deleted inbox messages (sent and inbox) that are over three days old, sent to LDAP bridge (#211) users.

$ php remove_internal_message.php -s [system_root] -p 3d -y inbox.* -u D -t 221*

© 2015- Squiz Pty Ltd