本文整理匯總了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();
}