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


PHP Attachments::deleteByProjectObjectIds方法代码示例

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


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

示例1: cleanUpByIds

 /**
  * Clean up system by object ID-s
  * 
  * This function cleans up project objects recursively. It is also infinite 
  * loop safe because it will filter out ID-s that are already removed
  *
  * @param array $ids
  * @return null
  */
 function cleanUpByIds($ids)
 {
     static $cleaned_ids = array();
     // Remove objects that are already cleaned
     if (is_foreachable($ids)) {
         foreach ($ids as $k => $id) {
             if (isset($cleaned_ids[$id]) && $cleaned_ids[$id]) {
                 unset($ids[$k]);
             } else {
                 $cleaned_ids[$id] = false;
             }
             // if
         }
         // foreach
     }
     // if
     if (is_foreachable($ids)) {
         db_begin_work();
         Attachments::deleteByProjectObjectIds($ids);
         Subscriptions::deleteByObjectIds($ids);
         Assignments::deleteByObjectIds($ids);
         ActivityLogs::deleteByObjectIds($ids);
         StarredObjects::deleteByObjectIds($ids);
         Reminders::deleteByObjectIds($ids);
         search_index_remove($ids, 'ProjectObject');
         $rows = db_execute_all('SELECT DISTINCT id FROM ' . TABLE_PREFIX . 'project_objects WHERE parent_id IN (?)', $ids);
         if (is_foreachable($rows)) {
             $subobject_ids = array();
             foreach ($rows as $row) {
                 $subobject_ids[] = (int) $row['id'];
             }
             // foreach
             ProjectObjects::cleanUpByIds($subobject_ids);
         }
         // if
         ProjectObjects::delete(array('id IN (?)', $ids));
         foreach ($ids as $id) {
             $cleaned_ids[$id] = true;
         }
         // if
         db_commit();
     }
     // if
     return true;
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:54,代码来源:ProjectObjects.class.php


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