php-db | 2004071
Date: 07/13/04
- Next message: boclair <email protected>: "[PHP-DB] Getting a result from MAX() query"
- Previous message: pete M: "[PHP-DB] Re: endless loop / running as a service?"
- In reply to: H. J. Wils: "[PHP-DB] endless loop / running as a service?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
maybe something like this would do:
( warning: it is just a sketch,and probably will not run )
1. there are 4 files on the server:
a) check-flag
b) start-watch.php
c) stop-watch.php
d) watch.php
2. watch.php:
// in the check-flag file we have a flag which turns off/on the
checker
$flag_file = 'check-flag';
$fd = fopen($flag_file, 'r');
$go = fread($fd); // we shall get 0 - stop, 1 - go
// the loop runs as long as there is 1 in 'check-flag' file
while ( $go ) {
$dir_state = get_the_state_of_the_dir();
$old_dir_state = get_previous_state_of_the_dir();
if( compare_the_dirs( $dir_state, $old_dir_state)) {
// the state is different - something has been uploaded
// do somethnig ....
}
$result = write_previous_dir_state($old_dir_state);
rewind_the_file_position_to_start($fd);
$go = fread($fd);
} // end of the loop
3. start-watch.php
if( check_the_identity_and_privileges_of_the_user() ) {
set_flag_in_the_file( 'check-flag', 1);
}
4. stop-watch.php
if( check_the_identity_and_privileges_of_the_user() ) {
set_flag_in_the_file( 'check-flag', 0);
}
it is just a rough idea written down with pseudo-php, but You shall get the
idea
greetings.
Marcin
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: boclair <email protected>: "[PHP-DB] Getting a result from MAX() query"
- Previous message: pete M: "[PHP-DB] Re: endless loop / running as a service?"
- In reply to: H. J. Wils: "[PHP-DB] endless loop / running as a service?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

