• delete CDU


    function DeletePDU(){
    global $person;
    $this->MakeSafe();

    // Do not attempt anything else if the lookup fails
    if(!$this->GetPDU()){return false;}

    // Check rights
    $cab=new Cabinet();
    $cab->CabinetID=$this->CabinetID;
    $cab->GetCabinet();

    //person 不具有写权限 ,无法删除设备
    if(!$person->canWrite($cab->AssignedTo)){return false;}

    // First, remove any connections to the PDU
    $tmpConn=new PowerConnection();
    $tmpConn->PDUID=$this->PDUID;
    $connList=$tmpConn->GetConnectionsByPDU();

    foreach($connList as $delConn){
    $delConn->RemoveConnection();
    }

    // Clear out any records from PDUStats, possible S.U.T. involving changing
    // a devicetype but leaving behind a phantom reading for a non-power device
    $sql="DELETE FROM fac_PDUStats WHERE PDUID=$this->PDUID;";
    $this->exec($sql);

    $sql="DELETE FROM fac_PowerDistribution WHERE PDUID=$this->PDUID;";
    if(!$this->exec($sql)){
    // Something went south and this didn't delete.
    return false;
    }else{
    (class_exists('LogActions'))?LogActions::LogThis($this):'';
    return true;
    }
    }
  • 相关阅读:
    BBS
    BBS
    BBS
    BBS
    6.1
    Django
    Django
    tomcat——启动项目报错:java.lang.IllegalStateException
    Java——java.lang.NullPointerException
    Java——反射三种方式的效率对比
  • 原文地址:https://www.cnblogs.com/hehexu/p/8643096.html
Copyright © 2020-2023  润新知