前提・実現したいこと
前回osclassのアラートが機能せず質問したものです。指摘していただいた部分を直し、エラーはなくなったのですがいまだアラートは送信されません。 目標としては定期的に通知メールを登録者に送信することです。 結局osclassのphpをいじらないといけないといけなさそうなのですがよくわかっていない現状です。 どのような情報でもよいので教えていただけるとありがたいです。よろしくお願いいたします。
発生している問題・エラーメッセージ
発生している問題は前述したとおりです。エラーメッセージは特にありません。
該当のソースコード
PHP
1<?php 2 3 function osc_runAlert($type = null, $last_exec = null) { 4 $mUser = User::newInstance(); 5 if ( !in_array($type, array('HOURLY', 'DAILY', 'WEEKLY', 'INSTANT')) ) { 6 return; 7 } 8 if($last_exec==null) { 9 $cron = Cron::newInstance()->getCronByType($type); 10 if( is_array($cron) ) { 11 $last_exec = $cron['d_last_exec']; 12 } else { 13 $last_exec = '0000-00-00 00:00:00'; 14 } 15 } 16 $internal_name = 'alert_email_hourly'; 17 switch ($type) { 18 case 'HOURLY': 19 $internal_name = 'alert_email_hourly'; 20 break; 21 case 'DAILY': 22 $internal_name = 'alert_email_daily'; 23 break; 24 case 'WEEKLY': 25 $internal_name = 'alert_email_weekly'; 26 break; 27 case 'INSTANT': 28 $internal_name = 'alert_email_instant'; 29 break; 30 } 31 $active = TRUE; 32 $searches = Alerts::newInstance()->findByTypeGroup($type, $active); 33 foreach($searches as $s_search) { 34 35 $json = $s_search['s_search']; 36 $array_conditions = (array)json_decode($json); 37 $new_search = Search::newInstance(); 38 $new_search->setJsonAlert($array_conditions); 39 $new_search->addConditions(sprintf(" %st_item.dt_pub_date > '%s' ", DB_TABLE_PREFIX, $last_exec)); 40 $items = $new_search->doSearch(); 41 $totalItems = $new_search->count(); 42 if( count($items) > 0 ) { 43 44 $alerts = Alerts::newInstance()->findUsersBySearchAndType($s_search['s_search'], $type, $active); 45 if( count($alerts) > 0 ) { 46 $ads = ''; 47 foreach($items as $item) { 48 $ads .= '<a href="'. osc_item_url_ns($item['pk_i_id']).'">' . $item['s_title'] . '</a><br/>'; 49 } 50 foreach($alerts as $alert) { 51 $user = array(); 52 if($alert['fk_i_user_id']!=0) { 53 $user = $mUser->findByPrimaryKey($alert['fk_i_user_id']); 54 } 55 if(!isset($user['s_name'])) { 56 $user = array( 57 's_name' => $alert['s_email'], 58 's_email' => $alert['s_email'] 59 ); 60 } 61 if(count($alert)>0) { 62 osc_run_hook('hook_'.$internal_name, $user, $ads, $alert, $items, $totalItems); 63 AlertsStats::newInstance()->increase(date('Y-m-d')); 64 } 65 } 66 } 67 } 68 } 69 }
試したこと
githubで見つけた方法「https://github.com/osclass/Osclass/commit/00b9158aebafc7c33392e4e1a4d2f654c31fe3cf?diff=unified」も試してはみたのですが上手くいきませんでした。
cronも用いてみようとしましたがOSがwindowsなので?うまくいきませんでした。
補足情報(FW/ツールのバージョンなど)
osclassは(最新バージョン 374) です。
あなたの回答
tips
プレビュー