compucorp / uk.co.compucorp.civicrm.pivotreport

CiviCRM Pivot table reporting solution
Other
8 stars 13 forks source link

GS-83: Fix Source of Multiple PHP Notices on Cache Rebuild #57

Closed MiyaNoctem closed 6 years ago

MiyaNoctem commented 6 years ago

Overview

Rebuilding report caches through the front end caused a large amount of PHP notices to be logged to watchdog, affecting negatively the performance of the process.

INSERT INTO watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES ('1', 'php', '%type: !message in %function (line %line of %file).', 'a:6:
{s:5:\"%type\";s:6:\"Notice\";s:8:\"!message\";s:32:\"Undefined index: Activity Status\";s:9:\"%function\";s:42:\"CRM_PivotData_AbstractData->formatResult()\";s:5:\"%file\";s:144:\"/var/www/greenhouse-data.ccuptest.co.uk/httpdocs/sites/all/civicrm_extensions/uk.co.compucorp.civicrm.pivotreport/CRM/PivotData/AbstractData.php\";s:5:\"%line\";i:531;s:14:\"severity_level\";i:5;}
', '5', '', 'https://greenhouse-data.ccuptest.co.uk/civicrm/ajax/rest', 'https://greenhouse-data.ccuptest.co.uk/civicrm/activity-report', '185.53.227.161', '1508773159')

Before

Rebuilding the cache from front-end caused several PHP notice messages to be logged to watchdog, since an array was trying to be accessed with keys it did not have. This array in particular was being used this way for every field in every record for every entity, resulting in the problem escalating out of control on large datasets.

After

This part of the code was obsolete, so the problem was fixed by deleting the offending code.