System Check Script

Last Updated: 04 Nov 2019

The system_check.php script checks and identifies system integrity issues and reports back on any known inconsistencies in the system. Please note that this script (for the most part) does not resolve any issues that may be found. The results of this script should be interpreted and acted upon appropriately at your discretion.

The system tests run by this script are:

  • Dead File Revisions: checks for file revisions that have not been cleaned (i.e. multiple file versions in the data directory). You can run the --execute argument to clean up any orphaned file repositories found.
  • Form Integrity Test: checks forms for valid questions and sections, for any invalid form actions, and for any invalid submissions.
  • Dead Assets Test: checks for assets that don't exist anymore but are still present in the Asset Tree.
  • General Status Check: checks and returns the number of assets and asset links on the system.
  • Submission Integrity Test: checks form submissions for valid questions.
  • Fragmented Rollback Test: checksthe rollback table for multiple active entries.
  • Fragmented Attributes Test: checks the sq_ast_attr_val table for attributes and assets that don't exist in sq_ast_attr.
  • Invalid Number of Kids on Link Tree Test: checks for incorrect child counts on Asset Tree lineages.
  • Invalid Incomplete Attachments Test: checks for form submissions with incomplete attachments.
  • Broken Sort Order Test: checks for sort order errors on the link tree table.
  • Orphaned Assets Test: checks for orphaned assets (assets without links).
  • Invalid Links on Link Tree Test: checks for entries in the link tree table that don't exist in the link table.
  • HTML Tidy Errors Test: checks for HTML tidy issues on the system.
  • User Permissions Test: checks forpermissions applied for users that no longer exist.

This script takes the system root and can optionally pass the following arguments:

  • --verbose: displays more detailed errors.
  • --colours: uses colours in results.
  • --stats: shows statistics for this process.
  • --help: shows the help screen.
  • --execute: executes an action on the script. Currently, only the Dead File Revisions test allows you execute a system clean.

An example of the usage of this script is shown below. The highlighted content demonstrates the --execute argument:

php system_check.php --system=<root> --execute

Dead File Revisions                              [  !!  ]
        There are 5 orphaned file repository entries to clean up.
        The following assets were cleaned up successfully:
        140,141,170,192,19
Form Integrity Test                              [  OK  ]
Dead Assets Test                                 [  !!  ]
        There are 8 dead asset(s) on the system
General Status Check                             [ info ]
        There are 681 asset(s) on the system
        There are 713 asset link(s) on the system
Submission Integrity Test                        [  !!  ]
        There are 5 submissions found with problems
Fragmented Rollback Test                         [  OK  ]
Fragmented Attributes Test                       [  OK  ]
Invalid Number of Kids on Link Tree Test         [  !!  ]
        There are 1 invalid number of kids found on the system
Invalid Incomplete Attachments Test              [  OK  ]
Broken Sort Order Test                           [  OK  ]
Orphaned Assets Test                             [  OK  ]
Invalid Links on Link Tree Test                  [  OK  ]
HTML Tidy Errors Test                            [  !!  ]
        There are 115 content types with HTML Tidy issues
Invalid Matrix Links Test                        [  OK  ]
User Permissions Test                            [  OK  ]

Previous Chapter Next Chapter