Exemplo n.º 1
0
 /**
  * @uses		Deletes tag from database, node independent function
  * @param	Array Tags Id to delete
  * @return	Mixed response
  */
 public function killTags($killTagList)
 {
     $this->checkHasAdminPermission('canadmintags');
     if (!is_array($killTagList)) {
         $killTagList = array($killTagList);
     }
     $exception = new vB_Exception_Api();
     $killtagdm = new vB_DataManager_Tag(vB_DataManager_Constants::ERRTYPE_ARRAY);
     //clear existing because they may be changed here.
     $this->tagsObj = array();
     //Check that tags exist and they are synonyms
     $target = vB::getDbAssertor()->assertQuery('vBForum:tag', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'tagid' => $killTagList));
     if ($target and $target->valid()) {
         foreach ($killTagList as $killtagid) {
             if ($killtagdm->fetch_by_id($killtagid)) {
                 $killtagdm->delete();
             }
         }
     } else {
         $exception->add_error("tag_not_exist", array());
     }
     //Exception Handling
     if ($exception->has_errors()) {
         throw $exception;
     }
     return $response;
 }