performance optimizations

This commit is contained in:
Frank Schubert
2022-02-15 22:26:10 +01:00
parent dd6f171ee1
commit fa3dec263f
10 changed files with 82 additions and 23 deletions

View File

@@ -37,8 +37,12 @@ class BuildingModel {
}
}
$me = new User();
$me->loadMe();
$me = mfValuecache::get("me");
if(!$me) {
$me = new User();
$me->loadMe();
mfValuecache::set("me", $this->me);
}
if($model->create_by === null) {
$model->create_by = $me->id;

View File

@@ -4,8 +4,12 @@ class LineworkController extends mfBaseController {
protected function init() {
$this->needlogin=true;
$me = new User();
$me->loadMe();
$me = mfValuecache::get("me");
if(!$me) {
$me = new User();
$me->loadMe();
mfValuecache::set("me", $this->me);
}
$this->me = $me;
$this->layout()->set("me",$me);

View File

@@ -34,8 +34,12 @@ class PopModel {
}
}
$me = new User();
$me->loadMe();
$me = mfValuecache::get("me");
if(!$me) {
$me = new User();
$me->loadMe();
mfValuecache::set("me", $this->me);
}
if($model->create_by === null) {
$model->create_by = $me->id;

View File

@@ -282,7 +282,15 @@ class Termination extends mfBaseModel {
}
if($name == "creator") {
$user = mfValuecache::get("Worker-id-".$this->create_by);
if($user) {
$this->creator = $user;
return $this->creator;
}
$this->creator = new User($this->create_by);
if($this->creator->id) {
mfValuecache::set("Worker-id-".$this->create_by, $this->creator);
}
return $this->creator;
}

View File

@@ -4,8 +4,12 @@ class TerminationController extends mfBaseController {
protected function init() {
$this->needlogin=true;
$me = new User();
$me->loadMe();
$me = mfValuecache::get("me");
if(!$me) {
$me = new User();
$me->loadMe();
mfValuecache::set("me", $this->me);
}
$this->me = $me;
$this->layout()->set("me",$me);

View File

@@ -30,8 +30,12 @@ class TerminationModel {
$model->status_id = 1;
}
$me = new User();
$me->loadMe();
$me = mfValuecache::get("me");
if(!$me) {
$me = new User();
$me->loadMe();
mfValuecache::set("me", $this->me);
}
if($model->create_by === null) {
$model->create_by = $me->id;

View File

@@ -21,8 +21,12 @@ class TerminationFileModel {
}
}
$me = new User();
$me->loadMe();
$me = mfValuecache::get("me");
if(!$me) {
$me = new User();
$me->loadMe();
mfValuecache::set("me", $this->me);
}
if($model->create_by === null) {
$model->create_by = $me->id;

View File

@@ -27,8 +27,12 @@ class WorkflowitemModel {
}
}
$me = new User();
$me->loadMe();
$me = mfValuecache::get("me");
if(!$me) {
$me = new User();
$me->loadMe();
mfValuecache::set("me", $this->me);
}
if($model->create_by === null) {
$model->create_by = $me->id;

View File

@@ -3,10 +3,23 @@
class Workflowvalue extends mfBaseModel {
private $item;
private $changer;
private $me;
public $gps = [];
public $is_changed = false;
protected function init() {
$this->me = mfValuecache::get("me");
if(!$this->me) {
$this->me = new User();
$this->me->loadMe();
mfValuecache::set("me", $this->me);
}
}
protected function afterLoad() {
if(!$this->id) {
return true;
@@ -19,10 +32,8 @@ class Workflowvalue extends mfBaseModel {
protected function beforeSave() {
if($this->new() == "new") {
$me = new User();
$me->loadMe();
$this->changed = date('U');
$this->changed_by = $me->id;
$this->changed_by = $this->me->id;
}
}
@@ -102,18 +113,18 @@ class Workflowvalue extends mfBaseModel {
$this->is_changed = true;
$me = new User();
$me->loadMe();
/*$me = new User();
$me->loadMe();*/
if($this->{"value_".$value_type} != $value) {
$this->{"value_".$value_type} = $value;
$this->changed = date('U');
$this->changed_by = $me->id;
$this->changed_by = $this->me->id;
}
/*if($this->new() == "new") {
$this->changed = date('U');
$this->changed_by = $me->id;
$this->changed_by = $this->me->id;
}*/
}
@@ -127,8 +138,16 @@ class Workflowvalue extends mfBaseModel {
}
if($name == "changer") {
$user = mfValuecache::get("Worker-id-".$this->changed);
if($user) {
$this->changer = $user;
return $this->changer;
}
if($this->changed && $this->changed_by) {
$this->changer = new User($this->changed_by);
if($this->changer->id) {
mfValuecache::set("Worker-id-".$this->changed, $this->changer);
}
return $this->changer;
} else {
return new Address();

View File

@@ -24,8 +24,12 @@ class WorkflowvalueModel {
}
}
$me = new User();
$me->loadMe();
$me = mfValuecache::get("me");
if(!$me) {
$me = new User();
$me->loadMe();
mfValuecache::set("me", $this->me);
}
if($model->create_by === null) {
$model->create_by = $me->id;