- // also delete all the action temp tables
- // that were created the same interval ago
- $dao = new CRM_Core_DAO();
- $query = "
-SELECT TABLE_NAME as tableName
-FROM INFORMATION_SCHEMA.TABLES
-WHERE TABLE_SCHEMA = %1
-AND ( TABLE_NAME LIKE 'civicrm_task_action_temp_%'
- OR TABLE_NAME LIKE 'civicrm_export_temp_%'
- OR TABLE_NAME LIKE 'civicrm_import_job_%' )
-AND CREATE_TIME < date_sub( NOW( ), INTERVAL $timeIntervalDays day )
-";
-
- $params = array(1 => array($dao->database(), 'String'));
- $tableDAO = CRM_Core_DAO::executeQuery($query, $params);
- $tables = array();
- while ($tableDAO->fetch()) {
- $tables[] = $tableDAO->tableName;
- }
- if (!empty($tables)) {
- $table = implode(',', $tables);
- // drop leftover temporary tables
- CRM_Core_DAO::executeQuery("DROP TABLE $table");
- }