Skip to content

Commit

Permalink
Function to check if given Endpoint exists and troubleshooting (elan-…
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrahn authored Oct 4, 2021
1 parent 28346dd commit 05f60dc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions controllers/course.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Opencast\Models\OCTos;
use Opencast\Models\OCScheduledRecordings;
use Opencast\Models\OCUploadStudygroup;
use Opencast\Models\OCEndpoints;
use Opencast\LTI\OpencastLTI;

class CourseController extends OpencastController
Expand Down Expand Up @@ -885,6 +886,9 @@ public function remove_episode_action($ticket, $episode_id)
PageLayout::postSuccess($this->_('Die Episode wurde zum Entfernen markiert.'));
} else {
PageLayout::postError($this->_('Die Episode konnte nicht zum Entfernen markiert werden.'));
if (!OCEndpoints::hasEndpoint(OCConfig::getConfigIdForCourse($this->course_id), 'admin-ngevent')) {
PageLayout::postError($this->_('Um das Problem zu Beheben, muss ein Admin in den OpenCast-Einstellungen auf Übernehmen klicken'));
}
}
}

Expand Down
15 changes: 15 additions & 0 deletions models/OCEndpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ public static function setEndpoint($config_id, $service_url, $service_type)
}
}

/**
* Check if given config_id has an entry of service_type
*
* @param string $config_id
* @param string $service_type
* @return bool
*/
public static function hasEndpoint($config_id, $service_type)
{
return self::countBySql(
'config_id = ? AND service_type = ?',
[$config_id, $service_type]
) > 0;
}

/**
* Remove passed endpoint from config
*
Expand Down

0 comments on commit 05f60dc

Please sign in to comment.