Compare commits
2 Commits
feature/do
...
master
Author | SHA1 | Date | |
---|---|---|---|
bf7d1efb43 | |||
7bdf9683b4 |
@ -1,28 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 80 default_server;
|
|
||||||
listen [::]:80 default_server;
|
|
||||||
|
|
||||||
root /var/www/html/public;
|
|
||||||
|
|
||||||
index index.php;
|
|
||||||
#client_max_body_size 100m;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ /index.php$is_args$args;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ \.php {
|
|
||||||
try_files $uri /index.php =404;
|
|
||||||
fastcgi_pass php:9000;
|
|
||||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
|
||||||
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
|
||||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
|
||||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
|
||||||
fastcgi_index index.php;
|
|
||||||
include fastcgi_params;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ /\.(?:ht|git|svn) {
|
|
||||||
deny all;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
FROM php:8.4-fpm
|
|
||||||
ARG TIMEZONE
|
|
||||||
|
|
||||||
COPY php.ini /usr/local/etc/php/conf.d/docker-php-config.ini
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
gnupg \
|
|
||||||
g++ \
|
|
||||||
procps \
|
|
||||||
openssl \
|
|
||||||
git \
|
|
||||||
unzip \
|
|
||||||
zlib1g-dev \
|
|
||||||
libzip-dev \
|
|
||||||
libfreetype6-dev \
|
|
||||||
libpng-dev \
|
|
||||||
libjpeg-dev \
|
|
||||||
libicu-dev \
|
|
||||||
libonig-dev \
|
|
||||||
libxslt1-dev \
|
|
||||||
acl \
|
|
||||||
&& echo 'alias sf="php bin/console"' >> ~/.bashrc
|
|
||||||
|
|
||||||
RUN docker-php-ext-configure gd --with-jpeg --with-freetype
|
|
||||||
|
|
||||||
RUN docker-php-ext-install \
|
|
||||||
pdo pdo_mysql zip xsl gd intl opcache exif mbstring
|
|
||||||
|
|
||||||
# Set timezone
|
|
||||||
RUN ln -snf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime && echo ${TIMEZONE} > /etc/timezone \
|
|
||||||
&& printf '[PHP]\ndate.timezone = "%s"\n', ${TIMEZONE} > /usr/local/etc/php/conf.d/tzone.ini \
|
|
||||||
&& "date"
|
|
||||||
|
|
||||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
|
||||||
|
|
||||||
WORKDIR /var/www/html
|
|
@ -1,13 +0,0 @@
|
|||||||
memory_limit=1024M
|
|
||||||
|
|
||||||
opcache.enable=1
|
|
||||||
opcache.revalidate_freq=10
|
|
||||||
opcache.validate_timestamps=1
|
|
||||||
opcache.max_accelerated_files=10000
|
|
||||||
opcache.memory_consumption=192
|
|
||||||
opcache.max_wasted_percentage=10
|
|
||||||
opcache.interned_strings_buffer=1
|
|
||||||
opcache.fast_shutdown=1
|
|
||||||
|
|
||||||
upload_max_filesize = 20M
|
|
||||||
post_max_size = 20M
|
|
@ -1,37 +0,0 @@
|
|||||||
services:
|
|
||||||
nginx:
|
|
||||||
image: nginx:stable
|
|
||||||
ports:
|
|
||||||
- "8080:80"
|
|
||||||
volumes:
|
|
||||||
- .:/var/www/html
|
|
||||||
- ./.docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
|
|
||||||
depends_on:
|
|
||||||
- php
|
|
||||||
|
|
||||||
php:
|
|
||||||
build:
|
|
||||||
context: ./.docker/php
|
|
||||||
depends_on:
|
|
||||||
- db
|
|
||||||
volumes:
|
|
||||||
- .:/var/www/html
|
|
||||||
working_dir: /var/www/html
|
|
||||||
environment:
|
|
||||||
DATABASE_URL: mysql://user:password@db:3306/app?serverVersion=11.7.2-MariaDB
|
|
||||||
APP_ENV: prod
|
|
||||||
|
|
||||||
db:
|
|
||||||
image: mariadb:11.7.2
|
|
||||||
environment:
|
|
||||||
MARIADB_ROOT_PASSWORD: password
|
|
||||||
MARIADB_DATABASE: app
|
|
||||||
MARIADB_USER: user
|
|
||||||
MARIADB_PASSWORD: password
|
|
||||||
volumes:
|
|
||||||
- db_data:/var/lib/mysql
|
|
||||||
ports:
|
|
||||||
- "3306"
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
db_data:
|
|
@ -22,7 +22,8 @@ class SnipController extends AbstractController
|
|||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly SnipRepository $repository,
|
private readonly SnipRepository $repository,
|
||||||
) {}
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
#[Route('/', name: '_index')]
|
#[Route('/', name: '_index')]
|
||||||
public function index(#[MapQueryCached] SnipFilterRequest $request): Response
|
public function index(#[MapQueryCached] SnipFilterRequest $request): Response
|
||||||
@ -66,8 +67,7 @@ class SnipController extends AbstractController
|
|||||||
->setVary(['Accept', 'Accept-Encoding'])
|
->setVary(['Accept', 'Accept-Encoding'])
|
||||||
->setEtag(md5($response->getContent()))
|
->setEtag(md5($response->getContent()))
|
||||||
->setTtl(3600)
|
->setTtl(3600)
|
||||||
->setClientTtl(300)
|
->setClientTtl(300);
|
||||||
;
|
|
||||||
|
|
||||||
if (!$request->isNoCache()) {
|
if (!$request->isNoCache()) {
|
||||||
$response->isNotModified($request);
|
$response->isNotModified($request);
|
||||||
@ -90,11 +90,9 @@ class SnipController extends AbstractController
|
|||||||
$this->addFlash('error', 'Snip is not the latest version, changes will not be saved.');
|
$this->addFlash('error', 'Snip is not the latest version, changes will not be saved.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$form = $this->createForm(SnipType::class, $snip);
|
$form = $this->createForm(SnipType::class, $snip)
|
||||||
$form->add('Save', SubmitType::class);
|
->add('Save', SubmitType::class);
|
||||||
if ($snip->getId()) {
|
$form->get('content')->setData($snip->getActiveText());
|
||||||
$form->get('content')->setData($snip->getActiveText());
|
|
||||||
}
|
|
||||||
|
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
@ -128,10 +126,31 @@ class SnipController extends AbstractController
|
|||||||
{
|
{
|
||||||
$snip = new Snip();
|
$snip = new Snip();
|
||||||
$snip->setCreatedAtNow()
|
$snip->setCreatedAtNow()
|
||||||
->setCreatedBy($this->getUser())
|
->setCreatedBy($this->getUser());
|
||||||
;
|
|
||||||
|
|
||||||
return $this->edit($snip, $request, $contentService);
|
$form = $this->createForm(SnipType::class, $snip);
|
||||||
|
$form->add('Create', SubmitType::class);
|
||||||
|
|
||||||
|
$form->handleRequest($request);
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
$this->repository->save($snip);
|
||||||
|
$contentService->update(
|
||||||
|
$snip,
|
||||||
|
$form->get('content')->getData(),
|
||||||
|
$form->get('contentName')->getData()
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->addFlash('success', sprintf('Snip "%s" created', $snip));
|
||||||
|
|
||||||
|
return $this->redirectToRoute('snip_single', [
|
||||||
|
'snip' => $snip->getId(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('snip/create.html.twig', [
|
||||||
|
'snip' => $snip,
|
||||||
|
'form' => $form->createView(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/delete/{snip}', name: '_delete')]
|
#[Route('/delete/{snip}', name: '_delete')]
|
||||||
|
7
templates/snip/create.html.twig
Normal file
7
templates/snip/create.html.twig
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{% extends 'base/one.column.html.twig' %}
|
||||||
|
|
||||||
|
{% set title = 'Create Snip' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
{{ form(form) }}
|
||||||
|
{% endblock %}
|
@ -1,10 +1,6 @@
|
|||||||
{% extends 'snip/base.html.twig' %}
|
{% extends 'snip/base.html.twig' %}
|
||||||
|
|
||||||
{% if snip.id %}
|
{% set title %}{{ snip }} - Edit{% endset %}
|
||||||
{% set title %}{{ snip }} - Edit{% endset %}
|
|
||||||
{% else %}
|
|
||||||
{% set title = 'Create Snip' %}
|
|
||||||
{% endif %}
|
|
||||||
{% set active = 'edit' %}
|
{% set active = 'edit' %}
|
||||||
|
|
||||||
{% block buttons %}
|
{% block buttons %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user