How to migrate Web Service function?

How to migrate Web Service function?

by Rene P -
Number of replies: 0

     Basically I've found function  that will be implemented in the future version of Moodle, but I would like to have it right now. 

     So I checked changes of file and made changes accordingly (added lines to /enrol/manual/db/services.php and /enrol/manual/externallib.php), but the function isn't appearing in the list. As I've found out that all the services are inserted into table external_services in database, then I added new line as well: 

INSERT INTO mdl_external_functions(
id, name, classname, methodname, classpath, component, capabilities)
VALUES (99, 'enrol_manual_unenrol_users', 'enrol_manual_external', 'unenrol_users', 'enrol/manual/externallib.php', 'enrol_manual', 'enrol/manual:unenrol');

99 was randomly selected as DB doesn't offer a chance to add a line without identity for some reason.

      After that I went back to API documentation and my function was listed, but the problem is that is my test enviroment and in real enviroment I don't have access to database, so I can't add that line and not allowed to ask for admin over there to insert those lines. Is there a way to implement Web Service function without SQL insert and if yes, then how does Moodle find new functions?

      I am also supposed to make a couple of new functions. When I looked into changes, which Fábio Souto made for enrol_manual_unenrol_users, then I see Web Service functions are nothing more than changed versions of externallib.php, which are accessible outside of Moodle. Is that true or I have gotten something wrong? What I want is to create Web Service function, which suspends list of users from Moodle. Would I have to change /user/externallib.php file accordingly and again execute SQL insert with my function location and name?

Average of ratings: -