Example #1
0
 protected function _removeThreads($tIds, $isRecycle = false)
 {
     $tableThreads = array();
     foreach (Cloud_Service_SearchHelper::getTables('thread') as $tableid) {
         $_threads = Cloud_Service_SearchHelper::preGetThreads($tableid, $tIds);
         $tableThreads[$tableid] = $_threads;
     }
     foreach ($tableThreads as $tableid => $threads) {
         $_tids = $_threadIds = array();
         foreach ($threads as $thread) {
             $_tids[] = $thread['tId'];
             $postTable = $thread['postTableId'] ? $thread['postTableId'] : 0;
             $_threadIds[$postTable][] = $thread['tId'];
         }
         if ($_tids) {
             if ($isRecycle) {
                 C::t('forum_thread')->update($_tIds, array('displayorder' => -1), false, false, $tableid);
                 continue;
             }
             C::t('forum_thread')->delete_by_tid($_tids, false, $tableid);
             foreach ($_threadIds as $postTable => $_tIds) {
                 if ($_tIds) {
                     C::t('forum_post')->delete_by_tid($postTable, $_tIds);
                 }
             }
         }
     }
     return true;
 }