From 9f08a49f476222487a3394a11161b941dbf1069f Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Wed, 12 Jun 2019 07:01:50 +1000 Subject: [PATCH] Remove more free calls --- CRM/Core/BAO/ActionSchedule.php | 1 - CRM/Core/BAO/File.php | 1 - CRM/Core/BAO/Mapping.php | 1 - CRM/Core/BAO/MessageTemplate.php | 4 ---- CRM/Core/BAO/UFGroup.php | 1 - CRM/Core/BAO/UFMatch.php | 1 - CRM/Core/BAO/Website.php | 1 - CRM/Core/OptionGroup.php | 2 -- CRM/Friend/Form.php | 1 - CRM/Mailing/BAO/Mailing.php | 3 --- CRM/Mailing/BAO/MailingJob.php | 5 ----- CRM/Pledge/BAO/PledgePayment.php | 1 - CRM/Profile/Form.php | 1 - CRM/Queue/Queue/Sql.php | 2 -- CRM/Report/BAO/ReportInstance.php | 1 - CRM/Utils/Address/BatchUpdate.php | 1 - CRM/Utils/Cache/SqlGroup.php | 4 ---- CRM/Utils/Check/Component/Timestamps.php | 1 - CRM/Utils/Migrate/ExportJSON.php | 3 --- sql/GenerateData.php | 1 - 20 files changed, 36 deletions(-) diff --git a/CRM/Core/BAO/ActionSchedule.php b/CRM/Core/BAO/ActionSchedule.php index a85f4df852..abc90a1cfb 100644 --- a/CRM/Core/BAO/ActionSchedule.php +++ b/CRM/Core/BAO/ActionSchedule.php @@ -332,7 +332,6 @@ FROM civicrm_action_schedule cas CRM_Core_BAO_ActionLog::create($logParams); } - $dao->free(); } } diff --git a/CRM/Core/BAO/File.php b/CRM/Core/BAO/File.php index c2c06bd279..a0a28476ed 100644 --- a/CRM/Core/BAO/File.php +++ b/CRM/Core/BAO/File.php @@ -366,7 +366,6 @@ class CRM_Core_BAO_File extends CRM_Core_DAO_File { } } - $dao->free(); return $results; } diff --git a/CRM/Core/BAO/Mapping.php b/CRM/Core/BAO/Mapping.php index 55e1ef9ae2..606c3d282c 100644 --- a/CRM/Core/BAO/Mapping.php +++ b/CRM/Core/BAO/Mapping.php @@ -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; } diff --git a/CRM/Core/BAO/MessageTemplate.php b/CRM/Core/BAO/MessageTemplate.php index 6687dd0ee4..4b81879706 100644 --- a/CRM/Core/BAO/MessageTemplate.php +++ b/CRM/Core/BAO/MessageTemplate.php @@ -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('/html}", $mailContent['html']); - $testDao->free(); } // replace tokens in the three elements (in subject as if it was the text body) diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index 3adba27015..98b6065688 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -357,7 +357,6 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { $fields[$name] = $formattedField; } } - $field->free(); } if (empty($fields) && !$validGroup) { diff --git a/CRM/Core/BAO/UFMatch.php b/CRM/Core/BAO/UFMatch.php index cab931e41b..778dd29f42 100644 --- a/CRM/Core/BAO/UFMatch.php +++ b/CRM/Core/BAO/UFMatch.php @@ -323,7 +323,6 @@ AND domain_id = %4 if (!$conflict) { $ufmatch = CRM_Core_BAO_UFMatch::create((array) $ufmatch); - $ufmatch->free(); $newContact = TRUE; $transaction->commit(); } diff --git a/CRM/Core/BAO/Website.php b/CRM/Core/BAO/Website.php index f947253594..57bd28beee 100644 --- a/CRM/Core/BAO/Website.php +++ b/CRM/Core/BAO/Website.php @@ -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; } diff --git a/CRM/Core/OptionGroup.php b/CRM/Core/OptionGroup.php index 913f874d50..3d6f501da4 100644 --- a/CRM/Core/OptionGroup.php +++ b/CRM/Core/OptionGroup.php @@ -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; } diff --git a/CRM/Friend/Form.php b/CRM/Friend/Form.php index 70cd21086d..4509acd993 100644 --- a/CRM/Friend/Form.php +++ b/CRM/Friend/Form.php @@ -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); diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index 21d10f7c5f..dcc8d46d55 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -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; } diff --git a/CRM/Mailing/BAO/MailingJob.php b/CRM/Mailing/BAO/MailingJob.php index 6bbf839474..f14eb00c7e 100644 --- a/CRM/Mailing/BAO/MailingJob.php +++ b/CRM/Mailing/BAO/MailingJob.php @@ -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); } diff --git a/CRM/Pledge/BAO/PledgePayment.php b/CRM/Pledge/BAO/PledgePayment.php index ec637d58b7..7de77302e0 100644 --- a/CRM/Pledge/BAO/PledgePayment.php +++ b/CRM/Pledge/BAO/PledgePayment.php @@ -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(); diff --git a/CRM/Profile/Form.php b/CRM/Profile/Form.php index 4c110de5d4..f5d605dfb3 100644 --- a/CRM/Profile/Form.php +++ b/CRM/Profile/Form.php @@ -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.', [ diff --git a/CRM/Queue/Queue/Sql.php b/CRM/Queue/Queue/Sql.php index 6be0e23aa2..a77ba055fe 100644 --- a/CRM/Queue/Queue/Sql.php +++ b/CRM/Queue/Queue/Sql.php @@ -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(); } } diff --git a/CRM/Report/BAO/ReportInstance.php b/CRM/Report/BAO/ReportInstance.php index da56063bc7..1fd77605c8 100644 --- a/CRM/Report/BAO/ReportInstance.php +++ b/CRM/Report/BAO/ReportInstance.php @@ -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; diff --git a/CRM/Utils/Address/BatchUpdate.php b/CRM/Utils/Address/BatchUpdate.php index 9b16c0d2f4..4e3a47331f 100644 --- a/CRM/Utils/Address/BatchUpdate.php +++ b/CRM/Utils/Address/BatchUpdate.php @@ -254,7 +254,6 @@ class CRM_Utils_Address_BatchUpdate { $address->id = $dao->address_id; $address->copyValues($addressParams); $address->save(); - $address->free(); } } diff --git a/CRM/Utils/Cache/SqlGroup.php b/CRM/Utils/Cache/SqlGroup.php index 6c0b6960ff..7b4df7dcc9 100644 --- a/CRM/Utils/Cache/SqlGroup.php +++ b/CRM/Utils/Cache/SqlGroup.php @@ -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) { diff --git a/CRM/Utils/Check/Component/Timestamps.php b/CRM/Utils/Check/Component/Timestamps.php index 932d33f070..8bf32c1204 100644 --- a/CRM/Utils/Check/Component/Timestamps.php +++ b/CRM/Utils/Check/Component/Timestamps.php @@ -104,7 +104,6 @@ class CRM_Utils_Check_Component_Timestamps extends CRM_Utils_Check_Component { $result = TRUE; } } - $dao->free(); return $result; } diff --git a/CRM/Utils/Migrate/ExportJSON.php b/CRM/Utils/Migrate/ExportJSON.php index ffaa63065b..24ba0aa764 100644 --- a/CRM/Utils/Migrate/ExportJSON.php +++ b/CRM/Utils/Migrate/ExportJSON.php @@ -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(); } /** diff --git a/sql/GenerateData.php b/sql/GenerateData.php index 13b6c400ea..2809fa382d 100644 --- a/sql/GenerateData.php +++ b/sql/GenerateData.php @@ -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); -- 2.25.1