+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
* @param $groupIDs
* Of group that we are checking against.
*
- * @return boolean
+ * @return bool
* TRUE if we did not regenerate, FALSE if we did
*/
public static function check($groupIDs) {
* Check to see if we have cache entries for this group
* if not, regenerate, else return
*
- * @param int /array $groupID groupID of group that we are checking against
+ * @param int /array $groupIDs groupIDs of group that we are checking against
* if empty, all groups are checked
* @param int $limit
* Limits the number of groups we evaluate.
*
- * @return boolean
+ * @return bool
* TRUE if we did not regenerate, FALSE if we did
*/
public static function loadAll($groupIDs = NULL, $limit = 0) {
$groupIDs = array($groupIDs);
}
- // note escapeString is a must here and we can't send the imploded value as second arguement to
+ // note escapeString is a must here and we can't send the imploded value as second argument to
// the executeQuery(), since that would put single quote around the string and such a string
// of comma separated integers would not work.
$groupIDString = CRM_Core_DAO::escapeString(implode(', ', $groupIDs));
}
/**
- * Change the cache_date
+ * Change the cache_date.
*
* @param array $groupID
* @param bool $processed
}
/**
- * Removes all the cache entries pertaining to a specific group
+ * Removes all the cache entries pertaining to a specific group.
* If no groupID is passed in, removes cache entries for all groups
* Has an optimization to bypass repeated invocations of this function.
* Note that this function is an advisory, i.e. the removal respects the
}
/**
- * Removes one or more contacts from the smart group cache
+ * Removes one or more contacts from the smart group cache.
* @param int|array $cid
* @param int $groupId
* @return bool
}
/**
- * Load the smart group cache for a saved search
+ * Load the smart group cache for a saved search.
*
* @param object $group
* The smart group that needs to be loaded.
self::$_alreadyLoaded[$groupID] = 1;
- // we now have the lock, but some other proces could have actually done the work
+ // we now have the lock, but some other process could have actually done the work
// before we got here, so before we do any work, lets ensure that work needs to be
// done
// we allow hidden groups here since we dont know if the caller wants to evaluate an
CRM_Contact_BAO_ProximityQuery::fixInputParams($ssParams);
}
-
$returnProperties = array();
if (CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $savedSearchID, 'mapping_id')) {
$fv = CRM_Contact_BAO_SavedSearch::getFormValues($savedSearchID);
// we split it up and store custom class
// so temp tables are not destroyed if they are used
// hence customClass is defined above at top of function
- $customClass =
- CRM_Contact_BAO_SearchCustom::customClass($ssParams['customSearchID'], $savedSearchID);
+ $customClass = CRM_Contact_BAO_SearchCustom::customClass($ssParams['customSearchID'], $savedSearchID);
$searchSQL = $customClass->contactIDs();
$searchSQL = str_replace('ORDER BY contact_a.id ASC', '', $searchSQL);
$idName = 'contact_id';
else {
$formValues = CRM_Contact_BAO_SavedSearch::getFormValues($savedSearchID);
- $query =
- new CRM_Contact_BAO_Query(
+ $query
+ = new CRM_Contact_BAO_Query(
$ssParams, $returnProperties, NULL,
FALSE, FALSE, 1,
TRUE, TRUE,
);
$query->_useDistinct = FALSE;
$query->_useGroupBy = FALSE;
- $searchSQL =
- $query->searchQuery(
+ $searchSQL
+ = $query->searchQuery(
0, 0, NULL,
FALSE, FALSE,
FALSE, TRUE,
"INSERT IGNORE INTO civicrm_group_contact_cache (contact_id, group_id)
SELECT DISTINCT $idName, group_id FROM $tempTable
");
- CRM_Core_DAO::executeQuery(" DROP TABLE $tempTable");
+ CRM_Core_DAO::executeQuery(" DROP TEMPORARY TABLE $tempTable");
}
self::updateCacheTime($groupIDs, $processed);
}
/**
- * Get all the smart groups that this contact belongs to
+ * Get all the smart groups that this contact belongs to.
* Note that this could potentially be a super slow function since
* it ensure that all contact groups are loaded in the cache
*
*/
public static function contactGroup($contactID, $showHidden = FALSE) {
if (empty($contactID)) {
- return;
+ return NULL;
}
if (is_array($contactID)) {
}
$prevContactID = $dao->contact_id;
if (!array_key_exists($dao->contact_id, $contactGroup)) {
- $contactGroup[$dao->contact_id] =
- array('group' => array(), 'groupTitle' => array());
+ $contactGroup[$dao->contact_id]
+ = array('group' => array(), 'groupTitle' => array());
}
- $contactGroup[$dao->contact_id]['group'][] =
- array(
+ $contactGroup[$dao->contact_id]['group'][]
+ = array(
'id' => $dao->group_id,
'title' => $dao->title,
'description' => $dao->description,