Esempio n. 1
0
 /**
  * @param string      $name     The lock name
  * @param string|null $lockPath The directory to store the lock. Default values will use temporary directory
  *
  * @throws ehough_filesystem_exception_IOException If the lock directory could not be created or is not writable
  */
 public function __construct($name, $lockPath = null)
 {
     $lockPath = $lockPath ?: sys_get_temp_dir();
     if (!is_dir($lockPath)) {
         $fs = new ehough_filesystem_Filesystem();
         $fs->mkdir($lockPath);
     }
     if (!is_writable($lockPath)) {
         throw new ehough_filesystem_exception_IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
     }
     $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\\._-]+/i', '-', $name), hash('sha256', $name));
 }
Esempio n. 2
0
 protected function tearDown()
 {
     $this->filesystem->remove($this->workspace);
     umask($this->umask);
 }