Merge pull request #22986 from colemanw/afformFixBlocksAgain
[civicrm-core.git] / api / v3 / Job.php
index e791235232659d41f17084fb41d6cd9ee782a646..4210e43a695fee44c9b983144e69472dc5ad9f3f 100644 (file)
@@ -98,7 +98,7 @@ function civicrm_api3_job_get($params) {
  * @param array $params
  */
 function civicrm_api3_job_delete($params) {
-  _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
+  return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
 }
 
 /**
@@ -555,7 +555,7 @@ function civicrm_api3_job_process_batch_merge($params) {
 /**
  * Metadata for batch merge function.
  *
- * @param $params
+ * @param array $params
  */
 function _civicrm_api3_job_process_batch_merge_spec(&$params) {
   $params['rule_group_id'] = [
@@ -711,21 +711,41 @@ function civicrm_api3_job_group_rebuild($params) {
 /**
  * Flush smart groups caches.
  *
- * This job purges aged smart group cache data (based on the timeout value). Sites can decide whether they want this
- * job and / or the group cache rebuild job to run. In some cases performance is better when old caches are cleared out
- * prior to any attempt to rebuild them. Also, many sites are very happy to have caches built on demand, provided the
- * user is not having to wait for deadlocks to clear when invalidating them.
+ * This job purges aged smart group cache data (based on the timeout value).
+ * Sites can decide whether they want this job and / or the group cache rebuild
+ * job to run. In some cases performance is better when old caches are cleared
+ * out prior to any attempt to rebuild them. Also, many sites are very happy to
+ * have caches built on demand, provided the user is not having to wait for
+ * deadlocks to clear when invalidating them.
  *
  * @param array $params
  *
  * @return array
- * @throws \API_Exception
+ * @throws \CiviCRM_API3_Exception
  */
-function civicrm_api3_job_group_cache_flush($params) {
+function civicrm_api3_job_group_cache_flush(array $params): array {
   CRM_Contact_BAO_GroupContactCache::deterministicCacheFlush();
   return civicrm_api3_create_success();
 }
 
+/**
+ * Flush acl caches.
+ *
+ * This job flushes the acl cache. For many sites it is better to do
+ * this by cron (or not at all if acls are not used) than whenever
+ * a contact is edited.
+ *
+ * @param array $params
+ *
+ * @return array
+ *
+ * @throws \CiviCRM_API3_Exception
+ */
+function civicrm_api3_job_acl_cache_flush(array $params): array {
+  CRM_ACL_BAO_Cache::resetCache();
+  return civicrm_api3_create_success();
+}
+
 /**
  * Check for CiviCRM software updates.
  *