Example #1
0
 /** This function either deletes the channel if it has no children, or fixes it.
 	 *
 		@param	mixed	node record, which may have missing child table data.
 	 */
 public function incompleteNodeCleanup($node)
 {
     //If we have child records we should create an empty text table record.
     $children = $this->assertor->assertQuery('vBForum:node', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'parentid' => $node['nodeid']));
     if ($children->valid()) {
         //We need to make sure we have text and gallery records.
         $data = array('nodeid' => $node['nodeid'], 'category' => 0);
         $data['guid'] = vB_Xml_Export_Channel::createGUID($data);
         $data[vB_dB_Query::TYPE_KEY] = vB_dB_Query::QUERY_INSERT;
         $this->assertor->assertQuery('vBForum:channel', $data);
         vB_Cache::instance()->allCacheEvent(array('nodeChg_' . $node['parentid'], 'nodeChg_' . $node['nodeid']));
         vB_Library::instance('node')->clearCacheEvents($node['nodeid']);
     } else {
         //just delete
         parent::incompleteNodeCleanup($node);
     }
 }