Commit 5cb67d40 authored by pestov's avatar pestov
Browse files

Merge remote-tracking branch 'origin/master' into handle_Hi_Tag

parents cd167cfc fd5926c4
......@@ -25,3 +25,7 @@ CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
###< nelmio/cors-bundle ###
MAIN_DOMAIN=https://localhost:8000
STORAGE_ENDPOINT=https://s3.example.com
STORAGE_KEY=foo
STORAGE_SECRET=bar
STORAGE_BUCKET=gfl
......@@ -17,16 +17,13 @@ yarn-error.log
###> symfony/phpunit-bridge ###
.phpunit
/phpunit.xml
.phpunit.result.cache
###< symfony/phpunit-bridge ###
###> friendsofphp/php-cs-fixer ###
/.php_cs
/.php_cs.cache
/.php-cs-fixer.cache
###< friendsofphp/php-cs-fixer ###
###> symfony/web-server-bundle ###
/.web-server-pid
###< symfony/web-server-bundle ###
/data/
/solr/*/*/index/
/public/data
<?php
$finder = PhpCsFixer\Finder::create()
->exclude(['var', 'cache', 'build', 'vendor', 'public'])
->in(__DIR__);
return (new PhpCsFixer\Config())
->setRules([
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_class_elements' => [
'order' => [
'use_trait',
'constant_public',
'constant_protected',
'constant_private',
'property_public',
'property_protected',
'property_private',
'construct',
'destruct',
'magic',
'phpunit',
'method_public',
'method_protected',
'method_private',
],
'sort_algorithm' => 'alpha',
],
])
->setFinder($finder)
;
<?php
return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
])
;
......@@ -26,7 +26,8 @@ RUN apk add --update --no-cache \
libzip \
libxslt-dev \
bzip2-dev && \
# Install PHP extensions
# Install PHP extensions \
docker-php-ext-configure intl && \
docker-php-ext-install \
xsl \
intl \
......
......@@ -4,6 +4,7 @@
"type": "project",
"description": "GFL Website",
"minimum-stability": "dev",
"prefer-stable": true,
"repositories": [
{
"type": "vcs",
......@@ -15,50 +16,52 @@
"ext-ctype": "*",
"ext-dom": "*",
"ext-iconv": "*",
"ext-intl": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-simplexml": "*",
"ext-xsl": "*",
"doctrine/collections": "^1.6",
"eightpoints/guzzle-bundle": "^8.0",
"erusev/parsedown": "^1.8@beta",
"knplabs/knp-paginator-bundle": "^2.8",
"erusev/parsedown": "^1.8",
"knplabs/knp-paginator-bundle": "^5.3.0",
"league/flysystem-aws-s3-v3": "^1.0",
"nelmio/api-doc-bundle": "^2.13",
"nelmio/cors-bundle": "^2.1",
"nelmio/solarium-bundle": "dev-master",
"nelmio/api-doc-bundle": "^3.0",
"nelmio/cors-bundle": "^2.1.1",
"nelmio/solarium-bundle": "^5.0",
"oneup/flysystem-bundle": "^3.0",
"opis/json-schema": "^1.0@dev",
"roave/better-reflection": "^4.3",
"solarium/solarium": "^6.1.4",
"opis/json-schema": "^2.2",
"subugoe/emo-bundle": "dev-master",
"symfony/asset": "4.4.*",
"symfony/console": "^4.0",
"symfony/asset": "^5.0",
"symfony/console": "^5.0",
"symfony/flex": "^1.14",
"symfony/form": "*",
"symfony/framework-bundle": "^4.3",
"symfony/form": "^5.0",
"symfony/framework-bundle": "^5.0",
"symfony/polyfill-uuid": "*",
"symfony/security-csrf": "*",
"symfony/runtime": "^5.0",
"symfony/security-csrf": "^5.0",
"symfony/serializer": "^5.2",
"symfony/translation": "*",
"symfony/webpack-encore-bundle": "dev-main",
"symfony/yaml": "*"
"symfony/translation": "^5.0",
"symfony/webpack-encore-bundle": "^1.12",
"symfony/yaml": "^5.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.13",
"roave/security-advisories": "dev-latest",
"friendsofphp/php-cs-fixer": "^3.0",
"fzaninotto/faker": "^1.8",
"liip/functional-test-bundle": "~2.0@alpha",
"phpunit/phpunit": "9.5.x-dev",
"symfony/browser-kit": "*",
"symfony/css-selector": "*",
"symfony/debug-bundle": "*",
"symfony/dotenv": "*",
"liip/functional-test-bundle": "^4.4.3",
"phpunit/phpunit": "^9.5",
"rector/rector": "^0.11.59",
"symfony/browser-kit": "^5.0",
"symfony/css-selector": "^5.0",
"symfony/debug-bundle": "^5.0",
"symfony/dotenv": "^5.0",
"symfony/maker-bundle": "^1.7",
"symfony/phpunit-bridge": "*",
"symfony/stopwatch": "4.4.x-dev",
"symfony/phpunit-bridge": "^5.0",
"symfony/stopwatch": "^5.0",
"symfony/validator": "^5.0",
"symfony/var-dumper": "*",
"symfony/web-profiler-bundle": "4.4.x-dev",
"symfony/web-server-bundle": "*"
"symfony/var-dumper": "^5.0",
"symfony/web-profiler-bundle": "^5.0"
},
"config": {
"preferred-install": {
......@@ -80,9 +83,10 @@
}
},
"replace": {
"paragonie/random_compat": "*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php74": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
......@@ -90,7 +94,6 @@
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
......@@ -105,8 +108,7 @@
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.4.*"
"allow-contrib": true
}
}
}
This diff is collapsed.
......@@ -8,7 +8,6 @@ return [
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Liip\FunctionalTestBundle\LiipFunctionalTestBundle::class => ['dev' => true, 'test' => true],
Oneup\FlysystemBundle\OneupFlysystemBundle::class => ['all' => true],
Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true],
Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true],
Subugoe\EMOBundle\SubugoeEMOBundle::class => ['all' => true],
FOS\RestBundle\FOSRestBundle::class => ['all' => true],
......
fos_rest:
body_listener: true
cache_dir: "%kernel.root_dir%/../var/cache/dev/fos_rest/"
cache_dir: "%kernel.project_dir%/var/cache/dev/fos_rest/"
format_listener:
rules:
- { path: '^/tido', priorities: ['json'], fallback_format: json, prefer_extension: false }
......
subugoe_emo:
resource: "@SubugoeEMOBundle/Resources/config/routing.yml"
resource: "./../vendor/subugoe/emo-bundle/config/routing.yml"
prefix: /tido
#index:
......
_errors:
resource: '@TwigBundle/Resources/config/routing/errors.xml'
prefix: /_error
......@@ -87,8 +87,8 @@ services:
App\Service\FileService:
arguments: ["@cache_filesystem", "@source_filesystem", "@pdf_filesystem", "@image_filesystem", "@tei_filesystem"]
App\Controller\Tei2SolrController:
App\Import\TEIToSolrImport:
calls:
- method: 'setConfigs'
arguments:
- '%tei_dir%'
\ No newline at end of file
- '%tei_dir%'
This diff is collapsed.
......@@ -18,7 +18,7 @@
"build": "encore production"
},
"dependencies": {
"@subugoe/tido": "^1.20.1",
"@subugoe/tido": "^1.22.0",
"jquery": "^3.6.0"
},
"resolutions": {
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.5/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
>
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="false" colors="true"
bootstrap="vendor/autoload.php">
<coverage>
<include>
<directory>./src/</directory>
</include>
</coverage>
<php>
<ini name="error_reporting" value="-1" />
<env name="KERNEL_CLASS" value="App\Kernel" />
<env name="APP_ENV" value="test" />
<env name="APP_DEBUG" value="1" />
<env name="APP_SECRET" value="s$cretf0rt3st" />
<env name="SHELL_VERBOSITY" value="-1" />
<ini name="error_reporting" value="-1"/>
<env name="KERNEL_CLASS" value="App\Kernel"/>
<env name="APP_ENV" value="test"/>
<env name="APP_DEBUG" value="1"/>
<env name="APP_SECRET" value="s$cretf0rt3st"/>
<env name="SHELL_VERBOSITY" value="-1"/>
<!-- define your env variables for the test env here -->
<!-- ###+ nelmio/cors-bundle ### -->
<env name="CORS_ALLOW_ORIGIN" value="'^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'"/>
<!-- ###- nelmio/cors-bundle ### -->
<!-- ###+ symfony/framework-bundle ### -->
<env name="APP_ENV" value="dev"/>
<env name="APP_SECRET" value="c4e4b1e9c09c8d0125f2e226c6245973"/>
......@@ -26,26 +26,7 @@
<!-- env name="TRUSTED_HOSTS" value="'^(localhost|example\.com)$'" -->
<!-- ###- symfony/framework-bundle ### -->
</php>
<testsuites>
<testsuite name="Functional Test Suite">
<directory>tests/Functional</directory>
</testsuite>
</testsuites>
<testsuites>
<testsuite name="Unit Test Suite">
<directory>tests/Unit</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
</phpunit>
<?php
use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\HttpFoundation\Request;
require __DIR__.'/../vendor/autoload.php';
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
// The check is to ensure we don't use .env in production
if (!isset($_SERVER['APP_ENV'])) {
if (!class_exists(Dotenv::class)) {
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
}
(new Dotenv())->load(__DIR__.'/../.env');
}
$env = $_SERVER['APP_ENV'] ?? 'dev';
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env));
if ($debug) {
umask(0000);
Debug::enable();
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts(explode(',', $trustedHosts));
}
$kernel = new Kernel($env, $debug);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
return function (array $context) {
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};
<?php
declare(strict_types=1);
use Rector\Core\Configuration\Option;
use Rector\Set\ValueObject\SetList;
use Rector\Symfony\Set\SymfonySetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::IMPORT_SHORT_CLASSES, false);
$containerConfigurator->import(SetList::PHP_74);
$containerConfigurator->import(SymfonySetList::SYMFONY_52);
$containerConfigurator->import(SymfonySetList::SYMFONY_CODE_QUALITY);
$parameters->set(Option::PATHS, [
'src/',
'tests/',
]);
$parameters->set(Option::SKIP, [
'*/src/Migrations/*',
'*/vendor/*',
'*/var/*',
'*/public/*',
'*/config/*',
]);
};
......@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Command;
use App\Controller\Tei2SolrController;
use App\Import\ImporterInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
......@@ -12,13 +12,14 @@ use Symfony\Component\HttpKernel\KernelInterface;
class SolrIndexing extends Command
{
private Tei2SolrController $tei2SolrController;
protected $projectDir;
protected static $defaultName = 'app:start_indexing';
protected string $projectDir;
private ImporterInterface $teiToSolrImport;
public function __construct(Tei2SolrController $tei2SolrController, KernelInterface $kernel)
public function __construct(ImporterInterface $teiToSolrImport, KernelInterface $kernel)
{
parent::__construct();
$this->tei2SolrController = $tei2SolrController;
$this->teiToSolrImport = $teiToSolrImport;
$this->projectDir = $kernel->getProjectDir();
}
......@@ -27,9 +28,7 @@ class SolrIndexing extends Command
*/
protected function configure()
{
$this
->setName('app:start_indexing')
->setDescription('Process mysql data to elastic search data fot importing into elastic search.');
$this->setDescription('Process mysql data to solr data for importing into solr.');
}
/**
......@@ -39,12 +38,12 @@ class SolrIndexing extends Command
{
$output->writeln('Start solr indexing.');
$this->tei2SolrController->fetchTeis();
$this->tei2SolrController->deleteSolrIndex();
$this->tei2SolrController->tei2solr();
$this->teiToSolrImport->fetchTeis();
$this->teiToSolrImport->deleteSolrIndex();
$this->teiToSolrImport->tei2solr();
$time = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
$time = $time/60;
$time /= 60;
$output->writeln('Indexing process completed in '.$time.' minutes.');
return 1;
......
......@@ -2,6 +2,7 @@
namespace App\Controller;
use Parsedown;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
......@@ -10,21 +11,21 @@ use Symfony\Component\Routing\Annotation\Route;
class ContentController extends AbstractController
{
/**
* @Route("/", name="_content")
* @Route("kontakt", name="_contact"),
*/
public function homepage(string $id = 'homepage'): Response
public function contact(): Response
{
$parsedown = new \Parsedown();
$parsedown = new Parsedown();
$file = sprintf('%s/../../assets/content/%s.md', __DIR__, $id);
$file = sprintf('%s/../../assets/content/%s.md', __DIR__, 'contact');
if (file_exists($file)) {
$content = file_get_contents($file);
} else {
throw new NotFoundHttpException(sprintf('Page %s not found.', $id));
throw new NotFoundHttpException(sprintf('Page %s not found.', 'contact'));
}
return $this->render('content/homepage.html.twig',
return $this->render('content/contact.html.twig',
[
'content' => $parsedown->text($content),
]
......@@ -32,11 +33,11 @@ class ContentController extends AbstractController
}
/**
* @Route("leittexte", name="_monograph")
* @Route("/", name="_content")
*/
public function monograph(string $id = 'monograph'): Response
public function homepage(string $id = 'homepage'): Response
{
$parsedown = new \Parsedown();
$parsedown = new Parsedown();
$file = sprintf('%s/../../assets/content/%s.md', __DIR__, $id);
......@@ -46,7 +47,7 @@ class ContentController extends AbstractController
throw new NotFoundHttpException(sprintf('Page %s not found.', $id));
}
return $this->render('content/monograph.html.twig',
return $this->render('content/homepage.html.twig',
[
'content' => $parsedown->text($content),
]
......@@ -58,7 +59,7 @@ class ContentController extends AbstractController
*/
public function imprint(): Response
{
$parsedown = new \Parsedown();
$parsedown = new Parsedown();
$file = sprintf('%s/../../assets/content/%s.md', __DIR__, 'imprint');
......@@ -76,21 +77,21 @@ class ContentController extends AbstractController
}
/**
* @Route("kontakt", name="_contact"),
* @Route("leittexte", name="_monograph")
*/
public function contact(): Response
public function monograph(string $id = 'monograph'): Response
{
$parsedown = new \Parsedown();
$parsedown = new Parsedown();
$file = sprintf('%s/../../assets/content/%s.md', __DIR__, 'contact');
$file = sprintf('%s/../../assets/content/%s.md', __DIR__, $id);
if (file_exists($file)) {
$content = file_get_contents($file);
} else {
throw new NotFoundHttpException(sprintf('Page %s not found.', 'contact'));
throw new NotFoundHttpException(sprintf('Page %s not found.', $id));
}
return $this->render('content/contact.html.twig',
return $this->render('content/monograph.html.twig',
[
'content' => $parsedown->text($content),
]
......@@ -102,7 +103,7 @@ class ContentController extends AbstractController
*/
public function privacy(): Response
{
$parsedown = new \Parsedown();
$parsedown = new Parsedown();
$file = sprintf('%s/../../assets/content/%s.md', __DIR__, 'privacy');
......
......@@ -3,35 +3,28 @@
namespace App\Controller;
use App\Service\SearchServiceInterface;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
class DocumentFromEntitiesController extends Controller
class DocumentFromEntitiesController extends AbstractController
{
private $client;
private $request;
private SearchServiceInterface $client;
public function __construct(SearchServiceInterface $client)
{
$this->client = $client;
}
/**
* @Route("/entities_from_doc", name="_entities_from_doc")
*/
public function entities_from_doc(Request $request)
{
return $this->render('partials/entities_from_doc.html.twig',
[
'response' => $this->client->getDocumentFromEntities($request->get('q'))
'response' => $this->client->getDocumentFromEntities($request->get('q')),
]
);
}
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment