PHP Class App\Libraries\WatchRecord\InotifyWatchRecord

Inheritance: extends WatchRecord, implements App\Libraries\WatchRecord\WatchRecordInterface
Show file Open project: phanan/koel

Public Methods

Method Description
__construct ( $string ) InotifyWatchRecord constructor.
isDeleted ( ) : boolean Determine if the object has just been deleted or moved from our watched directory.
isDirectory ( )
isNewOrModified ( ) : boolean Determine if the object has just been created or modified.
parse ( $string ) Parse the inotifywait's output. The inotifywait command should be something like: $ inotifywait -rme move,close_write,delete --format "%e %w%f" $MEDIA_PATH.

Method Details

__construct() public method

public __construct ( $string )
$string

isDeleted() public method

Determine if the object has just been deleted or moved from our watched directory.
public isDeleted ( ) : boolean
return boolean

isDirectory() public method

public isDirectory ( )

isNewOrModified() public method

For our purpose, we watch both the CREATE and the CLOSE_WRITE event, because some operating systems only support CREATE, but not CLOSE_WRITE and MOVED_TO. Additionally, a MOVED_TO (occurred after the object has been moved/renamed to another location **under our watched directory**) should be considered as "modified" also.
public isNewOrModified ( ) : boolean
return boolean

parse() public method

Parse the inotifywait's output. The inotifywait command should be something like: $ inotifywait -rme move,close_write,delete --format "%e %w%f" $MEDIA_PATH.
public parse ( $string )
$string string The output string.