phase a audit
This commit is contained in:
@@ -34,7 +34,7 @@ parameters:
|
|||||||
mto.index.embedding_dimension: 768
|
mto.index.embedding_dimension: 768
|
||||||
mto.index.scoring_version: 1
|
mto.index.scoring_version: 1
|
||||||
|
|
||||||
mto.vector.python_bin: '/var/www/html/.venv/bin/python3'
|
mto.vector.python_bin: '%kernel.project_dir%/.venv/bin/python3'
|
||||||
mto.vector.ingest_script: '%mto.vector.script_dir%/vector_ingest.py'
|
mto.vector.ingest_script: '%mto.vector.script_dir%/vector_ingest.py'
|
||||||
mto.vector.search_script: '%mto.vector.script_dir%/vector_search.py'
|
mto.vector.search_script: '%mto.vector.script_dir%/vector_search.py'
|
||||||
mto.vector.timeout: 600
|
mto.vector.timeout: 600
|
||||||
|
|||||||
@@ -410,7 +410,17 @@ class DocumentController extends AbstractController
|
|||||||
|
|
||||||
private function canExec(): bool
|
private function canExec(): bool
|
||||||
{
|
{
|
||||||
return function_exists('exec');
|
if (!function_exists('exec')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$disabled = (string) ini_get('disable_functions');
|
||||||
|
if ($disabled === '') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$list = array_map('trim', explode(',', $disabled));
|
||||||
|
return !in_array('exec', $list, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function ensureDir(string $dir): void
|
private function ensureDir(string $dir): void
|
||||||
@@ -429,14 +439,22 @@ class DocumentController extends AbstractController
|
|||||||
$projectDir = (string)$this->getParameter('kernel.project_dir');
|
$projectDir = (string)$this->getParameter('kernel.project_dir');
|
||||||
$console = $projectDir . '/bin/console';
|
$console = $projectDir . '/bin/console';
|
||||||
|
|
||||||
// WICHTIG: --no-interaction ist ein GLOBAL-Flag und muss VOR dem Command stehen!
|
$logDir = $projectDir . '/var/log/ingest';
|
||||||
|
if (!is_dir($logDir)) {
|
||||||
|
@mkdir($logDir, 0777, true);
|
||||||
|
}
|
||||||
|
$logFile = $logDir . '/job_' . $jobId . '.log';
|
||||||
|
|
||||||
|
// Wichtig: CLI-PHP verwenden, nicht PHP_BINARY aus FPM
|
||||||
|
$php = 'php';
|
||||||
|
|
||||||
$cmd = sprintf(
|
$cmd = sprintf(
|
||||||
'%s %s %s %s %s > /dev/null 2>&1 &',
|
'%s %s --no-interaction %s %s >> %s 2>&1 &',
|
||||||
escapeshellarg(PHP_BINARY),
|
escapeshellcmd($php),
|
||||||
escapeshellarg($console),
|
escapeshellarg($console),
|
||||||
'--no-interaction',
|
|
||||||
escapeshellarg('mto:agent:ingest:run'),
|
escapeshellarg('mto:agent:ingest:run'),
|
||||||
escapeshellarg($jobId),
|
escapeshellarg($jobId),
|
||||||
|
escapeshellarg($logFile),
|
||||||
);
|
);
|
||||||
|
|
||||||
exec($cmd);
|
exec($cmd);
|
||||||
|
|||||||
@@ -96,20 +96,23 @@ class IngestJobController extends AbstractController
|
|||||||
$projectDir = (string)$this->getParameter('kernel.project_dir');
|
$projectDir = (string)$this->getParameter('kernel.project_dir');
|
||||||
$console = $projectDir . '/bin/console';
|
$console = $projectDir . '/bin/console';
|
||||||
|
|
||||||
|
$logDir = $projectDir . '/var/log/ingest';
|
||||||
|
if (!is_dir($logDir)) {
|
||||||
|
@mkdir($logDir, 0777, true);
|
||||||
|
}
|
||||||
|
$logFile = $logDir . '/job_' . (string)$job->getId() . '.log';
|
||||||
|
|
||||||
|
$php = 'php';
|
||||||
|
|
||||||
$cmd = sprintf(
|
$cmd = sprintf(
|
||||||
'%s %s %s %s > /dev/null 2>&1 &',
|
'%s %s --no-interaction %s %s >> %s 2>&1 &',
|
||||||
|
escapeshellcmd($php),
|
||||||
escapeshellarg($console),
|
escapeshellarg($console),
|
||||||
escapeshellarg('mto:agent:ingest:run'),
|
escapeshellarg('mto:agent:ingest:run'),
|
||||||
escapeshellarg((string)$job->getId()),
|
escapeshellarg((string)$job->getId()),
|
||||||
escapeshellarg('--no-interaction'),
|
escapeshellarg($logFile),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!function_exists('exec')) {
|
|
||||||
$jobService->markFailed($job, 'Server configuration does not allow background execution (exec disabled).');
|
|
||||||
$this->addFlash('danger', 'Global Reindex konnte nicht gestartet werden.');
|
|
||||||
return $this->redirectToRoute('admin_jobs');
|
|
||||||
}
|
|
||||||
|
|
||||||
exec($cmd);
|
exec($cmd);
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ final readonly class GuardrailValidator
|
|||||||
*/
|
*/
|
||||||
public function validateOrThrow(): void
|
public function validateOrThrow(): void
|
||||||
{
|
{
|
||||||
|
$this->metaManager->ensureExists();
|
||||||
$this->metaManager->validateAgainstCurrent();
|
$this->metaManager->validateAgainstCurrent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,6 +26,9 @@ final readonly class VectorRebuildService
|
|||||||
*/
|
*/
|
||||||
public function rebuild(?string $logPath = null): void
|
public function rebuild(?string $logPath = null): void
|
||||||
{
|
{
|
||||||
|
// ✅ Stelle sicher, dass index_meta.json existiert
|
||||||
|
$this->metaManager->ensureExists();
|
||||||
|
|
||||||
// 1️⃣ Vector Index neu bauen
|
// 1️⃣ Vector Index neu bauen
|
||||||
$this->vectorBuilder->rebuildFromNdjson($logPath);
|
$this->vectorBuilder->rebuildFromNdjson($logPath);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user