public function delete() {
$returnValue = parent::delete();
- $languageVariables = array();
+ // delete language items
+ if (!empty($this->objects)) {
+ // identify i18n labels
- $conditions->add('languageItem IN (?)', array($languageVariables));
++ $languageVariables = [];
+ foreach ($this->objects as $category) {
+ if ($category->title === $category->getProcessor()->getI18nLangVarPrefix() . '.title.category' . $category->categoryID) {
+ $languageVariables[] = $category->title;
+ }
+ if ($category->description === $category->getProcessor()->getI18nLangVarPrefix() . '.description.category' . $category->categoryID) {
+ $languageVariables[] = $category->description;
+ }
+ }
+
+ // remove language variables
+ if (!empty($languageVariables)) {
+ $conditions = new PreparedStatementConditionBuilder();
- $languageItemIDs = array();
- while ($row = $statement->fetchArray()) {
- $languageItemIDs[] = $row['languageItemID'];
- }
++ $conditions->add('languageItem IN (?)', [$languageVariables]);
+
+ $sql = "SELECT languageItemID
+ FROM wcf".WCF_N."_language_item
+ ".$conditions;
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute($conditions->getParameters());
++ $languageItemIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
+
+ $objectAction = new LanguageItemAction($languageItemIDs, 'delete');
+ $objectAction->executeAction();
+ }
+ }
+
// call category types
- foreach ($this->objects as $categoryEditor) {
+ foreach ($this->getObjects() as $categoryEditor) {
$categoryEditor->getProcessor()->afterDeletion($categoryEditor);
}
public function delete() {
$count = parent::delete();
- $languageVariables = array();
+ if (!empty($this->objects)) {
+ // identify i18n labels
- $conditions->add('languageItem IN (?)', array($languageVariables));
++ $languageVariables = [];
+ foreach ($this->objects as $labelGroup) {
+ if ($labelGroup->groupName === 'wcf.acp.label.group' . $labelGroup->groupID) {
+ $languageVariables[] = $labelGroup->groupName;
+ }
+ }
+
+ // remove language variables
+ if (!empty($languageVariables)) {
+ $conditions = new PreparedStatementConditionBuilder();
- $languageItemIDs = array();
- while ($row = $statement->fetchArray()) {
- $languageItemIDs[] = $row['languageItemID'];
- }
++ $conditions->add('languageItem IN (?)', [$languageVariables]);
+
+ $sql = "SELECT languageItemID
+ FROM wcf".WCF_N."_language_item
+ ".$conditions;
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute($conditions->getParameters());
++ $languageItemIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
+
+ $objectAction = new LanguageItemAction($languageItemIDs, 'delete');
+ $objectAction->executeAction();
+ }
+ }
+
foreach (ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.label.objectType') as $objectType) {
$objectType->getProcessor()->save();
}