Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Develop

See merge request ILIAS/Plugins/ViMP!16
  • Loading branch information
Theodor Truffer committed Jul 2, 2019
2 parents a92ab68 + 35c7b4c commit cdea5bc
Show file tree
Hide file tree
Showing 1,107 changed files with 480,155 additions and 91,542 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## [1.1.0]
- Bugfix: Category Cache didn't work (should improve performance)
- Library: VideoJS included via npm now and upgraded to 7.5.5
- Feature: Added videojs-http-source-selector for adaptive streaming
- Improvement: Configs will be cached now (should improve performance)
- Improvement: Chapters will be cached now (should improve performance)
- Improvement: Version will be cached now (should improve performance)
- Improvement: changed button for showing own videos

## [1.0.5]
- Bugfix: PageComponent in ILIAS learning module not working correctly
- Bugfix: Possible Error when changing owner
Expand Down
5 changes: 5 additions & 0 deletions classes/GUI/Form/class.xvmpConfFormGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ protected function initForm(){
$input->setInfo($this->pl->confTxt(xvmpConf::F_CACHE_TTL_TOKEN . '_info'));
$this->addItem($input);

// Config TTL
$input = new ilNumberInputGUI($this->pl->confTxt(xvmpConf::F_CACHE_TTL_CONFIG), xvmpConf::F_CACHE_TTL_CONFIG);
$input->setInfo($this->pl->confTxt(xvmpConf::F_CACHE_TTL_CONFIG . '_info'));
$this->addItem($input);


// Buttons
$this->addCommandButton(ilViMPConfigGUI::CMD_UPDATE,$this->lng->txt('save'));
Expand Down
12 changes: 6 additions & 6 deletions classes/GUI/Form/class.xvmpUploadVideoFormGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ protected function initForm() {

// FILE
$input = new xvmpFileUploadInputGUI($this, xvmpOwnVideosGUI::CMD_CREATE, $this->lng->txt('file'), self::F_SOURCE_URL);
$response = xvmpRequest::config('upload_max_size')->getResponseArray();
if (isset($response['config']['value'])) {
$max_filesize_vimp = trim($response['config']['value'], "'");
$config = xvmpConfig::find('upload_max_size')->getValue();
if ($config !== null) {
$max_filesize_vimp = trim($config, "'");
}
$max_filesize_plugin = xvmpConf::getConfig(xvmpConf::F_UPLOAD_LIMIT);
if ($max_filesize_vimp || $max_filesize_plugin) {
Expand All @@ -92,9 +92,9 @@ protected function initForm() {
'mpeg',
'avi',
);
$response = xvmpRequest::config('extension_whitelist_video')->getResponseArray();
if (isset($response['config']['value'])) {
$suffixes = eval('return ' . $response['config']['value'] . ';');
$config = xvmpConfig::find('extension_whitelist_video')->getValue();
if ($config !== null) {
$suffixes = eval('return ' . $config . ';');
}
$input->setUrl($this->ctrl->getLinkTarget($this->parent_gui, xvmpOwnVideosGUI::CMD_UPLOAD_CHUNKS));
$input->setSuffixes($suffixes);
Expand Down
2 changes: 1 addition & 1 deletion classes/GUI/Table/class.xvmpOwnVideosTableGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class xvmpOwnVideosTableGUI extends xvmpTableGUI {
/**
* xvmpOwnVideosTableGUI constructor.
*
* @param $ parent_gui
* @param $parent_gui
* @param string $parent_cmd
*/
public function __construct($parent_gui, $parent_cmd) {
Expand Down
2 changes: 0 additions & 2 deletions classes/GUI/class.xvmpContentGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ class xvmpContentGUI extends xvmpGUI {
*
*/
protected function index() {
xvmpRequest::version();

xvmpVideoPlayer::loadVideoJSAndCSS(!xvmpConf::getConfig(xvmpConf::F_EMBED_PLAYER));

if (!$this->ctrl->isAsynch() && ilObjViMPAccess::hasWriteAccess()) {
Expand Down
66 changes: 66 additions & 0 deletions classes/Model/API/class.xvmpChapters.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

/**
* Class xvmpChapters
*
* @author Theodor Truffer <[email protected]>
*/
class xvmpChapters extends xvmpObject {

/**
* @param $id
*
* @return array
*/
public static function getObjectAsArray($id) {
$key = self::class . '-' . $id;
$existing = xvmpCacheFactory::getInstance()->get($key);
if ($existing) {
xvmpCurlLog::getInstance()->write('CACHE: used cached: ' . $key, xvmpCurlLog::DEBUG_LEVEL_2);
return $existing;
}

$array = xvmpRequest::getChapters($id)->getResponseArray();

self::cache($key, $array);

return $array;
}


/**
* @param $identifier
* @param array $object
* @param null $ttl
*/
public static function cache($identifier, $object, $ttl = null) {
parent::cache($identifier, $object, xvmpConf::getConfig(xvmpConf::F_CACHE_TTL_VIDEOS));
}


/**
* @var string
*/
protected $lang;
/**
* @var array
*/
protected $chapters;


/**
* @return string
*/
public function getLang() {
return $this->lang;
}


/**
* @return array
*/
public function getChapters() {
return $this->chapters;
}

}
67 changes: 67 additions & 0 deletions classes/Model/API/class.xvmpConfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

/**
* Class xvmpConfig
*
* @author Theodor Truffer <[email protected]>
*/
class xvmpConfig extends xvmpObject {

/**
* @param $id
*
* @return array
*/
public static function getObjectAsArray($id) {
$key = self::class . '-' . $id;
$existing = xvmpCacheFactory::getInstance()->get($key);
if ($existing) {
xvmpCurlLog::getInstance()->write('CACHE: used cached: ' . $key, xvmpCurlLog::DEBUG_LEVEL_2);
return $existing;
}

$array = xvmpRequest::config($id)->getResponseArray()['config'];
$array['id'] = $id;

self::cache($key, $array);

return $array;
}


/**
* @param $identifier
* @param array $object
* @param null $ttl
*/
public static function cache($identifier, $object, $ttl = null) {
parent::cache($identifier, $object, xvmpConf::getConfig(xvmpConf::F_CACHE_TTL_CONFIG));
}


/**
* @var string
*/
protected $name;
/**
* @var string
*/
protected $value;


/**
* @return string
*/
public function getName() {
return $this->name;
}


/**
* @return string
*/
public function getValue() {
return $this->value;
}

}
1 change: 1 addition & 0 deletions classes/Model/AR/class.xvmpConf.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class xvmpConf extends ActiveRecord {
const F_CACHE_TTL_USERS = 'cache_ttl_users';
const F_CACHE_TTL_CATEGORIES = 'cache_ttl_categories';
const F_CACHE_TTL_TOKEN = 'cache_ttl_token';
const F_CACHE_TTL_CONFIG = 'cache_ttl_config';
const F_FILTER_FIELDS = 'filter_fields';
const F_FILTER_FIELD_ID = 'filter_id';
const F_FILTER_FIELD_TITLE = 'filter_title';
Expand Down
4 changes: 2 additions & 2 deletions classes/Request/class.xvmpRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class xvmpRequest {
const GET_USER_MEDIA = 'getUserMedia';
const EXTENDED_SEARCH = 'extendedSearch';
const GET_PICTURE = 'getPicture';
const GET_VIDEOSOURCES = '../media/ajax';
const GET_CHAPTERS = '../webplayer/getchapters/key/';
const GET_VIDEOSOURCES = '../media/ajax';
const GET_CHAPTERS = '../webplayer/getchapters/key/';
const CONFIG = 'config';

/**
Expand Down
Loading

0 comments on commit cdea5bc

Please sign in to comment.