Skip to content

Commit

Permalink
MDL-81924 core: Remove unused AWS classes and tests
Browse files Browse the repository at this point in the history
Originally implemented as MDL-80962.
  • Loading branch information
safatshahin authored and mickhawkins committed Aug 26, 2024
1 parent 61f2ad8 commit c663ac8
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 151 deletions.
9 changes: 9 additions & 0 deletions .upgradenotes/MDL-80962-2024071606563987.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
issueNumber: MDL-80962
notes:
core:
- message: >
The following classes are deprecated as they are handled by core_sms API and smsgateway_aws plugin:
- admin_settings_aws_region (lib/classes/aws/admin_settings_aws_region.php)
- aws_helper (lib/classes/aws/aws_helper.php)
- client_factory (lib/classes/aws/client_factory.php)
type: deprecated
8 changes: 8 additions & 0 deletions .upgradenotes/MDL-80962-2024071606591847.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
issueNumber: MDL-80962
notes:
core:
- message: >
The following test classes are removed as their base classes are deprecated:
- admin_settings_aws_region_test (lib/tests/aws/admin_settings_aws_region_test.php)
- aws_helper_test (lib/tests/aws/aws_helper_test.php)
type: removed
18 changes: 9 additions & 9 deletions lib/classes/aws/admin_settings_aws_region.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Admin setting for AWS regions.
*
* @package core
* @author Dmitrii Metelkin <[email protected]>
* @copyright 2020 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace core\aws;

defined('MOODLE_INTERNAL') || die();
Expand All @@ -35,6 +26,8 @@
* @package core
* @copyright 2020 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @deprecated Since Moodle 4.5
* @todo MDL-82459 Final deprecation in Moodle 5.0.
*/
class admin_settings_aws_region extends \admin_setting_configtext {

Expand All @@ -44,8 +37,15 @@ class admin_settings_aws_region extends \admin_setting_configtext {
* @param mixed $data array or string depending on setting
* @param string $query
* @return string
* @deprecated Since Moodle 4.5
*/
#[\core\attribute\deprecated(
'admin_settings_aws_region::output_html()',
since: '4.5',
mdl: 'MDL-80962',
)]
public function output_html($data, $query='') {
\core\deprecation::emit_deprecation_if_present([$this, __FUNCTION__]);
global $CFG, $OUTPUT;

$default = $this->get_defaultsetting();
Expand Down
32 changes: 23 additions & 9 deletions lib/classes/aws/aws_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* AWS helper class. Contains useful functions when interacting with the SDK.
*
* @package core
* @author Peter Burnett <[email protected]>
* @copyright 2020 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace core\aws;

use Aws\CommandInterface;
Expand All @@ -34,15 +25,24 @@
*
* @copyright 2020 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @deprecated Since Moodle 4.5
* @todo MDL-82459 Final deprecation in Moodle 5.0.
*/
class aws_helper {

/**
* This creates a proxy string suitable for use with the AWS SDK.
*
* @return string the string to use for proxy settings.
* @deprecated Since Moodle 4.5
*/
#[\core\attribute\deprecated(
'aws_helper::get_proxy_string()',
since: '4.5',
mdl: 'MDL-80962',
)]
public static function get_proxy_string(): string {
\core\deprecation::emit_deprecation_if_present(__FUNCTION__);
global $CFG;
$proxy = '';
if (empty($CFG->proxytype)) {
Expand Down Expand Up @@ -71,8 +71,15 @@ public static function get_proxy_string(): string {
*
* @param AwsClient $client
* @return AwsClient
* @deprecated Since Moodle 4.5
*/
#[\core\attribute\deprecated(
'aws_helper::configure_client_proxy()',
since: '4.5',
mdl: 'MDL-80962',
)]
public static function configure_client_proxy(AwsClient $client): AwsClient {
\core\deprecation::emit_deprecation_if_present(__FUNCTION__);
$client->getHandlerList()->appendBuild(self::add_proxy_when_required(), 'proxy_bypass');
return $client;
}
Expand All @@ -81,8 +88,15 @@ public static function configure_client_proxy(AwsClient $client): AwsClient {
* Generate a middleware higher order function to wrap the handler and append proxy configuration based on target.
*
* @return callable Middleware high order callable.
* @deprecated Since Moodle 4.5
*/
#[\core\attribute\deprecated(
'aws_helper::add_proxy_when_required()',
since: '4.5',
mdl: 'MDL-80962',
)]
protected static function add_proxy_when_required(): callable {
\core\deprecation::emit_deprecation_if_present(__FUNCTION__);
return function (callable $fn) {
return function (CommandInterface $command, ?RequestInterface $request = null) use ($fn) {
if (isset($request)) {
Expand Down
18 changes: 9 additions & 9 deletions lib/classes/aws/client_factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* AWS Client factory. Retrieves a client with moodle specific HTTP configuration.
*
* @package core
* @author Peter Burnett <[email protected]>
* @copyright 2022 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace core\aws;
use Aws\AwsClient;

Expand All @@ -32,6 +23,8 @@
* @copyright 2022 Catalyst IT
* @author Peter Burnett <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @deprecated Since Moodle 4.5
* @todo MDL-82459 Final deprecation in Moodle 5.0.
*/
class client_factory {
/**
Expand All @@ -40,8 +33,15 @@ class client_factory {
* @param string $class Fully qualified AWS classname e.g. \Aws\S3\S3Client
* @param array $opts array of constructor options for AWS Client.
* @return AwsClient
* @deprecated Since Moodle 4.5
*/
#[\core\attribute\deprecated(
'client_factory::get_client()',
since: '4.5',
mdl: 'MDL-80962',
)]
public static function get_client(string $class, array $opts): AwsClient {
\core\deprecation::emit_deprecation_if_present(__FUNCTION__);
// Modify the opts to add HTTP timeouts.
if (empty($opts['http'])) {
$opts['http'] = ['connect_timeout' => HOURSECS];
Expand Down
65 changes: 0 additions & 65 deletions lib/tests/aws/admin_settings_aws_region_test.php

This file was deleted.

59 changes: 0 additions & 59 deletions lib/tests/aws/aws_helper_test.php

This file was deleted.

0 comments on commit c663ac8

Please sign in to comment.