Skip to content

Commit

Permalink
2017071000 release code. (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalmsten-panopto authored Jul 11, 2017
1 parent a0241aa commit aaaceb0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
7 changes: 5 additions & 2 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ function xmldb_block_panopto_upgrade($oldversion = 0) {
}

if ($oldversion < 2017061000) {
// 7200 seconds is 2 hours, this is for larger Moodle instances with a lot of Panopto folders mapped to it.
upgrade_set_timeout(7200);

// Get all active courses mapped to Panopto.
$oldpanoptocourses = $DB->get_records(
'block_panopto_foldermap',
Expand Down Expand Up @@ -307,13 +310,13 @@ function xmldb_block_panopto_upgrade($oldversion = 0) {
$oldpanoptocourse->panopto->uname !== 'guest') {
$oldpanoptocourse->panopto->ensure_auth_manager();
$activepanoptoserverversion = $oldpanoptocourse->panopto->authmanager->get_server_version();
if (!version_compare($activepanoptoserverversion, get_config('block_panopto', 'minimum_panopto_version'), '>=')) {
if (!version_compare($activepanoptoserverversion, \panopto_data::$requiredpanoptoversion, '>=')) {
echo "<div class='alert alert-error alert-block'>" .
"<strong>Panopto ClientData(old) to Public API(new) Upgrade Error - Panopto Server requires newer version</strong>" .
"<br/>" .
"<p>" . $versionerrorstring . "</p><br/>" .
"<p>Impacted server: " . $oldpanoptocourse->panopto->servername . "</p>" .
"<p>Minimum required version: " . get_config('block_panopto', 'minimum_panopto_version') . "</p>" .
"<p>Minimum required version: " . \panopto_data::$requiredpanoptoversion . "</p>" .
"<p>Current version: " . $activepanoptoserverversion . "</p>" .
"</div>";
return false;
Expand Down
18 changes: 15 additions & 3 deletions lib/panopto_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ class panopto_data {
*/
private static $requiredversion = 2014051200;

/**
* @var string $requiredpanoptoversion Any block_panopto newer than 2017061000 will require a Panopto server to be at least this version to succeed.
*/
public static $requiredpanoptoversion = '5.4.0';

/**
* main constructor
*
Expand Down Expand Up @@ -244,7 +249,7 @@ public function ensure_user_manager() {
* @param object $provisioninginfo info for course being provisioned
*/
public function provision_course($provisioninginfo) {
global $CFG, $USER;
global $CFG, $USER, $DB;

if (isset($provisioninginfo->fullname) && !empty($provisioninginfo->fullname) &&
isset($provisioninginfo->externalcourseid) && !empty($provisioninginfo->externalcourseid)) {
Expand Down Expand Up @@ -279,10 +284,16 @@ public function provision_course($provisioninginfo) {

$this->ensure_auth_manager();

$currentblockversion = $DB->get_record(
'config_plugins',
array('plugin' => 'block_panopto', 'name' => 'version'),
'value'
);

// If we succeeded in provisioning lets send the Panopto server some updated integration information.
$this->authmanager->report_integration_info(
get_config('block_panopto', 'instance_name'),
get_config('block_panopto', 'current_version'),
$currentblockversion->value,
$CFG->version
);

Expand All @@ -293,6 +304,7 @@ public function provision_course($provisioninginfo) {
$courseinfo->servername = $this->servername;
$courseinfo->applicationkey = $this->applicationkey;
$courseinfo->missingrequiredversion = true;
$courseinfo->requiredpanoptoversion = self::$requiredpanoptoversion;
}
} else {
// Give the user some basic info they can use to debug or send to AE.
Expand Down Expand Up @@ -341,7 +353,7 @@ public function get_provisioning_info() {
$provisioninginfo->fullname = $mappedpanoptocourse->Name;
} else if ($foundmappedfolder && !$userhasaccesstofolder) {
// API call returned false, course exists but the user does not have access to the folder.
error_log(get_string('provisioning_access_error', 'block_panopto'));
error_log(get_string('provision_access_error', 'block_panopto'));
$provisioninginfo->accesserror = true;
return $provisioninginfo;
} else {
Expand Down
5 changes: 1 addition & 4 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// Plugin version should normally be the same as the internal version.
// If an admin wants to install with an older version number, however, set that here.

$plugin->version = 2017061400;
$plugin->version = 2017071000;

// Requires this Moodle version - 2.7.
$plugin->requires = 2014051200;
Expand All @@ -41,7 +41,4 @@
$plugin->dependencies = array(
'mod_forum' => ANY_VERSION
);

set_config('current_version', $plugin->version, 'block_panopto');
set_config('minimum_panopto_version', '5.4.0', 'block_panopto');
/* End of file version.php */
2 changes: 1 addition & 1 deletion views/provisioned_course.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<?php echo get_string('missing_required_version', 'block_panopto') ?>
</div>
<div class='attribute'><?php echo get_string('require_panopto_version_title', 'block_panopto') ?></div>
<div class='value'><?php echo get_config('block_panopto', 'minimum_panopto_version') ?></div>
<div class='value'><?php echo $provisioneddata->requiredpanoptoversion ?></div>
<div class='attribute'><?php echo get_string('attempted_moodle_course_id', 'block_panopto') ?></div>
<div class='value'><?php echo $provisioneddata->moodlecourseid ?></div>
<div class='attribute'><?php echo get_string('attempted_panopto_server', 'block_panopto') ?></div>
Expand Down

0 comments on commit aaaceb0

Please sign in to comment.