Wunderbyte-GmbH / moodle-local_wunderbyte_table

Wunderbyte Table
Other
4 stars 5 forks source link

Cannot find file [dirroot]/local/wunderbyte_table/externallib.php with external function implementation for local_wunderbyte_table\external\sort_rows::execute #57

Closed cnodegam closed 1 month ago

cnodegam commented 3 months ago

Moodle 4.3.4+ (Build: 20240510) PHP 8.0.30 Wunderbyte_table 2.0.6 (2024042600)

I want to add a function to a web service at Admin -> Server -> Web services -> External services -> line of my service -> Functions -> Add functions

For some reason, wunderbyte_table is being referenced there but fails with following error:

Coding error detected, it must be fixed by a programmer: Cannot find file [dirroot]/local/wunderbyte_table/externallib.php with external function implementation for local_wunderbyte_table\external\sort_rows::execute

[More information about this error](http://docs.moodle.org/403/en/error/debug/codingerror)
Debug info:
Error code: codingerror
Stack trace:

    line 70 of /lib/external/classes/external_api.php: coding_exception thrown
    line 199 of /admin/webservice/forms.php: call to core_external\external_api::external_function_info()
    line 217 of /lib/formslib.php: call to external_service_functions_form->definition()
    line 61 of /admin/webservice/service_functions.php: call to moodleform->__construct()

On my test system, when adding a file local/wunderbyte_table/classes/external/sort_rows.php with following minimal content:

<?php

namespace local_wunderbyte_table\external;

use core_external\external_api;
use core_external\external_function_parameters;

defined('MOODLE_INTERNAL') || die();

require_once($CFG->libdir . '/externallib.php');

class sort_rows extends external_api {

    public static function execute_parameters() {
        return new external_function_parameters(array());
    }

    public static function execute() {
    }

    public static function  execute_returns() {
        return null;
    }

}

the error disappears. I don't have that choice on the live systems.

It seems that commit https://github.com/Wunderbyte-GmbH/moodle-local_wunderbyte_table/commit/41b9617fc986bd815310e3c56f74d4115dcb413e missed that point. Please correct soon.

Kind regards

georgmaisser commented 3 months ago

Hi, Sorry for that, we didn't need the service in the end, because we used the existing "execute_action". My fix removes it and with the update, everything should work fine again. Will be in main soon, but of course, you can check out the branch with this commit already now.