Skip to content

Commit

Permalink
MDL-76052 webservice_xmlrpc: Remove it completely from core
Browse files Browse the repository at this point in the history
Normal removal procedure:
  - Remove the plugin completely from core.
  - Document it in the webservices upgrade.txt file.
  - Add a core upgrade step to proceed to remove any configuration
    if the plugin has not been re-installed manually.

Plus:
  - Remove a few remaining uses in the hub/sites registration scripts,
    that were moved from xmlrpc to hand.made rest calls by MDL-31436
    (Moodle 3.4.1 and up) and never removed then.
  - Remove the php-xmlrpc extension as a recommendation in composer.
  - Remove "xmlrpc" from various comments, trivial cleanup.

Note:
  - While working on this MDL-76078 has been created about to
    fix a serious design problem detected (it does not affect
    functionality). That's out from this issue scope.
  • Loading branch information
stronk7 committed Nov 4, 2022
1 parent fee1b8c commit df227f3
Show file tree
Hide file tree
Showing 22 changed files with 38 additions and 1,171 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"ext-sqlsrv": "Needed when Moodle uses MS SQL Server database.",
"ext-oci8": "Needed when Moodle uses Oracle database.",
"ext-tokenizer": "Enabling Tokenizer PHP extension is recommended, it improves Moodle Networking functionality.",
"ext-xmlrpc": "Enabling XMLRPC PHP extension is useful for web services and Moodle networking.",
"ext-soap": "Enabling SOAP PHP extension is useful for web services and some plugins.",
"ext-sodium": "Enabling Sodium PHP extension is recommended, it is used by Moodle encryption API.",
"ext-exif": "Enabling Exif PHP extension is recommended, it is used by Moodle to parse image meta data."
Expand Down
3 changes: 1 addition & 2 deletions lib/classes/hub/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
namespace core\hub;
defined('MOODLE_INTERNAL') || die();

use webservice_xmlrpc_client;
use moodle_exception;
use curl;
use stdClass;
Expand Down Expand Up @@ -370,4 +369,4 @@ public static function download_course_backup($hubcourseid, $path) {
public static function upload_course_backup($hubcourseid, \stored_file $backupfile) {
debugging("This function has been deprecated as part of the Moodle.net sunsetting process.");
}
}
}
4 changes: 2 additions & 2 deletions lib/classes/plugin_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1745,7 +1745,7 @@ public static function is_deleted_standard_plugin($type, $name) {
'binarius', 'boxxie', 'brick', 'canvas', 'formal_white', 'formfactor', 'fusion', 'leatherbound',
'magazine', 'mymobile', 'nimble', 'nonzero', 'overlay', 'serenity', 'sky_high', 'splash',
'standard', 'standardold'),
'webservice' => array('amf'),
'webservice' => array('amf', 'xmlrpc'),
);

if (!isset($plugins[$type])) {
Expand Down Expand Up @@ -2047,7 +2047,7 @@ public static function standard_plugins_list($type) {
),

'webservice' => array(
'rest', 'soap', 'xmlrpc'
'rest', 'soap'
),

'workshopallocation' => array(
Expand Down
4 changes: 0 additions & 4 deletions lib/classes/plugininfo/webservice.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ public function load_settings(part_of_admin_tree $adminroot, $parentnodename, $h
}

public function is_uninstall_allowed() {
// The xmlrpc plugin contains webservice_xmlrpc_client (used by core).
if ($this->name == 'xmlrpc') {
return false;
}
return true;
}
}
26 changes: 26 additions & 0 deletions lib/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3005,5 +3005,31 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2022102800.01);
}

if ($oldversion < 2022110600.00) {
// If webservice_xmlrpc isn't any longer installed, remove its configuration,
// capabilities and presence in other settings.
if (!file_exists($CFG->dirroot . '/webservice/xmlrpc/version.php')) {
// No DB structures to delete in this plugin.

// Remove capabilities.
capabilities_cleanup('webservice_xmlrpc');

// Remove own configuration.
unset_all_config_for_plugin('webservice_xmlrpc');

// Remove it from the enabled protocols if it was there.
$protos = get_config('core', 'webserviceprotocols');
$protoarr = explode(',', $protos);
$protoarr = array_filter($protoarr, function($ele) {
return trim($ele) !== 'xmlrpc';
});
$protos = implode(',', $protoarr);
set_config('webserviceprotocols', $protos);
}

// Main savepoint reached.
upgrade_main_savepoint(true, 2022110600.00);
}

return true;
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

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

$version = 2022110400.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2022110600.00; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '4.1dev+ (Build: 20221104)'; // Human-friendly version name
Expand Down
2 changes: 1 addition & 1 deletion webservice/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ function __construct($debuginfo) {
/**
* Check if a protocol is enabled
*
* @param string $protocol name of WS protocol ('rest', 'soap', 'xmlrpc'...)
* @param string $protocol name of WS protocol ('rest', 'soap', ...)
* @return bool true if the protocol is enabled
*/
function webservice_protocol_is_enabled($protocol) {
Expand Down
9 changes: 7 additions & 2 deletions webservice/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ information provided here is intended especially for developers.

This information is intended for authors of webservices, not people writing webservice clients.

=== 4.1 ===

* The XMLRPC webservice (protocol) has been completely removed. It's now available in the plugins directory.

=== 4.0 ===

* User access related exceptions have been changed to use the moodle_exception class instead of the generic webservice_access_exception,
the main reason for this change is to allow clients to implement some code logic against an access error.
* User access related exceptions have been changed to use the moodle_exception class instead of the
generic webservice_access_exception, the main reason for this change is to allow clients to
implement some code logic against an access error.

=== 3.11 ===

Expand Down
46 changes: 0 additions & 46 deletions webservice/xmlrpc/classes/privacy/provider.php

This file was deleted.

36 changes: 0 additions & 36 deletions webservice/xmlrpc/db/access.php

This file was deleted.

29 changes: 0 additions & 29 deletions webservice/xmlrpc/lang/en/webservice_xmlrpc.php

This file was deleted.

138 changes: 0 additions & 138 deletions webservice/xmlrpc/lib.php

This file was deleted.

Loading

0 comments on commit df227f3

Please sign in to comment.