X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FLock.php;h=215d39490a7f0b4203d99c8f031c01756c9d78ae;hb=553ffa22464ff37a28a070458bcd52097b54235f;hp=862d2da5d46d395ee7634734f9022fad1bd0ac8e;hpb=58a50b22e20f112fdbfc7e50f18353c311ceb1ae;p=civicrm-core.git diff --git a/CRM/Core/Lock.php b/CRM/Core/Lock.php index 862d2da5d4..215d39490a 100644 --- a/CRM/Core/Lock.php +++ b/CRM/Core/Lock.php @@ -1,7 +1,7 @@ dsn); $database = $dsnArray['database']; @@ -75,22 +78,19 @@ class CRM_Core_Lock { if (stristr($name, 'civimail.job.')) { $jobLog = $this->_name; } - //if (defined('CIVICRM_LOCK_DEBUG')) { - //CRM_Core_Error::debug_var('backtrace', debug_backtrace()); - //} $this->_timeout = $timeout !== NULL ? $timeout : self::TIMEOUT; $this->acquire(); } - function __destruct() { + public function __destruct() { $this->release(); } /** * @return bool */ - function acquire() { + public function acquire() { if (defined('CIVICRM_LOCK_DEBUG')) { CRM_Core_Error::debug_log_message('acquire lock for ' . $this->_name); } @@ -111,7 +111,7 @@ class CRM_Core_Lock { /** * @return null|string */ - function release() { + public function release() { if ($this->_hasLock) { $this->_hasLock = FALSE; @@ -124,7 +124,7 @@ class CRM_Core_Lock { /** * @return null|string */ - function isFree() { + public function isFree() { $query = "SELECT IS_FREE_LOCK( %1 )"; $params = array(1 => array($this->_name, 'String')); return CRM_Core_DAO::singleValueQuery($query, $params); @@ -133,7 +133,7 @@ class CRM_Core_Lock { /** * @return bool */ - function isAcquired() { + public function isAcquired() { return $this->_hasLock; } @@ -148,9 +148,9 @@ class CRM_Core_Lock { * * @param string $jobLog * @throws CRM_Core_Exception - * @return boolean + * @return bool */ - function hackyHandleBrokenCode($jobLog) { + public function hackyHandleBrokenCode($jobLog) { if (stristr($this->_name, 'job')) { throw new CRM_Core_Exception('lock aquisition for ' . $this->_name . 'attempted when ' . $jobLog . 'is not released'); } @@ -160,5 +160,5 @@ class CRM_Core_Lock { $this->_hasLock = TRUE; return TRUE; } -} +}