CRM-18692 issue warning about empty smart group cache rather than crash the server
[civicrm-core.git] / CRM / Contact / BAO / GroupContactCache.php
index cdb781dcbfc311091bf4f48fa15dd801d837e668..2ba71e2d77e731823424f59a71f3599226f63f8e 100644 (file)
@@ -210,17 +210,6 @@ AND    g.refresh_date IS NULL
     }
   }
 
-  /**
-   * Fill the group contact cache if it is empty.
-   *
-   * Do this by the expensive operation of loading all groups. Call sparingly.
-   */
-  public static function fillIfEmpty() {
-    if (!CRM_Core_DAO::singleValueQuery("SELECT COUNT(id) FROM civicrm_group_contact_cache")) {
-      self::loadAll();
-    }
-  }
-
   /**
    * Build the smart group cache for a given group.
    *
@@ -354,7 +343,7 @@ WHERE  id IN ( $groupIDs )
     if (!isset($groupID)) {
       if ($smartGroupCacheTimeout == 0) {
         $query = "
-TRUNCATE civicrm_group_contact_cache
+DELETE FROM civicrm_group_contact_cache
 ";
         $update = "
 UPDATE civicrm_group g