Compare commits
20
Commits
7839b97e63
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8be8b5042 | ||
|
|
85b1bd1578 | ||
|
|
f4f0857870 | ||
|
|
2771be2d67 | ||
|
|
11f46d0acf | ||
|
|
4279669aa3 | ||
|
|
aa3d81102e | ||
|
|
739a4c49f7 | ||
|
|
88e0488b49 | ||
|
|
f57671b4d4 | ||
|
|
313fb151bc | ||
|
|
6350742084 | ||
|
|
ef7d81fe99 | ||
|
|
0477589a7a | ||
|
|
38962845d3 | ||
|
|
c7f43ad02c | ||
|
|
1111c180f8 | ||
|
|
69f9b42757 | ||
|
|
5bb4b6254a | ||
|
|
32b70f9b70 |
No files matched your search
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
## Description: Export the TYPO3 sites as static document roots (no PHP)
|
||||
## Usage: static-export [--site <identifier>] [--url <ddev url>] [--no-follow] [--out <dir>] [--workers <n>] [--hybrid --typo3-current <path> [--live-ajax]]
|
||||
## Example: "ddev static-export --site ep-reisen"
|
||||
set -euo pipefail
|
||||
|
||||
exec python3 -I "${DDEV_APPROOT}/.ddev/static-export/export.py" "$@"
|
||||
+10
-13
@@ -1,26 +1,23 @@
|
||||
name: ep-reisen
|
||||
name: ep-reisen-10
|
||||
type: typo3
|
||||
docroot: public
|
||||
php_version: "7.4"
|
||||
webserver_type: nginx-fpm
|
||||
xdebug_enabled: false
|
||||
additional_hostnames:
|
||||
- ep-events
|
||||
- ski-boarderweek
|
||||
- snowzone
|
||||
- unichamp
|
||||
- ski-wochenenden
|
||||
- schnee-event
|
||||
- semesterende
|
||||
- ep-events-10
|
||||
- ski-boarderweek-10
|
||||
- snowzone-10
|
||||
- unichamp-10
|
||||
- ski-wochenenden-10
|
||||
- schnee-event-10
|
||||
- semesterende-10
|
||||
- alvac-10
|
||||
- cllt-10
|
||||
additional_fqdns: []
|
||||
database:
|
||||
type: mariadb
|
||||
version: "11.4"
|
||||
hooks:
|
||||
post-start:
|
||||
- exec: .ddev/claude-code/install.sh
|
||||
- exec: .ddev/codex-cli/install.sh
|
||||
webimage_extra_packages: [ripgrep, bubblewrap, socat]
|
||||
use_dns_when_possible: true
|
||||
timezone: Europe/Berlin
|
||||
composer_version: "2"
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
"""Fetch every exported page of a site live, then check every referenced asset/link on the site, its CDN and ajax files."""
|
||||
import os, re, sys, html, urllib.parse, urllib.request, urllib.error, concurrent.futures, collections
|
||||
root, prod = sys.argv[1], sys.argv[2].rstrip('/')
|
||||
host = urllib.parse.urlsplit(prod).netloc
|
||||
class NoRedir(urllib.request.HTTPRedirectHandler):
|
||||
def redirect_request(self, *a): return None
|
||||
op = urllib.request.build_opener(NoRedir)
|
||||
def get(url, body=False):
|
||||
try:
|
||||
with op.open(urllib.request.Request(url, headers={'User-Agent': 'ep-static-check', 'Accept': 'image/webp,*/*'}), timeout=60) as r:
|
||||
return r.status, (r.read().decode('utf-8', 'replace') if body else '')
|
||||
except urllib.error.HTTPError as e: return e.code, ''
|
||||
except Exception as e: return str(e)[:60], ''
|
||||
pages = []
|
||||
for d, _, files in os.walk(root):
|
||||
if '/_ajax' in d: continue
|
||||
for f in files:
|
||||
if f == 'index.html': pages.append('/' + os.path.relpath(d, root).replace('.', '', 1).lstrip('/') + ('/' if d != root else ''))
|
||||
pages = sorted(set(p.replace('//', '/') for p in pages))
|
||||
with concurrent.futures.ThreadPoolExecutor(12) as ex:
|
||||
res = dict(zip(pages, ex.map(lambda p: get(prod + p, True), pages)))
|
||||
refs = set()
|
||||
for p, (st, body) in res.items():
|
||||
for v in re.findall(r'(?:href|src|srcset|hx-get|data-[\w-]+)="([^"]*)"', body):
|
||||
for c in html.unescape(v).split(','):
|
||||
c = c.strip().split(' ')[0]; u = urllib.parse.urlsplit(c)
|
||||
if u.netloc in ('', host, 'cdn.ep-reisen.de') and u.path.startswith('/') and not u.path.startswith('//'):
|
||||
base = 'https://' + (u.netloc or host)
|
||||
refs.add(base + u.path + ('?' + u.query if u.path.startswith('/_ajax/') else ''))
|
||||
with concurrent.futures.ThreadPoolExecutor(16) as ex:
|
||||
rr = dict(zip(sorted(refs), ex.map(lambda u: get(u)[0], sorted(refs))))
|
||||
print('pages: %d → %s' % (len(res), dict(collections.Counter(st for st, _ in res.values()))))
|
||||
by = collections.Counter((urllib.parse.urlsplit(u).netloc, s if s in (200, 404) else ('3xx' if isinstance(s, int) and 300 <= s < 400 else s)) for u, s in rr.items())
|
||||
print('references by host/status:'); [print(' %-26s %-5s %d' % (h, s, n)) for (h, s), n in sorted(by.items(), key=str)]
|
||||
bad = [(s, u) for u, s in rr.items() if not (isinstance(s, int) and (s == 200 or 300 <= s < 400))]
|
||||
for s, u in sorted(bad, key=str)[:20]: print(' FAIL %s %s' % (s, u))
|
||||
@@ -0,0 +1,30 @@
|
||||
"""Request every exported page and every local URL referenced in pages/fragments via a local Apache."""
|
||||
import os, re, sys, html, urllib.parse, urllib.request, urllib.error, concurrent.futures
|
||||
root, host, base = sys.argv[1], sys.argv[2], 'http://127.0.0.1:8099'
|
||||
class NoRedir(urllib.request.HTTPRedirectHandler):
|
||||
def redirect_request(self, *a): return None
|
||||
op = urllib.request.build_opener(NoRedir)
|
||||
def get(path):
|
||||
try:
|
||||
with op.open(urllib.request.Request(base + path, headers={'Host': host}), timeout=30) as r: return r.status
|
||||
except urllib.error.HTTPError as e: return e.code
|
||||
except Exception as e: return str(e)
|
||||
pages, refs = [], set()
|
||||
for d, _, files in os.walk(root):
|
||||
for f in files:
|
||||
if not f.endswith('.html'): continue
|
||||
rel = '/' + os.path.relpath(os.path.join(d, f), root)
|
||||
if not rel.startswith('/_ajax/') and rel != '/404.html': pages.append(rel[:-10] if rel.endswith('/index.html') else rel)
|
||||
t = open(os.path.join(d, f), encoding='utf-8').read()
|
||||
for v in re.findall(r'(?:href|src|srcset|hx-get|data-[\w-]+)="([^"]*)"', t):
|
||||
for c in html.unescape(v).split(','):
|
||||
c = c.strip().split(' ')[0]; p = urllib.parse.urlsplit(c)
|
||||
if p.netloc in ('', host, 'cdn.ep-reisen.de') and p.path.startswith('/') and not p.path.startswith('//'):
|
||||
refs.add(p.path + ('?' + p.query if p.path.startswith('/_ajax/') else ''))
|
||||
with concurrent.futures.ThreadPoolExecutor(16) as ex:
|
||||
pr = dict(zip(pages, ex.map(get, pages))); rr = dict(zip(sorted(refs), ex.map(get, sorted(refs))))
|
||||
bad_p = {k: v for k, v in pr.items() if v != 200}
|
||||
bad_r = {k: v for k, v in rr.items() if v not in (200, 301, 302, 303, 307, 308)}
|
||||
print('pages: %d, not 200: %d' % (len(pr), len(bad_p)))
|
||||
print('referenced local URLs: %d (ajax: %d), failing: %d' % (len(rr), sum(1 for k in rr if k.startswith('/_ajax/')), len(bad_r)))
|
||||
for k, v in list(bad_p.items())[:10] + list(bad_r.items())[:25]: print(' %s %s' % (v, k))
|
||||
@@ -0,0 +1,41 @@
|
||||
"""Compare /api/hotel + /api/product of a static export (Apache on 127.0.0.1:8099) with live local TYPO3.
|
||||
|
||||
Usage: compare_api.py <export dir>. Case list: every hotel/product code, sampled pairs, random
|
||||
unlinked pairs, empty/missing params, missing/wrong/query-string key, direct snapshot access.
|
||||
"""
|
||||
import sys, os, random, importlib.util, urllib.request, urllib.error, concurrent.futures
|
||||
spec = importlib.util.spec_from_file_location('export', '/var/www/html/.ddev/static-export/export.py'); m = importlib.util.module_from_spec(spec); spec.loader.exec_module(m)
|
||||
sites = m.load_sites(); exp = m.Exporter('ep-reisen', sites['ep-reisen'], sites, '/nonexistent', follow=False, workers=1); key = m.cms_api_key()
|
||||
class N(urllib.request.HTTPRedirectHandler):
|
||||
def redirect_request(self, *a): return None
|
||||
op = urllib.request.build_opener(N)
|
||||
def call(url, headers):
|
||||
try:
|
||||
with op.open(urllib.request.Request(url, headers=headers), timeout=60) as r: return r.status, r.read().decode(), r.headers.get('Content-Type')
|
||||
except urllib.error.HTTPError as e: return e.code, e.read().decode(), e.headers.get('Content-Type')
|
||||
typo3 = lambda q, h: call('http://127.0.0.1/' + q, dict(h, **{'Host': 'ep-reisen.ddev.site', 'X-Forwarded-Proto': 'https'}))
|
||||
static = lambda q, h: call('http://127.0.0.1:8099/' + q, dict(h, **{'Host': 'www.ep-reisen.de'}))
|
||||
root = sys.argv[1]; K = {'X-Api-Key': key}
|
||||
hotels = sorted(f[:-5] for f in os.listdir(root + '/_api/hotel')); products = sorted(f[:-5] for f in os.listdir(root + '/_api/product') if f.endswith('.json'))
|
||||
pairs = sorted((p, f[:-5]) for p in products if os.path.isdir(root + '/_api/product/' + p) for f in os.listdir(root + '/_api/product/' + p) if not f.startswith('_'))
|
||||
random.seed(1)
|
||||
cases = [('api/hotel?hotel=' + c, K) for c in hotels] + [('api/product?product=' + c, K) for c in products]
|
||||
cases += [('api/product?product=%s&hotel=%s' % pc, K) for pc in random.sample(pairs, 150)]
|
||||
cases += [('api/product?hotel=%s&product=%s' % (h, p), K) for p, h in random.sample(pairs, 10)]
|
||||
cases += [('api/product?product=%s&hotel=%s' % (p, random.choice(hotels)), K) for p in random.sample(products, 60)]
|
||||
cases += [(q, K) for q in ['api/hotel?hotel=_empty', 'api/product?product=_empty', 'api/hotel?hotel=%40empty', 'api/product?product=3VIIN&hotel=@empty', 'api/product?product=3VIIN&hotel=PMVSW%26A', 'api/hotel?hotel=a%20b', 'api/product?product=%40empty&hotel=', 'api/hotel', 'api/product', 'api/hotel?hotel=', 'api/product?product=', 'api/product?product=&hotel=X',
|
||||
'api/hotel?hotel=NOPE', 'api/product?product=NOPE', 'api/product?product=NOPE&hotel=' + hotels[0],
|
||||
'api/product?product=%s&hotel=' % products[0], 'api/product?product=%s&hotel=NOPE' % products[0]]]
|
||||
cases += [('api/hotel?hotel=' + hotels[0], {}), ('api/hotel?hotel=' + hotels[0], {'X-Api-Key': 'wrong'}),
|
||||
('api/hotel?hotel=%s&key=%s' % (hotels[0], key), {}), ('api/product?key=%s&product=%s' % (key, products[0]), {}),
|
||||
('api/product?product=%s&key=wrong' % products[0], {})]
|
||||
def compare(c):
|
||||
q, h = c; a, b = typo3(q, h), static(q, h)
|
||||
return q, (a[0], exp.to_prod(a[1]), a[2]), b
|
||||
bad = []
|
||||
with concurrent.futures.ThreadPoolExecutor(8) as ex:
|
||||
for q, a, b in ex.map(compare, cases):
|
||||
if a != b: bad.append((q, a, b))
|
||||
print('cases: %d, identical: %d, different: %d' % (len(cases), len(cases) - len(bad), len(bad)))
|
||||
for q, a, b in bad[:6]: print(' DIFF', q, '| typo3', a[0], a[2], '| static', b[0], b[2], repr(b[1][:90]))
|
||||
for q in ['_api/hotel/%s.json' % hotels[0], '_api/pair.shtml', '_api/product-part/%s.part' % products[0]]: print(' direct', q, static(q, {})[0])
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* Import the same buspro data twice (XML files, MyE&P API) into the local DB and keep each
|
||||
* result as cmp_<source>_<table>. The live tables are backed up first and restored at the end.
|
||||
*/
|
||||
putenv('TYPO3_PATH_ROOT=/var/www/html/public');
|
||||
putenv('TYPO3_PATH_APP=/var/www/html');
|
||||
$classLoader = require '/var/www/html/vendor/autoload.php';
|
||||
\TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(0, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_CLI);
|
||||
\TYPO3\CMS\Core\Core\Bootstrap::init($classLoader);
|
||||
|
||||
use EP\EpProducts\Service\ApiImportSource;
|
||||
use EP\EpProducts\Service\DateImportService;
|
||||
use EP\EpProducts\Service\XmlProductReader;
|
||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
$db = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionByName('Default');
|
||||
$tables = ['date' => 'tx_epproducts_domain_model_date', 'room' => 'tx_epproducts_domain_model_room', 'product' => 'tx_epproducts_domain_model_product'];
|
||||
|
||||
$snapshot = function (string $prefix) use ($db, $tables) {
|
||||
foreach ($tables as $short => $table) {
|
||||
$db->executeStatement("DROP TABLE IF EXISTS cmp_{$prefix}_{$short}");
|
||||
$db->executeStatement("CREATE TABLE cmp_{$prefix}_{$short} AS SELECT * FROM {$table}");
|
||||
}
|
||||
};
|
||||
$restore = function () use ($db, $tables) {
|
||||
foreach ($tables as $short => $table) {
|
||||
$db->executeStatement("DELETE FROM {$table}");
|
||||
$db->executeStatement("INSERT INTO {$table} SELECT * FROM cmp_bak_{$short}");
|
||||
}
|
||||
};
|
||||
|
||||
$snapshot('bak');
|
||||
try {
|
||||
$reader = new XmlProductReader(GeneralUtility::getFileAbsFileName('fileadmin/xmlexport'));
|
||||
$rows = iterator_to_array($reader, false);
|
||||
$count = GeneralUtility::makeInstance(DateImportService::class)->import($rows);
|
||||
printf("xml: %d rows, %d dates imported, source generated at %s\n", count($rows), $count,
|
||||
$reader->getSourceGeneratedAt() ? $reader->getSourceGeneratedAt()->format('c') : '?');
|
||||
$snapshot('xml');
|
||||
$restore();
|
||||
|
||||
// Bypass the "already imported" baseline: walk the export pages directly
|
||||
$api = GeneralUtility::makeInstance(ApiImportSource::class);
|
||||
$walk = new \ReflectionMethod($api, 'walkPages');
|
||||
$walk->setAccessible(true);
|
||||
$export = $walk->invoke($api);
|
||||
if (!is_array($export)) {
|
||||
throw new \RuntimeException('MyE&P export walk returned ' . var_export($export, true));
|
||||
}
|
||||
[$apiRows, $generatedAt] = $export;
|
||||
$count = GeneralUtility::makeInstance(DateImportService::class)->import($apiRows);
|
||||
printf("api: %d rows, %d dates imported, source generated at %s\n", count($apiRows), $count,
|
||||
$generatedAt ? $generatedAt->format('c') : '?');
|
||||
$snapshot('api');
|
||||
|
||||
// Raw rows of both sources, for a field-by-field comparison independent of the import
|
||||
file_put_contents('/var/www/html/var/rows_xml.json', json_encode($rows));
|
||||
file_put_contents('/var/www/html/var/rows_api.json', json_encode($apiRows));
|
||||
} finally {
|
||||
$restore();
|
||||
echo "live tables restored\n";
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -21,3 +21,4 @@ public/typo3temp
|
||||
public/uploads
|
||||
var
|
||||
http-client.private.env.json
|
||||
.ddev/static-export/__pycache__/export.cpython-313.pyc
|
||||
@@ -1,12 +1,42 @@
|
||||
# Backchannel endpoints MyE&P reads hotel and product data from. Same environment files and key
|
||||
# as content-feed.http: pick "local" and put cmsApiKey in http-client.private.env.json.
|
||||
|
||||
### GET product data for myep
|
||||
GET https://ep-reisen.ddev.site/api/product
|
||||
?product=SSTMR
|
||||
&hotel=SSTGR
|
||||
&key=abcabc123
|
||||
GET {{host}}/api/product?product=3VIIN&hotel=VLTS
|
||||
X-Api-Key: {{cmsApiKey}}
|
||||
|
||||
> {%
|
||||
client.test("200 with key", function () {
|
||||
client.assert(response.status === 200, "expected 200, got " + response.status);
|
||||
});
|
||||
%}
|
||||
|
||||
### GET hotel data for myep
|
||||
GET https://ep-reisen.ddev.site/api/hotel
|
||||
?hotel=DPWGRP
|
||||
&key=abcabc123
|
||||
GET {{host}}/api/hotel?hotel=DPWGRP
|
||||
X-Api-Key: {{cmsApiKey}}
|
||||
|
||||
> {%
|
||||
client.test("200 with key", function () {
|
||||
client.assert(response.status === 200, "expected 200, got " + response.status);
|
||||
});
|
||||
%}
|
||||
|
||||
### Transition form: key as query parameter, as MyE&P sends it today (still accepted)
|
||||
GET {{host}}/api/hotel?hotel=DPWGRP&key={{cmsApiKey}}
|
||||
|
||||
> {%
|
||||
client.test("200 with query key", function () {
|
||||
client.assert(response.status === 200, "expected 200, got " + response.status);
|
||||
});
|
||||
%}
|
||||
|
||||
### Any other value is refused now - this used to pass
|
||||
GET {{host}}/api/hotel?hotel=DPWGRP&key=AbcAbc123
|
||||
|
||||
> {%
|
||||
client.test("403 with the old dummy key", function () {
|
||||
client.assert(response.status === 403, "expected 403, got " + response.status);
|
||||
});
|
||||
%}
|
||||
|
||||
###
|
||||
@@ -0,0 +1,22 @@
|
||||
base: 'https://www.alpinevacation.ch'
|
||||
baseVariants:
|
||||
-
|
||||
base: 'https://alvac.ddev.site'
|
||||
condition: 'applicationContext == "Development"'
|
||||
disableStaticFileCache: false
|
||||
languages:
|
||||
-
|
||||
title: Deutsch
|
||||
enabled: true
|
||||
base: /
|
||||
typo3Language: de
|
||||
locale: de_DE
|
||||
iso-639-1: de
|
||||
websiteTitle: ''
|
||||
navigationTitle: ''
|
||||
hreflang: ''
|
||||
direction: ''
|
||||
flag: de
|
||||
languageId: 0
|
||||
rootPageId: 2458
|
||||
websiteTitle: ''
|
||||
@@ -0,0 +1,22 @@
|
||||
base: 'https://www.cllt-touristik.at'
|
||||
baseVariants:
|
||||
-
|
||||
base: 'https://cllt.ddev.site'
|
||||
condition: 'applicationContext == "Development"'
|
||||
disableStaticFileCache: false
|
||||
languages:
|
||||
-
|
||||
title: Deutsch
|
||||
enabled: true
|
||||
base: /
|
||||
typo3Language: de
|
||||
locale: de_DE
|
||||
iso-639-1: de
|
||||
websiteTitle: ''
|
||||
navigationTitle: ''
|
||||
hreflang: ''
|
||||
direction: ''
|
||||
flag: de
|
||||
languageId: 0
|
||||
rootPageId: 2457
|
||||
websiteTitle: ''
|
||||
@@ -1,4 +1,4 @@
|
||||
base: 'https://www.unichamp.de'
|
||||
base: 'https://snowbreak.ep-reisen.de'
|
||||
baseVariants:
|
||||
-
|
||||
base: 'https://unichamp.ddev.site'
|
||||
|
||||
+4
-1
@@ -70,7 +70,10 @@ host('prod')
|
||||
->set('writable_mode', 'chmod')
|
||||
->set('rsync_src', __DIR__)
|
||||
->set('rsync', $rsyncOptions)
|
||||
->set('cachetool_args', '--web=SymfonyHttpClient --web-path={{current_path}}/{{typo3_webroot}}/ --web-url=https://www.ep-reisen.de')
|
||||
// The temp script goes into the shared typo3temp, which resolves to the same directory from every
|
||||
// release: PHP workers with a stale realpath cache still map "current" to the previous release and
|
||||
// would 404 on a script placed inside the new one.
|
||||
->set('cachetool_args', '--web=SymfonyHttpClient --web-path={{deploy_path}}/shared/{{typo3_webroot}}/typo3temp/ --web-url=https://www.ep-reisen.de/typo3temp')
|
||||
;
|
||||
|
||||
task('deploy', [
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"local": {
|
||||
"host": "https://ep-reisen.ddev.site"
|
||||
},
|
||||
"staging": {
|
||||
"host": "https://staging.ep-reisen.de"
|
||||
"prod": {
|
||||
"host": "https://www.ep-reisen.de"
|
||||
}
|
||||
}
|
||||
@@ -285,9 +285,6 @@ AddDefaultCharset utf-8
|
||||
<FilesMatch "\.(eot|otf|tt[cf]|woff2?)$">
|
||||
Header set Access-Control-Allow-Origin "*"
|
||||
</FilesMatch>
|
||||
<FilesMatch "\.(png|gif|jpe?g)$">
|
||||
Header append Vary Accept
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
|
||||
### End: Cross Origin ###
|
||||
@@ -395,12 +392,6 @@ AddDefaultCharset utf-8
|
||||
# NOTE: Add your additional local storages here
|
||||
RewriteRule ^(?:typo3/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
|
||||
|
||||
RewriteCond %{HTTP_ACCEPT} image/webp
|
||||
RewriteCond %{REQUEST_FILENAME} (.*)\.(png|gif|jpe?g)$
|
||||
RewriteCond %{REQUEST_FILENAME}\.webp -f
|
||||
RewriteRule ^ %{REQUEST_FILENAME}\.webp [L,T=image/webp]
|
||||
|
||||
|
||||
### Begin: StaticFileCache (preparation) ####
|
||||
|
||||
# Document root configuration
|
||||
|
||||
@@ -90,6 +90,14 @@ $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['rootline']
|
||||
// by the CDN, so stop generating them. mod_deflate still compresses direct origin hits.
|
||||
$GLOBALS['TYPO3_CONF_VARS']['FE']['compressionLevel'] = 0;
|
||||
|
||||
// utf8 in MySQL/MariaDB is utf8mb3 (max. 3 bytes) and rejects 4-byte characters like emoji.
|
||||
// Set here because LocalConfiguration.php is a Deployer shared file and not deployed from the repo.
|
||||
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['charset'] = 'utf8mb4';
|
||||
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['tableoptions'] = [
|
||||
'charset' => 'utf8mb4',
|
||||
'collate' => 'utf8mb4_unicode_ci',
|
||||
];
|
||||
|
||||
// suppress php deprecation warnings flooding typo3 logs
|
||||
$GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandlerErrors'] =
|
||||
$GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandlerErrors'] & ~E_DEPRECATED & ~E_USER_DEPRECATED;
|
||||
|
||||
@@ -59,6 +59,7 @@ call_user_func(function() {
|
||||
'label' => 'Reiseart',
|
||||
'config' => [
|
||||
'type' => 'select',
|
||||
'default' => 0,
|
||||
'renderType' => 'selectSingle',
|
||||
'items' => [
|
||||
['Keine Zuordnung', 0],
|
||||
@@ -74,6 +75,7 @@ call_user_func(function() {
|
||||
'label' => 'Angebot/Beispielangebot',
|
||||
'config' => [
|
||||
'type' => 'select',
|
||||
'default' => 0,
|
||||
'renderType' => 'selectSingle',
|
||||
'items' => [
|
||||
['Keine Zuordnung', 0],
|
||||
|
||||
@@ -114,6 +114,11 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
||||
*/
|
||||
protected $skipassIncluded = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $groupTravel = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
@@ -421,6 +426,22 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
||||
$this->skipassIncluded = $skipassIncluded;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getGroupTravel()
|
||||
{
|
||||
return $this->groupTravel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $groupTravel
|
||||
*/
|
||||
public function setGroupTravel($groupTravel)
|
||||
{
|
||||
$this->groupTravel = $groupTravel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
@@ -33,6 +33,7 @@ class DateRepository extends AbstractRepository
|
||||
->where(
|
||||
$qb->expr()->eq('date.product', $qb->createNamedParameter($productUid, Connection::PARAM_INT)),
|
||||
$qb->expr()->eq('date.hotel', $qb->createNamedParameter($hotelUid, Connection::PARAM_INT)),
|
||||
$qb->expr()->eq('date.group_travel', $qb->createNamedParameter(0, Connection::PARAM_INT)),
|
||||
'date.date_start >= NOW()'
|
||||
)
|
||||
->orderBy('date.date_start', 'DESC')
|
||||
|
||||
@@ -210,6 +210,7 @@ class ProductRepository extends AbstractRepository
|
||||
'date.uid as dateUid', 'date.date_start as dateStart', 'date.date_end as dateEnd',
|
||||
'date.bus_pro_id as dateBusProId', 'date.hotel as hotelUid', 'date.hotel_bus_pro_id as hotelBusProId',
|
||||
'date.bus_included as dateBusIncluded', 'date.skipass_included as dateSkiPassIncluded',
|
||||
'date.group_travel as dateGroupTravel',
|
||||
'date.season as season', 'date.product_detail_page as productDetailPage',
|
||||
'room.uid as roomUid', 'room.bus_pro_id as roomBusProId', 'room.name as roomName',
|
||||
'room.price as roomPrice', 'date.discount as roomDiscount', 'date.bus_price as busPrice',
|
||||
@@ -273,6 +274,7 @@ class ProductRepository extends AbstractRepository
|
||||
'date.discount as dateDiscount', 'date.bus_price as busPrice', 'date.nights as dateNights',
|
||||
'date.bus_included as dateBusIncluded', 'date.services_included as dateServicesIncluded',
|
||||
'date.services_general as dateServicesGeneral', 'date.skipass_included as dateSkiPassIncluded',
|
||||
'date.group_travel as dateGroupTravel',
|
||||
'date.bus_pro_id as dateBusProId', 'date.hotel_bus_pro_id as hotelBusProId',
|
||||
'date.available as available', 'date.product_detail_page as productDetailPage',
|
||||
)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace EP\EpProducts\Middleware;
|
||||
|
||||
use EP\EpProducts\ContentFeed\ContentFeedApi;
|
||||
use EP\EpProducts\Http\ApiKeyAuthenticator;
|
||||
use EP\EpProducts\Service\MyEpImageService;
|
||||
use EP\EpProducts\Utility\HotelIconUtility;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
@@ -47,13 +48,19 @@ class ApiMiddleware implements MiddlewareInterface
|
||||
*/
|
||||
private $contentFeedApi;
|
||||
|
||||
/**
|
||||
* @var ApiKeyAuthenticator
|
||||
*/
|
||||
private $authenticator;
|
||||
|
||||
public function __construct(
|
||||
MyEpImageService $hotelImageService,
|
||||
MyEpImageService $productImageService,
|
||||
MyEpImageService $regionImageService,
|
||||
FileRepository $fileRepository,
|
||||
ImageService $imageService,
|
||||
ContentFeedApi $contentFeedApi
|
||||
ContentFeedApi $contentFeedApi,
|
||||
ApiKeyAuthenticator $authenticator
|
||||
) {
|
||||
$this->hotelImageService = $hotelImageService;
|
||||
$this->productImageService = $productImageService;
|
||||
@@ -61,6 +68,7 @@ class ApiMiddleware implements MiddlewareInterface
|
||||
$this->fileRepository = $fileRepository;
|
||||
$this->imageService = $imageService;
|
||||
$this->contentFeedApi = $contentFeedApi;
|
||||
$this->authenticator = $authenticator;
|
||||
}
|
||||
|
||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||
@@ -84,12 +92,8 @@ class ApiMiddleware implements MiddlewareInterface
|
||||
|
||||
private function handleHotelRequest(ServerRequestInterface $request): ResponseInterface
|
||||
{
|
||||
// This is currently fake, we only check for existence. Since we are communicating
|
||||
// on the backchannel only it's not much of a problem.
|
||||
$apiKey = $request->getQueryParams()['key'] ?? null;
|
||||
|
||||
if (null === $apiKey) {
|
||||
return new JsonResponse(['message' => 'No api key provided'], 403);
|
||||
if (!$this->authenticator->isAuthorized($request)) {
|
||||
return new JsonResponse(['message' => 'Invalid or missing api key'], 403);
|
||||
}
|
||||
|
||||
$hotelCode = $request->getQueryParams()['hotel'] ?? null;
|
||||
@@ -109,12 +113,8 @@ class ApiMiddleware implements MiddlewareInterface
|
||||
|
||||
private function handleProductRequest(ServerRequestInterface $request): ResponseInterface
|
||||
{
|
||||
// This is currently fake, we only check for existence. Since we are communicating
|
||||
// on the backchannel only it's not much of a problem.
|
||||
$apiKey = $request->getQueryParams()['key'] ?? null;
|
||||
|
||||
if (null === $apiKey) {
|
||||
return new JsonResponse(['message' => 'No api key provided'], 403);
|
||||
if (!$this->authenticator->isAuthorized($request)) {
|
||||
return new JsonResponse(['message' => 'Invalid or missing api key'], 403);
|
||||
}
|
||||
|
||||
$productCode = $request->getQueryParams()['product'] ?? null;
|
||||
|
||||
@@ -64,6 +64,22 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
|
||||
const SELECTION_GROUP_EVENTS = 89;
|
||||
const SELECTION_GROUP_TRANSPORTATION = 90;
|
||||
|
||||
/**
|
||||
* Group 'Kunde' also carries trip types (Wochenreise, Midweekreise, ...), so
|
||||
* group travel keys on the selection, not on the group's presence. Every
|
||||
* date should carry either 'Gruppenkunde' or 'Endkunde'.
|
||||
*/
|
||||
const SELECTION_GROUP_CUSTOMER = 96;
|
||||
const SELECTION_CUSTOMER_GROUP = 1418;
|
||||
const SELECTION_CUSTOMER_END = 1419;
|
||||
|
||||
/**
|
||||
* Fallback for dates the office has not tagged with either selection: these
|
||||
* trip type markers in front of the travel code's trailing date mean
|
||||
* end-customer travel.
|
||||
*/
|
||||
const END_CUSTOMER_CODE_PATTERN = '/(?:MP|WE|KT|PM|MW|FA)\d{6}$/';
|
||||
|
||||
/**
|
||||
* 'Leistungen Personal' occurs in no export so far, so its id is unknown and
|
||||
* it is still matched by label. Register its id once the warning fires.
|
||||
@@ -286,6 +302,9 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
|
||||
{
|
||||
$dateCount = 0;
|
||||
|
||||
// Selection groups are date-level, so any hotel row tells.
|
||||
$this->checkCustomerSelection(reset($rows));
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$date = $this->createDateRecord($product, $row);
|
||||
|
||||
@@ -410,6 +429,8 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
|
||||
$skiPassIncluded = (int) (count($includedSkiPass) > 0);
|
||||
$date['skipass_included'] = $skiPassIncluded;
|
||||
|
||||
$date['group_travel'] = (int) $this->isGroupTravel($row);
|
||||
|
||||
$servicesTransportation = $this->parseService($row['transportServices']);
|
||||
$discount = $this->determineDiscount($servicesTransportation);
|
||||
$date['discount'] = $discount;
|
||||
@@ -771,6 +792,49 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'Gruppenkunde' and 'Endkunde' decide. A date carrying neither is judged by
|
||||
* its travel code.
|
||||
*
|
||||
* @param array $row
|
||||
* @return bool
|
||||
*/
|
||||
protected function isGroupTravel(array $row): bool
|
||||
{
|
||||
$customer = $this->parseSelectionGroup($row['selectionGroups'], static::SELECTION_GROUP_CUSTOMER);
|
||||
$isGroup = isset($customer[static::SELECTION_CUSTOMER_GROUP]);
|
||||
$isEnd = isset($customer[static::SELECTION_CUSTOMER_END]);
|
||||
if ($isGroup || $isEnd) {
|
||||
return $isGroup;
|
||||
}
|
||||
|
||||
return !preg_match(static::END_CUSTOMER_CODE_PATTERN, (string) $row['date']['code']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports dates whose customer selection is missing or contradictory, along
|
||||
* with what they import as.
|
||||
*
|
||||
* @param array $row
|
||||
*/
|
||||
protected function checkCustomerSelection(array $row): void
|
||||
{
|
||||
$customer = $this->parseSelectionGroup($row['selectionGroups'], static::SELECTION_GROUP_CUSTOMER);
|
||||
$isGroup = isset($customer[static::SELECTION_CUSTOMER_GROUP]);
|
||||
$isEnd = isset($customer[static::SELECTION_CUSTOMER_END]);
|
||||
if ($isGroup !== $isEnd) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->logger->warning(
|
||||
$isGroup
|
||||
? 'date has both Gruppenkunde and Endkunde selected, importing as group travel'
|
||||
: 'date has neither Gruppenkunde nor Endkunde selected, falling back to travel code, importing as '
|
||||
. ($this->isGroupTravel($row) ? 'group travel' : 'end-customer travel'),
|
||||
['product' => $row['product']['code'], 'date' => $row['date']['code']]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array[] $selections
|
||||
* @param array $data
|
||||
|
||||
@@ -230,6 +230,7 @@ class DateService implements SingletonInterface
|
||||
'summer' => $row['season'] === 's',
|
||||
'busIncluded' => (bool) $row['dateBusIncluded'],
|
||||
'skiPassIncluded' => (bool) $row['dateSkiPassIncluded'],
|
||||
'groupTravel' => (bool) $row['dateGroupTravel'],
|
||||
'roomUid' => $row['roomUid'],
|
||||
'roomName' => $row['roomName'],
|
||||
'available' => $row['roomAvailable'] && $row['roomPrice'],
|
||||
@@ -320,6 +321,7 @@ class DateService implements SingletonInterface
|
||||
'nights' => $row['dateNights'],
|
||||
'busIncluded' => (bool) $row['dateBusIncluded'],
|
||||
'skiPassIncluded' => (bool) $row['dateSkiPassIncluded'],
|
||||
'groupTravel' => (bool) $row['dateGroupTravel'],
|
||||
'servicesIncluded' => unserialize($row['dateServicesIncluded'], ['allowed_classes' => false]),
|
||||
'servicesGeneral' => unserialize($row['dateServicesGeneral'], ['allowed_classes' => false]),
|
||||
'season' => $row['season'],
|
||||
|
||||
@@ -7,10 +7,12 @@ use EP\EpProducts\Domain\Model\Product;
|
||||
use EP\EpProducts\Domain\Repository\DateRepository;
|
||||
|
||||
/**
|
||||
* Lists the pickup points of a product's latest upcoming date that has any,
|
||||
* with that date's time and round-trip surcharge per pickup point. Pickups,
|
||||
* times and prices may differ on other dates; taking the latest one keeps the
|
||||
* values unique and shows them for as long as the product is offered.
|
||||
* Lists the pickup points of a product's latest upcoming end-customer date that
|
||||
* has any, with that date's time and round-trip surcharge per pickup point.
|
||||
* Group travel dates are left out: their pickups are arranged per group and
|
||||
* are not offered publicly. Pickups, times and prices may differ on other
|
||||
* dates; taking the latest one keeps the values unique and shows them for as
|
||||
* long as the product is offered.
|
||||
*
|
||||
* The returned shape is meant to be served by MyE&P later on, so that only the
|
||||
* data source has to change once the local date table goes away.
|
||||
|
||||
+1
@@ -403,6 +403,7 @@ return [
|
||||
'label' => 'Produkte',
|
||||
'config' => [
|
||||
'type' => 'select',
|
||||
'default' => 0,
|
||||
'renderType' => 'selectMultipleSideBySide',
|
||||
'foreign_table' => 'tx_epproducts_domain_model_product',
|
||||
'size' => 10,
|
||||
|
||||
+10
-2
@@ -24,8 +24,8 @@ return [
|
||||
],
|
||||
'types' => [
|
||||
'1' => ['showitem' => 'hidden, bus_pro_id, hotel_bus_pro_id, code, daytrip, date_start, date_end, nights, board,
|
||||
board_code, board_bus_pro_id, bus_included, bus_available, skipass_included, services_included,
|
||||
services_general, courses_included, guide, pickups, discount, min_price, pseudo_price, available, min_pax,
|
||||
board_code, board_bus_pro_id, bus_included, bus_available, skipass_included, group_travel,
|
||||
services_included, services_general, courses_included, guide, pickups, discount, min_price, pseudo_price, available, min_pax,
|
||||
new'
|
||||
],
|
||||
],
|
||||
@@ -322,6 +322,14 @@ return [
|
||||
'default' => 0
|
||||
]
|
||||
],
|
||||
'group_travel' => [
|
||||
'exclude' => false,
|
||||
'label' => 'Gruppenreise',
|
||||
'config' => [
|
||||
'type' => 'check',
|
||||
'default' => 0
|
||||
]
|
||||
],
|
||||
'bus_price' => [
|
||||
'exclude' => false,
|
||||
'label' => 'Bus Preis',
|
||||
|
||||
@@ -76,7 +76,7 @@ productImportSftpHostKey =
|
||||
# cat=SftpImport; type=int+; label=SFTP connection timeout in seconds
|
||||
productImportSftpTimeout = 15
|
||||
|
||||
# cat=ContentFeed; type=string; label=API key for the CMS backchannel endpoints (chatbot content feed, CMS index); sent as X-Api-Key. Empty denies every request.
|
||||
# cat=ContentFeed; type=string; label=API key for the CMS backchannel endpoints used by MyE&P (/api/hotel, /api/product, /api/content/*); sent as X-Api-Key or ?key=. Empty denies every request.
|
||||
cmsApiKey =
|
||||
|
||||
# cat=ContentFeed; type=boolean; label=Serve the chatbot content feed (off: all feed endpoints answer 503)
|
||||
|
||||
@@ -117,6 +117,7 @@ CREATE TABLE tx_epproducts_domain_model_date
|
||||
bus_included tinyint(1) unsigned DEFAULT '0' NOT NULL,
|
||||
bus_available tinyint(1) unsigned DEFAULT '0' NOT NULL,
|
||||
skipass_included tinyint(1) unsigned DEFAULT '0' NOT NULL,
|
||||
group_travel tinyint(1) unsigned DEFAULT '0' NOT NULL,
|
||||
bus_price decimal(10,2) DEFAULT '0.00' NOT NULL,
|
||||
services_included text NOT NULL,
|
||||
services_general text NOT NULL,
|
||||
|
||||
@@ -24,6 +24,7 @@ call_user_func(function() {
|
||||
'label' => 'Land',
|
||||
'config' => [
|
||||
'type' => 'select',
|
||||
'default' => 0,
|
||||
'renderType' => 'selectSingle',
|
||||
'foreign_table' => 'tx_epproducts_domain_model_country',
|
||||
'foreign_table_where' => 'ORDER BY name',
|
||||
@@ -39,6 +40,7 @@ call_user_func(function() {
|
||||
'label' => 'Gebiet',
|
||||
'config' => [
|
||||
'type' => 'select',
|
||||
'default' => 0,
|
||||
'renderType' => 'selectSingle',
|
||||
'foreign_table' => 'tx_epproducts_domain_model_region',
|
||||
'foreign_table_where' => 'ORDER BY name',
|
||||
@@ -106,6 +108,7 @@ call_user_func(function() {
|
||||
'label' => 'Badge',
|
||||
'config' => [
|
||||
'type' => 'select',
|
||||
'default' => 0,
|
||||
'renderType' => 'selectSingle',
|
||||
'foreign_table' => 'tx_epproducts_domain_model_badge',
|
||||
'foreign_table_where' => 'ORDER BY title',
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ call_user_func(function() {
|
||||
'label' => 'Mitarbeiter',
|
||||
'config' => [
|
||||
'type' => 'select',
|
||||
'default' => 0,
|
||||
'renderType' => 'selectSingle',
|
||||
'foreign_table' => 'tx_epproducts_domain_model_teammember',
|
||||
'foreign_table_where' => 'ORDER BY name',
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<f:render partial="Disrupter/Outlines" section="Top1" arguments="{classes: '-translate-y-2 text-white'}"/>
|
||||
</f:if>
|
||||
<div class="py-4 relative">
|
||||
<div class="container grid grid-cols-2 lg:grid-cols-4 gap-8 pb-4">
|
||||
<div class="container grid md:grid-cols-2 lg:grid-cols-4 gap-8 pb-4 text-center md:text-left">
|
||||
<f:if condition="{settings.footerNavPid}">
|
||||
<f:for each="{footernav}" as="menuheader">
|
||||
<div>
|
||||
@@ -32,7 +32,7 @@
|
||||
</f:if>
|
||||
</div>
|
||||
|
||||
<div class="container py-4 text-white text-xl border-t border-white">
|
||||
<div class="container py-4 text-white text-xl border-t border-white text-center md:text-left">
|
||||
{totalRatings.totalAverage -> f:format.number(decimalSeparator: ',')} Sterne bei {totalRatings.totalCount} Bewertungen
|
||||
</div>
|
||||
|
||||
@@ -184,10 +184,8 @@
|
||||
<f:format.raw>{totalRatings.jsonData->f:format.json()}</f:format.raw>
|
||||
</script>
|
||||
|
||||
<f:comment><!--
|
||||
<f:if condition="{site.identifier} == 'ep-reisen'">
|
||||
<f:render partial="Chatbot" arguments="{_all}"/>
|
||||
</f:if>
|
||||
--></f:comment>
|
||||
<f:if condition="{site.identifier} == 'ep-reisen'">
|
||||
<f:render partial="Chatbot" arguments="{_all}"/>
|
||||
</f:if>
|
||||
|
||||
</html>
|
||||
@@ -2,7 +2,7 @@
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
|
||||
|
||||
<div class="odd:bg-zinc-50 p-4" data-rte-content>
|
||||
<div class="group odd:bg-zinc-50 p-4" data-rte-content>
|
||||
<f:if condition="{journey.byBus}">
|
||||
<h3>
|
||||
Busanreise
|
||||
@@ -11,6 +11,9 @@
|
||||
{journey.byBus -> f:format.html()}
|
||||
</div>
|
||||
</f:if>
|
||||
<f:if condition="{pickupsOverview.pickups}">
|
||||
<f:render partial="Product/Pickups" arguments="{pickupsOverview: pickupsOverview}"/>
|
||||
</f:if>
|
||||
<f:if condition="{journey.byCar}">
|
||||
<h3>
|
||||
Eigenanreise
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
|
||||
|
||||
<div class="group odd:bg-zinc-50 p-4" data-rte-content>
|
||||
<div class="pb-8">
|
||||
<h3>
|
||||
Bus-Zustiege
|
||||
</h3>
|
||||
|
||||
@@ -162,12 +162,7 @@
|
||||
<div class="mb-4 hidden"
|
||||
data-tabs-target="tab"
|
||||
data-tab="journey">
|
||||
<f:if condition="{product.journey}">
|
||||
<f:render partial="Journey/Details" arguments="{journey: product.journey, bars: 1}"/>
|
||||
</f:if>
|
||||
<f:if condition="{pickupsOverview.pickups}">
|
||||
<f:render partial="Product/Pickups" arguments="{pickupsOverview: pickupsOverview}"/>
|
||||
</f:if>
|
||||
<f:render partial="Journey/Details" arguments="{journey: product.journey, pickupsOverview: pickupsOverview, bars: 1}"/>
|
||||
</div>
|
||||
</f:if>
|
||||
</f:section>
|
||||
|
||||
Reference in new issue
Block a user