$options .= " AND ( CONCAT(title,' ',description) like '%".mysql_real_escape_string($keyword)."%'";
if( $f_zennum ) {
- $options .= " OR CONCAT(title,' ',description) like '%".mysql_real_escape_string(mb_convert_kana( $keyword, 'KVN' ))."%'";
+ $options .= " OR CONCAT(title,' ',description) like '%".mysql_real_escape_string(mb_convert_kana( $keyword, 'KVN',"UTF-8" ))."%'";
}
if( $f_zenal ) {
- $options .= " OR CONCAT(title,' ',description) like '%".mysql_real_escape_string(mb_convert_kana( $keyword, 'KVR' ))."%'";
+ $options .= " OR CONCAT(title,' ',description) like '%".mysql_real_escape_string(mb_convert_kana( $keyword, 'KVR', "UTF-8" ))."%'";
}
if( $f_zenal && $f_zennum ) {
- $options .= " OR CONCAT(title,' ',description) like '%".mysql_real_escape_string(mb_convert_kana( $keyword, 'KVRN' ))."%'";
+ $options .= " OR CONCAT(title,' ',description) like '%".mysql_real_escape_string(mb_convert_kana( $keyword, 'KVRN', "UTF-8" ))."%'";
}
$options .= ") ";
}
include_once( INSTALL_PATH . "/DBRecord.class.php" );
include_once( INSTALL_PATH . "/reclib.php" );
include_once( INSTALL_PATH . "/Settings.class.php" );
+include_once( INSTALL_PATH . "/recLog.inc.php" );
// 予約クラス
throw new Exception( "終わりつつある/終わっている番組です" );
}
-
// ここからファイル名生成
/*
%TITLE% 番組タイトル
}
else {
$rrec->delete();
+ reclog( "Reservation::custom atの実行に失敗した模様", E_ERROR);
throw new Exception("AT実行エラー");
}
// job番号を取り出す
if( $key !== false ) {
if( is_numeric( $rarr[$key+1]) ) {
$rrec->job = $rarr[$key+1];
+ reclog( "Reservation::custom ジョブ番号".$rrec->job."に録画ジョブを登録");
return $rrec->job; // 成功
}
}
// エラー
$rrec->delete();
+ reclog( "Reservation::custom job番号の取得に失敗",E_ERROR );
throw new Exception( "job番号の取得に失敗" );
}
catch( Exception $e ) {
}
if( ! $rec->complete ) {
// 未実行の予約である
- if( toTimestamp($rec->starttime) < (time() + PADDING_TIME + $settings->former_time) )
- throw new Exception("過去の録画予約です");
+ if( toTimestamp($rec->starttime) < (time() + PADDING_TIME + $settings->former_time) ) {
+ reclog("Reservation::cancel 未実行の予約の取り消しが実行された", E_ERROR );
+ }
exec( $settings->atrm . " " . $rec->job );
+ reclog("Reservation::cancel ジョブ番号".$rec->job."を削除");
}
$rec->delete();
}
catch( Exception $e ) {
+ reclog("Reservation::cancel 予約キャンセルでDB接続またはアクセスに失敗した模様", E_ERROR );
throw $e;
}
}
$rec = new DBRecord( KEYWORD_TBL );
$rec->createTable( KEYWORD_STRUCT );
+
+ $rec = new DBRecord( LOG_TBL );
+ $rec->createTable( LOG_STRUCT );
}
catch( Exception $e ) {
jdialog("テーブルの作成に失敗しました。データベースに権限がない等の理由が考えられます。", "step2.php" );
--- /dev/null
+<?php
+
+define( "E_INFO" , 0 );
+define( "E_ERROR", 2 );
+
+
+function reclog( $message , $level = E_INFO ) {
+
+ try {
+ $log = new DBRecord( LOG_TBL );
+
+ $log->logtime = date("Y-m-d H:i:s");
+ $log->level = $level;
+ $log->message = $message;
+ }
+ catch( Exception $e ) {
+ //
+ }
+}
+
+?>
// 8日以上先のデータがあれば消す
$arr = array();
- $arr = DBRecord::createRecords( PROGRAM_TBL, "WHERE starttime > adddate( now(), 8 )" );
+ $arr = DBRecord::createRecords( PROGRAM_TBL, "WHERE starttime > adddate( now(), 8 ) ");
+ foreach( $arr as $val ) $val->delete();
+
+ // 8日以上前のログを消す
+ $arr = array();
+ $arr = DBRecord::createRecords( LOG_TBL, "WHERE endtime < subdate( now(), 8 )" );
foreach( $arr as $val ) $val->delete();
}
foreach( $arr as $val ) {
try {
$val->reservation();
+ reclog( "getepg::キーワードID".$val->id."を予約");
}
catch( Exception $e ) {
- // 無視
+ // 無視
}
}
}
// XML parse
$xml = @simplexml_load_file( $xmlfile );
if( $xml === false ) {
+ reclog( "getepg::".$xmlfile."が作成されなかった模様", E_ERROR );
return; // XMLが読み取れないなら何もしない
}
// channel抽出
}
}
catch( Exception $e ) {
- // 無視
+ reclog( "getepg::DBの接続またはチャンネルテーブルの書き込みに失敗", E_ERROR );
}
}
// channel 終了
$channel_rec = new DBRecord(CHANNEL_TBL, "channel_disc", "$channel_disc" );
}
catch( Exception $e ) {
- // 無視
+ reclog( "getepg::チャンネルレコードが発見できない", E_ERROR );
}
if( $channel_rec == null ) continue; // あり得ないことが起きた
if( $channel_rec->skip == 1 ) continue; // 受信しないチャンネル
try {
$reserve = new DBRecord(RESERVE_TBL, "program_id", $rec->id );
if( $reserve->autorec ) {
+ reclog( "getepg::録画ID".$reserve->id."は時間変更の可能性あり予約を取り消し");
Reservation::cancel( $reserve->id );
}
}
catch( Exception $e ) {
- //無視
+ // 無視
}
// 番組削除
+ reclog( "getepg::放送時間重複が発生した番組ID".$rec->id."を削除" );
$rec->delete();
}
}
}
}
catch(Exception $e) {
+ reclog( "getepg::DBの入出力に問題が生じた模様", E_ERROR );
exit( $e->getMessage() );
}
}
// Programme取得完了
}
-?>
\ No newline at end of file
+?>
""
);
+define( "LOG_STRUCT",
+ "id integer not null auto_increment primary key". // ID
+ ",logtime datetime not null default '1970-01-01 00:00:00'". // 記録日時
+ ",level integer not null default '0'". // エラーレベル
+ ",message varchar(512) not null default ''".
+ ""
+);
+
?>
\ No newline at end of file
chdir( $script_path );
include_once($script_path . '/config.php');
include_once(INSTALL_PATH . '/Settings.class.php' );
-
+include_once(INSTALL_PATH . '/DBRecord.class.php' );
+include_once(INSTALL_PATH . '/tableStruct.inc.php' );
// mysqli::multi_queryは動作がいまいちなので使わない
if( multi_query( $sqlstrs, $dbh ) ) {
echo "キーワードテーブルのアップデートに失敗\n";
}
+
+ // ログテーブル
+
+ try {
+ $log = new DBRecord( LOG_TBL );
+ $log->createTable( LOG_STRUCT );
+ }
+ catch( Exception $e ) {
+ echo $e->message;
+ echo "\n";
+ }
+
}
else
exit( "DBの接続に失敗\n" );