From fb530290dc4cfa5c71e5b4e3fdd851f96f48c727 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 8 Aug 2019 13:18:47 +1200 Subject: [PATCH] Remove ?last? instances of ->free() dev/core#562 These are almost the last places where ->free is to be found. The remaining ones are in the dao and perhaps out of scope / need more careful investigation --- CRM/Core/DAO.php | 4 ---- CRM/Utils/System/Backdrop.php | 3 --- CRM/Utils/System/Drupal.php | 3 --- CRM/Utils/System/Drupal6.php | 3 --- CRM/Utils/System/Drupal8.php | 3 --- CRM/Utils/System/Joomla.php | 3 --- CRM/Utils/System/WordPress.php | 3 --- tools/scripts/solr/createSyncJSON.php | 9 --------- 8 files changed, 31 deletions(-) diff --git a/CRM/Core/DAO.php b/CRM/Core/DAO.php index 5eb4713b8fe6..4cca5e8db8e5 100644 --- a/CRM/Core/DAO.php +++ b/CRM/Core/DAO.php @@ -234,26 +234,22 @@ protected function assignTestFK($fieldName, $fieldDef, $params) { if ($fkDAO->find(TRUE)) { $this->$dbName = $fkDAO->id; } - $fkDAO->free(); } elseif (in_array($FKClassName, CRM_Core_DAO::$_testEntitiesToSkip)) { $depObject = new $FKClassName(); $depObject->find(TRUE); $this->$dbName = $depObject->id; - $depObject->free(); } elseif ($daoName == 'CRM_Member_DAO_MembershipType' && $fieldName == 'member_of_contact_id') { // FIXME: the fields() metadata is not specific enough $depObject = CRM_Core_DAO::createTestObject($FKClassName, ['contact_type' => 'Organization']); $this->$dbName = $depObject->id; - $depObject->free(); } else { //if it is required we need to generate the dependency object first $depObject = CRM_Core_DAO::createTestObject($FKClassName, CRM_Utils_Array::value($dbName, $params, 1)); $this->$dbName = $depObject->id; - $depObject->free(); } } diff --git a/CRM/Utils/System/Backdrop.php b/CRM/Utils/System/Backdrop.php index eb34b8a2b7c2..ee7ef622a80a 100644 --- a/CRM/Utils/System/Backdrop.php +++ b/CRM/Utils/System/Backdrop.php @@ -880,9 +880,6 @@ public function synchronizeUsers() { else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/CRM/Utils/System/Drupal.php b/CRM/Utils/System/Drupal.php index 4af43912446b..44e4349b8687 100644 --- a/CRM/Utils/System/Drupal.php +++ b/CRM/Utils/System/Drupal.php @@ -836,9 +836,6 @@ public function synchronizeUsers() { else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/CRM/Utils/System/Drupal6.php b/CRM/Utils/System/Drupal6.php index 9fc4813751b7..af566e5d2a78 100644 --- a/CRM/Utils/System/Drupal6.php +++ b/CRM/Utils/System/Drupal6.php @@ -815,9 +815,6 @@ public function synchronizeUsers() { else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/CRM/Utils/System/Drupal8.php b/CRM/Utils/System/Drupal8.php index 4a54bdc799c6..38ed2933c671 100644 --- a/CRM/Utils/System/Drupal8.php +++ b/CRM/Utils/System/Drupal8.php @@ -616,9 +616,6 @@ public function synchronizeUsers() { else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/CRM/Utils/System/Joomla.php b/CRM/Utils/System/Joomla.php index fa5b4e5b68c1..030b73cc6c80 100644 --- a/CRM/Utils/System/Joomla.php +++ b/CRM/Utils/System/Joomla.php @@ -897,9 +897,6 @@ public function synchronizeUsers() { else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index bf35954360ef..382892d314b6 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -847,9 +847,6 @@ public function synchronizeUsers() { else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/tools/scripts/solr/createSyncJSON.php b/tools/scripts/solr/createSyncJSON.php index 95d4fac75fff..57688b34bc97 100644 --- a/tools/scripts/solr/createSyncJSON.php +++ b/tools/scripts/solr/createSyncJSON.php @@ -133,7 +133,6 @@ function getTableInfo(&$contactIDs, &$values, $tableName, &$fields, } appendValue($values, $dao->contact_id, 'contact', $contact, $flat); } - $dao->free(); } /** @@ -187,7 +186,6 @@ function getNoteInfo(&$contactIDs, &$values) { appendValue($values, $dao->id, 'note', $note); } - $dao->free(); } /** @@ -225,7 +223,6 @@ function getPhoneInfo(&$contactIDs, &$values) { appendValue($values, $dao->id, 'phone', $phone); } - $dao->free(); } /** @@ -258,7 +255,6 @@ function getEmailInfo(&$contactIDs, &$values) { ]; appendValue($values, $dao->id, 'email', $email); } - $dao->free(); } /** @@ -309,7 +305,6 @@ function getAddressInfo(&$contactIDs, &$values) { } appendValue($values, $dao->id, 'address', $address); } - $dao->free(); } /** @@ -362,7 +357,6 @@ function getRelationshipInfo(&$contactIDs, &$values, &$allContactIDs, &$addition $allContactIDs, $additionalContacts ); } - $dao->free(); } /** @@ -418,7 +412,6 @@ function getActivityInfo(&$contactIDs, &$values, &$allContactIDs, &$additionalCo $allContactIDs, $additionalContacts ); } - $dao->free(); if (empty($activityIDs)) { return; @@ -439,7 +432,6 @@ function getActivityInfo(&$contactIDs, &$values, &$allContactIDs, &$additionalCo appendValue($values, $aaDAO->id, 'activity_assignment', $activityAssignee); $activityContacts[] = $aaDAO->assignee_contact_id; } - $aaDAO->free(); $sql = "SELECT * FROM civicrm_activity_target WHERE activity_id IN ($activityIDString)"; $atDAO = &CRM_Core_DAO::executeQuery($sql); @@ -452,7 +444,6 @@ function getActivityInfo(&$contactIDs, &$values, &$allContactIDs, &$additionalCo appendValue($values, $atDAO->id, 'activity_target', $activityTarget); $activityContacts[] = $atDAO->target_contact_id; } - $atDAO->free(); addAdditionalContacts($activityContacts, $allContactIDs, $additionalContacts); }