From cbed1284f4a9d5be599075fafced502e339b42a6 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Sat, 28 Dec 2013 08:21:09 +0800 Subject: [PATCH] MDL-43506 Blocks: Remove various deprecated functions --- blocks/moodleblock.class.php | 65 -------------------------- blocks/myprofile/block_myprofile.php | 18 ------- blocks/upgrade.txt | 12 +++++ lib/blocklib.php | 70 ---------------------------- 4 files changed, 12 insertions(+), 153 deletions(-) diff --git a/blocks/moodleblock.class.php b/blocks/moodleblock.class.php index 87f4707044c..bbbd72b3d8d 100644 --- a/blocks/moodleblock.class.php +++ b/blocks/moodleblock.class.php @@ -75,12 +75,6 @@ class block_base { */ var $content = NULL; - /** - * A string generated by {@link _add_edit_controls()} to display block manipulation links when the user is in editing mode. - * @var string $edit_controls - */ - var $edit_controls = NULL; - /** * The initialized instance of this block object. * @var block $instance @@ -484,32 +478,6 @@ class block_base { return false; } - /** - * Default behavior: print the config_instance.html file - * You don't need to override this if you're satisfied with the above - * - * @deprecated since Moodle 2.0. - * @return boolean whether anything was done. Blocks should use edit_form.php. - */ - function instance_config_print() { - global $CFG, $DB, $OUTPUT; - // Default behavior: print the config_instance.html file - // You don't need to override this if you're satisfied with the above - if (!$this->instance_allow_multiple() && !$this->instance_allow_config()) { - return false; - } - - if (is_file($CFG->dirroot .'/blocks/'. $this->name() .'/config_instance.html')) { - echo $OUTPUT->box_start('generalbox boxaligncenter blockconfiginstance'); - include($CFG->dirroot .'/blocks/'. $this->name() .'/config_instance.html'); - echo $OUTPUT->box_end(); - } else { - notice(get_string('blockconfigbad'), str_replace('blockaction=', 'dummy=', qualified_me())); - } - - return true; - } - /** * Serialize and store config data */ @@ -637,39 +605,6 @@ class block_base { return 180; } - /** @deprecated since Moodle 2.0. */ - function _print_block() { - throw new coding_exception('_print_block is no longer used. It was a private ' . - 'method of the block class, only for use by the blocks system. You ' . - 'should not have been calling it anyway.'); - } - - /** @deprecated since Moodle 2.0. */ - function _print_shadow() { - throw new coding_exception('_print_shadow is no longer used. It was a private ' . - 'method of the block class, only for use by the blocks system. You ' . - 'should not have been calling it anyway.'); - } - - /** @deprecated since Moodle 2.0. */ - function _title_html() { - throw new coding_exception('_title_html is no longer used. It was a private ' . - 'method of the block class, only for use by the blocks system. You ' . - 'should not have been calling it anyway.'); - } - - /** @deprecated since Moodle 2.0. */ - function _add_edit_controls() { - throw new coding_exception('_add_edit_controls is no longer used. It was a private ' . - 'method of the block class, only for use by the blocks system. You ' . - 'should not have been calling it anyway.'); - } - - /** @deprecated since Moodle 2.0. */ - function config_print() { - throw new coding_exception('config_print() can no longer be used. Blocks should use a settings.php file.'); - } - /** * Can be overridden by the block to prevent the block from being dockable. * diff --git a/blocks/myprofile/block_myprofile.php b/blocks/myprofile/block_myprofile.php index 48909b12feb..cd82a6eaf2e 100644 --- a/blocks/myprofile/block_myprofile.php +++ b/blocks/myprofile/block_myprofile.php @@ -212,24 +212,6 @@ class block_myprofile extends block_base { public function specialization() { } - /** - * displays instance configuration form - * - * @return boolean - */ - function instance_config_print() { - return false; - - /* - global $CFG; - - $form = new block_myprofile.phpConfigForm(null, array($this->config)); - $form->display(); - - return true; - */ - } - /** * locations where block can be displayed * diff --git a/blocks/upgrade.txt b/blocks/upgrade.txt index 1a9ad4863dc..abd99d2af9a 100644 --- a/blocks/upgrade.txt +++ b/blocks/upgrade.txt @@ -1,6 +1,18 @@ This files describes API changes in /blocks/* - activity modules, information provided here is intended especially for developers. +=== 2.8 === + +* The instance_config_print() function was removed. It was deprecated in + Moodle 2.0, but without debugging notices. Since it was no longer a part + of the code path, debugging notices would not have been displayed. +* Deprecated functions were removed from the block_base class: +** _print_block() +** _print_shadow() +** _title_html() +** _add_edit_controls() +** config_print() + === 2.6 === * Deprecated /admin/block.php was removed, make sure blocks are using settings.php instead. diff --git a/lib/blocklib.php b/lib/blocklib.php index afd6cb09db3..d4e62a9ef9a 100644 --- a/lib/blocklib.php +++ b/lib/blocklib.php @@ -28,16 +28,6 @@ defined('MOODLE_INTERNAL') || die(); -/**#@+ - * @deprecated since Moodle 2.0. No longer used. - */ -define('BLOCK_MOVE_LEFT', 0x01); -define('BLOCK_MOVE_RIGHT', 0x02); -define('BLOCK_MOVE_UP', 0x04); -define('BLOCK_MOVE_DOWN', 0x08); -define('BLOCK_CONFIGURE', 0x10); -/**#@-*/ - /**#@+ * Default names for the block regions in the standard theme. */ @@ -45,14 +35,6 @@ define('BLOCK_POS_LEFT', 'side-pre'); define('BLOCK_POS_RIGHT', 'side-post'); /**#@-*/ -/**#@+ - * @deprecated since Moodle 2.0. No longer used. - */ -define('BLOCKS_PINNED_TRUE',0); -define('BLOCKS_PINNED_FALSE',1); -define('BLOCKS_PINNED_BOTH',2); -/**#@-*/ - define('BUI_CONTEXTS_FRONTPAGE_ONLY', 0); define('BUI_CONTEXTS_FRONTPAGE_SUBS', 1); define('BUI_CONTEXTS_ENTIRE_SITE', 2); @@ -485,19 +467,6 @@ class block_manager { $this->extracontent[$region][] = $bc; } - /** - * When the block_manager class was created, the {@link add_fake_block()} - * was called add_pretend_block, which is inconsisted with - * {@link show_only_fake_blocks()}. To fix this inconsistency, this method - * was renamed to add_fake_block. Please update your code. - * @param block_contents $bc the content of the block-like thing. - * @param string $region a block region that exists on this page. - */ - public function add_pretend_block($bc, $region) { - debugging(DEBUG_DEVELOPER, 'add_pretend_block has been renamed to add_fake_block. Please rename the method call in your code.'); - $this->add_fake_block($bc, $region); - } - /** * Checks to see whether all of the blocks within the given region are docked * @@ -1949,28 +1918,6 @@ function block_add_block_ui($page, $output) { return $bc; } -// Functions that have been deprecated by block_manager ======================= - -/** - * @deprecated since Moodle 2.0 - use $page->blocks->get_addable_blocks(); - * - * This function returns an array with the IDs of any blocks that you can add to your page. - * Parameters are passed by reference for speed; they are not modified at all. - * - * @param $page the page object. - * @param $blockmanager Not used. - * @return array of block type ids. - */ -function blocks_get_missing(&$page, &$blockmanager) { - debugging('blocks_get_missing is deprecated. Please use $page->blocks->get_addable_blocks() instead.', DEBUG_DEVELOPER); - $blocks = $page->blocks->get_addable_blocks(); - $ids = array(); - foreach ($blocks as $block) { - $ids[] = $block->id; - } - return $ids; -} - /** * Actually delete from the database any blocks that are currently on this page, * but which should not be there according to blocks_name_allowed_in_format. @@ -2102,23 +2049,6 @@ function blocks_set_visibility($instance, $page, $newvisibility) { $DB->insert_record('block_positions', $bp); } -/** - * @deprecated since 2.0 - * Delete all the blocks from a particular page. - * - * @param string $pagetype the page type. - * @param integer $pageid the page id. - * @return bool success or failure. - */ -function blocks_delete_all_on_page($pagetype, $pageid) { - global $DB; - - debugging('Call to deprecated function blocks_delete_all_on_page. ' . - 'This function cannot work any more. Doing nothing. ' . - 'Please update your code to use a block_manager method $PAGE->blocks->....', DEBUG_DEVELOPER); - return false; -} - /** * Get the block record for a particular blockid - that is, a particular type os block. *