本文整理汇总了PHP中BlockInstance::delete_artefact方法的典型用法代码示例。如果您正苦于以下问题:PHP BlockInstance::delete_artefact方法的具体用法?PHP BlockInstance::delete_artefact怎么用?PHP BlockInstance::delete_artefact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockInstance
的用法示例。
在下文中一共展示了BlockInstance::delete_artefact方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* This function provides basic delete functionality. It gets rid of the
* artefact's row in the artefact table, and the tables that reference the
* artefact table. It also recursively deletes child artefacts.
*
* If your artefact has additional data in another table, you should
* override this function, but you MUST call parent::delete() after you
* have done your own thing.
*/
public function delete()
{
if (empty($this->id)) {
$this->dirty = false;
return;
}
db_begin();
// Call delete() on children (if there are any)
if ($children = $this->get_children_instances()) {
foreach ($children as $child) {
$child->delete();
}
}
artefact_watchlist_notification($this->id);
// Delete any references to this artefact from non-artefact places.
delete_records_select('artefact_parent_cache', 'artefact = ? OR parent = ?', array($this->id, $this->id));
// Make sure that the artefact is removed from any view blockinstances that have it
if ($records = get_column('view_artefact', 'block', 'artefact', $this->id)) {
foreach ($records as $blockid) {
require_once get_config('docroot') . 'blocktype/lib.php';
$bi = new BlockInstance($blockid);
$bi->delete_artefact($this->id);
}
}
delete_records('view_artefact', 'artefact', $this->id);
delete_records('artefact_feedback', 'artefact', $this->id);
delete_records('artefact_tag', 'artefact', $this->id);
delete_records('artefact_access_role', 'artefact', $this->id);
delete_records('artefact_access_usr', 'artefact', $this->id);
if ($this->can_be_logged()) {
$this->log('deleted');
}
// Delete the record itself.
delete_records('artefact', 'id', $this->id);
handle_event('deleteartefact', $this);
// Set flags.
$this->dirty = false;
$this->parentdirty = true;
$this->deleted = true;
db_commit();
}