Commit 7def71a517b54d497772ac3c055f64d306e32621
1 parent
3ed056c4
Exists in
master
and in
110 other branches
redmine #5380
Showing
3 changed files
with
56 additions
and
19 deletions
Show diff stats
php/classes/CatalogCacheMgr.php
... | ... | @@ -47,14 +47,22 @@ class CatIntervalCacheObject extends IntervalCacheObject |
47 | 47 | { |
48 | 48 | fwrite($handle,pack('L6',$this->id,$this->index,$this->start,$this->stop,$this->isNew,$this->isModified)); |
49 | 49 | for ($i = 0; $i < $paramsNumber; $i++) |
50 | - { | |
51 | - if ($paramsTypes[$i] == '1') | |
52 | - $paramString = CacheTools::iso2stamp($this->params[$i]); | |
53 | - else | |
54 | - $paramString = $this->params[$i]; | |
55 | - | |
56 | - $paramArray = explode(',',$paramString); | |
57 | - for ($j = 0; $j < $paramsSizes[$i]; $j++) fwrite($handle,pack('d', $paramArray[$j])); | |
50 | + { | |
51 | + if ($paramsTypes[$i] == '2') // string | |
52 | + { | |
53 | + fwrite($handle,pack('d', strlen($this->params[$i]))); | |
54 | + fwrite($handle, $this->params[$i],strlen($this->params[$i])); | |
55 | + } | |
56 | + else | |
57 | + { | |
58 | + if ($paramsTypes[$i] == '1') | |
59 | + $paramString = CacheTools::iso2stamp($this->params[$i]); | |
60 | + else | |
61 | + $paramString = $this->params[$i]; | |
62 | + | |
63 | + $paramArray = explode(',',$paramString); | |
64 | + for ($j = 0; $j < $paramsSizes[$i]; $j++) fwrite($handle,pack('d', $paramArray[$j])); | |
65 | + } | |
58 | 66 | } |
59 | 67 | } |
60 | 68 | |
... | ... | @@ -70,16 +78,24 @@ class CatIntervalCacheObject extends IntervalCacheObject |
70 | 78 | |
71 | 79 | for ($i = 0; $i < $paramsNumber; $i++) { |
72 | 80 | $this->params[$i] = null; |
81 | + | |
73 | 82 | for ($j = 0; $j < $paramsSizes[$i]; $j++) |
74 | 83 | { |
75 | 84 | $val = unpack('dval',fread($handle,8)); |
76 | 85 | |
77 | - if ($paramsTypes[$i] == '1') | |
78 | - $this->params[$i] .= CacheTools::stamp2iso($val['val']); | |
79 | - else | |
80 | - $this->params[$i] .= $val['val']; | |
81 | - | |
82 | - if ($j != $paramsSizes[$i] - 1) $this->params[$i] .= ','; | |
86 | + if ($paramsTypes[$i] == '2') // string | |
87 | + { | |
88 | + $this->params[$i] = fread($handle,$val['val']); | |
89 | + } | |
90 | + else | |
91 | + { | |
92 | + if ($paramsTypes[$i] == '1') | |
93 | + $this->params[$i] .= CacheTools::stamp2iso($val['val']); | |
94 | + else | |
95 | + $this->params[$i] .= $val['val']; | |
96 | + | |
97 | + if ($j != $paramsSizes[$i] - 1) $this->params[$i] .= ','; | |
98 | + } | |
83 | 99 | } |
84 | 100 | } |
85 | 101 | ... | ... |
php/classes/CatalogMgr.php
... | ... | @@ -479,18 +479,34 @@ class CatalogMgr extends TimeTableMgr |
479 | 479 | else |
480 | 480 | { |
481 | 481 | $oneParam['size'] = 1; |
482 | - } | |
482 | + } | |
483 | + | |
483 | 484 | foreach ($paramNode->attributes as $attr) |
484 | 485 | { |
485 | 486 | if ($attr->nodeName == 'datatype') |
486 | 487 | { |
487 | - if ($paramNode->hasAttribute('xtype') && ($paramNode->getAttribute('xtype') == 'dateTime')) | |
488 | + $datatype = $attr->nodeValue; | |
489 | + | |
490 | + if ($paramNode->hasAttribute('xtype') && (($paramNode->getAttribute('xtype') == 'dateTime') || ($paramNode->getAttribute('xtype') == 'iso8601'))) | |
491 | + { | |
488 | 492 | $oneParam['type'] = 1; |
489 | - else | |
493 | + $paramNode->setAttribute('xtype','dateTime'); | |
494 | + $paramNode->setAttribute('size',1); | |
495 | + } | |
496 | + else if ($datatype == 'char') | |
497 | + { | |
498 | + $oneParam['type'] = 2;// string | |
499 | + $paramNode->setAttribute('size', 1); | |
500 | + } | |
501 | + else | |
502 | + { | |
490 | 503 | $oneParam['type'] = 0;//'Double'; |
504 | + } | |
491 | 505 | } |
492 | 506 | else if ($attr->nodeName != 'arraysize') |
493 | - $oneParam[$attr->nodeName] = $attr->nodeValue; | |
507 | + { | |
508 | + $oneParam[$attr->nodeName] = $attr->nodeValue; | |
509 | + } | |
494 | 510 | } |
495 | 511 | $paramsArray[] = $oneParam; |
496 | 512 | } | ... | ... |
php/classes/TimeTableCacheMgr.php
... | ... | @@ -3,7 +3,12 @@ |
3 | 3 | class CacheTools |
4 | 4 | { |
5 | 5 | public static function iso2stamp($iso) { |
6 | - $time = new DateTime($iso); | |
6 | + try { | |
7 | + $time = new DateTime($iso); | |
8 | + } | |
9 | + catch (Exception $e) { | |
10 | + $time = new DateTime('1970-01-01T00:00:00Z'); | |
11 | + } | |
7 | 12 | $stamp = $time->format('U'); |
8 | 13 | unset($time); |
9 | 14 | return $stamp; | ... | ... |