Remove more free calls
authorSeamus Lee <seamuslee001@gmail.com>
Tue, 11 Jun 2019 21:01:50 +0000 (07:01 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Wed, 12 Jun 2019 09:36:31 +0000 (19:36 +1000)
20 files changed:
CRM/Core/BAO/ActionSchedule.php
CRM/Core/BAO/File.php
CRM/Core/BAO/Mapping.php
CRM/Core/BAO/MessageTemplate.php
CRM/Core/BAO/UFGroup.php
CRM/Core/BAO/UFMatch.php
CRM/Core/BAO/Website.php
CRM/Core/OptionGroup.php
CRM/Friend/Form.php
CRM/Mailing/BAO/Mailing.php
CRM/Mailing/BAO/MailingJob.php
CRM/Pledge/BAO/PledgePayment.php
CRM/Profile/Form.php
CRM/Queue/Queue/Sql.php
CRM/Report/BAO/ReportInstance.php
CRM/Utils/Address/BatchUpdate.php
CRM/Utils/Cache/SqlGroup.php
CRM/Utils/Check/Component/Timestamps.php
CRM/Utils/Migrate/ExportJSON.php
sql/GenerateData.php

index a85f4df8526141fe32d29926b7b37a9a26975e7f..abc90a1cfb313222848d392c32c88a5292adce07 100644 (file)
@@ -332,7 +332,6 @@ FROM civicrm_action_schedule cas
         CRM_Core_BAO_ActionLog::create($logParams);
       }
 
-      $dao->free();
     }
   }
 
index c2c06bd279fbc166fe15af0537e3f7c2afe6d840..a0a28476edc2777c95dcf5b4accb80d980df820f 100644 (file)
@@ -366,7 +366,6 @@ class CRM_Core_BAO_File extends CRM_Core_DAO_File {
       }
     }
 
-    $dao->free();
     return $results;
   }
 
index 55e1ef9ae2e2d16a326fdc978a5c6024a791c288..606c3d282c88622bfca7258ac368a62cc8be9745 100644 (file)
@@ -661,7 +661,6 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping {
                   $relatedFields = array_merge($relatedFields, (array) $relationshipCustomFields);
                 }
               }
-              $relationshipType->free();
               asort($relatedFields);
               $sel5[$k][$field] = $relatedFields;
             }
index 6687dd0ee4c16da9be2278b3a3549b9bb1d78282..4b81879706d30b8f65adb8c8e3bf30afd1379a55 100644 (file)
@@ -310,8 +310,6 @@ class CRM_Core_BAO_MessageTemplate extends CRM_Core_DAO_MessageTemplate {
       $result = CRM_Utils_Mail::send($mailParams);
     }
 
-    $messageTemplates->free();
-
     return $result;
   }
 
@@ -442,7 +440,6 @@ class CRM_Core_BAO_MessageTemplate extends CRM_Core_DAO_MessageTemplate {
       'valueName' => $params['valueName'],
       'messageTemplateID' => $params['messageTemplateID'],
     ];
-    $dao->free();
 
     CRM_Utils_Hook::alterMailContent($mailContent);
 
@@ -459,7 +456,6 @@ class CRM_Core_BAO_MessageTemplate extends CRM_Core_DAO_MessageTemplate {
       $mailContent['subject'] = $testDao->subject . $mailContent['subject'];
       $mailContent['text'] = $testDao->text . $mailContent['text'];
       $mailContent['html'] = preg_replace('/<body(.*)$/im', "<body\\1\n{$testDao->html}", $mailContent['html']);
-      $testDao->free();
     }
 
     // replace tokens in the three elements (in subject as if it was the text body)
index 3adba27015c53d0b4b0268721538da21f6fbc0ef..98b606568869adb6bdbe537bf5c2eecb5fb7096d 100644 (file)
@@ -357,7 +357,6 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup {
           $fields[$name] = $formattedField;
         }
       }
-      $field->free();
     }
 
     if (empty($fields) && !$validGroup) {
index cab931e41b5d8a4f7d9060a2bbc7a7058ea449a2..778dd29f42ea9a7911b2d77b4afc9b3e0270ea71 100644 (file)
@@ -323,7 +323,6 @@ AND    domain_id    = %4
 
       if (!$conflict) {
         $ufmatch = CRM_Core_BAO_UFMatch::create((array) $ufmatch);
-        $ufmatch->free();
         $newContact = TRUE;
         $transaction->commit();
       }
index f947253594eb4cb2e7930c9154748268a5392469..57bd28beeea368cef4ea54b4c505a688f176614d 100644 (file)
@@ -141,7 +141,6 @@ class CRM_Core_BAO_Website extends CRM_Core_DAO_Website {
       return FALSE;
     }
     CRM_Utils_Hook::post('delete', 'Website', $id, $obj);
-    $obj->free();
     return TRUE;
   }
 
