Mercurial > epgrec.yaz
changeset 169:e379552d084c
fix: recorder.php:子プロセスを再帰的に停止させるよう変更
author | epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp> |
---|---|
date | Sun, 18 Apr 2010 18:06:39 +0900 |
parents | b307e3749e80 |
children | 1c4558d1a449 c729a68415eb |
files | Reservation.class.php recorder.php storeProgram.inc.php |
diffstat | 3 files changed, 22 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/Reservation.class.php Fri Apr 16 18:04:23 2010 +0900 +++ b/Reservation.class.php Sun Apr 18 18:06:39 2010 +0900 @@ -238,7 +238,10 @@ $filename = mb_str_replace("%DURATION%","".$duration, $filename ); // √絖_ - $filename = preg_replace("/[ \.\/\*:<>\?\\|()\'\"&]/u","_", trim($filename) ); +// $filename = preg_replace("/[ \.\/\*:<>\?\\|()\'\"&]/u","_", trim($filename) ); + + // preg_replaceUTF-8絲上с医mb_ereg_replace祉 + $filename = mb_ereg_replace("[ \./\*:<>\?\\|()\'\"&]","_", trim($filename) ); // 絖潟若紊 if( defined("FILESYSTEM_ENCODING") ) {
--- a/recorder.php Fri Apr 16 18:04:23 2010 +0900 +++ b/recorder.php Sun Apr 18 18:06:39 2010 +0900 @@ -56,14 +56,11 @@ return false; } -// 絎祉鴻潟絖祉鴻pid鴻菴 +// 絎祉ID絖祉鴻pid鴻菴 // 鴻鐚 // -function epgrec_childproc( $p ) +function epgrec_childproc( $ppid ) { - $st = proc_get_status( $p ); - $ppid = $st['pid']; - // ps 絎茵 $d = array( 0 => array( 'file','/dev/null','r' ), @@ -88,6 +85,12 @@ fclose( $pipes[1] ); proc_close( $ps ); + foreach( $cpids as $p ) { + $ccpids = epgrec_childproc( $p ); + foreach( $ccpids as $ccpid ) { + array_push( $cpids, $ccpid ); + } + } return $cpids; } @@ -100,8 +103,8 @@ system( "ps ax >>".$logfile ); system( "echo ------- >>".$logfile ); } - - $cpids = epgrec_childproc( $p ); + $status = proc_get_status( $p ); + $cpids = epgrec_childproc( $status['pid'] ); if( DEBUG ) { global $logfile; @@ -112,12 +115,13 @@ system( "echo ------- >>".$logfile ); } + // 荀罩≪ @proc_terminate( $p ); - sleep(1); + usleep(500*1000); @proc_terminate( $p ); // 2綺 foreach( $cpids as $cpid ) { - $ret = posix_kill( $cpid, SIGTERM ); // sigterm + $ret = posix_kill( $cpid, SIGTERM ); // sigterm usleep(100*1000); if( ! $ret ) posix_kill( $cpid, SIGKILL ); // sigkill } @@ -128,10 +132,12 @@ system( "echo ------- >>".$logfile ); } + /* 祉鴻違鎡罧翫 foreach( $cpids as $cpid ) { $ret = posix_kill( $cpid, SIGTERM ); // sigterm - if( $ret ) return false; // 祉鴻絖с + if( $ret ) return false; // 祉鴻絖с } + */ return true; // 篆荐若с } @@ -226,7 +232,6 @@ if( time() < $endtime ) { $rrec->endtime = toDatetime( time() ); } - // 絎篋違腴 $rrec->complete = '1';
--- a/storeProgram.inc.php Fri Apr 16 18:04:23 2010 +0900 +++ b/storeProgram.inc.php Sun Apr 18 18:06:39 2010 +0900 @@ -191,7 +191,8 @@ try { $reserve = new DBRecord( RESERVE_TBL, "program_id", $rec->id ); - if( $reserve->dirty == 0 ) { + // dirty腴c憜緇牙私膣с + if( ($reserve->dirty == 0) && (toTimestamp($reserve->starttime) > time()) ) { $reserve->title = $title; $reserve->description = $desc; reclog( "getepg:: 篋膣ID".$reserve->id."EPG宴贋違" );