diff --git a/grade/grading/form/guide/db/services.php b/grade/grading/form/guide/db/services.php index 88ea5fda701..545558c96f7 100644 --- a/grade/grading/form/guide/db/services.php +++ b/grade/grading/form/guide/db/services.php @@ -27,7 +27,6 @@ defined('MOODLE_INTERNAL') || die; $functions = [ 'gradingform_guide_grader_gradingpanel_fetch' => [ 'classname' => 'gradingform_guide\\grades\\grader\\gradingpanel\\external\\fetch', - 'methodname' => 'execute', 'description' => 'Fetch the data required to display the grader grading panel, ' . 'creating the grade item if required', 'type' => 'write', @@ -35,7 +34,6 @@ $functions = [ ], 'gradingform_guide_grader_gradingpanel_store' => [ 'classname' => 'gradingform_guide\\grades\\grader\\gradingpanel\\external\\store', - 'methodname' => 'execute', 'description' => 'Store the grading data for a user from the grader grading panel.', 'type' => 'write', 'ajax' => true, diff --git a/grade/grading/form/rubric/db/services.php b/grade/grading/form/rubric/db/services.php index 08b90a960f9..7cdd0bda39c 100644 --- a/grade/grading/form/rubric/db/services.php +++ b/grade/grading/form/rubric/db/services.php @@ -27,7 +27,6 @@ defined('MOODLE_INTERNAL') || die; $functions = [ 'gradingform_rubric_grader_gradingpanel_fetch' => [ 'classname' => 'gradingform_rubric\\grades\\grader\\gradingpanel\\external\\fetch', - 'methodname' => 'execute', 'description' => 'Fetch the data required to display the grader grading panel, ' . 'creating the grade item if required', 'type' => 'write', @@ -35,7 +34,6 @@ $functions = [ ], 'gradingform_rubric_grader_gradingpanel_store' => [ 'classname' => 'gradingform_rubric\\grades\\grader\\gradingpanel\\external\\store', - 'methodname' => 'execute', 'description' => 'Store the grading data for a user from the grader grading panel.', 'type' => 'write', 'ajax' => true, diff --git a/lib/db/services.php b/lib/db/services.php index 0b7f5949432..6c95c4c2d1a 100644 --- a/lib/db/services.php +++ b/lib/db/services.php @@ -289,7 +289,6 @@ $functions = array( ], 'core_calendar_get_calendar_export_token' => [ 'classname' => 'core_calendar\external\export\token', - 'methodname' => 'execute', 'description' => 'Return the auth token required for exporting a calendar.', 'type' => 'read', 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE), @@ -817,14 +816,12 @@ $functions = array( ), 'core_files_delete_draft_files' => array( 'classname' => 'core_files\external\delete\draft', - 'methodname' => 'execute', 'description' => 'Delete the indicated files (or directories) from a user draft file area.', 'type' => 'write', 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE), ), 'core_files_get_unused_draft_itemid' => array( 'classname' => 'core_files\external\get\unused_draft', - 'methodname' => 'execute', 'description' => 'Generate a new draft itemid for the current user.', 'type' => 'write', 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE), @@ -840,7 +837,6 @@ $functions = array( ), 'core_form_dynamic_form' => array( 'classname' => 'core_form\external\dynamic_form', - 'methodname' => 'execute', 'description' => 'Process submission of a dynamic (modal) form', 'type' => 'write', 'ajax' => true, @@ -908,7 +904,6 @@ $functions = array( ), 'core_grades_grader_gradingpanel_point_fetch' => [ 'classname' => 'core_grades\\grades\\grader\\gradingpanel\\point\\external\\fetch', - 'methodname' => 'execute', 'description' => 'Fetch the data required to display the grader grading panel for simple grading, ' . 'creating the grade item if required', 'type' => 'write', @@ -917,7 +912,6 @@ $functions = array( ], 'core_grades_grader_gradingpanel_point_store' => [ 'classname' => 'core_grades\\grades\\grader\\gradingpanel\\point\\external\\store', - 'methodname' => 'execute', 'description' => 'Store the data required to display the grader grading panel for simple grading', 'type' => 'write', 'ajax' => true, @@ -925,7 +919,6 @@ $functions = array( ], 'core_grades_grader_gradingpanel_scale_fetch' => [ 'classname' => 'core_grades\\grades\\grader\\gradingpanel\\scale\\external\\fetch', - 'methodname' => 'execute', 'description' => 'Fetch the data required to display the grader grading panel for scale-based grading, ' . 'creating the grade item if required', 'type' => 'write', @@ -934,7 +927,6 @@ $functions = array( ], 'core_grades_grader_gradingpanel_scale_store' => [ 'classname' => 'core_grades\\grades\\grader\\gradingpanel\\scale\\external\\store', - 'methodname' => 'execute', 'description' => 'Store the data required to display the grader grading panel for scale-based grading', 'type' => 'write', 'ajax' => true, @@ -1558,7 +1550,6 @@ $functions = array( ), 'core_output_load_fontawesome_icon_system_map' => array( 'classname' => 'core\external\output\icon_system\load_fontawesome_map', - 'methodname' => 'execute', 'description' => 'Load the mapping of moodle pix names to fontawesome icon names', 'type' => 'read', 'loginrequired' => false, @@ -1749,7 +1740,6 @@ $functions = array( ), 'core_user_search_identity' => array( 'classname' => '\core_user\external\search_identity', - 'methodname' => 'execute', 'description' => 'Return list of users identities matching the given criteria in their name or other identity fields.', 'type' => 'read', 'capabilities' => 'moodle/user:viewalldetails', @@ -2635,7 +2625,6 @@ $functions = array( 'core_block_fetch_addable_blocks' => array( 'classname' => 'core_block\external\fetch_addable_blocks', - 'methodname' => 'execute', 'description' => 'Returns all addable blocks in a given page.', 'type' => 'read', 'capabilities' => 'moodle/site:manageblocks', @@ -2711,7 +2700,6 @@ $functions = array( ], 'core_table_get_dynamic_table_content' => [ 'classname' => 'core_table\external\dynamic\get', - 'methodname' => 'execute', 'description' => 'Get the dynamic table content raw html', 'type' => 'read', 'ajax' => true, @@ -2719,7 +2707,6 @@ $functions = array( ], 'core_xapi_statement_post' => [ 'classname' => 'core_xapi\external\post_statement', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'Post an xAPI statement.', 'type' => 'write', @@ -2729,7 +2716,6 @@ $functions = array( ], 'core_contentbank_delete_content' => [ 'classname' => 'core_contentbank\external\delete_content', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'Delete a content from the content bank.', 'type' => 'write', @@ -2738,7 +2724,6 @@ $functions = array( ], 'core_contentbank_rename_content' => [ 'classname' => 'core_contentbank\external\rename_content', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'Rename a content in the content bank.', 'type' => 'write', @@ -2747,7 +2732,6 @@ $functions = array( ], 'core_contentbank_set_content_visibility' => [ 'classname' => 'core_contentbank\external\set_content_visibility', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'Set the visibility of a content in the content bank.', 'type' => 'write', @@ -2756,7 +2740,6 @@ $functions = array( ], 'core_create_userfeedback_action_record' => [ 'classname' => 'core\external\record_userfeedback_action', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'Record the action that the user takes in the user feedback notification for future use.', 'type' => 'write', @@ -2765,7 +2748,6 @@ $functions = array( ], 'core_payment_get_available_gateways' => [ 'classname' => 'core_payment\external\get_available_gateways', - 'methodname' => 'execute', 'description' => 'Get the list of payment gateways that support the given component/area', 'type' => 'read', 'ajax' => true, diff --git a/lib/upgrade.txt b/lib/upgrade.txt index 5a31aa433ba..3de48ed9063 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -118,6 +118,8 @@ information provided here is intended especially for developers. * The behat transformation 'string time to timestamp' no longer supports datetime format. If provided, the format must be strftime compatible. Example: - I should see "##tomorrow noon##%A, %d %B %Y, %I:%M %p##" +* External functions implementation classes should use 'execute' as the method name, in which case the + 'methodname' property should not be specified in db/services.php file. === 3.10 === * PHPUnit has been upgraded to 8.5. That comes with a few changes: diff --git a/lib/upgradelib.php b/lib/upgradelib.php index 2b7898a5309..35c1cc8c2c0 100644 --- a/lib/upgradelib.php +++ b/lib/upgradelib.php @@ -1217,6 +1217,7 @@ function external_update_descriptions($component) { $function = $functions[$dbfunction->name]; unset($functions[$dbfunction->name]); $function['classpath'] = empty($function['classpath']) ? null : $function['classpath']; + $function['methodname'] = $function['methodname'] ?? 'execute'; $update = false; if ($dbfunction->classname != $function['classname']) { @@ -1266,7 +1267,7 @@ function external_update_descriptions($component) { $dbfunction = new stdClass(); $dbfunction->name = $fname; $dbfunction->classname = $function['classname']; - $dbfunction->methodname = $function['methodname']; + $dbfunction->methodname = $function['methodname'] ?? 'execute'; $dbfunction->classpath = empty($function['classpath']) ? null : $function['classpath']; $dbfunction->component = $component; $dbfunction->capabilities = array_key_exists('capabilities', $function)?$function['capabilities']:''; diff --git a/media/player/videojs/db/services.php b/media/player/videojs/db/services.php index e96d97f2a4d..56339a4d8fd 100644 --- a/media/player/videojs/db/services.php +++ b/media/player/videojs/db/services.php @@ -27,7 +27,6 @@ defined('MOODLE_INTERNAL') || die; $functions = [ 'media_videojs_get_language' => [ 'classname' => 'media_videojs\external\get_language', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'get language.', 'type' => 'read', diff --git a/mod/glossary/db/services.php b/mod/glossary/db/services.php index 1584e012a48..2614b9143c5 100644 --- a/mod/glossary/db/services.php +++ b/mod/glossary/db/services.php @@ -164,7 +164,6 @@ $functions = array( 'mod_glossary_delete_entry' => [ 'classname' => 'mod_glossary\external\delete_entry', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'Delete the given entry from the glossary.', 'type' => 'write', @@ -173,7 +172,6 @@ $functions = array( 'mod_glossary_update_entry' => [ 'classname' => 'mod_glossary\external\update_entry', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'Updates the given glossary entry.', 'type' => 'write', @@ -182,7 +180,6 @@ $functions = array( 'mod_glossary_prepare_entry_for_edition' => [ 'classname' => 'mod_glossary\external\prepare_entry', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'Prepares the given entry for edition returning draft item areas and file areas information.', 'type' => 'read', diff --git a/mod/h5pactivity/db/services.php b/mod/h5pactivity/db/services.php index 46d45b1bdea..4da90f53536 100644 --- a/mod/h5pactivity/db/services.php +++ b/mod/h5pactivity/db/services.php @@ -28,7 +28,6 @@ defined('MOODLE_INTERNAL') || die; $functions = [ 'mod_h5pactivity_get_h5pactivity_access_information' => [ 'classname' => 'mod_h5pactivity\external\get_h5pactivity_access_information', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'Return access information for a given h5p activity.', 'type' => 'read', @@ -37,7 +36,6 @@ $functions = [ ], 'mod_h5pactivity_view_h5pactivity' => [ 'classname' => 'mod_h5pactivity\external\view_h5pactivity', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'Trigger the course module viewed event and update the module completion status.', 'type' => 'write', @@ -46,7 +44,6 @@ $functions = [ ], 'mod_h5pactivity_get_attempts' => [ 'classname' => 'mod_h5pactivity\external\get_attempts', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'Return the information needed to list a user attempts.', 'type' => 'read', @@ -55,7 +52,6 @@ $functions = [ ], 'mod_h5pactivity_get_results' => [ 'classname' => 'mod_h5pactivity\external\get_results', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'Return the information needed to list a user attempt results.', 'type' => 'read', @@ -64,7 +60,6 @@ $functions = [ ], 'mod_h5pactivity_get_h5pactivities_by_courses' => [ 'classname' => 'mod_h5pactivity\external\get_h5pactivities_by_courses', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'Returns a list of h5p activities in a list of provided courses, if no list is provided all h5p activities @@ -75,7 +70,6 @@ $functions = [ ], 'mod_h5pactivity_log_report_viewed' => [ 'classname' => 'mod_h5pactivity\external\log_report_viewed', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'Log that the h5pactivity was viewed.', 'type' => 'write', @@ -83,7 +77,6 @@ $functions = [ ], 'mod_h5pactivity_get_user_attempts' => [ 'classname' => 'mod_h5pactivity\external\get_user_attempts', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'Return the information needed to list all enrolled user attempts.', 'type' => 'read', diff --git a/payment/gateway/paypal/db/services.php b/payment/gateway/paypal/db/services.php index f1986c6ba44..0d2a3abddb8 100644 --- a/payment/gateway/paypal/db/services.php +++ b/payment/gateway/paypal/db/services.php @@ -27,7 +27,6 @@ defined('MOODLE_INTERNAL') || die(); $functions = [ 'paygw_paypal_get_config_for_js' => [ 'classname' => 'paygw_paypal\external\get_config_for_js', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'Returns the configuration settings to be used in js', 'type' => 'read', @@ -35,7 +34,6 @@ $functions = [ ], 'paygw_paypal_create_transaction_complete' => [ 'classname' => 'paygw_paypal\external\transaction_complete', - 'methodname' => 'execute', 'classpath' => '', 'description' => 'Takes care of what needs to be done when a PayPal transaction comes back as complete.', 'type' => 'write',