Skip to content

Commit

Permalink
low-level fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
2M1 committed Nov 7, 2018
1 parent a13b8e2 commit c16bee1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/Resources/contao/classes/Substitutions.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Substitutions extends System
*
* @var int
*/
static $cacheTime = 24*60*60*3; # cache for three days
protected static $cacheTime = 24*60*60*3; # cache for three days

public function __construct()
{
Expand Down Expand Up @@ -244,8 +244,6 @@ public function getLastImport():int
}
/**
* automatically generate the dates to specify the load interval of the substitutions plan
* @var int $intStart
* @var int $intEnd
*/
public function generateDates():void
{
Expand Down Expand Up @@ -273,17 +271,19 @@ protected function saveToCache():void
# save the import time:
$cacheLastUpdate = $this->objCache->getItem('lastImportTime');
$cacheLastUpdate->set($this->lastImport);
$this->objCache->save($cacheLastUpdate);
$this->objCache->saveDeferred($cacheLastUpdate);
# save the cached max time
$cacheEnd = $this->objCache->getItem('endDate');
$cacheEnd->set($this->intEnd);
$this->objCache->save($cacheEnd);
$this->objCache->saveDeferred($cacheEnd);
# save substitutions plan
# NOTE: saving the raw content prevents the filter from deleteing parts of the content
# NOTE: or all loops from beeing run twice.
$cacheSubstitutions = $this->objCache->getItem('substitutions');
$cacheSubstitutions->set($this->arrSubs);
$this->objCache->save($cacheSubstitutions);
$this->objCache->saveDeferred($cacheSubstitutions);
# save all:
$this->objCache->commit();
}
/**
* loads the substitutions plan from webuntis some days in advance
Expand Down
1 change: 0 additions & 1 deletion src/Resources/contao/modules/ModuleSubstitutions.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ protected function addStringsAndReorder():void
$sub['course'] = $kl->name;

//REORDER AND FILTER SUBSTITUTIONS
//TODO: move to seperate filter method!!
if($this->strSelector == 'all' || in_array($this->strSelector,$arrTeachers) || $this->strSelector == $kl->name) {
$this->arrSubs[$sub['date']][$year][$kl->name][$sub['time']][] = $sub;
}
Expand Down

0 comments on commit c16bee1

Please sign in to comment.