comparison storeProgram.inc.php @ 135:9c5e597ef6c6

mod: ログ機能を追加
author epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
date Sat, 20 Mar 2010 23:59:01 +0900
parents ef3df87f3c7d
children 481e789605e3
comparison
equal deleted inserted replaced
134:58791b90221b 135:9c5e597ef6c6
7 $arr = DBRecord::createRecords( PROGRAM_TBL, "WHERE endtime < subdate( now(), 8 )" ); 7 $arr = DBRecord::createRecords( PROGRAM_TBL, "WHERE endtime < subdate( now(), 8 )" );
8 foreach( $arr as $val ) $val->delete(); 8 foreach( $arr as $val ) $val->delete();
9 9
10 // 8ヤ札筝若帥井 10 // 8ヤ札筝若帥井
11 $arr = array(); 11 $arr = array();
12 $arr = DBRecord::createRecords( PROGRAM_TBL, "WHERE starttime > adddate( now(), 8 )" ); 12 $arr = DBRecord::createRecords( PROGRAM_TBL, "WHERE starttime > adddate( now(), 8 ) ");
13 foreach( $arr as $val ) $val->delete();
14
15 // 8ヤ札筝違羔
16 $arr = array();
17 $arr = DBRecord::createRecords( LOG_TBL, "WHERE endtime < subdate( now(), 8 )" );
13 foreach( $arr as $val ) $val->delete(); 18 foreach( $arr as $val ) $val->delete();
14 } 19 }
15 20
16 function doKeywordReservation() { 21 function doKeywordReservation() {
17 // 若若牙私膣 22 // 若若牙私膣
18 $arr = array(); 23 $arr = array();
19 $arr = Keyword::createKeywords(); 24 $arr = Keyword::createKeywords();
20 foreach( $arr as $val ) { 25 foreach( $arr as $val ) {
21 try { 26 try {
22 $val->reservation(); 27 $val->reservation();
28 reclog( "getepg::若若ID".$val->id."篋膣");
23 } 29 }
24 catch( Exception $e ) { 30 catch( Exception $e ) {
25 // ∴ 31 // ∴
26 } 32 }
27 } 33 }
28 } 34 }
29 35
30 function storeProgram( $type, $xmlfile ) { 36 function storeProgram( $type, $xmlfile ) {
37 else if( $type == "CS") $map = $CS_CHANNEL_MAP; 43 else if( $type == "CS") $map = $CS_CHANNEL_MAP;
38 44
39 // XML parse 45 // XML parse
40 $xml = @simplexml_load_file( $xmlfile ); 46 $xml = @simplexml_load_file( $xmlfile );
41 if( $xml === false ) { 47 if( $xml === false ) {
48 reclog( "getepg::".$xmlfile."篏c罔≧", E_ERROR );
42 return; // XML茯水篏 49 return; // XML茯水篏
43 } 50 }
44 // channel遵 51 // channel遵
45 foreach( $xml->channel as $ch ) { 52 foreach( $xml->channel as $ch ) {
46 $disc = $ch['id']; 53 $disc = $ch['id'];
62 $rec = new DBRecord(CHANNEL_TBL, "channel_disc", $disc ); 69 $rec = new DBRecord(CHANNEL_TBL, "channel_disc", $disc );
63 $rec->name = $ch->{'display-name'}; 70 $rec->name = $ch->{'display-name'};
64 } 71 }
65 } 72 }
66 catch( Exception $e ) { 73 catch( Exception $e ) {
67 // ∴ 74 reclog( "getepg::DB・膓障c潟若吾莨若帥紊掩", E_ERROR );
68 } 75 }
69 } 76 }
70 // channel 腟篋 77 // channel 腟篋
71 78
72 // programme 緇 79 // programme 緇
80 87
81 try { 88 try {
82 $channel_rec = new DBRecord(CHANNEL_TBL, "channel_disc", "$channel_disc" ); 89 $channel_rec = new DBRecord(CHANNEL_TBL, "channel_disc", "$channel_disc" );
83 } 90 }
84 catch( Exception $e ) { 91 catch( Exception $e ) {
85 // ∴ 92 reclog( "getepg::c潟潟若肴с", E_ERROR );
86 } 93 }
87 if( $channel_rec == null ) continue; // 緇莎激 94 if( $channel_rec == null ) continue; // 緇莎激
88 if( $channel_rec->skip == 1 ) continue; // 篆<c潟 95 if( $channel_rec->skip == 1 ) continue; // 篆<c潟
89 96
90 $starttime = str_replace(" +0900", '', $program['start'] ); 97 $starttime = str_replace(" +0900", '', $program['start'] );
127 foreach( $records as $rec ) { 134 foreach( $records as $rec ) {
128 // 牙私膣腟丈紊眼cゃ 135 // 牙私膣腟丈紊眼cゃ
129 try { 136 try {
130 $reserve = new DBRecord(RESERVE_TBL, "program_id", $rec->id ); 137 $reserve = new DBRecord(RESERVE_TBL, "program_id", $rec->id );
131 if( $reserve->autorec ) { 138 if( $reserve->autorec ) {
139 reclog( "getepg::牙ID".$reserve->id."紊眼醇с篋膣羔");
132 Reservation::cancel( $reserve->id ); 140 Reservation::cancel( $reserve->id );
133 } 141 }
134 } 142 }
135 catch( Exception $e ) { 143 catch( Exception $e ) {
136 //∴ 144 // ∴
137 } 145 }
138 // 腟 146 // 腟
147 reclog( "getepg::冗茲榊腟ID".$rec->id."" );
139 $rec->delete(); 148 $rec->delete();
140 } 149 }
141 } 150 }
142 // // 151 // //
143 $rec = new DBRecord( PROGRAM_TBL ); 152 $rec = new DBRecord( PROGRAM_TBL );
159 $rec->description = $desc; 168 $rec->description = $desc;
160 $rec->category_id = $cat_rec->id; 169 $rec->category_id = $cat_rec->id;
161 } 170 }
162 } 171 }
163 catch(Exception $e) { 172 catch(Exception $e) {
173 reclog( "getepg::DBュ阪馹罔≧", E_ERROR );
164 exit( $e->getMessage() ); 174 exit( $e->getMessage() );
165 } 175 }
166 } 176 }
167 // Programme緇絎篋 177 // Programme緇絎篋
168 } 178 }