Fix: require __DIR__.
This commit is contained in:
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once __DIR__."/mail/mail_sender.php";
|
||||||
|
require_once __DIR__."/mail/mail_setting.php";
|
||||||
|
require_once __DIR__."/mail/chocomae_info.php";
|
||||||
|
|
||||||
|
if($argc != 4) {
|
||||||
|
echo "check the input arguments\n";
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// for($i = 0; $i < $argc; $i++) {
|
||||||
|
// echo "[".$i."] : ".$argv[$i]."\n";
|
||||||
|
// }
|
||||||
|
// exit(0);
|
||||||
|
|
||||||
|
|
||||||
|
$maestroEmail = $argv[1];
|
||||||
|
$maestroName = $argv[2];
|
||||||
|
$date = $argv[3];
|
||||||
|
$year = substr($date, 0, 4);
|
||||||
|
$month = substr($date, 4, 2);
|
||||||
|
$day = substr($date, 6, 2);
|
||||||
|
$registerDate = $year."년 ".$month."월 ".$day."일";
|
||||||
|
|
||||||
|
|
||||||
|
$parameters = array(
|
||||||
|
"maestro_name" => $maestroName,
|
||||||
|
"register_date" => $registerDate,
|
||||||
|
);
|
||||||
|
|
||||||
|
$recipientParam = array(
|
||||||
|
"maestro_name" => $maestroName
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
$nCloudSetting = new MailSetting();
|
||||||
|
$chocomae = new ChocomaeInfo();
|
||||||
|
|
||||||
|
$mailSender = new MailSender();
|
||||||
|
$mailSender->setMailSetting($nCloudSetting);
|
||||||
|
$mailSender->setSenderInfo($chocomae->sender_name, $chocomae->sender_email);
|
||||||
|
|
||||||
|
$mailSender->makePostParam(337);
|
||||||
|
$mailSender->setParameters($parameters);
|
||||||
|
$mailSender->addRecipient($maestroEmail, $maestroName, "R", $recipientParam);
|
||||||
|
$mailSender->addRecipient($chocomae->sender_bcc, $chocomae->sender_name, "B", $recipientParam);
|
||||||
|
|
||||||
|
// $mailSender->showSettings();
|
||||||
|
$mailSender->send();
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -18,30 +18,33 @@ def print_items(list):
|
|||||||
|
|
||||||
|
|
||||||
def send_mail(email, name, register_date):
|
def send_mail(email, name, register_date):
|
||||||
space = ' '
|
filename = 'send_mail_to_unpaid_maestro.php'
|
||||||
command = 'mysqldump' + space
|
path = ''
|
||||||
user = '-u root' + space
|
|
||||||
password = '-p52napark!' + space
|
|
||||||
transaction = '--single-transaction' + space
|
|
||||||
db = 'chocomae' + space
|
|
||||||
table = 'maestro' + space
|
|
||||||
where_clause = '--where="DATE(NOW()) - INTERVAL 7 DAY > AcceptClausesDateTime AND ActivateStatus = 0"' + space
|
|
||||||
output_directory = '/home/chocomae/unregister-user-backup/'
|
|
||||||
if mode == 'mac':
|
if mode == 'mac':
|
||||||
output_directory = ''
|
path = '/Applications/MAMP/htdocs/mouse_typing/src/web/php/'
|
||||||
today = datetime.today().strftime('%Y%m%d-%H%M%S')
|
|
||||||
output_filename = '> ' + output_directory + today + '.sql'
|
|
||||||
|
|
||||||
command_db_backup = command + user + password + transaction + db + table + where_clause + output_filename
|
|
||||||
# 'mysqldump -u "${DBUSER}" -p"${DBPASS}" --single-transaction "${DBNAME}" "${filename}" --where="DATE(${record_date})=CURDATE()" > "${filename}.dump.bydate.sql"'
|
|
||||||
if mode == 'mac':
|
|
||||||
print(command_db_backup)
|
|
||||||
else:
|
else:
|
||||||
subprocess.call(command_db_backup)
|
path = '/var/www/html/mouse_typing/src/web/php/'
|
||||||
|
|
||||||
|
command_send_mail = []
|
||||||
|
command_send_mail.append('/usr/bin/php')
|
||||||
|
command_send_mail.append(path + filename)
|
||||||
|
command_send_mail.append(email)
|
||||||
|
command_send_mail.append(name)
|
||||||
|
date = register_date.strftime('%Y%m%d')
|
||||||
|
command_send_mail.append(date)
|
||||||
|
print(command_send_mail)
|
||||||
|
|
||||||
|
# command_move_dir = ['cd', path]
|
||||||
|
# print(command_move_dir)
|
||||||
|
# subprocess.call(command_move_dir)
|
||||||
|
command_move_pwd = ['pwd']
|
||||||
|
subprocess.call(command_move_pwd)
|
||||||
|
subprocess.call(command_send_mail)
|
||||||
|
|
||||||
|
|
||||||
|
# insert log and delete from DB
|
||||||
unpaidMaestroMan = UnpaidMaestroManager(mode)
|
unpaidMaestroMan = UnpaidMaestroManager(mode)
|
||||||
maestro_list = unpaidMaestroMan.get_unpaid_7days_maestro_list()
|
maestro_list = unpaidMaestroMan.get_unpaid_7days_maestro_list()
|
||||||
# print_items(maestro_list)
|
# print_items(maestro_list)
|
||||||
|
for maestro in maestro_list:
|
||||||
backup_unregister_maestro_table_file()
|
send_mail(maestro['Email'], maestro['Name'], maestro['AcceptClausesDateTime'])
|
||||||
|
|||||||
Reference in New Issue
Block a user