Skip to content

Commit

Permalink
fixes #190, prevent counting to infinity - thanks for trying though, …
Browse files Browse the repository at this point in the history
…poor server
  • Loading branch information
tgloeggl committed Mar 6, 2020
1 parent da0b019 commit 2ab3942
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions classes/OCJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ public function created_at_time()
*/
public function number_of_chunks()
{
$config = OCConfig::getConfigForCourse(Context::getId());
return ceil($this->data['file']['size'] / $config['upload_chunk_size']);
$config = OCConfig::getConfigForCourse($this->data['id_list']['course']);

$chunks = ceil($this->data['file']['size'] / $config['upload_chunk_size']);

// prevent counting to infinity, might take to long
return !is_infinite($chunks) ?: 0;

This comment has been minimized.

Copy link
@Rillke

Rillke Mar 13, 2020

Contributor

Are you sure returning !is_infinite($chunks) is desired here? See #210

This comment has been minimized.

Copy link
@tgloeggl

tgloeggl Mar 16, 2020

Author Member

Nope, the number of chunks was the desired return value. Thx for the pull request!

}

/**
Expand Down Expand Up @@ -160,7 +164,7 @@ public function load_media_package()
*/
public function load_opencast_job_id()
{
$config = OCConfig::getConfigForCourse(Context::getId());
$config = OCConfig::getConfigForCourse($this->data['id_list']['course']);

if (!$this->opencast_unloaded('media_package') && $this->opencast_unloaded('opencast_job_id')) {
$opencast_job_id = $this->upload_client->newJob(
Expand Down
2 changes: 1 addition & 1 deletion plugin.manifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pluginname=OpenCast
pluginclassname=OpenCast
origin=elan-ev
version=1.2.98
version=1.2.99
studipMinVersion=4.0
studipMaxVersion=4.4
summary=Vorlesungsaufzeichnung
Expand Down

0 comments on commit 2ab3942

Please sign in to comment.