Remove ?last? instances of ->free() dev/core#562
authoreileen <emcnaughton@wikimedia.org>
Thu, 8 Aug 2019 01:18:47 +0000 (13:18 +1200)
committereileen <emcnaughton@wikimedia.org>
Thu, 8 Aug 2019 01:18:47 +0000 (13:18 +1200)
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
CRM/Utils/System/Backdrop.php
CRM/Utils/System/Drupal.php
CRM/Utils/System/Drupal6.php
CRM/Utils/System/Drupal8.php
CRM/Utils/System/Joomla.php
CRM/Utils/System/WordPress.php
tools/scripts/solr/createSyncJSON.php

index 5eb4713b8fe6cb21cf520acaa6b636478e1ec983..4cca5e8db8e56bcbfd25926d135f82a9a18a3c81 100644 (file)
@@ -234,26 +234,22 @@ class CRM_Core_DAO extends DB_DataObject {
       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();
     }
   }
 
index eb34b8a2b7c2d842749028dd181a4ee804975ec8..ee7ef622a80a0a3af2eb0d4aa7cb6da5ccb696e7 100644 (file)
@@ -880,9 +880,6 @@ AND    u.status = 1
       else {
         $contactMatching++;
       }
-      if (is_object($match)) {
-        $match->free();
-      }
     }
 
     return [
index 4af43912446b38f14b1c99e797ae4aaaadf4486a..44e4349b86876829fd723ded7a28ffe498e2edcf 100644 (file)
@@ -836,9 +836,6 @@ AND    u.status = 1
       else {
         $contactMatching++;
       }
-      if (is_object($match)) {
-        $match->free();
-      }
     }
 
     return [
index 9fc4813751b723caa03fa160d4d37fed38e73703..af566e5d2a786c38a9069d18c8fb838e9881fda0 100644 (file)
@@ -815,9 +815,6 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
       else {
         $contactMatching++;
       }
-      if (is_object($match)) {
-        $match->free();
-      }
     }
 
     return [
index 4a54bdc799c63f96b5f3250da46f9f3f22e417cf..38ed2933c671bca40bbd577285f79714c08ba2a1 100644 (file)
@@ -616,9 +616,6 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
       else {
         $contactMatching++;
       }
-      if (is_object($match)) {
-        $match->free();
-      }
     }
 
     return [
index fa5b4e5b68c1833edb43122c42ec2dd9748876e0..030b73cc6c80bf3d1c24c286d2537d71876307ad 100644 (file)
@@ -897,9 +897,6 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
       else {
         $contactMatching++;
       }
-      if (is_object($match)) {
-        $match->free();
-      }
     }
 
     return [
index bf35954360efa02b4711d693867b1103ffcc9a9d..382892d314b62688942bcfdacbc56655b2324cc1 100644 (file)
@@ -847,9 +847,6 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
       else {
         $contactMatching++;
       }
-      if (is_object($match)) {
-        $match->free();
-      }
     }
 
     return [
index 95d4fac75fffc867855038d0a964b0b944cf8235..57688b34bc9714e7cce6eaf7ab11c0009ef54b71 100644 (file)
@@ -133,7 +133,6 @@ SELECT $selectString, $whereField as contact_id
     }
     appendValue($values, $dao->contact_id, 'contact', $contact, $flat);
   }
-  $dao->free();
 }
 
 /**
@@ -187,7 +186,6 @@ AND   entity_table = 'civicrm_contact'
 
     appendValue($values, $dao->id, 'note', $note);
   }
-  $dao->free();
 }
 
 /**
@@ -225,7 +223,6 @@ AND        p.phone IS NOT NULL
 
     appendValue($values, $dao->id, 'phone', $phone);
   }
-  $dao->free();
 }
 
 /**
@@ -258,7 +255,6 @@ AND        e.email IS NOT NULL
     ];
     appendValue($values, $dao->id, 'email', $email);
   }
-  $dao->free();
 }
 
 /**
@@ -309,7 +305,6 @@ WHERE c.id IN ( $ids )
     }
     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);
 }