39 return 'Fragmented Attributes Test';
52 return 'A test to check for fragmented attributes on the attributes table';
66 public static function test(&$messages, &$errors)
70 $asset_sql =
'SELECT assetid FROM sq_ast_attr_val WHERE assetid NOT IN (SELECT DISTINCT assetid FROM sq_ast) OR attrid NOT IN (SELECT DISTINCT attrid FROM sq_ast_attr)';
73 foreach ($asset_results as $index => $result) {
74 $asset_results[$index] = $result[
'assetid'];
76 $asset_results = array_unique($asset_results);
78 if (!empty($asset_results)) {
80 foreach ($asset_results as $result) {
81 $errors[] =
'Asset #'.$result.
' on the attributes table does not exist';
86 $attr_sql =
'SELECT attrid FROM sq_ast_attr_val WHERE attrid NOT IN (SELECT DISTINCT attrid FROM sq_ast_attr)';
89 foreach ($attr_results as $index => $result) {
90 $attr_results[$index] = $result[
'attrid'];
92 $attr_results = array_unique($asset_results);
94 if (!empty($attr_results)) {
96 foreach ($attr_results as $result) {
97 $errors[] =
'Attribute #'.$result.
' on the attributes table does not exist';
102 $count = count($asset_results) + count($attr_results);
103 $messages[] =
'There are '.$count.
' fragmented attribute(s) on the system';