index 913f874d50b6c903b3311c3024f2e31d41b6bb38..3d6f501da4d6865981c4fd2a78bc579d4d36072c 100644 (file)
@@ -416,10 +416,8 @@ WHERE  v.option_group_id = g.id
     ];
     $dao = CRM_Core_DAO::executeQuery($query, $p);
     if ($dao->fetch()) {
-      $dao->free();
       return $dao->value;
     }
-    $dao->free();
     return NULL;
   }
 
index 70cd21086dc5109a098aaee6f2fedca8f44f01ff..4509acd993377f7c524565a73b6d7279d99d51d2 100644 (file)
@@ -129,7 +129,6 @@ class CRM_Friend_Form extends CRM_Core_Form {
       while ($pcp->fetch()) {
         $this->_title = $pcp->title;
         $this->_campaignId = $pcp->campaign_id;
-        $pcp->free();
       }
 
       $this->assign('pcpTitle', $this->_title);
index 21d10f7c5f77d2aab9ed34ad29bb15daed6f7446..dcc8d46d55d3366fe195974b3b1bf3b03628ff72 100644 (file)
@@ -863,14 +863,12 @@ ORDER BY   civicrm_email.is_bulkmail DESC
       $this->header = new CRM_Mailing_BAO_MailingComponent();
       $this->header->id = $this->header_id;
       $this->header->find(TRUE);
-      $this->header->free();
     }
 
     if (!$this->footer and $this->footer_id) {
       $this->footer = new CRM_Mailing_BAO_MailingComponent();
       $this->footer->id = $this->footer_id;
       $this->footer->find(TRUE);
-      $this->footer->free();
     }
   }
 
@@ -1451,7 +1449,6 @@ ORDER BY   civicrm_email.is_bulkmail DESC
     while ($mg->fetch()) {
       $groups[] = $mg->name;
     }
-    $mg->free();
     return $groups;
   }
 
index 6bbf83947436e4cb31e58d022382a08a2abc80d8..f14eb00c7e263f9fa9f79337056dfbbde7a5e3c8 100644 (file)
@@ -501,7 +501,6 @@ VALUES (%1, %2, %3, %4, %5, %6, %7)
     $mailing = new CRM_Mailing_BAO_Mailing();
     $mailing->id = $this->mailing_id;
     $mailing->find(TRUE);
-    $mailing->free();
 
     $config = NULL;
 
@@ -542,7 +541,6 @@ VALUES (%1, %2, %3, %4, %5, %6, %7)
         if (!empty($fields)) {
           $this->deliverGroup($fields, $mailing, $mailer, $job_date, $attachments);
         }
-        $eq->free();
         return FALSE;
       }
       self::$mailsProcessed++;
@@ -557,15 +555,12 @@ VALUES (%1, %2, %3, %4, %5, %6, %7)
       if (count($fields) == self::MAX_CONTACTS_TO_PROCESS) {
         $isDelivered = $this->deliverGroup($fields, $mailing, $mailer, $job_date, $attachments);
         if (!$isDelivered) {
-          $eq->free();
           return $isDelivered;
         }
         $fields = [];
       }
     }
 
-    $eq->free();
-
     if (!empty($fields)) {
       $isDelivered = $this->deliverGroup($fields, $mailing, $mailer, $job_date, $attachments);
     }
index ec637d58b70b7d9143bcfc3d7beeb766b0c20e9c..7de77302e0a6c9fcf3d44fee30a4aa373c188cf4 100644 (file)
@@ -306,7 +306,6 @@ WHERE     pledge_id = %1
       $pledgeStatusID = self::calculatePledgeStatus($pledgeID);
       CRM_Core_DAO::setFieldValue('CRM_Pledge_DAO_Pledge', $pledgeID, 'status_id', $pledgeStatusID);
 
-      $payment->free();
     }
 
     $transaction->commit();
index 4c110de5d40298124b7e6d14df29932ccf298f4f..f5d605dfb3a2e31dc886068f3d06191e0300eb3d 100644 (file)
@@ -372,7 +372,6 @@ class CRM_Profile_Form extends CRM_Core_Form {
         $this->_isAddCaptcha = $dao->add_captcha;
         $this->_ufGroup = (array) $dao;
       }
