Esempio n. 1
0
 /**
  * Permanently deletes a node
  *	@param	integer	The nodeid of the record to be deleted
  *
  *	@return	boolean
  */
 public function delete($nodeid)
 {
     //We need to update the parent counts, but first we need to get the status
     $node = $this->assertor->getRow('vBForum:node', array('nodeid' => $nodeid));
     //We have to get this before we delete
     if ($node['showpublished']) {
         $parents = vB_Library::instance('Node')->getParents($nodeid);
     }
     //do the delete
     parent::delete($nodeid);
     //delete videoitems
     $this->assertor->assertQuery('videoitem', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_DELETE, 'nodeid' => $nodeid));
     vB_Cache::instance(vB_Cache::CACHE_FAST)->event("nodeChg_{$nodeid}");
     vB_Cache::instance()->event("nodeChg_{$nodeid}");
 }
 public function delete($nodeid)
 {
     //Call the parent first. It will do the permission checks, among other things.
     $result = parent::delete($nodeid);
     if ($result) {
         //We need to delete from the sentto table.
         $users = array();
         $recipients = $this->assertor->getRows('vBForum:sentto', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'nodeid' => $nodeid));
         foreach ($recipients as $recipient) {
             $users[] = $recipient['userid'];
         }
         $data = array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_DELETE, 'nodeid' => $nodeid);
         $this->assertor->assertQuery('vBForum:sentto', $data);
         if (!empty($users)) {
             $this->buildPmTotals($users);
         }
     }
     return $result;
 }
Esempio n. 3
0
 public function delete($nodeid)
 {
     $existing = $this->nodeApi->getNode($nodeid);
     //do the delete
     parent::delete($nodeid);
     //delete polloptions
     $this->assertor->assertQuery('vBForum:polloption', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_DELETE, 'nodeid' => $nodeid));
     //delete pollvotes
     $this->assertor->assertQuery('vBForum:pollvote', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_DELETE, 'nodeid' => $nodeid));
     $this->nodeApi->clearCacheEvents(array($nodeid, $existing['parentid']));
 }
Esempio n. 4
0
 public function delete($nodeid)
 {
     /** Get filedata refcount */
     $fileDataRecord = $this->fetchFileDataRecord($nodeid);
     if ($fileDataRecord and !$this->canDeleteLink(vB::getCurrentSession()->get('userid'), $nodeid, $fileDataRecord)) {
         throw new vB_Exception_Api('no_delete_permissions');
     }
     if ($result = parent::delete($nodeid)) {
         $refCount = $fileDataRecord["refcount"] - 1;
         $data = array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, vB_dB_Query::CONDITIONS_KEY => array('filedataid' => $fileDataRecord["filedataid"]), 'refcount' => $refCount);
         $this->assertor->assertQuery("vBForum:filedata", $data);
         return $result;
     } else {
         return false;
     }
 }