$path = $path . '/' . $id; if (!file_exists($path)) { mkdir($path); chmod($path, 0700); chown($path, 'diradmin'); chgrp($path, 'diradmin'); } $lines = []; $lines[] = 'from=da-letsencrypt'; $lines[] = 'name=Message System'; $lines[] = 'priority=30'; $lines[] = 'status=open'; $lines[] = 'subject=Lets Encrypt reissue cron ran'; $lines[] = 'type=message'; $lines[] = 'user=multiple'; file_put_contents($path . '/000.conf', implode("\n", $lines)); chmod($path . '/000.conf', 0600); chown($path . '/000.conf', 'diradmin'); chgrp($path . '/000.conf', 'diradmin'); $lines = []; $lines[] = 'First of all, thanks for using our plugin! Now, let\'s get to straight business, the reissue cron has just ran!'; $lines[] = ''; $lines[] = 'Here a list of everything that happend:'; foreach ($log->getLog() as $line) { $lines[] = $line; } file_put_contents($path . '/000.msg', implode("\n", $lines)); chmod($path . '/000.msg', 0600); chown($path . '/000.msg', 'diradmin'); chgrp($path . '/000.msg', 'diradmin'); file_put_contents('/usr/local/directadmin/data/admin/tickets.list', sprintf("%09d", $id) . '=new=yes&type=message' . PHP_EOL, FILE_APPEND);