Remove Internal Message Script

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
--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:

  • Delete all the internal messages older than last 2 days
    $ php remove_internal_message.php -s [system_root] -p 2d
    
  • Delete all the internal messages sent to LDAP Bridge (#221) and IPB Bridge (#328) users in last 2 days
    $ php remove_internal_message.php -s [system_root] -p 2d -t 221*:328*
    
  • Delete all the internal messages sent from the system and Message type starts with asset in last month
    $ php remove_internal_message.php -s [system_root] -p 1m -f 0 -y asset.*
    
  • Delete all the internal messages sent to users who have been deleted in last 3 days
    $ php remove_internal_message.php -s [system_root] -p 3d -t all -u D
    

Some inbox message examples are given below:

  • Delete all read and deleted inbox messages (sent and inbox) in last 3 days
    $ php remove_internal_message.php -s [system_root] -p 3d -y inbox.* -u R:D
    
  • Delete all read inbox sent messages in last 3 days
    $ php remove_internal_message.php -s [system_root] -p 3d -y inbox.sent -u R
    
  • Delete all deleted inbox messages (sent and inbox) sent to LDAP bridge (#211) users in last 3 days
    $ php remove_internal_message.php -s [system_root] -p 3d -y inbox.* -u D -t 221*
    

PreviousNext