Remove Internal Message Script

Last Updated: 17 Dec 2015

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

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

Example

The usage of this script is as follows:

$ 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 2 days old.
    $ php remove_internal_message.php -s [system_root] -p 2d
  • Remove all internal messages that are over 2 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 3 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 3 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 3 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 3 days old, sent to LDAP bridge (#211) users.
    $ php remove_internal_message.php -s [system_root] -p 3d -y inbox.* -u D -t 221*

Previous Chapter Next Chapter

The Latest

Let Us Know What You Think

Let us know if you spot any errors or if you have any ideas on how we can improve the Matrix Community Website.

Contact Squiz for Demo

Let us show you the true power of Squiz Matrix by giving you a personalised demonstration.