Setup/Update

* reapply flags for community content when rebuilding DB
   fixes associated filters and meta page 'missing screenshots'
This commit is contained in:
Sarjuuk
2022-03-03 18:55:04 +01:00
parent 33ec14f232
commit 73c1118601
22 changed files with 57 additions and 0 deletions

View File

@@ -84,6 +84,21 @@ abstract class SetupScript
{
return $this->command;
}
protected function reapplyCCFlags(string $tbl, int $type) : void
{
// reaply flags for community content as these are lost when the table is rebuild
if (preg_match('/[^a-z]/i', $tbl))
{
trigger_error('SetupScript::reapplyCCFlags() - invalid table name');
return;
}
DB::Aowow()->query('UPDATE ?_'.$tbl.' x, ?_comments y SET x.`cuFlags` = x.`cuFlags` | ?d WHERE x.`id` = y.`typeId` AND y.`type` = ?d AND y.`flags` & ?d', CUSTOM_HAS_COMMENT, $type, CC_FLAG_APPROVED);
DB::Aowow()->query('UPDATE ?_'.$tbl.' x, ?_screenshots y SET x.`cuFlags` = x.`cuFlags` | ?d WHERE x.`id` = y.`typeId` AND y.`type` = ?d AND y.`status` & ?d', CUSTOM_HAS_SCREENSHOT, $type, CC_FLAG_APPROVED);
DB::Aowow()->query('UPDATE ?_'.$tbl.' x, ?_videos y SET x.`cuFlags` = x.`cuFlags` | ?d WHERE x.`id` = y.`typeId` AND y.`type` = ?d AND y.`status` & ?d', CUSTOM_HAS_VIDEO, $type, CC_FLAG_APPROVED);
}
}
?>