| @@ -15,34 +15,34 @@ | ||
| 15 | 15 | |
| 16 | 16 | public function update(): bool |
| 17 | 17 | { |
| 18 | 18 | $dbAccessGroupToObject = $this->database->getUserGroupToObjectTable(); |
| 19 | - $alterQuery = "ALTER TABLE {$dbAccessGroupToObject} | |
| 20 | - ADD general_object_type VARCHAR(64) NOT NULL AFTER object_id"; | |
| 19 | + $alterQuery = "ALTER TABLE `{$dbAccessGroupToObject}` | |
| 20 | + ADD `general_object_type` VARCHAR(64) NOT NULL AFTER `object_id`"; | |
| 21 | 21 | |
| 22 | 22 | $success = $this->database->query($alterQuery) !== false; |
| 23 | 23 | |
| 24 | 24 | $generalTermType = ObjectHandler::GENERAL_TERM_OBJECT_TYPE; |
| 25 | 25 | $objectTypeConditions = [ |
| 26 | - ObjectHandler::GENERAL_POST_OBJECT_TYPE => "object_type IN ('post', 'page', 'attachment')", | |
| 27 | - ObjectHandler::GENERAL_ROLE_OBJECT_TYPE => "object_type = 'role'", | |
| 28 | - ObjectHandler::GENERAL_USER_OBJECT_TYPE => "object_type = 'user'", | |
| 29 | - $generalTermType => "object_type = 'term'" | |
| 26 | + ObjectHandler::GENERAL_POST_OBJECT_TYPE => "`object_type` IN ('post', 'page', 'attachment')", | |
| 27 | + ObjectHandler::GENERAL_ROLE_OBJECT_TYPE => "`object_type` = 'role'", | |
| 28 | + ObjectHandler::GENERAL_USER_OBJECT_TYPE => "`object_type` = 'user'", | |
| 29 | + $generalTermType => "`object_type` = 'term'" | |
| 30 | 30 | ]; |
| 31 | 31 | |
| 32 | 32 | foreach ($objectTypeConditions as $generalObjectType => $condition) { |
| 33 | - $query = "UPDATE {$dbAccessGroupToObject} | |
| 34 | - SET general_object_type = '$generalObjectType' | |
| 33 | + $query = "UPDATE `{$dbAccessGroupToObject}` | |
| 34 | + SET `general_object_type` = '$generalObjectType' | |
| 35 | 35 | WHERE $condition"; |
| 36 | 36 | |
| 37 | 37 | $success = $success && $this->database->query($query) !== false; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - $query = "UPDATE $dbAccessGroupToObject AS gto | |
| 41 | - LEFT JOIN {$this->database->getTermTaxonomyTable()} AS tt | |
| 42 | - ON gto.object_id = tt.term_id | |
| 43 | - SET gto.object_type = tt.taxonomy | |
| 44 | - WHERE gto.general_object_type = '$generalTermType'"; | |
| 40 | + $query = "UPDATE `$dbAccessGroupToObject` AS `gto` | |
| 41 | + LEFT JOIN `{$this->database->getTermTaxonomyTable()}` AS `tt` | |
| 42 | + ON `gto`.`object_id` = `tt`.`term_id` | |
| 43 | + SET `gto`.`object_type` = `tt`.`taxonomy` | |
| 44 | + WHERE `gto`.`general_object_type` = '$generalTermType'"; | |
| 45 | 45 | |
| 46 | 46 | return $success && $this->database->query($query) !== false; |
| 47 | 47 | } |
| 48 | 48 | } |