/** * Hooked method to marks a form as dirty (needs to be cached). * @param mixed $args. an array of two elements whose first element is a form object, the second is the user */ public function globalUpdate_hook($args) { if (!is_array($args) || !array_key_exists('form', $args)) { return; } $form = $args['form']; if ($form instanceof I2CE_Form) { $form = $form->getName(); } if (!is_string($form)) { return; } $reports = I2CE_CustomReport::getReports(); foreach ($reports as $report) { try { $rep = new I2CE_CustomReport($report); } catch (Exception $e) { continue; } if (I2CE_CustomReport::getStatus($report) == 'not_generated') { continue; } $forms = $rep->getFormsRequiredByReport(); if (!in_array($form, $forms)) { continue; } I2CE::raiseError("Dropping {$report} as it uses {$form} which has been changed in a global update"); $rep->dropTable(); } }