Skip to content

Commit

Permalink
revert api version setting
Browse files Browse the repository at this point in the history
  • Loading branch information
ferishili committed Oct 21, 2024
1 parent d0c1e79 commit 92b380d
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 37 deletions.
8 changes: 0 additions & 8 deletions classes/local/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ class api extends \curl {
private $connecttimeout = 1000;
/** @var string the api baseurl */
private $baseurl;
/** @var string the api version */
public $version;
/** @var \OpencastApi\Opencast the opencast endpoints instance */
public $opencastapi;
/** @var \OpencastApi\Rest\OcRestClient the opencast REST Client instance */
Expand Down Expand Up @@ -229,7 +227,6 @@ public function __construct($instanceid = null,
$this->timeout = settings_api::get_apitimeout($storedconfigocinstanceid);
$this->connecttimeout = settings_api::get_apiconnecttimeout($storedconfigocinstanceid);
$this->baseurl = settings_api::get_apiurl($storedconfigocinstanceid);
$this->version = settings_api::get_apiversion($storedconfigocinstanceid);

if (empty($this->username)) {
throw new empty_configuration_exception('apiusernameempty', 'tool_opencast');
Expand Down Expand Up @@ -259,10 +256,6 @@ public function __construct($instanceid = null,
if (array_key_exists('apiconnecttimeout', $customconfigs)) {
$this->connecttimeout = $customconfigs['apiconnecttimeout'];
}

if (array_key_exists('apiversion', $customconfigs)) {
$this->version = $customconfigs['version'];
}
}

// If the admin omitted the protocol part, add the HTTPS protocol on-the-fly.
Expand All @@ -285,7 +278,6 @@ public function __construct($instanceid = null,
'password' => $this->password,
'timeout' => (intval($this->timeout) / 1000),
'connect_timeout' => (intval($this->connecttimeout) / 1000),
'version' => !empty($this->version) ? $this->version : null,
];
$this->opencastapi = new \OpencastApi\Opencast($config, [], $enableingest);
$this->opencastrestclient = new \OpencastApi\Rest\OcRestClient($config);
Expand Down
6 changes: 1 addition & 5 deletions classes/local/api_testable.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class api_testable extends api {
private $httpcode;

/** @var string version api version to apply for */
public $version;
public $version = '1.10.0';

/** @var string the username. */
private string $username;
Expand Down Expand Up @@ -85,10 +85,6 @@ public function __construct($instanceid = null, $enableingest = false) {
$this->timeout = settings_api::get_apitimeout($storedconfigocinstanceid);
$this->connecttimeout = settings_api::get_apiconnecttimeout($storedconfigocinstanceid);
$this->baseurl = settings_api::get_apiurl($storedconfigocinstanceid);
$this->version = settings_api::get_apiversion($storedconfigocinstanceid);
if (empty($this->version)) {
$this->version = '1.10.0';
}

$config = [
'url' => $this->baseurl,
Expand Down
16 changes: 0 additions & 16 deletions classes/local/settings_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,6 @@ public static function get_apiurl(int $ocinstanceid) {
return get_config('tool_opencast', 'apiurl_' . $ocinstanceid);
}

/**
* Returns the api version of an Opencast instance as string
* or false, if the corresponding config was not found.
*
* @param int $ocinstanceid
* The id of the Opencast instance, for that the config is retrieved.
*
* @return string|bool
* The requested config as string or false, if the corresponding config was not found.
*
* @throws \dml_exception
*/
public static function get_apiversion(int $ocinstanceid) {
return get_config('tool_opencast', 'apiversion_' . $ocinstanceid);
}

/**
* Returns the api username of an Opencast instance as string
* or false, if the corresponding config was not found.
Expand Down
6 changes: 0 additions & 6 deletions classes/settings/admin_settings_builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,6 @@ private static function add_config_settings_fulltree(\admin_settingpage $setting
PARAM_URL
);

self::add_admin_setting_configtext($settings,
'tool_opencast/apiversion_' . $instanceid,
'apiversion', 'apiversiondesc',
''
);

self::add_admin_setting_configtext($settings,
'tool_opencast/apiusername_' . $instanceid,
'apiusername', 'apiusernamedesc',
Expand Down
2 changes: 0 additions & 2 deletions lang/en/tool_opencast.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
$string['apiusername'] = 'Username of Opencast API user';
$string['apiusernamedesc'] = 'Configure the username of the Opencast user who is used to do the Opencast API calls. Moodle uses this Opencast user for all communication with Opencast. Authorization is done by adding suitable roles to the call.';
$string['apiusernameempty'] = 'Username of Opencast API user is not configured correctly. Go to the settings of the Opencast API tool to fix this.';
$string['apiversion'] = 'Opencast API version';
$string['apiversiondesc'] = 'This is the api version of the opencast instance (e.g. "v1.11.0") to be configured. This would increase the overall performance when configured, because it reduces the automated version extraction step.<br/> Use this link format to get the api version from your opencast: [your opencast address]/docs.html?path=/api#getversiondefault-8';
$string['configuration'] = 'Configuration';
$string['configuration_instance'] = 'Configuration: {$a}';
$string['connecttimeout'] = 'Connection timeout';
Expand Down

0 comments on commit 92b380d

Please sign in to comment.