Merge pull request #4708 from jitendrapurohit/CRM-15662
[civicrm-core.git] / CRM / Contact / BAO / GroupContactCache.php
index 8ffeb2da1345347975c79d071ba829a444acf491..a88d317325675d0aa44f7623b0036b4d1ed86331 100644 (file)
@@ -190,6 +190,15 @@ AND    g.refresh_date IS NULL
     }
   }
 
+  /**
+   * FIXME: This function should not be needed, because the cache table should not be getting truncated
+   */
+  static function fillIfEmpty() {
+    if (!CRM_Core_DAO::singleValueQuery("SELECT COUNT(id) FROM civicrm_group_contact_cache")) {
+      self::loadAll();
+    }
+  }
+
   /**
    * @param $groupID
    */