Skip to content

Commit

Permalink
MDL-80231 mod_lti: deprecate end of life ltiservice classes
Browse files Browse the repository at this point in the history
The replacements now reside in core_ltix. This also includes a minor
docs change to some references in locallib.php.
  • Loading branch information
snake committed May 22, 2024
1 parent 432b1c6 commit 8393c53
Show file tree
Hide file tree
Showing 5 changed files with 188 additions and 24 deletions.
16 changes: 16 additions & 0 deletions mod/lti/classes/event/unknown_service_api_called.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*
* Event for when something happens with an unknown lti service API call.
*
* @deprecated since Moodle 4.5 use \core_ltix\event\unknown_service_api_called instead.
* @package mod_lti
* @since Moodle 2.6
* @copyright 2013 Adrian Greeve <adrian@moodle.com>
Expand All @@ -44,17 +45,23 @@ class unknown_service_api_called extends \core\event\base {
* Sets custom data used by event observers.
*
* @param \stdClass $data
* @deprecated since Moodle 4.5
*/
public function set_message_data(\stdClass $data) {
debugging('Class \mod_lti\event\unknown_service_api_called is deprecated, please use '.
'\core_ltix\event\unknown_service_api_called instead.', DEBUG_DEVELOPER);
$this->eventdata = $data;
}

/**
* Returns custom data for event observers.
*
* @return \stdClass
* @deprecated since Moodle 4.5
*/
public function get_message_data() {
debugging('Class \mod_lti\event\unknown_service_api_called is deprecated, please use '.
'\core_ltix\event\unknown_service_api_called instead.', DEBUG_DEVELOPER);
if ($this->is_restored()) {
throw new \coding_exception('Function get_message_data() can not be used on restored events.');
}
Expand All @@ -74,17 +81,23 @@ protected function init() {
* Returns localised description of what happened.
*
* @return string
* @deprecated since Moodle 4.5
*/
public function get_description() {
debugging('Class \mod_lti\event\unknown_service_api_called is deprecated, please use '.
'\core_ltix\event\unknown_service_api_called instead.', DEBUG_DEVELOPER);
return 'An unknown call to a service api was made.';
}

/**
* Returns localised general event name.
*
* @return string
* @deprecated since Moodle 4.5
*/
public static function get_name() {
debugging('Class \mod_lti\event\unknown_service_api_called is deprecated, please use '.
'\core_ltix\event\unknown_service_api_called instead.', DEBUG_DEVELOPER);
return get_string('ltiunknownserviceapicall', 'mod_lti');
}

Expand All @@ -94,8 +107,11 @@ public static function get_name() {
* Events cannot be deprecated in the normal fashion as they must remain to support historical data.
*
* @return boolean
* @deprecated since Moodle 4.5
*/
public static function is_deprecated() {
debugging('Class \mod_lti\event\unknown_service_api_called is deprecated, please use '.
'\core_ltix\event\unknown_service_api_called instead.', DEBUG_DEVELOPER);
return true;
}
}
38 changes: 38 additions & 0 deletions mod/lti/classes/local/ltiservice/resource_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
/**
* The mod_lti\local\ltiservice\resource_base class.
*
* @deprecated since Moodle 4.5 use \core_ltix\local\ltiservice\resource_base instead.
* @package mod_lti
* @since Moodle 2.8
* @copyright 2014 Vital Source Technologies http://vitalsource.com
Expand Down Expand Up @@ -73,9 +74,12 @@ abstract class resource_base {
* Class constructor.
*
* @param service_base $service Service instance
* @deprecated since Moodle 4.5
*/
public function __construct($service) {

debugging('Class \mod_lti\local\ltiservice\resource_base is deprecated, please use '.
'\core_ltix\local\ltiservice\resource_base instead.', DEBUG_DEVELOPER);
$this->service = $service;
$this->type = 'RestService';
$this->id = null;
Expand All @@ -92,9 +96,12 @@ public function __construct($service) {
* Get the resource ID.
*
* @return string
* @deprecated since Moodle 4.5
*/
public function get_id() {

debugging('Class \mod_lti\local\ltiservice\resource_base is deprecated, please use '.
'\core_ltix\local\ltiservice\resource_base instead.', DEBUG_DEVELOPER);
return $this->id;

}
Expand All @@ -103,9 +110,12 @@ public function get_id() {
* Get the resource template.
*
* @return string
* @deprecated since Moodle 4.5
*/
public function get_template() {

debugging('Class \mod_lti\local\ltiservice\resource_base is deprecated, please use '.
'\core_ltix\local\ltiservice\resource_base instead.', DEBUG_DEVELOPER);
return $this->template;

}
Expand All @@ -114,9 +124,12 @@ public function get_template() {
* Get the resource path.
*
* @return string
* @deprecated since Moodle 4.5
*/
public function get_path() {

debugging('Class \mod_lti\local\ltiservice\resource_base is deprecated, please use '.
'\core_ltix\local\ltiservice\resource_base instead.', DEBUG_DEVELOPER);
return $this->get_template();

}
Expand All @@ -125,9 +138,12 @@ public function get_path() {
* Get the resource type.
*
* @return string
* @deprecated since Moodle 4.5
*/
public function get_type() {

debugging('Class \mod_lti\local\ltiservice\resource_base is deprecated, please use '.
'\core_ltix\local\ltiservice\resource_base instead.', DEBUG_DEVELOPER);
return $this->type;

}
Expand All @@ -136,9 +152,12 @@ public function get_type() {
* Get the resource's service.
*
* @return service_base
* @deprecated since Moodle 4.5
*/
public function get_service() {

debugging('Class \mod_lti\local\ltiservice\resource_base is deprecated, please use '.
'\core_ltix\local\ltiservice\resource_base instead.', DEBUG_DEVELOPER);
return $this->service;

}
Expand All @@ -147,9 +166,12 @@ public function get_service() {
* Get the resource methods.
*
* @return array
* @deprecated since Moodle 4.5
*/
public function get_methods() {

debugging('Class \mod_lti\local\ltiservice\resource_base is deprecated, please use '.
'\core_ltix\local\ltiservice\resource_base instead.', DEBUG_DEVELOPER);
return $this->methods;

}
Expand All @@ -158,9 +180,12 @@ public function get_methods() {
* Get the resource media types.
*
* @return array
* @deprecated since Moodle 4.5
*/
public function get_formats() {

debugging('Class \mod_lti\local\ltiservice\resource_base is deprecated, please use '.
'\core_ltix\local\ltiservice\resource_base instead.', DEBUG_DEVELOPER);
return $this->formats;

}
Expand All @@ -169,9 +194,12 @@ public function get_formats() {
* Get the resource template variables.
*
* @return array
* @deprecated since Moodle 4.5
*/
public function get_variables() {

debugging('Class \mod_lti\local\ltiservice\resource_base is deprecated, please use '.
'\core_ltix\local\ltiservice\resource_base instead.', DEBUG_DEVELOPER);
return $this->variables;

}
Expand All @@ -180,8 +208,11 @@ public function get_variables() {
* Get the resource fully qualified endpoint.
*
* @return string
* @deprecated since Moodle 4.5
*/
public function get_endpoint() {
debugging('Class \mod_lti\local\ltiservice\resource_base is deprecated, please use '.
'\core_ltix\local\ltiservice\resource_base instead.', DEBUG_DEVELOPER);

$this->parse_template();
$template = preg_replace('/[\(\)]/', '', $this->get_template());
Expand All @@ -206,6 +237,7 @@ public function get_endpoint() {
* Execute the request for this resource.
*
* @param response $response Response object for this request.
* @deprecated since Moodle 4.5
*/
abstract public function execute($response);

Expand All @@ -217,9 +249,12 @@ abstract public function execute($response);
* @param string[] $scopes Array of scope(s) required for incoming request
*
* @return boolean
* @deprecated since Moodle 4.5
*/
public function check_tool($typeid, $body = null, $scopes = null) {

debugging('Class \mod_lti\local\ltiservice\resource_base is deprecated, please use '.
'\core_ltix\local\ltiservice\resource_base instead.', DEBUG_DEVELOPER);
$ok = $this->get_service()->check_tool($typeid, $body, $scopes);
if ($ok) {
if ($this->get_service()->get_tool_proxy()) {
Expand Down Expand Up @@ -350,9 +385,12 @@ public function get_permissions($ltitype) {
* @param string $value String to be parsed
*
* @return string
* @deprecated since Moodle 4.5
*/
public function parse_value($value) {

debugging('Class \mod_lti\local\ltiservice\resource_base is deprecated, please use '.
'\core_ltix\local\ltiservice\resource_base instead.', DEBUG_DEVELOPER);
return $value;

}
Expand Down
Loading

0 comments on commit 8393c53

Please sign in to comment.