extends delete system logic

This commit is contained in:
team2
2026-02-23 11:47:05 +01:00
parent dceeaeee52
commit c047c401df
3 changed files with 29 additions and 3 deletions

View File

@@ -5,6 +5,7 @@
parameters:
mto.root: '%kernel.project_dir%'
mto.kernel.dir: '%mto.root%'
mto.locks.dir: '%mto.knowledge.root%/locks'
mto.knowledge.root: '%mto.root%/var/knowledge'
@@ -24,7 +25,7 @@ parameters:
mto.vector.ingest_tags_script: '%mto.vector.script_dir%/vector_ingest_tags.py'
mto.vector.search_tags_script: '%mto.vector.script_dir%/vector_search_tags.py'
mto.tags.rebuild_lock: '%mto.knowledge.root%/locks/tag_rebuild.lock'
mto.tags.rebuild_lock: '%mto.locks.dir%/tag_rebuild.lock'
mto.vector.data.upload.path: '%mto.knowledge.upload%'

View File

@@ -323,21 +323,44 @@ class DocumentController extends AbstractController
@unlink((string)$params->get('mto.knowledge.index_meta'));
@unlink((string)$params->get('mto.runtime.meta'));
@unlink((string)$params->get('mto.knowledge.tags_ndjson'));
@unlink((string)$params->get('mto.knowledge.vector_tags_index'));
@unlink((string)$params->get('mto.knowledge.vector_tags_index_meta'));
$uploadDir = (string)$params->get('mto.knowledge.upload');
if ($uploadDir !== '' && is_dir($uploadDir)) {
exec('rm -rf ' . escapeshellarg($uploadDir));
}
$lockDir = (string)$params->get('mto.locks.dir');
if ($lockDir !== '' && is_dir($lockDir)) {
exec('rm -rf ' . escapeshellarg($lockDir));
}
$sql = '
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE db.document;
SET FOREIGN_KEY_CHECKS = 1;
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE db.document_version;
SET FOREIGN_KEY_CHECKS = 1;
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE db.ingest_job;
SET FOREIGN_KEY_CHECKS = 1;
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE db.knowledge_tag;
SET FOREIGN_KEY_CHECKS = 1;
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE db.tag_rebuild_job;
SET FOREIGN_KEY_CHECKS = 1;
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE db.document_tag;
SET FOREIGN_KEY_CHECKS = 1;
';
$connection->executeQuery($sql);

View File

@@ -171,9 +171,11 @@
Ein vollständiger System-Reset entfernt:
<ul>
<li>Alle Dokumente und Versionen</li>
<li>Den NDJSON-Index</li>
<li>Den FAISS-Vektorindex</li>
<li>Den gesamten var/knowledge Inhalt</li>
<li>Den FAISS-Vektorindex für Chunks und Tags</li>
<li>Alle Ingest-Jobs</li>
<li>Alle Tags-Jobs</li>
<li>Alle Tags / Dokument Tags</li>
</ul>
<strong>Diese Aktion ist nicht rückgängig zu machen.</strong>
</div>