Przeglądaj źródła

#1847 Channels: Table bx_cnl_content is not cleaned when remove channel using delete_entity service

RomanL 7 lat temu
rodzic
commit
89411d6800

+ 9 - 0
modules/boonex/channels/classes/BxCnlDb.php

@@ -81,6 +81,15 @@ class BxCnlDb extends BxBaseModGroupsDb
         );
         $this->query("DELETE FROM `" . $CNF['TABLE_CONTENT'] . "` WHERE `content_id` = :content_id AND `module_name` = :module_name", $aBindings);
     }
+	
+	public function removeChannelContent($iChannelId)
+    {
+        $CNF = &$this->_oConfig->CNF;
+        $aBindings = array(
+            'channel_id' => $iChannelId
+        );
+        $this->query("DELETE FROM `" . $CNF['TABLE_CONTENT'] . "` WHERE `cnl_id` = :channel_id", $aBindings);
+    }
 }
 
 /** @} */

+ 6 - 0
modules/boonex/channels/classes/BxCnlFormsEntryHelper.php

@@ -18,6 +18,12 @@ class BxCnlFormsEntryHelper extends BxBaseModGroupsFormsEntryHelper
     {
         parent::__construct($oModule);
     }
+    
+    public function onDataDeleteAfter ($iContentId, $aContentInfo, $oProfile)
+    {
+        $this->_oModule->_oDb->removeChannelContent($iContentId);
+        return parent::onDataDeleteAfter ($iContentId, $aContentInfo, $oProfile);
+    }
 }
 
 /** @} */