Example #1
0
function sync_host_with_templates($hostid, $templateid = null)
{
    delete_template_elements($hostid, $templateid);
    copy_template_elements($hostid, $templateid);
}
Example #2
0
function sync_host_with_templates($hostid, $templateid = null)
{
    delete_template_elements($hostid, $templateid);
    $res = copy_template_elements($hostid, $templateid);
    return $res;
}
Example #3
0
 /**
  * Unlink Templates from Host
  *
  * {@source}
  * @access public
  * @static
  * @since 1.8
  * @version 1
  *
  * @param string $data
  * @param string $data['templateid']
  * @param array $data['hostids']
  * @param boolean $data['clean'] whether to wipe all info from template elements.
  * @return boolean
  */
 public static function unlinkTemplates($data)
 {
     $templateid = $data['templateid'];
     $hostids = $data['hostids'];
     $clean = isset($data['clean']);
     $result = delete_template_elements($hostid, $templateids, $clean);
     $result &= DBexecute('DELETE FROM hosts_templates WHERE hostid=' . $hostid . ' AND ' . DBcondition('templateid', $templateids));
     if ($result) {
         return true;
     } else {
         self::$error = array('error' => ZBX_API_ERROR_INTERNAL, 'data' => $error);
         return false;
     }
 }