Skip to content

Commit

Permalink
various fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
antedebaas committed Jul 1, 2024
1 parent 89f791a commit f8fe3c0
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 39 deletions.
12 changes: 11 additions & 1 deletion dockerfiles/usr/local/bin/containerstartup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,19 @@ if [ ! -f "/var/www/html/.env.local" ]; then
echo "ENABLE_REGISTRATION=\"$ENABLE_REGISTRATION\"" >> /var/www/html/.env.local
fi

echo "Check if attachments directory exists"
if test -d /path/to/directory; then
echo "Attachments directory exists."
else
echo "Attachments directory does not exist, creating it."
mkdir -p /var/www/html/var/imap/attachments
chown -R nobody:nobody /var/www/html/var/imap/attachments
chmod 775 /var/www/html/var/imap/attachments
fi

echo "Set cron schedule"
if echo "$MAILCHECK_SCHEDULE" | egrep -s -q "^(@(monthly|weekly|daily|hourly|15min))|((((\d+,)+\d+|((\d+|\*)(\/|-)\d+)|\d+|\*) ?){5})$"; then
echo 'Cron schedule match found, following input';
echo 'Cron schedule match found, following input schedule';
else
echo 'Cron schedule match not found, setting to run once every hour';
MAILCHECK_SCHEDULE='0 * * * *';
Expand Down
6 changes: 3 additions & 3 deletions src/Command/GetReportsFromMailboxCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
use App\Entity\Logs;
use App\Entity\Config;

use App\Response\GetReportsResponse;
use App\Response\MailboxResponse;
use App\Response\MailReportResponse;

use App\Enums\ReportType;
Expand Down Expand Up @@ -116,9 +116,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
}

private function open_mailbox(ConnectionInterface $ci_mailbox): GetReportsResponse
private function open_mailbox(ConnectionInterface $ci_mailbox): MailboxResponse
{
$response = new GetReportsResponse();
$response = new MailboxResponse();

$mailbox = $ci_mailbox->getMailbox();
$mail_ids = $mailbox->searchMailbox('UNSEEN');
Expand Down
24 changes: 0 additions & 24 deletions src/Controller/ReportsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,4 @@ public function index(): Response
'breadcrumbs' => array(array('name' => $this->translator->trans("Reports"), 'url' => $this->router->generate('app_reports'))),
]);
}

#[Route('/reports/checkmailnow', name: 'app_checkmailnow')]
public function checkmailboxnow(): Response
{
if (!$this->getUser() || !$this->isGranted('IS_AUTHENTICATED')) {
return $this->redirectToRoute('app_login');
}

$this->denyAccessUnlessGranted('ROLE_ADMIN');

$kernel = new Kernel($_ENV['APP_ENV'], (bool) $_ENV['APP_DEBUG']);

$application = new Application($kernel);
$application->setAutoExit(false);

$input = new ArrayInput(array(
'command' => 'app:getreportsfrommailbox'
));

$output = new BufferedOutput();
$application->run($input, $output);

return $this->redirectToRoute('app_dashboard');
}
}
7 changes: 0 additions & 7 deletions src/Response/GetReportsResponse.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Response;

class BaseResponse
class MailboxResponse
{
private bool $success = false;
private string $message = 'Unknown error.';
Expand Down
3 changes: 0 additions & 3 deletions templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@

</div>
<div class="col-12 col-md-5 col-lg-8 d-flex align-items-center justify-content-md-end mt-3 mt-md-0">
{% if app.user.getroles is defined and 'ROLE_ADMIN' in app.user.getroles() %}
<a href="{{ path('app_checkmailnow') }}" class="btn btn-sm btn-primary mx-4">Check mailbox now</a>
{% endif %}
{% if app.user.email is defined %}
<div class="dropdown">
<button class="btn dropdown-toggle btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-expanded="false">
Expand Down

0 comments on commit f8fe3c0

Please sign in to comment.