changeset 150:3a6ec345ab0c

merged with upstream
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sat, 27 Mar 2010 23:21:25 +0900
parents 8f4f74463d08 (current diff) 5b192e94f49d (diff)
children 43f74519bd52
files Reservation.class.php
diffstat 5 files changed, 23 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/Reservation.class.php	Fri Mar 26 15:41:36 2010 +0900
+++ b/Reservation.class.php	Sat Mar 27 23:21:25 2010 +0900
@@ -303,7 +303,7 @@
 			}
 			else {
 				$rrec->delete();
-				reclog( "Reservation::custom atの実行に失敗した模様", E_ERROR);
+				reclog( "Reservation::custom atの実行に失敗した模様", EPGREC_ERROR);
 				throw new Exception("AT実行エラー");
 			}
 			// job番号を取り出す
@@ -323,7 +323,7 @@
 			}
 			// エラー
 			$rrec->delete();
-			reclog( "Reservation::custom job番号の取得に失敗",E_ERROR );
+			reclog( "Reservation::custom job番号の取得に失敗",EPGREC_ERROR );
 			throw new Exception( "job番号の取得に失敗" );
 		}
 		catch( Exception $e ) {
@@ -356,7 +356,8 @@
 			if( ! $rec->complete ) {
 				// 未実行の予約である
 				if( toTimestamp($rec->starttime) < (time() + PADDING_TIME + $settings->former_time) ) {
-					reclog("Reservation::cancel 未実行の予約の取り消しが実行された", E_ERROR );
+					reclog("Reservation::cancel 未実行の予約の取り消しが実行された", EPGREC_ERROR );
+					throw new Exception("未実行の予約です");
 				}
 				exec( $settings->atrm . " " . $rec->job );
 				reclog("Reservation::cancel ジョブ番号".$rec->job."を削除");
@@ -364,7 +365,7 @@
 			$rec->delete();
 		}
 		catch( Exception $e ) {
-			reclog("Reservation::cancel 予約キャンセルでDB接続またはアクセスに失敗した模様", E_ERROR );
+			reclog("Reservation::cancel 予約キャンセルでDB接続またはアクセスに失敗した模様", EPGREC_ERROR );
 			throw $e;
 		}
 	}
--- a/recLog.inc.php	Fri Mar 26 15:41:36 2010 +0900
+++ b/recLog.inc.php	Sat Mar 27 23:21:25 2010 +0900
@@ -1,10 +1,11 @@
 <?php
 
-define( "E_INFO" , 0 );
-define( "E_ERROR", 2 );
+define( "EPGREC_INFO" , 0 );
+define( "EPGREC_WARN" , 1 );
+define( "EPGREC_ERROR", 2 );
 
 
-function reclog( $message , $level = E_INFO ) {
+function reclog( $message , $level = EPGREC_INFO ) {
 	
 	try {
 		$log = new DBRecord( LOG_TBL );
--- a/recomplete.php	Fri Mar 26 15:41:36 2010 +0900
+++ b/recomplete.php	Sat Mar 27 23:21:25 2010 +0900
@@ -39,13 +39,13 @@
 	}
 	else {
 		// 予約失敗
-		reclog( "recomplete:: 予約ID". $rrec->id .":".$rrec->type.$rrec->channel.$rrec->title."の録画に失敗した模様", E_ERROR );
+		reclog( "recomplete:: 予約ID". $rrec->id .":".$rrec->type.$rrec->channel.$rrec->title."の録画に失敗した模様", EPGREC_ERROR );
 		$rrec->delete();
 	}
 }
 catch( exception $e ) {
-	reclog( "recomplete:: 予約テーブルのアクセスに失敗した模様", E_ERROR );
-	reclog( "recomplete:: ".$e->getMessage()."" , E_ERROR );
+	reclog( "recomplete:: 予約テーブルのアクセスに失敗した模様", EPGREC_ERROR );
+	reclog( "recomplete:: ".$e->getMessage()."" , EPGREC_ERROR );
 	exit( $e->getMessage() );
 }
 
--- a/storeProgram.inc.php	Fri Mar 26 15:41:36 2010 +0900
+++ b/storeProgram.inc.php	Sat Mar 27 23:21:25 2010 +0900
@@ -45,7 +45,7 @@
 	// XML parse
   	$xml = @simplexml_load_file( $xmlfile );
 	if( $xml === false ) {
-		reclog( "getepg:: 正常な".$xmlfile."が作成されなかった模様(放送間帯でないなら問題ありません)" );
+		reclog( "getepg:: 正常な".$xmlfile."が作成されなかった模様(放送間帯でないなら問題ありません)", EPGREC_WARN );
 		return;	// XMLが読み取れないなら何もしない
 	}
 	// channel抽出
@@ -71,7 +71,7 @@
 		}
 	 }
 	 catch( Exception $e ) {
-		reclog( "getepg::DBの接続またはチャンネルテーブルの書き込みに失敗", E_ERROR );
+		reclog( "getepg::DBの接続またはチャンネルテーブルの書き込みに失敗", EPGREC_ERROR );
 	 }
 	}
 	// channel 終了
@@ -89,7 +89,7 @@
 			$channel_rec = new DBRecord(CHANNEL_TBL, "channel_disc", "$channel_disc" );
 		}
 		catch( Exception $e ) {
-			reclog( "getepg::チャンネルレコード $channel_disc が発見できない", E_ERROR );
+			reclog( "getepg::チャンネルレコード $channel_disc が発見できない", EPGREC_ERROR );
 		}
 		if( $channel_rec == null ) continue;	// あり得ないことが起きた
 		if( $channel_rec->skip == 1 ) continue;	// 受信しないチャンネル
@@ -126,8 +126,8 @@
 				$cat_rec = new DBRecord(CATEGORY_TBL, "category_disc" , $category_disc );
 		}
 		catch( Exception $e ) {
-			reclog("getepg:: カテゴリテーブルのアクセスに失敗した模様", E_ERROR );
-			reclog("getepg:: ".$e->getMessage()."" ,E_ERROR );
+			reclog("getepg:: カテゴリテーブルのアクセスに失敗した模様", EPGREC_ERROR );
+			reclog("getepg:: ".$e->getMessage()."" ,EPGREC_ERROR );
 			exit( $e->getMessage() );
 		}
 		
@@ -196,8 +196,8 @@
 			}
 		}
 		catch(Exception $e) {
-			reclog( "getepg:: プログラムテーブルに問題が生じた模様", E_ERROR );
-			reclog( "getepg:: ".$e->getMessage()."" , E_ERROR);
+			reclog( "getepg:: プログラムテーブルに問題が生じた模様", EPGREC_ERROR );
+			reclog( "getepg:: ".$e->getMessage()."" , EPGREC_ERROR);
 			exit( $e->getMessage() );
 		}
 	}
--- a/templates/logTable.html	Fri Mar 26 15:41:36 2010 +0900
+++ b/templates/logTable.html	Sat Mar 27 23:21:25 2010 +0900
@@ -37,8 +37,8 @@
 }
 
 table#log_table td.errorlevel0 {background-color: #FFFFFF;}
-table#log_table td.errorlevel1 {background-color: red;}
-
+table#log_table td.errorlevel1 {background-color: yellow;}
+table#log_table td.errorlevel2 {background-color: red;}
 
 -->
 </style>
@@ -63,7 +63,8 @@
  <tr>
   <td class="errorlevel{$log->level}">
     {if $log->level == 0}情報
-    {elseif $log->level == 1}エラー
+    {elseif $log->level == 1}警告
+    {elseif $log->level == 2}エラー
     {/if}
   </td>
   <td>{$log->logtime}</td>