Remove free calls from Activity and Member sections of CRM
authorSeamus Lee <seamuslee001@gmail.com>
Mon, 11 Feb 2019 01:20:11 +0000 (12:20 +1100)
committerSeamus Lee <seamuslee001@gmail.com>
Mon, 11 Feb 2019 04:12:42 +0000 (15:12 +1100)
CRM/Activity/BAO/Activity.php
CRM/Activity/Page/AJAX.php
CRM/Member/BAO/Membership.php
CRM/Member/BAO/MembershipLog.php
CRM/Member/BAO/MembershipStatus.php
CRM/Member/BAO/MembershipType.php

index 7249a8e6d6bba683e8da3e14b44152a9801a9c1f..e4bee42129fa3eefb4bed8f704c35595f223544a 100644 (file)
@@ -2361,7 +2361,6 @@ AND cl.modified_id  = c.id
           $priorActivities[$index][$dao->activityID]['name'] = $dao->name;
           $priorActivities[$index][$dao->activityID]['date'] = $dao->date;
         }
-        $dao->free();
       }
     }
     return $priorActivities[$index];
@@ -2678,10 +2677,8 @@ AND cl.modified_id  = c.id
         $result = self::deleteActivity($activityParams);
       }
 
-      $activityContactOther->free();
     }
 
-    $activityContact->free();
     $transaction->commit();
 
     return $result;
index 787c18d26d14d0e6a8f53fceb606833a35b44ea1..e8be4c76e38806c7dd9b580ce170ef86a13de535 100644 (file)
@@ -309,7 +309,6 @@ class CRM_Activity_Page_AJAX {
     $mainActivity->save();
     $mainActivityId = $mainActivity->id;
     CRM_Activity_BAO_Activity::logActivityAction($mainActivity);
-    $mainActivity->free();
 
     // Mark previous activity as deleted. If it was a non-case activity
     // then just change the subject.
@@ -330,9 +329,7 @@ class CRM_Activity_Page_AJAX {
       }
       $otherActivity->save();
 
-      $caseActivity->free();
     }
