You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9c0da43
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/apis/subsystems/external/writing-a-service.md
+28-2Lines changed: 28 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -464,18 +464,44 @@ Edit your `local/groupmanager/version.php` and increase the plugin version. This
464
464
465
465
## Deprecation {/* #deprecation */}
466
466
467
-
External functions deprecation process is slightly different from the standard deprecation. If you are interested in deprecating any of your external functions you should **also** (apart from the applicable points detailed in the [standard deprecation docs](/general/development/policies/deprecation)) create a `FUNCTIONNAME_is_deprecated()` method in your external function class. Return true if the external function is deprecated. This is an example:
467
+
The deprecation process for external functions is different from the [standard deprecation](/general/development/policies/deprecation) process. To deprecate an external function, you must do **both** of the following:
468
+
469
+
1. Create a `FUNCTIONNAME_is_deprecated()` method in your external function class, returning `true`. The web service framework uses this method to flag the function as deprecated.
470
+
1. Add the `@deprecated` PHPDoc tag, documenting the version it was deprecated in and the MDL issue, so that IDEs show the function as deprecated:
471
+
- When the whole class is deprecated (for example, a class with a single `execute()` external function), add the tag to the class PHPDoc.
472
+
- Otherwise, add the tag to each of the deprecated methods (`FUNCTIONNAME_parameters()`, `FUNCTIONNAME()` and `FUNCTIONNAME_returns()`).
468
473
469
474
```php
475
+
/**
476
+
* Create groups.
477
+
*
478
+
* @package local_groupmanager
479
+
* @copyright 2026 Your Name <you@example.com>
480
+
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
481
+
* @deprecated since 5.3 MDL-XXXXX
482
+
*/
483
+
class create_groups extends \core_external\external_api {
484
+
// ...
485
+
470
486
/**
471
487
* Mark the function as deprecated.
488
+
*
472
489
* @return bool
473
490
*/
474
-
public static function execute_is_deprecated() {
491
+
public static function execute_is_deprecated(): bool {
475
492
return true;
476
493
}
494
+
}
477
495
```
478
496
497
+
:::danger
498
+
499
+
Do **not** add the `\core\attribute\deprecated` attribute, nor call `\core\deprecation::emit_deprecation()` or `\core\deprecation::emit_deprecation_if_present()`, in external functions. The `FUNCTIONNAME_is_deprecated()` method is the only mechanism needed to mark them as deprecated at runtime.
500
+
501
+
:::
502
+
503
+
The remaining applicable points of the [standard deprecation](/general/development/policies/deprecation) process (such as creating the follow-up issue for the final deprecation and adding an upgrade note) still apply.
Copy file name to clipboardExpand all lines: general/development/policies/deprecation/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,7 @@ debugging('foobar() is deprecated. Please use foobar::blah() instead.', DEBUG_DE
99
99
- Unit tests that call the function should have `assertDebuggingCalled()` added to allow them to continue running.
100
100
- If the deprecated function has been replaced with a new function, ideally the new function should be called from the deprecated function, so that the new functionality is used. This will make maintenance easier moving forward.
101
101
- A `@deprecated` tag should be added to the PHPDoc for the function description so that IDEs describing the function will note that it is deprecated, documenting which version it was deprecated in and the MDL issue associated with it. See the guidelines in [Coding style](../codingstyle/index.md#deprecated-and-todo).
102
-
- If the function is an external function, then an additional deprecation-specific method needs to be created and set to return true. See the [adding a web service to a plugin](/docs/apis/subsystems/external/writing-a-service#deprecation) docs on that process. You should continue to add the `@deprecated since x.x` tag to the docs of all three of the relevant external methods (parameters, main method, returns) to make it clear to IDEs that the function is deprecated.
102
+
- If the function is an external function, the process is different from the one described above. Follow the [external functions deprecation](/docs/apis/subsystems/external/writing-a-service#deprecation) docs instead.
103
103
- There will need to be an issue associated with the initial part of the deprecation. A second issue needs to be created to finish the job. The first issue will be linked to second issue. The second issue needs to be a sub-task of an appropriate [deprecation META](https://moodle.atlassian.net/issues/?jql=%28summary%20~%20%22meta%22%20or%20type%20%3D%20Epic%29%20AND%20summary%20~%20%22together%20deprecated%22%20order%20by%20created&runQuery=true&clear=true).
Copy file name to clipboardExpand all lines: versioned_docs/version-4.5/apis/subsystems/external/writing-a-service.md
+28-2Lines changed: 28 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -464,18 +464,44 @@ Edit your `local/groupmanager/version.php` and increase the plugin version. This
464
464
465
465
## Deprecation {/* #deprecation */}
466
466
467
-
External functions deprecation process is slightly different from the standard deprecation. If you are interested in deprecating any of your external functions you should **also** (apart from the applicable points detailed in the [standard deprecation docs](/general/development/policies/deprecation)) create a `FUNCTIONNAME_is_deprecated()` method in your external function class. Return true if the external function is deprecated. This is an example:
467
+
The deprecation process for external functions is different from the [standard deprecation](/general/development/policies/deprecation) process. To deprecate an external function, you must do **both** of the following:
468
+
469
+
1. Create a `FUNCTIONNAME_is_deprecated()` method in your external function class, returning `true`. The web service framework uses this method to flag the function as deprecated.
470
+
1. Add the `@deprecated` PHPDoc tag, documenting the version it was deprecated in and the MDL issue, so that IDEs show the function as deprecated:
471
+
- When the whole class is deprecated (for example, a class with a single `execute()` external function), add the tag to the class PHPDoc.
472
+
- Otherwise, add the tag to each of the deprecated methods (`FUNCTIONNAME_parameters()`, `FUNCTIONNAME()` and `FUNCTIONNAME_returns()`).
468
473
469
474
```php
475
+
/**
476
+
* Create groups.
477
+
*
478
+
* @package local_groupmanager
479
+
* @copyright 2026 Your Name <you@example.com>
480
+
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
481
+
* @deprecated since 4.5 MDL-XXXXX
482
+
*/
483
+
class create_groups extends \core_external\external_api {
484
+
// ...
485
+
470
486
/**
471
487
* Mark the function as deprecated.
488
+
*
472
489
* @return bool
473
490
*/
474
-
public static function execute_is_deprecated() {
491
+
public static function execute_is_deprecated(): bool {
475
492
return true;
476
493
}
494
+
}
477
495
```
478
496
497
+
:::danger
498
+
499
+
Do **not** add the `\core\attribute\deprecated` attribute, nor call `\core\deprecation::emit_deprecation()` or `\core\deprecation::emit_deprecation_if_present()`, in external functions. The `FUNCTIONNAME_is_deprecated()` method is the only mechanism needed to mark them as deprecated at runtime.
500
+
501
+
:::
502
+
503
+
The remaining applicable points of the [standard deprecation](/general/development/policies/deprecation) process (such as creating the follow-up issue for the final deprecation and adding an upgrade note) still apply.
Copy file name to clipboardExpand all lines: versioned_docs/version-5.0/apis/subsystems/external/writing-a-service.md
+28-2Lines changed: 28 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -464,18 +464,44 @@ Edit your `local/groupmanager/version.php` and increase the plugin version. This
464
464
465
465
## Deprecation {/* #deprecation */}
466
466
467
-
External functions deprecation process is slightly different from the standard deprecation. If you are interested in deprecating any of your external functions you should **also** (apart from the applicable points detailed in the [standard deprecation docs](/general/development/policies/deprecation)) create a `FUNCTIONNAME_is_deprecated()` method in your external function class. Return true if the external function is deprecated. This is an example:
467
+
The deprecation process for external functions is different from the [standard deprecation](/general/development/policies/deprecation) process. To deprecate an external function, you must do **both** of the following:
468
+
469
+
1. Create a `FUNCTIONNAME_is_deprecated()` method in your external function class, returning `true`. The web service framework uses this method to flag the function as deprecated.
470
+
1. Add the `@deprecated` PHPDoc tag, documenting the version it was deprecated in and the MDL issue, so that IDEs show the function as deprecated:
471
+
- When the whole class is deprecated (for example, a class with a single `execute()` external function), add the tag to the class PHPDoc.
472
+
- Otherwise, add the tag to each of the deprecated methods (`FUNCTIONNAME_parameters()`, `FUNCTIONNAME()` and `FUNCTIONNAME_returns()`).
468
473
469
474
```php
475
+
/**
476
+
* Create groups.
477
+
*
478
+
* @package local_groupmanager
479
+
* @copyright 2026 Your Name <you@example.com>
480
+
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
481
+
* @deprecated since 5.0 MDL-XXXXX
482
+
*/
483
+
class create_groups extends \core_external\external_api {
484
+
// ...
485
+
470
486
/**
471
487
* Mark the function as deprecated.
488
+
*
472
489
* @return bool
473
490
*/
474
-
public static function execute_is_deprecated() {
491
+
public static function execute_is_deprecated(): bool {
475
492
return true;
476
493
}
494
+
}
477
495
```
478
496
497
+
:::danger
498
+
499
+
Do **not** add the `\core\attribute\deprecated` attribute, nor call `\core\deprecation::emit_deprecation()` or `\core\deprecation::emit_deprecation_if_present()`, in external functions. The `FUNCTIONNAME_is_deprecated()` method is the only mechanism needed to mark them as deprecated at runtime.
500
+
501
+
:::
502
+
503
+
The remaining applicable points of the [standard deprecation](/general/development/policies/deprecation) process (such as creating the follow-up issue for the final deprecation and adding an upgrade note) still apply.
Copy file name to clipboardExpand all lines: versioned_docs/version-5.1/apis/subsystems/external/writing-a-service.md
+28-2Lines changed: 28 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -464,18 +464,44 @@ Edit your `local/groupmanager/version.php` and increase the plugin version. This
464
464
465
465
## Deprecation {/* #deprecation */}
466
466
467
-
External functions deprecation process is slightly different from the standard deprecation. If you are interested in deprecating any of your external functions you should **also** (apart from the applicable points detailed in the [standard deprecation docs](/general/development/policies/deprecation)) create a `FUNCTIONNAME_is_deprecated()` method in your external function class. Return true if the external function is deprecated. This is an example:
467
+
The deprecation process for external functions is different from the [standard deprecation](/general/development/policies/deprecation) process. To deprecate an external function, you must do **both** of the following:
468
+
469
+
1. Create a `FUNCTIONNAME_is_deprecated()` method in your external function class, returning `true`. The web service framework uses this method to flag the function as deprecated.
470
+
1. Add the `@deprecated` PHPDoc tag, documenting the version it was deprecated in and the MDL issue, so that IDEs show the function as deprecated:
471
+
- When the whole class is deprecated (for example, a class with a single `execute()` external function), add the tag to the class PHPDoc.
472
+
- Otherwise, add the tag to each of the deprecated methods (`FUNCTIONNAME_parameters()`, `FUNCTIONNAME()` and `FUNCTIONNAME_returns()`).
468
473
469
474
```php
475
+
/**
476
+
* Create groups.
477
+
*
478
+
* @package local_groupmanager
479
+
* @copyright 2026 Your Name <you@example.com>
480
+
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
481
+
* @deprecated since 5.1 MDL-XXXXX
482
+
*/
483
+
class create_groups extends \core_external\external_api {
484
+
// ...
485
+
470
486
/**
471
487
* Mark the function as deprecated.
488
+
*
472
489
* @return bool
473
490
*/
474
-
public static function execute_is_deprecated() {
491
+
public static function execute_is_deprecated(): bool {
475
492
return true;
476
493
}
494
+
}
477
495
```
478
496
497
+
:::danger
498
+
499
+
Do **not** add the `\core\attribute\deprecated` attribute, nor call `\core\deprecation::emit_deprecation()` or `\core\deprecation::emit_deprecation_if_present()`, in external functions. The `FUNCTIONNAME_is_deprecated()` method is the only mechanism needed to mark them as deprecated at runtime.
500
+
501
+
:::
502
+
503
+
The remaining applicable points of the [standard deprecation](/general/development/policies/deprecation) process (such as creating the follow-up issue for the final deprecation and adding an upgrade note) still apply.
Copy file name to clipboardExpand all lines: versioned_docs/version-5.2/apis/subsystems/external/writing-a-service.md
+28-2Lines changed: 28 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -464,18 +464,44 @@ Edit your `local/groupmanager/version.php` and increase the plugin version. This
464
464
465
465
## Deprecation {/* #deprecation */}
466
466
467
-
External functions deprecation process is slightly different from the standard deprecation. If you are interested in deprecating any of your external functions you should **also** (apart from the applicable points detailed in the [standard deprecation docs](/general/development/policies/deprecation)) create a `FUNCTIONNAME_is_deprecated()` method in your external function class. Return true if the external function is deprecated. This is an example:
467
+
The deprecation process for external functions is different from the [standard deprecation](/general/development/policies/deprecation) process. To deprecate an external function, you must do **both** of the following:
468
+
469
+
1. Create a `FUNCTIONNAME_is_deprecated()` method in your external function class, returning `true`. The web service framework uses this method to flag the function as deprecated.
470
+
1. Add the `@deprecated` PHPDoc tag, documenting the version it was deprecated in and the MDL issue, so that IDEs show the function as deprecated:
471
+
- When the whole class is deprecated (for example, a class with a single `execute()` external function), add the tag to the class PHPDoc.
472
+
- Otherwise, add the tag to each of the deprecated methods (`FUNCTIONNAME_parameters()`, `FUNCTIONNAME()` and `FUNCTIONNAME_returns()`).
468
473
469
474
```php
475
+
/**
476
+
* Create groups.
477
+
*
478
+
* @package local_groupmanager
479
+
* @copyright 2026 Your Name <you@example.com>
480
+
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
481
+
* @deprecated since 5.2 MDL-XXXXX
482
+
*/
483
+
class create_groups extends \core_external\external_api {
484
+
// ...
485
+
470
486
/**
471
487
* Mark the function as deprecated.
488
+
*
472
489
* @return bool
473
490
*/
474
-
public static function execute_is_deprecated() {
491
+
public static function execute_is_deprecated(): bool {
475
492
return true;
476
493
}
494
+
}
477
495
```
478
496
497
+
:::danger
498
+
499
+
Do **not** add the `\core\attribute\deprecated` attribute, nor call `\core\deprecation::emit_deprecation()` or `\core\deprecation::emit_deprecation_if_present()`, in external functions. The `FUNCTIONNAME_is_deprecated()` method is the only mechanism needed to mark them as deprecated at runtime.
500
+
501
+
:::
502
+
503
+
The remaining applicable points of the [standard deprecation](/general/development/policies/deprecation) process (such as creating the follow-up issue for the final deprecation and adding an upgrade note) still apply.
0 commit comments