39 return 'Dead Assets Test';
52 return 'A test to check for dead assets in the link table in Matrix';
66 public static function test(&$messages, &$errors)
69 $minor_sql =
'SELECT minorid FROM sq_ast_lnk WHERE minorid NOT IN (select assetid FROM sq_ast) AND linkid <> 1';
72 foreach ($minor_result as $index => $result) {
73 $minor_result[$index] = $result[
'minorid'];
75 $minor_result = array_unique($minor_result);
77 if (!empty($minor_result)) {
79 foreach ($minor_result as $result) {
80 $errors[] =
'Asset #'.$result.
' was not found on the system';
83 $major_sql =
'SELECT majorid FROM sq_ast_lnk WHERE majorid NOT IN (SELECT assetid FROM sq_ast) AND linkid <> 1';
86 foreach ($major_result as $index => $result) {
87 $major_result[$index] = $result[
'majorid'];
89 $major_result = array_unique($major_result);
91 if (!empty($major_result)) {
93 foreach ($major_result as $result) {
94 $errors[] =
'Asset #'.$result.
' was not found on the system';
99 $count = count($minor_result) + count($major_result);
100 $messages[] =
'There are '.$count.
' dead asset(s) on the system';