本文整理汇总了PHP中BlockInstance::bulk_delete_artefacts方法的典型用法代码示例。如果您正苦于以下问题:PHP BlockInstance::bulk_delete_artefacts方法的具体用法?PHP BlockInstance::bulk_delete_artefacts怎么用?PHP BlockInstance::bulk_delete_artefacts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockInstance
的用法示例。
在下文中一共展示了BlockInstance::bulk_delete_artefacts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _delete_dbrecords
private static function _delete_dbrecords($artefactids)
{
if (empty($artefactids)) {
return;
}
$idstr = '(' . join(',', array_map('intval', $artefactids)) . ')';
db_begin();
// Detach any files from this artefact
delete_records_select('artefact_attachment', "artefact IN {$idstr}");
// Make sure that the artefacts are removed from any view blockinstances
if ($records = get_records_sql_array("\n SELECT va.block, va.artefact, bi.configdata\n FROM {view_artefact} va JOIN {block_instance} bi ON va.block = bi.id\n WHERE va.artefact IN {$idstr}", array())) {
require_once get_config('docroot') . 'blocktype/lib.php';
BlockInstance::bulk_delete_artefacts($records);
}
delete_records_select('view_artefact', "artefact IN {$idstr}");
delete_records_select('artefact_tag', "artefact IN {$idstr}");
delete_records_select('artefact_access_role', "artefact IN {$idstr}");
delete_records_select('artefact_access_usr', "artefact IN {$idstr}");
execute_sql("UPDATE {usr} SET profileicon = NULL WHERE profileicon IN {$idstr}");
execute_sql("UPDATE {institution} SET logo = NULL WHERE logo IN {$idstr}");
// Delete any references to files embedded in textboxes
delete_records_select('artefact_file_embedded', "fileid IN {$idstr}");
delete_records_select('artefact', "id IN {$idstr}");
db_commit();
}
示例2: _delete_dbrecords
private static function _delete_dbrecords($artefactids)
{
if (empty($artefactids)) {
return;
}
$idstr = '(' . join(',', array_map('intval', $artefactids)) . ')';
db_begin();
// Detach any files from this artefact
delete_records_select('artefact_attachment', "artefact IN {$idstr}");
// Delete any references to these artefacts from non-artefact places.
delete_records_select('artefact_parent_cache', "artefact IN {$idstr}");
// The artefacts should have no 'real' children at this point, but they
// could still be in the artefact_parent_cache as parents if they had
// attachments, or if any of their children had attachments.
delete_records_select('artefact_parent_cache', "parent IN {$idstr}");
// Make sure that the artefacts are removed from any view blockinstances
if ($records = get_records_sql_array("\n SELECT va.block, va.artefact, bi.configdata\n FROM {view_artefact} va JOIN {block_instance} bi ON va.block = bi.id\n WHERE va.artefact IN {$idstr}", array())) {
require_once get_config('docroot') . 'blocktype/lib.php';
BlockInstance::bulk_delete_artefacts($records);
}
delete_records_select('view_artefact', "artefact IN {$idstr}");
delete_records_select('artefact_tag', "artefact IN {$idstr}");
delete_records_select('artefact_access_role', "artefact IN {$idstr}");
delete_records_select('artefact_access_usr', "artefact IN {$idstr}");
delete_records_select('artefact', "id IN {$idstr}");
db_commit();
}