Files
FloatBackOfffice/CRONS/blog_rotattion.php
T
dev-chiefworks f76abffdcd first commit
2022-05-31 16:21:53 -04:00

61 lines
1.9 KiB
PHP

<?php
echo "[" . date("Y-m-d H:i:s") . "] blog_rotattion job is starting.\n";
require('../backend.php');
define('EMAIL_PENDING', 1);
define('EMAIL_SENT', 5);
// We will not limit the SQL we will exhaust the allowed memory
// we will process data in ${hard_limit} batches and hopefully catch up
$hard_limit = 500000;
// GPS coordinate precision to assume the same location
$precision = 3;
$tag_message = false;
$email_templates_dir = $savvyext->cfgReadChar('mailsend.templates_dir');
$template_name = "DealTemplate.html"; // This is test template.
$db_host = $savvyext->cfgReadChar('database.host');
$db_name = $savvyext->cfgReadChar('database.name');
$db_user = $savvyext->cfgReadChar('database.user');
$db_pass = $savvyext->cfgReadChar('database.pass');
$db_port = $savvyext->cfgReadLong('database.port');
$connstr = "host=${db_host} port=${db_port} dbname=${db_name} user=${db_user} password=${db_pass}";
$conn = pg_connect($connstr);
$db_host = $savvyext->cfgReadChar('database_replica.host');
$db_name = $savvyext->cfgReadChar('database_replica.name');
$db_user = $savvyext->cfgReadChar('database_replica.user');
$db_pass = $savvyext->cfgReadChar('database_replica.pass');
$db_port = $savvyext->cfgReadLong('database_replica.port');
$readOnlyReplicaConnstr = "host=${db_host} port=${db_port} dbname=${db_name} user=${db_user} password=${db_pass}";
$readOnlyReplicaConn = pg_connect($readOnlyReplicaConnstr);
$mysql = "SELECT *,id AS member_id FROM members LIMIT 10";
$r = pg_query($readOnlyReplicaConn, $mysql);
$acc = array();
if ($r && pg_num_rows($r)) {
// Load Email template
$htm_template = file_get_contents($email_templates_dir . "/" . $template_name);
while ($f = pg_fetch_assoc($r)) {
$member_id = $f["member_id"];
$notify_id = $f["notify_id"];
$reciever_email = $f["reciever_email"];
$notice_type = $f["notice_type"];
$category = $f["category"];
}
}