performance optimizations
This commit is contained in:
@@ -154,11 +154,11 @@
|
||||
<?php if($bcount > 0): ?>
|
||||
<tr id="termination-<?=$term->id?>-top-header" class="hidden">
|
||||
<th>Anschluss</th>
|
||||
<th>Baustatus</th>
|
||||
<th>Patchstatus</th>
|
||||
<th>BB hergestellt</th>
|
||||
<th>BEP montiert</th>
|
||||
<th>K-Kabel eingeblasen</th>
|
||||
<th>Tiefbau</th>
|
||||
<th>Patch-/Kabeldaten</th>
|
||||
<th>Backbone</th>
|
||||
<th>BEP</th>
|
||||
<th>Kundenkabel</th>
|
||||
<th>Spleiß Netz</th>
|
||||
<th>Spleiß Kunde</th>
|
||||
<th>Fertig</th>
|
||||
|
||||
@@ -83,18 +83,18 @@ class Building extends mfBaseModel {
|
||||
foreach(WorkflowitemModel::search(["object_type" => "building", "active" => 1]) as $item) {
|
||||
$item->setObjectId($this->id);
|
||||
$this->workflowitems[$item->name] = $item;
|
||||
mfValuecache::set("wfBuilding-".$item->name, $item);
|
||||
mfValuecache::singleton()->set("wfBuilding-".$item->name, $item);
|
||||
}
|
||||
}
|
||||
|
||||
public function getWorkflowvalue($itemname, $type = false) {
|
||||
$item = mfValuecache::get("wfBuilding-".$itemname);
|
||||
$item = mfValuecache::singleton()->get("wfBuilding-".$itemname);
|
||||
if(!$item) {
|
||||
$item = WorkflowitemModel::getFirst(['name' => $itemname]);
|
||||
if(!$item->id) {
|
||||
return null;
|
||||
}
|
||||
mfValuecache::set("wfBuilding-".$itemname, $item);
|
||||
mfValuecache::singleton()->set("wfBuilding-".$itemname, $item);
|
||||
}
|
||||
|
||||
switch($item->type) {
|
||||
|
||||
@@ -4,11 +4,11 @@ class LineworkController extends mfBaseController {
|
||||
|
||||
protected function init() {
|
||||
$this->needlogin=true;
|
||||
$me = mfValuecache::get("me");
|
||||
$me = mfValuecache::singleton()->get("me");
|
||||
if(!$me) {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
mfValuecache::set("me", $this->me);
|
||||
mfValuecache::singleton()->set("me", $this->me);
|
||||
}
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me",$me);
|
||||
|
||||
@@ -36,21 +36,41 @@ class Termination extends mfBaseModel {
|
||||
}
|
||||
|
||||
public function loadWorkflowItems() {
|
||||
$item_ids = [];
|
||||
foreach(WorkflowitemModel::search(["object_type" => "Termination", "active" => 1]) as $item) {
|
||||
$item->setObjectId($this->id);
|
||||
$this->workflowitems[$item->name] = $item;
|
||||
mfValuecache::set("wfTerm-".$item->name, $item);
|
||||
//mfValuecache::set("wfTerm-name-".$item->name, $item);
|
||||
//mfValuecache::set("wfTerm-id-".$item->id, $item);
|
||||
$item_ids[] = $item->id;
|
||||
}
|
||||
|
||||
// get values
|
||||
$values = WorkflowvalueModel::search(["object_id" => $this->id]);
|
||||
//var_dump($values);exit;
|
||||
foreach($values as $value) {
|
||||
if(array_key_exists($value->item->name, $this->workflowitems)) {
|
||||
//var_dump($value);exit;
|
||||
$this->workflowitems[$value->item->name]->setValue($value);
|
||||
mfValuecache::singleton()->set("wfTerm-name-".$this->workflowitems[$value->item->name]->name, $this->workflowitems[$value->item->name]);
|
||||
mfValuecache::singleton()->set("wfTerm-id-".$this->workflowitems[$value->item->name]->id, $this->workflowitems[$value->item->name]);
|
||||
mfValuecache::singleton()->set("wfItemvalue-item-".$value->item_id."-object-".$value->object_id, $value);
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump(array_keys(mfValuecache::singleton()->getCache()));
|
||||
|
||||
}
|
||||
|
||||
public function getWorkflowvalue($itemname, $type = false) {
|
||||
$item = mfValuecache::get("wfTerm-".$itemname);
|
||||
$item = mfValuecache::singleton()->get("wfTerm-name-".$itemname);
|
||||
if(!$item) {
|
||||
$item = WorkflowitemModel::getFirst(['name' => $itemname]);
|
||||
if(!$item->id) {
|
||||
return null;
|
||||
}
|
||||
mfValuecache::set("wfTerm-".$itemname, $item);
|
||||
mfValuecache::singleton()->set("wfTerm-name-".$itemname, $item);
|
||||
mfValuecache::singleton()->set("wfTerm-id-".$item->id, $item);
|
||||
}
|
||||
|
||||
switch($item->type) {
|
||||
@@ -282,14 +302,14 @@ class Termination extends mfBaseModel {
|
||||
}
|
||||
|
||||
if($name == "creator") {
|
||||
$user = mfValuecache::get("Worker-id-".$this->create_by);
|
||||
$user = mfValuecache::singleton()->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);
|
||||
mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator);
|
||||
}
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,10 @@ class Workflowitem extends mfBaseModel {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setValue(Workflowvalue $value) {
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
@@ -20,12 +24,18 @@ class Workflowitem extends mfBaseModel {
|
||||
$this->log->warn(__CLASS__."::getProperty('value'): Object ID not set");
|
||||
return null;
|
||||
}
|
||||
$value = mfValuecache::singleton()->get("wfItemvalue-item-".$this->id."-object-".$this->object_id);
|
||||
if($value) {
|
||||
$this->value = $value;
|
||||
return $value;
|
||||
}
|
||||
$value = WorkflowvalueModel::getFirst(['item_id' => $this->id, "object_id" => $this->object_id]);
|
||||
if(!$value) {
|
||||
$vdata['item_id'] = $this->id;
|
||||
$vdata['object_id'] = $this->object_id;
|
||||
$value = WorkflowvalueModel::create($vdata);
|
||||
}
|
||||
mfValuecache::singleton()->set("wfItemvalue-item-".$this->id."-object-".$this->object_id, $value);
|
||||
$this->value = $value;
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@ class WorkflowitemModel {
|
||||
}
|
||||
}
|
||||
|
||||
$me = mfValuecache::get("me");
|
||||
$me = mfValuecache::singleton()->get("me");
|
||||
if(!$me) {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
mfValuecache::set("me", $this->me);
|
||||
mfValuecache::singleton()->set("me", $this->me);
|
||||
}
|
||||
|
||||
if($model->create_by === null) {
|
||||
|
||||
@@ -11,11 +11,11 @@ class Workflowvalue extends mfBaseModel {
|
||||
public $is_changed = false;
|
||||
|
||||
protected function init() {
|
||||
$this->me = mfValuecache::get("me");
|
||||
$this->me = mfValuecache::singleton()->get("me");
|
||||
if(!$this->me) {
|
||||
$this->me = new User();
|
||||
$this->me->loadMe();
|
||||
mfValuecache::set("me", $this->me);
|
||||
mfValuecache::singleton()->set("me", $this->me);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -133,12 +133,19 @@ class Workflowvalue extends mfBaseModel {
|
||||
if($this->$name == null) {
|
||||
|
||||
if($name == "item") {
|
||||
$this->item = new Workflowitem($this->item_id);
|
||||
$this->item = mfValuecache::singleton()->get("wfItem-id-".$this->item_id);
|
||||
if(!$this->item) {
|
||||
$this->item = new Workflowitem($this->item_id);
|
||||
if($this->item->id) {
|
||||
mfValuecache::singleton()->set("wfItem-id-".$this->item->id, $this->item);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->item;
|
||||
}
|
||||
|
||||
if($name == "changer") {
|
||||
$user = mfValuecache::get("Worker-id-".$this->changed);
|
||||
$user = mfValuecache::singleton()->get("Worker-id-".$this->changed);
|
||||
if($user) {
|
||||
$this->changer = $user;
|
||||
return $this->changer;
|
||||
@@ -146,7 +153,7 @@ class Workflowvalue extends mfBaseModel {
|
||||
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);
|
||||
mfValuecache::singleton()->set("Worker-id-".$this->changed, $this->changer);
|
||||
}
|
||||
return $this->changer;
|
||||
} else {
|
||||
|
||||
@@ -24,11 +24,11 @@ class WorkflowvalueModel {
|
||||
}
|
||||
}
|
||||
|
||||
$me = mfValuecache::get("me");
|
||||
$me = mfValuecache::singleton()->get("me");
|
||||
if(!$me) {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
mfValuecache::set("me", $this->me);
|
||||
mfValuecache::singleton()->set("me", $this->me);
|
||||
}
|
||||
|
||||
if($model->create_by === null) {
|
||||
|
||||
@@ -4,10 +4,7 @@ class mfValuecache {
|
||||
public static $instance;
|
||||
public $cache = [];
|
||||
|
||||
|
||||
private function __construct() {
|
||||
|
||||
}
|
||||
private function __construct() { }
|
||||
|
||||
public static function singleton() {
|
||||
if(!isset(self::$instance)) {
|
||||
@@ -17,16 +14,18 @@ class mfValuecache {
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
public static function get($key) {
|
||||
$instance = self::singleton();
|
||||
if(array_key_exists($key, $instance->cache)) {
|
||||
return $instance->cache[$key];
|
||||
public function get($key) {
|
||||
if(array_key_exists($key, $this->cache)) {
|
||||
return $this->cache[$key];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function set($key, $value) {
|
||||
$instance = self::singleton();
|
||||
$instance->cache[$key] = $value;
|
||||
public function set($key, $value) {
|
||||
$this->cache[$key] = $value;
|
||||
}
|
||||
|
||||
public function getCache() {
|
||||
return $this->cache;
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ if(defined('MFLOCALE_NUMERIC')) {
|
||||
setlocale(LC_NUMERIC, MFLOCALE_NUMERIC);
|
||||
}
|
||||
|
||||
define('FRONKDB_SQLDEBUG',false);
|
||||
define('FRONKDB_SQLDEBUG',true);
|
||||
|
||||
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
|
||||
require_once(LIBDIR."/mvcfronk/mfRouter/mfRouter.php");
|
||||
|
||||
Reference in New Issue
Block a user