Exemple #1
0
 /**
  * Perform an update.
  *
  * If enabled (default) this method will send a E_USER_NOTICE about the update.
  *
  * @see setNotice()
  */
 public function perform(DataBackend $backend)
 {
     $isNotice = $this->notice;
     $lock = new Lock(self::UPDATE_LOCK);
     $lock->nonblockingExecuteOnce(function () use($backend, $isNotice) {
         $backend->update();
         if ($isNotice) {
             trigger_error("bav's bank data was updated sucessfully.", E_USER_NOTICE);
         }
     });
 }
Exemple #2
0
 /**
  * Tests nonblockingExecuteOnce().
  * 
  * @see Lock::nonblockingExecuteOnce()
  */
 public function testNonblockingExecuteOnce()
 {
     $name = __FUNCTION__;
     $isExecuted = false;
     $isExecutedCheck = false;
     $lock = new Lock($name);
     $lock->nonblockingExecuteOnce(function () use(&$isExecuted, &$isExecutedCheck, $name) {
         $isExecuted = true;
         $checkLock = new Lock($name);
         $checkLock->nonblockingExecuteOnce(function () use(&$isExecutedCheck) {
             $isExecutedCheck = true;
         });
     });
     $this->assertTrue($isExecuted);
     $this->assertFalse($isExecutedCheck);
 }