当前位置: 首页>>代码示例>>PHP>>正文


PHP Document_Item::cleanDBonItemDelete方法代码示例

本文整理汇总了PHP中Document_Item::cleanDBonItemDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP Document_Item::cleanDBonItemDelete方法的具体用法?PHP Document_Item::cleanDBonItemDelete怎么用?PHP Document_Item::cleanDBonItemDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Document_Item的用法示例。


在下文中一共展示了Document_Item::cleanDBonItemDelete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cleanDBonPurge

 function cleanDBonPurge()
 {
     $di = new Document_Item();
     $di->cleanDBonItemDelete($this->getType(), $this->fields['id']);
     // UNLINK DU FICHIER
     if (!empty($this->fields["filepath"])) {
         if (is_file(GLPI_DOC_DIR . "/" . $this->fields["filepath"]) && !is_dir(GLPI_DOC_DIR . "/" . $this->fields["filepath"]) && countElementsInTable($this->getTable(), "`sha1sum`='" . $this->fields["sha1sum"] . "'") <= 1) {
             if (unlink(GLPI_DOC_DIR . "/" . $this->fields["filepath"])) {
                 Session::addMessageAfterRedirect(sprintf(__('Succesful deletion of the file %s'), GLPI_DOC_DIR . "/" . $this->fields["filepath"]));
             } else {
                 Session::addMessageAfterRedirect(sprintf(__('Failed to delete the file %s'), GLPI_DOC_DIR . "/" . $this->fields["filepath"]), false, ERROR);
             }
         }
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:15,代码来源:document.class.php

示例2: cleanDBonPurge

 function cleanDBonPurge()
 {
     global $LANG;
     $di = new Document_Item();
     $di->cleanDBonItemDelete($this->getType(), $this->fields['id']);
     // UNLINK DU FICHIER
     if (!empty($this->fields["filepath"])) {
         if (is_file(GLPI_DOC_DIR . "/" . $this->fields["filepath"]) && !is_dir(GLPI_DOC_DIR . "/" . $this->fields["filepath"]) && countElementsInTable($this->getTable(), "`sha1sum`='" . $this->fields["sha1sum"] . "'") <= 1) {
             if (unlink(GLPI_DOC_DIR . "/" . $this->fields["filepath"])) {
                 addMessageAfterRedirect($LANG['document'][24] . " " . GLPI_DOC_DIR . "/" . $this->fields["filepath"]);
             } else {
                 addMessageAfterRedirect($LANG['document'][25] . " " . GLPI_DOC_DIR . "/" . $this->fields["filepath"], false, ERROR);
             }
         }
     }
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:16,代码来源:document.class.php

示例3: cleanRelationTable

 /**
  * Clean the date in the relation tables for the deleted item
  * Clear N/N Relation
  **/
 function cleanRelationTable()
 {
     global $CFG_GLPI, $DB;
     // If this type have INFOCOM, clean one associated to purged item
     if (in_array($this->getType(), $CFG_GLPI['infocom_types'])) {
         $infocom = new Infocom();
         if ($infocom->getFromDBforDevice($this->getType(), $this->fields['id'])) {
             $infocom->delete(array('id' => $infocom->fields['id']));
         }
     }
     // If this type have NETPORT, clean one associated to purged item
     if (in_array($this->getType(), $CFG_GLPI['networkport_types'])) {
         $query = "SELECT `id`\n                   FROM `glpi_networkports`\n                   WHERE (`items_id` = '" . $this->fields['id'] . "'\n                          AND `itemtype` = '" . $this->getType() . "')";
         $result = $DB->query($query);
         while ($data = $DB->fetch_array($result)) {
             $q = "DELETE\n                  FROM `glpi_networkports_networkports`\n                  WHERE (`networkports_id_1` = '" . $data["id"] . "'\n                         OR `networkports_id_2` = '" . $data["id"] . "')";
             $result2 = $DB->query($q);
         }
         $query = "DELETE\n                   FROM `glpi_networkports`\n                   WHERE (`items_id` = '" . $this->fields['id'] . "'\n                          AND `itemtype` = '" . $this->getType() . "')";
         $result = $DB->query($query);
     }
     // If this type is RESERVABLE clean one associated to purged item
     if (in_array($this->getType(), $CFG_GLPI['reservation_types'])) {
         $rr = new ReservationItem();
         if ($rr->getFromDBbyItem($this->getType(), $this->fields['id'])) {
             $rr->delete(array('id' => $infocom->fields['id']));
         }
     }
     // If this type have CONTRACT, clean one associated to purged item
     if (in_array($this->getType(), $CFG_GLPI['contract_types'])) {
         $ci = new Contract_Item();
         $ci->cleanDBonItemDelete($this->getType(), $this->fields['id']);
     }
     // If this type have DOCUMENT, clean one associated to purged item
     if (in_array($this->getType(), $CFG_GLPI["document_types"])) {
         $di = new Document_Item();
         $di->cleanDBonItemDelete($this->getType(), $this->fields['id']);
     }
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:43,代码来源:commondbtm.class.php

示例4: cleanRelationTable

 /**
  * Clean the date in the relation tables for the deleted item
  * Clear N/N Relation
  **/
 function cleanRelationTable()
 {
     global $CFG_GLPI, $DB;
     // If this type have INFOCOM, clean one associated to purged item
     if (Infocom::canApplyOn($this)) {
         $infocom = new Infocom();
         if ($infocom->getFromDBforDevice($this->getType(), $this->fields['id'])) {
             $infocom->delete(array('id' => $infocom->fields['id']));
         }
     }
     // If this type have NETPORT, clean one associated to purged item
     if (in_array($this->getType(), $CFG_GLPI['networkport_types'])) {
         // If we don't use delete, then cleanDBonPurge() is not call and the NetworkPorts are not
         // clean properly
         $networkPortObject = new NetworkPort();
         $networkPortObject->cleanDBonItemDelete($this->getType(), $this->getID());
         // Manage networkportmigration if exists
         if (TableExists('glpi_networkportmigrations')) {
             $networkPortMigObject = new NetworkPortMigration();
             $networkPortMigObject->cleanDBonItemDelete($this->getType(), $this->getID());
         }
     }
     // If this type is RESERVABLE clean one associated to purged item
     if (in_array($this->getType(), $CFG_GLPI['reservation_types'])) {
         $rr = new ReservationItem();
         if ($rr->getFromDBbyItem($this->getType(), $this->fields['id'])) {
             $rr->delete(array('id' => $infocom->fields['id']));
         }
     }
     // If this type have CONTRACT, clean one associated to purged item
     if (in_array($this->getType(), $CFG_GLPI['contract_types'])) {
         $ci = new Contract_Item();
         $ci->cleanDBonItemDelete($this->getType(), $this->fields['id']);
     }
     // If this type have DOCUMENT, clean one associated to purged item
     if (Document::canApplyOn($this)) {
         $di = new Document_Item();
         $di->cleanDBonItemDelete($this->getType(), $this->fields['id']);
     }
     // If this type have NOTEPAD, clean one associated to purged item
     if ($this->usenotepad) {
         $note = new Notepad();
         $note->cleanDBonItemDelete($this->getType(), $this->fields['id']);
     }
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:49,代码来源:commondbtm.class.php


注:本文中的Document_Item::cleanDBonItemDelete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。