-    $otherActivity->free();
 
     $targetContacts = array();
     if (!empty($params['targetContactIds'])) {
@@ -385,7 +382,6 @@ class CRM_Activity_Page_AJAX {
     $params['mainActivityId'] = $mainActivityId;
     CRM_Activity_BAO_Activity::copyExtendedActivityData($params);
     CRM_Utils_Hook::post('create', 'CaseActivity', $caseActivity->id, $caseActivity);
-    $caseActivity->free();
 
     return (array('error_msg' => $error_msg, 'newId' => $mainActivity->id));
   }
index 00548c146e80cb0574c2eccd32c18bf0e429c93e..cbc07cf2b641cbd3de5d1ba6675fc8eb6cd78bfe 100644 (file)
@@ -94,7 +94,6 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership {
     $membership->id = $id;
 
     $membership->save();
-    $membership->free();
 
     if (empty($membership->contact_id) || empty($membership->status_id)) {
       // this means we are in renewal mode and are just updating the membership
@@ -545,8 +544,6 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership {
         $defaults['active'] = TRUE;
       }
 
-      $membership->free();
-
       return $membership;
     }
 
@@ -702,7 +699,6 @@ INNER JOIN  civicrm_membership_type type ON ( type.id = membership.membership_ty
       self::deleteRelatedMemberships($membership->id);
       self::deleteMembership($membership->id);
     }
-    $membership->free();
   }
 
   /**
@@ -1184,7 +1180,6 @@ AND civicrm_membership.is_test = %2";
       $memberDAO->end_date = CRM_Utils_Date::isoToMysql($memberDAO->end_date);
       $memberDAO->save();
       CRM_Core_DAO::storeValues($memberDAO, $currentMembership);
-      $memberDAO->free();
 
       $currentMembership['is_current_member'] = CRM_Core_DAO::getFieldValue(
         'CRM_Member_DAO_MembershipStatus',
@@ -1277,10 +1272,8 @@ SELECT c.contribution_page_id as pageID
       $relatedMembership->id = $membership->id;
       $relatedMembership->copyValues($params);
       $relatedMembership->save();
-      $relatedMembership->free();
     }
 
-    $membership->free();
   }
 
   /**
@@ -1407,7 +1400,6 @@ WHERE  civicrm_membership.contact_id = civicrm_contact.id
           $nestedRelMembership->id = $membership->owner_membership_id;
           $nestedRelMembership->contact_id = $cid;
           $nestedRelationship = $nestedRelMembership->find(TRUE);
-          $nestedRelMembership->free();
         }
         if (!$nestedRelationship) {
           $relatedContacts[$cid] = $status;
@@ -1610,7 +1602,6 @@ FROM   civicrm_membership_type
         $membershipTypeValues[$dao->id][$mtField] = $dao->$mtField;
       }
     }
-    $dao->free();
 
     CRM_Utils_Hook::membershipTypeValues($form, $membershipTypeValues);
 
@@ -2168,7 +2159,6 @@ INNER JOIN  civicrm_contact contact ON ( contact.id = membership.contact_id AND
       ]);
       $count++;
     }
-    $deceasedDAO->free();
     return $count;
   }
 
@@ -2279,7 +2269,6 @@ WHERE      civicrm_membership.is_test = 0
     while ($dao1->fetch()) {
       self::processOverriddenUntilDateMembership($dao1);
     }
-    $dao1->free();
 
     $query = $baseQuery . " AND civicrm_membership.is_override IS NULL
      AND civicrm_membership.status_id NOT IN (%1, %2, %3, %4)
@@ -2351,7 +2340,6 @@ WHERE      civicrm_membership.is_test = 0
         $updateCount++;
       }
     }
-    $dao2->free();
     $result['is_error'] = 0;
     $result['messages'] = ts('Processed %1 membership records. Updated %2 records.', array(
       1 => $processCount,
index 686183c10b9fd4d1477ed50138e2284e45abaaff..37544276768b634fc978ca7225f2d631a114a057 100644 (file)
@@ -46,7 +46,6 @@ class CRM_Member_BAO_MembershipLog extends CRM_Member_DAO_MembershipLog {
     $membershipLog = new CRM_Member_DAO_MembershipLog();
     $membershipLog->copyValues($params);
     $membershipLog->save();
-    $membershipLog->free();
 
     return $membershipLog;
   }
index 30e00ec715692a4bf84365bf706b99a44ddf2bcb..0f7f8ae4197068520b9e722945925e56c940f27e 100644 (file)
@@ -212,7 +212,6 @@ class CRM_Member_BAO_MembershipStatus extends CRM_Member_DAO_MembershipStatus {
     }
     $membershipStatus->delete();
     CRM_Member_PseudoConstant::flush('membershipStatus');
-    $membershipStatus->free();
   }
 
   /**
@@ -361,8 +360,6 @@ class CRM_Member_BAO_MembershipStatus extends CRM_Member_DAO_MembershipStatus {
     }
     //end fetch
 
-    $membershipStatus->free();
-
     //we bundle the arguments into an array as we can't pass 8 variables to the hook otherwise
     // the membership array might contain the pre-altered settings so we don't want to merge this
     $arguments = array(
@@ -394,7 +391,6 @@ class CRM_Member_BAO_MembershipStatus extends CRM_Member_DAO_MembershipStatus {
     while ($membershipStatus->fetch()) {
       $statusIds[] = $membershipStatus->id;
     }
-    $membershipStatus->free();
     return $statusIds;
   }
 
index 1d119d742eedea40a4753c84138cdd6bd98da695..6438cff3c0ec6403df4ff84c2be14a6cd5dbfac3 100644 (file)
@@ -281,7 +281,6 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType {
     while ($membershipType->fetch()) {
       $membershipTypes[$membershipType->id] = $membershipType->name;
     }
-    $membershipType->free();
     return $membershipTypes;
   }
 
@@ -300,7 +299,6 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType {
     $membershipType->id = $membershipTypeId;
     if ($membershipType->find(TRUE)) {
       CRM_Core_DAO::storeValues($membershipType, $membershipTypeDetails);
-      $membershipType->free();
       return $membershipTypeDetails;
     }
     else {