@@ -17,7 +17,6 @@ class FileLock implements Lock
1717 private $ lock_file ;
1818 private $ exclusive ;
1919 private $ blocking ;
20- private $ identifier ;
2120 private $ fh ;
2221 private $ remove_on_release ;
2322
@@ -28,22 +27,19 @@ class FileLock implements Lock
2827 * @param boolean $exclusive true for an exclusive lock, false for shared one
2928 * @param boolean $blocking true to wait for lock to be available,
3029 * false to throw exception instead of waiting
31- * @param string|null $identifier resource identifier (default to $lock_file) for logging
3230 * @param boolean $remove_on_release remove file on release if no other lock remains
3331 * @param LoggerInterface $logger
3432 */
3533 public function __construct (
3634 $ lock_file ,
3735 $ exclusive = FileLock::EXCLUSIVE ,
3836 $ blocking = FileLock::NON_BLOCKING ,
39- $ identifier = null ,
4037 $ remove_on_release = false ,
4138 LoggerInterface $ logger = null
4239 ) {
4340 $ this ->lock_file = $ lock_file ;
4441 $ this ->exclusive = $ exclusive ;
4542 $ this ->blocking = $ blocking ;
46- $ this ->identifier = $ identifier ?:$ lock_file ;
4743 $ this ->remove_on_release = $ remove_on_release ;
4844
4945 $ this ->logger = $ logger ?: new NullLogger ;
@@ -79,20 +75,20 @@ public function acquire()
7975 private function tryAcquire ($ operation , $ lock_type )
8076 {
8177 $ log_data = [
82- 'identifier ' => $ this ->identifier ,
78+ 'lock_file ' => $ this ->lock_file ,
8379 'lock_type ' => $ lock_type
8480 ];
8581
8682 if (!$ this ->flock ($ operation )) {
87- $ this ->logger ->debug ('could not acquire {lock_type} lock on {identifier } ' , $ log_data );
83+ $ this ->logger ->debug ('could not acquire {lock_type} lock on {lock_file } ' , $ log_data );
8884
8985 throw new Exception (
90- 'Could not acquire ' .$ lock_type .' lock on ' .$ this ->identifier
86+ 'Could not acquire ' .$ lock_type .' lock on ' .$ this ->lock_file
9187 );
9288
9389 }
9490
95- $ this ->logger ->debug ('{lock_type} lock acquired on {identifier } ' , $ log_data );
91+ $ this ->logger ->debug ('{lock_type} lock acquired on {lock_file } ' , $ log_data );
9692 }
9793
9894 public function release ()
@@ -109,7 +105,7 @@ public function release()
109105 fclose ($ this ->fh );
110106 $ this ->fh = null ;
111107
112- $ this ->logger ->debug ('{lock_type} lock released on {identifier } ' , ['identifier ' => $ this ->identifier ]);
108+ $ this ->logger ->debug ('{lock_type} lock released on {lock_file } ' , ['lock_file ' => $ this ->lock_file ]);
113109 }
114110
115111 public function __destruct ()
0 commit comments