exit;
} else {
+ // Inform block it's about to be deleted
+ block_instance($block->name)->before_delete();
+
// Delete block
if (!delete_records('block', 'id', $block->id)) {
notify("Error occurred while deleting the $strblockname record from blocks table");
function __construct() {
$this->block_base();
}
+
+ /**
+ * Function that can be overridden to do extra setup after
+ * the database install. (Called once per block, not per instance!)
+ */
+ function after_install() {
+ }
+
+ /**
+ * Function that can be overridden to do extra cleanup before
+ * the database tables are deleted. (Called once per block, not per instance!)
+ */
+ function before_delete() {
+ }
/**
* Returns the block name, as present in the class name,
if (!is_dir($fullblock .'/db/') || modify_database($fullblock .'/db/'. $CFG->dbtype .'.sql')) {
$db->debug = false;
if ($block->id = insert_record('block', $block)) {
+ $blockobj->after_install();
notify(get_string('blocksuccess', '', $blocktitle), 'notifysuccess');
echo '<hr />';
} else {
}
}
-?>
+?>
\ No newline at end of file