Cheetah
inc
classes
ChWsbCronNotifies.php
Go to the documentation of this file.
1
<?
php
2
8
require_once( CH_DIRECTORY_PATH_INC .
'db.inc.php'
);
9
require_once(
'ChWsbCron.php'
);
10
11
class
ChWsbCronNotifies
extends
ChWsbCron
12
{
13
function
processing
()
14
{
15
global
$site
;
16
17
set_time_limit( 36000 );
18
ignore_user_abort();
19
20
$sResult
=
""
;
21
$iPerStart = (int)trim(
getParam
(
'msgs_per_start'
));
22
23
$iFullCount = (int)
$GLOBALS
[
'MySQL'
]->getOne(
'SELECT COUNT(*) FROM `sys_sbs_queue`'
);
24
if
($iFullCount) {
25
$iProcess = $iFullCount < $iPerStart ? $iFullCount : $iPerStart;
26
27
$sResult
.=
"\n- Start email send -\n"
;
28
$sResult
.=
"Total queued emails: "
. $iFullCount .
"\n"
;
29
$sResult
.=
"Ready for send: "
. $iProcess .
"\n"
;
30
31
$aMails =
$GLOBALS
[
'MySQL'
]->getAll(
"SELECT `id`, `email`, `subject`, `body` FROM `sys_sbs_queue` ORDER BY `id` LIMIT 0, "
. $iProcess);
32
33
$iSent = 0;
34
$aIds = array();
35
foreach
($aMails
as
$aMail) {
36
$aIds[] = $aMail[
'id'
];
37
if
(
sendMail
($aMail[
'email'
], $aMail[
'subject'
], $aMail[
'body'
]))
38
$iSent++;
39
else
40
$sResult
.=
"Cannot send message to "
. $aMail[
'email'
] .
"\n"
;
41
}
42
$GLOBALS
[
'MySQL'
]->query(
"DELETE FROM `sys_sbs_queue` WHERE `id` IN ('"
. implode(
"','"
, $aIds) .
"')"
);
43
44
$sResult
.=
"Processed emails: "
. $iSent .
"\n"
;
45
sendMail
(
$site
[
'email'
],
$site
[
'title'
] .
": Periodic Report"
,
$sResult
, 0, array(),
'text'
);
46
}
47
}
48
}
ChWsbCronNotifies\processing
processing()
Definition:
ChWsbCronNotifies.php:13
$sResult
$sResult
Definition:
advanced_settings.php:26
ChWsbCron
Definition:
ChWsbCron.php:76
sendMail
sendMail( $sRecipientEmail, $sMailSubject, $sMailBody, $iRecipientID=0, $aPlus=array(), $sEmailFlag='html', $isDisableAlert=false, $bForceSend=false)
Definition:
utils.inc.php:461
php
getParam
getParam($sParamName, $bUseCache=true)
Definition:
db.inc.php:130
$site
$site['ver']
Definition:
version.inc.php:8
global
if(!defined("GLOBAL_MODULE")) define("GLOBAL_MODULE" global
Definition:
header.inc.php:25
ChWsbCronNotifies
Definition:
ChWsbCronNotifies.php:12
as
as
Definition:
Filter.ExtractStyleBlocks.Escaping.txt:10
$GLOBALS
$GLOBALS['iAdminPage']
Definition:
advanced_settings.php:10
Generated by
1.8.20