Fixing warning messages + loading email from configuration.php

1.9.x
Julio Montoya 11 years ago
parent e9b99f2641
commit f05b852f21
  1. 12
      main/cron/import_csv.php

@ -19,6 +19,11 @@ class ImportCsv
public function run()
{
$path = api_get_path(SYS_CODE_PATH).'cron/incoming/';
if (!is_dir($path)) {
echo "The folder! $path does not exits";
exit;
}
$files = scandir($path);
if (!empty($files)) {
foreach ($files as $file) {
@ -331,10 +336,13 @@ use Monolog\Handler\RotatingFileHandler;
$logger = new Logger('cron');
$to = "";
$to = isset($_configuration['cron_notification_mail']) ? $_configuration['cron_notification_mail'] : null;
$subject = "Cron main/cron/import_csv.php ".date('Y-m-d h:i:s');
$from = api_get_setting('emailAdministrator');
$logger->pushHandler(new NativeMailerHandler($to, $subject, $from, Logger::ERROR));
if (!empty($to)) {
$logger->pushHandler(new NativeMailerHandler($to, $subject, $from, Logger::ERROR));
}
$logger->pushHandler(new StreamHandler(api_get_path(SYS_ARCHIVE_PATH).'import_csv.log'), Logger::ERROR);
$logger->pushHandler(new RotatingFileHandler('import_csv', 5, Logger::ERROR));

Loading…
Cancel
Save