-      $dao->free();
 
       if (!CRM_Utils_Array::value('is_active', $this->_ufGroup)) {
         CRM_Core_Error::fatal(ts('The requested profile (gid=%1) is inactive or does not exist.', [
index 6be0e23aa275beb6b15807b31ea1ea23b5ed7fc9..a77ba055feecce5f9065041aa514cbaa515bbffe 100644 (file)
@@ -199,7 +199,6 @@ class CRM_Queue_Queue_Sql extends CRM_Queue_Queue {
    */
   public function deleteItem($dao) {
     $dao->delete();
-    $dao->free();
   }
 
   /**
@@ -214,7 +213,6 @@ class CRM_Queue_Queue_Sql extends CRM_Queue_Queue {
       1 => [$dao->id, 'Integer'],
     ];
     CRM_Core_DAO::executeQuery($sql, $params);
-    $dao->free();
   }
 
 }
index da56063bc76d1c0532c5030329db7eeffef29484..1fd77605c8bd29ecf7b67d737777b2da7812dbf5 100644 (file)
@@ -267,7 +267,6 @@ class CRM_Report_BAO_ReportInstance extends CRM_Report_DAO_ReportInstance {
 
     if ($instance->find(TRUE)) {
       CRM_Core_DAO::storeValues($instance, $defaults);
-      $instance->free();
       return $instance;
     }
     return NULL;
index 9b16c0d2f4c2b985a6fcf1ef6a76812b9e96141d..4e3a47331fa810a1b8fbd824002a7ec5e29e2a9e 100644 (file)
@@ -254,7 +254,6 @@ class CRM_Utils_Address_BatchUpdate {
         $address->id = $dao->address_id;
         $address->copyValues($addressParams);
         $address->save();
-        $address->free();
       }
     }
 
index 6c0b6960ff635f9885f7e5d8abd48bb3f8135908..7b4df7dcc9a5b29a3312e5016963f88384f0426c 100644 (file)
@@ -159,8 +159,6 @@ class CRM_Utils_Cache_SqlGroup implements CRM_Utils_Cache_Interface {
 
     $lock->release();
 
-    $dao->free();
-
     $this->valueCache[$key] = CRM_Core_BAO_Cache::decode($dataSerialized);
     $this->expiresCache[$key] = $expires;
     return TRUE;
@@ -181,7 +179,6 @@ class CRM_Utils_Cache_SqlGroup implements CRM_Utils_Cache_Interface {
         $this->expiresCache[$key] = $dao->expires;
         $this->valueCache[$key] = CRM_Core_BAO_Cache::decode($dao->data);
       }
-      $dao->free();
     }
     return (isset($this->expiresCache[$key]) && time() < $this->expiresCache[$key]) ? $this->reobjectify($this->valueCache[$key]) : $default;
   }
@@ -241,7 +238,6 @@ class CRM_Utils_Cache_SqlGroup implements CRM_Utils_Cache_Interface {
       $this->valueCache[$dao->path] = CRM_Core_BAO_Cache::decode($dao->data);
       $this->expiresCache[$dao->path] = $dao->expires;
     }
-    $dao->free();
   }
 
   protected function where($path = NULL) {
index 932d33f070c413b252f5319d65ec72885c13747c..8bf32c12046fab4bda8ef155013137e6aad4a8df 100644 (file)
@@ -104,7 +104,6 @@ class CRM_Utils_Check_Component_Timestamps extends CRM_Utils_Check_Component {
         $result = TRUE;
       }
     }
-    $dao->free();
     return $result;
   }
 
index ffaa63065b77d5fbe970e6edc4ee9ab83d62bffe..24ba0aa76406ee3aa25714d058a647a0e0571d3d 100644 (file)
@@ -236,7 +236,6 @@ SELECT *
       }
       $this->appendValue($dao->id, $tableName, $value);
     }
-    $dao->free();
   }
 
   /**
@@ -440,7 +439,6 @@ AND    entity_table = 'civicrm_contact'
         $additionalContacts
       );
     }
-    $dao->free();
   }
 
   /**
@@ -499,7 +497,6 @@ WHERE ac.contact_id IN ( $ids )
       // append activity value
       $this->appendValue($dao->id, 'civicrm_activity', $activity);
     }
-    $dao->free();
   }
 
   /**
index 13b6c400ea198328cb6171e841769238817ec489..2809fa382df039e2c66f88cf928e751e6819bf23 100644 (file)
@@ -1274,7 +1274,6 @@ class CRM_GCD {
         $this->stateMap[$dao->abbreviation] = $dao->id;
         $this->states[$dao->id] = $dao->name;
       }
-      $dao->free();
     }
 
     $offset = mt_rand(1, 43000);