本文整理汇总了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;
}