Merge pull request #8006 from yashodha/CRM-18263
[civicrm-core.git] / api / v3 / Job.php
index 2d953119c86de4fd85f1f055a6516ac4b719f7d1..c68c9b9140da4a24d260ec78b92ec86e51793320 100644 (file)
@@ -178,7 +178,7 @@ function civicrm_api3_job_send_reminder($params) {
   // in that case (ie. makes it non-configurable via the UI). Another approach would be to set a default of 0
   // in the _spec function - but since that is a deprecated value it seems more contentious than this approach
   $params['rowCount'] = 0;
-  $lock = Civi::service('lockManager')->acquire('worker.core.ActionSchedule');
+  $lock = Civi::lockManager()->acquire('worker.core.ActionSchedule');
   if (!$lock->isAcquired()) {
     return civicrm_api3_create_error('Could not acquire lock, another ActionSchedule process is running');
   }
@@ -354,7 +354,7 @@ function civicrm_api3_job_process_sms($params) {
  * @return array
  */
 function civicrm_api3_job_fetch_bounces($params) {
-  $lock = Civi::service('lockManager')->acquire('worker.mailing.EmailProcessor');
+  $lock = Civi::lockManager()->acquire('worker.mailing.EmailProcessor');
   if (!$lock->isAcquired()) {
     return civicrm_api3_create_error('Could not acquire lock, another EmailProcessor process is running');
   }
@@ -377,7 +377,7 @@ function civicrm_api3_job_fetch_bounces($params) {
  * @return array
  */
 function civicrm_api3_job_fetch_activities($params) {
-  $lock = Civi::service('lockManager')->acquire('worker.mailing.EmailProcessor');
+  $lock = Civi::lockManager()->acquire('worker.mailing.EmailProcessor');
   if (!$lock->isAcquired()) {
     return civicrm_api3_create_error('Could not acquire lock, another EmailProcessor process is running');
   }
@@ -430,7 +430,7 @@ function civicrm_api3_job_process_participant($params) {
  *   true if success, else false
  */
 function civicrm_api3_job_process_membership($params) {
-  $lock = Civi::service('lockManager')->acquire('worker.member.UpdateMembership');
+  $lock = Civi::lockManager()->acquire('worker.member.UpdateMembership');
   if (!$lock->isAcquired()) {
     return civicrm_api3_create_error('Could not acquire lock, another Membership Processing process is running');
   }
@@ -627,7 +627,7 @@ function civicrm_api3_job_disable_expired_relationships($params) {
  * @throws \API_Exception
  */
 function civicrm_api3_job_group_rebuild($params) {
-  $lock = Civi::service('lockManager')->acquire('worker.core.GroupRebuild');
+  $lock = Civi::lockManager()->acquire('worker.core.GroupRebuild');
   if (!$lock->isAcquired()) {
     throw new API_Exception('Could not acquire lock, another EmailProcessor process is running');
   }
@@ -639,3 +639,14 @@ function civicrm_api3_job_group_rebuild($params) {
 
   return civicrm_api3_create_success();
 }
+
+/**
+ * Check for CiviCRM software updates.
+ *
+ * Anonymous site statistics are sent back to civicrm.org during this check.
+ */
+function civicrm_api3_job_version_check() {
+  $vc = new CRM_Utils_VersionCheck();
+  $vc->fetch();
+  return civicrm_api3_create_success();
+}