PDO::ERRMODE_EXCEPTION] ); $role = 'Director of the Engineering Department of Cosmos Sistemas Integrado'; echo $apply ? "APPLY\n\n" : "INSPECT - nichts wird geschrieben (--apply zum Schreiben)\n\n"; $story = $pdo->query( "SELECT uid, title, quote_person, quote_role, content_elements FROM tx_vitec_domain_model_usecase WHERE deleted = 0 AND slug = 'the-national-police-of-colombia'" )->fetch(PDO::FETCH_ASSOC); if (!$story) { echo "ABBRUCH: Story the-national-police-of-colombia nicht gefunden.\n"; exit(1); } printf( "Story #%d \"%s\": quote_person=\"%s\" quote_role=\"%s\" content_elements=%d\n", $story['uid'], $story['title'], $story['quote_person'], $story['quote_role'], $story['content_elements'] ); $element = $pdo->query( 'SELECT uid, pid, CType, deleted, tx_vitec_usecase_content, bodytext, header FROM tt_content WHERE uid = 12037' )->fetch(PDO::FETCH_ASSOC); if (!$element) { echo "Element #12037 existiert nicht.\n"; exit(1); } printf( "Element #12037: CType=%s deleted=%d usecase=%d text=\"%s\"\n", $element['CType'], $element['deleted'], $element['tx_vitec_usecase_content'], mb_substr(trim(strip_tags((string)$element['bodytext'] . ' ' . (string)$element['header'])), 0, 90) ); if ((int)$element['tx_vitec_usecase_content'] !== (int)$story['uid']) { echo "ABBRUCH: Element #12037 haengt nicht an dieser Story.\n"; exit(1); } if ((int)$element['deleted'] === 1) { echo "Element ist bereits geloescht.\n"; } if (!$apply) { echo "\nWuerde: Element #12037 loeschen, content_elements neu zaehlen, quote_role setzen auf:\n \"$role\"\n"; exit(0); } if ((int)$element['deleted'] === 0) { $pdo->prepare('UPDATE tt_content SET deleted = 1, tstamp = ? WHERE uid = 12037')->execute([time()]); echo "Element #12037 geloescht.\n"; } $count = (int)$pdo->query( 'SELECT COUNT(*) FROM tt_content WHERE deleted = 0 AND tx_vitec_usecase_content = ' . (int)$story['uid'] )->fetchColumn(); $pdo->prepare('UPDATE tx_vitec_domain_model_usecase SET content_elements = ?, quote_role = ?, tstamp = ? WHERE uid = ?') ->execute([$count, $role, time(), (int)$story['uid']]); printf("Record aktualisiert: quote_role gesetzt, content_elements = %d.\n", $count); echo "Danach: vendor/bin/typo3 cache:flush\n";