Commit b3724876 authored by Marc Egger's avatar Marc Egger
Browse files

Refs #12588 add "tt_content is hidden" note, show full qfq.json path, show log file postfix

parent c2b39d88
Pipeline #5406 failed with stages
in 2 minutes and 50 seconds
......@@ -470,10 +470,12 @@ class DatabaseUpdate {
$KEY_SQL_UPDATE = 'sql_update'; // sql update statement for that blob
// get reports from tt_content.bodytext
$reports = $this->db->sql("SELECT `uid`, `header`, `bodytext` FROM `" . $dbT3 . "`.`tt_content` WHERE `CType`='qfq_qfq' AND `deleted`=0;");
$reports = $this->db->sql("SELECT tt.`uid`, tt.`header`, tt.`bodytext`, tt.`hidden`, p.`hidden` AS pageHidden FROM `" . $dbT3 . "`.`tt_content` AS tt, `" . $dbT3 . "`.`pages` AS p WHERE tt.`CType`='qfq_qfq' AND tt.`deleted`=0 AND p.`deleted`=0 AND p.uid=tt.pid");
$qfqCodeBlobs = array_map(function($r) use ($dbT3, $KEY_SQL_UPDATE, $KEY_CONTENT, $KEY_TITLE) {
$maybeHidden = (intval($r['hidden']) !== 0) || (intval($r['pageHidden']) !== 0);
return [
$KEY_TITLE => 'QFQ Report with uid=' . $r['uid'] . ' and header: ' . $r['header'],
$KEY_TITLE => 'QFQ Report with uid=' . $r['uid'] . ' and header: ' . $r['header']
. ($maybeHidden ? '<br><small>Note: Content element is probably hidden / not in use.</small>' : ''),
$KEY_CONTENT => $r['bodytext'],
$KEY_SQL_UPDATE => "UPDATE `$dbT3`.`tt_content` SET `bodytext` = ? WHERE uid=" . $r['uid'] . ";"
];}, $reports);
......@@ -618,7 +620,7 @@ class DatabaseUpdate {
// if no occurrences were found then set db flag to "done"
if ($message === '' && !$doReplace) {
if ($forceRunMigrationCheck) {
Thrower::dbException('Page Slug Migration.', 'No occurrences of page alias where found. Please disable the setting ' . FORCE_RUN_PAGE_SLUG_MIGRATION_CHECK . ' in ' . CONFIG_QFQ_JSON);
Thrower::dbException('Page Slug Migration.', 'No occurrences of page alias where found. Please disable the setting ' . FORCE_RUN_PAGE_SLUG_MIGRATION_CHECK . ' in ' . Path::absoluteConf(CONFIG_QFQ_JSON));
}
return QFQ_VERSION_KEY_SLUG_MIGRATION_DONE;
}
......@@ -626,10 +628,12 @@ class DatabaseUpdate {
###############################################
##### FINALIZE THE EXCEPTION AND THROW IT #####
$reportFilePostfix = '_page_slug_migration.html';
if ($doReplace) {
// save report to file
$reportPath = Path::absoluteLog() . '/' . date("YmdHi") . '_page_slug_migration.html';
$reportPath = Path::absoluteLog() . '/' . date("YmdHi") . $reportFilePostfix;
Logger::logMessage('<meta charset="UTF-8">' . "<h2>Report: Replacement Marked with $replacedSymbol in Code</h2>" . $message, $reportPath);
$message = ''
......@@ -664,14 +668,14 @@ class DatabaseUpdate {
. '<li><a href="?' . ACTION_SLUG_MIGRATION_UPDATE . '=' . ACTION_SLUG_MIGRATION_DO_REPLACE . '">Auto replace</a>'
. ' occurrences of page aliases and page ids with the suggested page slug.'
. '<br>A report file will be saved to "' . Path::absoluteLog() . '" after the automatic replacement. </li>'
. '<br>A report file with name "[timestamp]'. $reportFilePostfix .'" will be saved to "' . Path::absoluteLog() . '" after the automatic replacement. </li>'
. ' <li>To use the Form Editor you can '
. '<a href="?' . ACTION_SLUG_MIGRATION_UPDATE . '=' . ACTION_SLUG_MIGRATION_DO_PAUSE . '">pause the migration temporarliy</a>.</li>'
. '<li>You may also '
. '<a href="?' . ACTION_SLUG_MIGRATION_UPDATE . '=' . ACTION_SLUG_MIGRATION_DO_SKIP_FOREVER . '">skip this check forever</a> but your app will probably be broken.'
. '<br>To reenable the check you can set the config variable ' . FORCE_RUN_PAGE_SLUG_MIGRATION_CHECK . ' to "true" in ' . CONFIG_QFQ_JSON . '</li>'
. '<br>To reenable the check you can set the config variable ' . FORCE_RUN_PAGE_SLUG_MIGRATION_CHECK . ' to "true" in ' . Path::absoluteConf(CONFIG_QFQ_JSON) . '</li>'
. "</ul>"
......
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