@@ -118,6 +118,9 @@ |
||
118 | 118 | return classSupernova::$gc->cacheOperator->db_ins_record(LOC_UNIT, $set); |
119 | 119 | } |
120 | 120 | |
121 | + /** |
|
122 | + * @param integer $unit_location_type |
|
123 | + */ |
|
121 | 124 | public static function db_unit_list_delete($user_id = 0, $unit_location_type, $unit_location_id = 0, $unit_snid = 0) { |
122 | 125 | $where = array('unit_location_type' => $unit_location_type); |
123 | 126 | ($unit_location_id = idval($unit_location_id)) ? $where['unit_location_id'] = $unit_location_id : false; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | /** |
13 | 13 | * @param $adjust |
14 | - * @param $location |
|
14 | + * @param integer $location |
|
15 | 15 | * @param $object_id |
16 | 16 | */ |
17 | 17 | function db_change_units_perform($adjust, $location, $object_id) { |
@@ -32,7 +32,6 @@ discard block |
||
32 | 32 | * @param $user |
33 | 33 | * @param $planet |
34 | 34 | * @param array $unit_list |
35 | - * @param null $query |
|
36 | 35 | */ |
37 | 36 | function db_change_units(&$user, &$planet, $unit_list) { |
38 | 37 | $query = array( |
@@ -74,6 +73,9 @@ discard block |
||
74 | 73 | db_change_units_perform($query[LOC_USER], LOC_USER, $user['id']); |
75 | 74 | db_change_units_perform($query[LOC_PLANET], LOC_PLANET, $planet['id']); |
76 | 75 | } |
76 | +/** |
|
77 | + * @param string $table |
|
78 | + */ |
|
77 | 79 | function sn_db_perform($table, $values, $type = 'insert', $options = false) { |
78 | 80 | $field_set = ''; |
79 | 81 | |
@@ -163,6 +165,9 @@ discard block |
||
163 | 165 | |
164 | 166 | |
165 | 167 | |
168 | +/** |
|
169 | + * @param boolean $transaction_should_be_started |
|
170 | + */ |
|
166 | 171 | function sn_db_transaction_check($transaction_should_be_started = null) { |
167 | 172 | return classSupernova::$gc->db->getTransaction()->check($transaction_should_be_started); |
168 | 173 | } |
@@ -42,15 +42,15 @@ discard block |
||
42 | 42 | |
43 | 43 | $group = sn_get_groups('resources_loot'); |
44 | 44 | |
45 | - foreach($unit_list as $unit_id => $unit_amount) { |
|
46 | - if(!in_array($unit_id, $group)) { |
|
45 | + foreach ($unit_list as $unit_id => $unit_amount) { |
|
46 | + if (!in_array($unit_id, $group)) { |
|
47 | 47 | // TODO - remove later |
48 | 48 | print('<h1>СООБЩИТЕ ЭТО АДМИНУ: db_change_units() вызван для не-ресурсов!</h1>'); |
49 | 49 | pdump(debug_backtrace()); |
50 | 50 | die('db_change_units() вызван для не-ресурсов!'); |
51 | 51 | } |
52 | 52 | |
53 | - if(empty($unit_amount)) { |
|
53 | + if (empty($unit_amount)) { |
|
54 | 54 | continue; |
55 | 55 | } |
56 | 56 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $unit_location = sys_get_unit_location($user, $planet, $unit_id); |
60 | 60 | |
61 | 61 | // Changing value in object |
62 | - switch($unit_location) { |
|
62 | + switch ($unit_location) { |
|
63 | 63 | case LOC_USER: |
64 | 64 | $user[$unit_db_name] += $unit_amount; |
65 | 65 | break; |
@@ -77,30 +77,30 @@ discard block |
||
77 | 77 | function sn_db_perform($table, $values, $type = 'insert', $options = false) { |
78 | 78 | $field_set = ''; |
79 | 79 | |
80 | - switch($type) { |
|
80 | + switch ($type) { |
|
81 | 81 | case 'delete': |
82 | 82 | $query = 'DELETE FROM'; |
83 | 83 | break; |
84 | 84 | |
85 | 85 | case 'insert': |
86 | 86 | $query = 'INSERT INTO'; |
87 | - if(isset($options['__multi'])) { |
|
87 | + if (isset($options['__multi'])) { |
|
88 | 88 | // Here we generate mass-insert set |
89 | 89 | break; |
90 | 90 | } |
91 | 91 | case 'update': |
92 | - if(!$query) { |
|
92 | + if (!$query) { |
|
93 | 93 | $query = 'UPDATE'; |
94 | 94 | } |
95 | 95 | |
96 | - foreach($values as $field => &$value) { |
|
96 | + foreach ($values as $field => &$value) { |
|
97 | 97 | $value_type = gettype($value); |
98 | 98 | if ($value_type == TYPE_STRING) { |
99 | - $value = "'" . db_escape($value) . "'"; |
|
99 | + $value = "'".db_escape($value)."'"; |
|
100 | 100 | } |
101 | 101 | $value = "`{$field}` = {$value}"; |
102 | 102 | } |
103 | - $field_set = 'SET ' . implode(', ', $values); |
|
103 | + $field_set = 'SET '.implode(', ', $values); |
|
104 | 104 | break; |
105 | 105 | |
106 | 106 | }; |
@@ -121,12 +121,12 @@ discard block |
||
121 | 121 | $field_set['__IS_SAFE'] = true; |
122 | 122 | } |
123 | 123 | function sn_db_field_set_make_safe($field_set, $serialize = false) { |
124 | - if(!is_array($field_set)) { |
|
124 | + if (!is_array($field_set)) { |
|
125 | 125 | die('$field_set is not an array!'); |
126 | 126 | } |
127 | 127 | |
128 | 128 | $result = array(); |
129 | - foreach($field_set as $field => $value) { |
|
129 | + foreach ($field_set as $field => $value) { |
|
130 | 130 | $field = db_escape(trim($field)); |
131 | 131 | switch (true) { |
132 | 132 | case is_int($value): |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $serialize ? $value = serialize($value) : die('$value is object or array with no $serialize'); |
143 | 143 | |
144 | 144 | case is_string($value): |
145 | - $value = '"' . db_escape($value) . '"'; |
|
145 | + $value = '"'.db_escape($value).'"'; |
|
146 | 146 | break; |
147 | 147 | |
148 | 148 | case is_null($value): |
@@ -408,31 +408,31 @@ discard block |
||
408 | 408 | |
409 | 409 | return classSupernova::$db->doSelect( |
410 | 410 | // Блокировка самого флота |
411 | - "SELECT 1 FROM {{fleets}} AS f " . |
|
411 | + "SELECT 1 FROM {{fleets}} AS f ". |
|
412 | 412 | |
413 | 413 | // Блокировка всех юнитов, принадлежащих этому флоту |
414 | - "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = " . static::$locationType . " AND unit.unit_location_id = f.fleet_id " . |
|
414 | + "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = ".static::$locationType." AND unit.unit_location_id = f.fleet_id ". |
|
415 | 415 | |
416 | 416 | // Блокировка всех прилетающих и улетающих флотов, если нужно |
417 | 417 | // TODO - lock fleets by COORDINATES |
418 | - ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : '') . |
|
418 | + ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : ''). |
|
419 | 419 | // Блокировка всех юнитов, принадлежащих прилетающим и улетающим флотам - ufd = unit_fleet_destination |
420 | - ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = " . static::$locationType . " AND ufd.unit_location_id = fd.fleet_id " : '') . |
|
420 | + ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = ".static::$locationType." AND ufd.unit_location_id = fd.fleet_id " : ''). |
|
421 | 421 | |
422 | - ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : '') . |
|
422 | + ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : ''). |
|
423 | 423 | // Блокировка всех юнитов, принадлежащих владельцу планеты-цели |
424 | - ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : '') . |
|
424 | + ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : ''). |
|
425 | 425 | // Блокировка планеты-цели |
426 | - ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : '') . |
|
426 | + ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : ''). |
|
427 | 427 | // Блокировка всех юнитов, принадлежащих планете-цели - НЕ НУЖНО. Уже залочили ранее, как принадлежащие игроку-цели |
428 | 428 | // ($mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS upd ON upd.unit_location_type = " . LOC_PLANET . " AND upd.unit_location_id = pd.id " : '') . |
429 | 429 | |
430 | 430 | |
431 | - ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : '') . |
|
431 | + ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : ''). |
|
432 | 432 | // Блокировка всех юнитов, принадлежащих владельцу флота |
433 | - ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : '') . |
|
433 | + ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : ''). |
|
434 | 434 | // Блокировка планеты отправления |
435 | - ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : '') . |
|
435 | + ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : ''). |
|
436 | 436 | // Блокировка всех юнитов, принадлежащих планете с которой юниты были отправлены - НЕ НУЖНО. Уже залочили ранее, как принадлежащие владельцу флота |
437 | 437 | // ($mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS ups ON ups.unit_location_type = " . LOC_PLANET . " AND ups.unit_location_id = ps.id " : '') . |
438 | 438 | |
@@ -449,11 +449,11 @@ discard block |
||
449 | 449 | public function dbGetLockById($dbId) { |
450 | 450 | classSupernova::$db->doSelect( |
451 | 451 | // Блокировка самого флота |
452 | - "SELECT 1 FROM {{fleets}} AS FLEET0 " . |
|
452 | + "SELECT 1 FROM {{fleets}} AS FLEET0 ". |
|
453 | 453 | // Lock fleet owner |
454 | - "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner " . |
|
454 | + "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner ". |
|
455 | 455 | // Блокировка всех юнитов, принадлежащих этому флоту |
456 | - "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = " . LOC_FLEET . " AND UNIT0.unit_location_id = FLEET0.fleet_id " . |
|
456 | + "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = ".LOC_FLEET." AND UNIT0.unit_location_id = FLEET0.fleet_id ". |
|
457 | 457 | |
458 | 458 | // Без предварительной выборки неизвестно - куда летит этот флот. |
459 | 459 | // Поэтому надо выбирать флоты, чьи координаты прибытия ИЛИ отбытия совпадают с координатами прибытия ИЛИ отбытия текущего флота. |
@@ -469,9 +469,9 @@ discard block |
||
469 | 469 | FLEET1.fleet_end_planet = FLEET0.fleet_end_planet |
470 | 470 | " . |
471 | 471 | // Блокировка всех юнитов, принадлежащих этим флотам |
472 | - "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = " . LOC_FLEET . " AND UNIT1.unit_location_id = FLEET1.fleet_id " . |
|
472 | + "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = ".LOC_FLEET." AND UNIT1.unit_location_id = FLEET1.fleet_id ". |
|
473 | 473 | // Lock fleet owner |
474 | - "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner " . |
|
474 | + "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner ". |
|
475 | 475 | |
476 | 476 | "LEFT JOIN {{fleets}} AS FLEET2 ON |
477 | 477 | FLEET2.fleet_mess = 1 AND FLEET0.fleet_mess = 0 AND |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | " . |
482 | 482 | // Блокировка всех юнитов, принадлежащих этим флотам |
483 | 483 | "LEFT JOIN {{unit}} as UNIT2 ON |
484 | - UNIT2.unit_location_type = " . LOC_FLEET . " AND |
|
484 | + UNIT2.unit_location_type = " . LOC_FLEET." AND |
|
485 | 485 | UNIT2.unit_location_id = FLEET2.fleet_id |
486 | 486 | " . |
487 | 487 | // Lock fleet owner |
@@ -498,11 +498,11 @@ discard block |
||
498 | 498 | " . |
499 | 499 | // Блокировка всех юнитов, принадлежащих этим флотам |
500 | 500 | "LEFT JOIN {{unit}} as UNIT3 ON |
501 | - UNIT3.unit_location_type = " . LOC_FLEET . " AND |
|
501 | + UNIT3.unit_location_type = " . LOC_FLEET." AND |
|
502 | 502 | UNIT3.unit_location_id = FLEET3.fleet_id |
503 | 503 | " . |
504 | 504 | // Lock fleet owner |
505 | - "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner " . |
|
505 | + "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner ". |
|
506 | 506 | |
507 | 507 | "LEFT JOIN {{fleets}} AS FLEET4 ON |
508 | 508 | FLEET4.fleet_mess = 1 AND FLEET0.fleet_mess = 1 AND |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | " . |
513 | 513 | // Блокировка всех юнитов, принадлежащих этим флотам |
514 | 514 | "LEFT JOIN {{unit}} as UNIT4 ON |
515 | - UNIT4.unit_location_type = " . LOC_FLEET . " AND |
|
515 | + UNIT4.unit_location_type = " . LOC_FLEET." AND |
|
516 | 516 | UNIT4.unit_location_id = FLEET4.fleet_id |
517 | 517 | " . |
518 | 518 | // Lock fleet owner |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | " . |
535 | 535 | // Блокировка всех юнитов, принадлежащих этой планете |
536 | 536 | "LEFT JOIN {{unit}} as UNIT5 ON |
537 | - UNIT5.unit_location_type = " . LOC_PLANET . " AND |
|
537 | + UNIT5.unit_location_type = " . LOC_PLANET." AND |
|
538 | 538 | UNIT5.unit_location_id = PLANETS5.id |
539 | 539 | " . |
540 | 540 | |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | " . |
553 | 553 | // Блокировка всех юнитов, принадлежащих этой планете |
554 | 554 | "LEFT JOIN {{unit}} as UNIT6 ON |
555 | - UNIT6.unit_location_type = " . LOC_PLANET . " AND |
|
555 | + UNIT6.unit_location_type = " . LOC_PLANET." AND |
|
556 | 556 | UNIT6.unit_location_id = PLANETS6.id |
557 | 557 | " . |
558 | 558 | "WHERE FLEET0.fleet_id = {$dbId} GROUP BY 1 FOR UPDATE" |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | } elseif ($this->isResource($unit_id)) { |
672 | 672 | $this->resource_list[$unit_id] = $unit_count; |
673 | 673 | } else { |
674 | - throw new Exception('Trying to pass to fleet non-resource and non-ship ' . var_export($unit_array, true), FLIGHT_SHIPS_UNIT_WRONG); |
|
674 | + throw new Exception('Trying to pass to fleet non-resource and non-ship '.var_export($unit_array, true), FLIGHT_SHIPS_UNIT_WRONG); |
|
675 | 675 | } |
676 | 676 | } |
677 | 677 | } |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | * @param int $unit_count |
806 | 806 | */ |
807 | 807 | public function shipSetCount($unit_id, $unit_count = 0) { |
808 | - pdump(__CLASS__ . '->' . __FUNCTION__); |
|
808 | + pdump(__CLASS__.'->'.__FUNCTION__); |
|
809 | 809 | $this->shipAdjustCount($unit_id, $unit_count, true); |
810 | 810 | } |
811 | 811 | |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | */ |
1006 | 1006 | public function resourcesSet($resource_list) { |
1007 | 1007 | if (!empty($this->propertiesAdjusted['resource_list'])) { |
1008 | - throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in ' . get_called_class() . '::unitSetResourceList', ERR_ERROR); |
|
1008 | + throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in '.get_called_class().'::unitSetResourceList', ERR_ERROR); |
|
1009 | 1009 | } |
1010 | 1010 | $this->resourcesAdjust($resource_list, true); |
1011 | 1011 | } |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | // Check for negative unit value |
1040 | 1040 | if ($this->resource_list[$resource_id] < 0) { |
1041 | 1041 | // TODO |
1042 | - throw new Exception('Resource ' . $resource_id . ' will become negative in ' . get_called_class() . '::unitAdjustResourceList', ERR_ERROR); |
|
1042 | + throw new Exception('Resource '.$resource_id.' will become negative in '.get_called_class().'::unitAdjustResourceList', ERR_ERROR); |
|
1043 | 1043 | } |
1044 | 1044 | } |
1045 | 1045 | } |
@@ -1220,7 +1220,7 @@ discard block |
||
1220 | 1220 | |
1221 | 1221 | protected function printErrorIfNoShips() { |
1222 | 1222 | if ($this->unitList->unitsCount() <= 0) { |
1223 | - message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet' . DOT_PHP_EX, 5); |
|
1223 | + message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet'.DOT_PHP_EX, 5); |
|
1224 | 1224 | } |
1225 | 1225 | } |
1226 | 1226 | |
@@ -1608,14 +1608,14 @@ discard block |
||
1608 | 1608 | if (FLIGHT_ALLOWED == $validateResult[$missionType]) { |
1609 | 1609 | $this->allowed_missions[$missionType] = $mission; |
1610 | 1610 | } else { |
1611 | - if($missionType == $this->mission_type) { |
|
1611 | + if ($missionType == $this->mission_type) { |
|
1612 | 1612 | } |
1613 | 1613 | unset($this->allowed_missions[$missionType]); |
1614 | 1614 | } |
1615 | 1615 | } |
1616 | 1616 | |
1617 | - if(empty($this->allowed_missions)) { |
|
1618 | - if($this->mission_type != MT_NONE && isset($validateResult[$this->mission_type])) { |
|
1617 | + if (empty($this->allowed_missions)) { |
|
1618 | + if ($this->mission_type != MT_NONE && isset($validateResult[$this->mission_type])) { |
|
1619 | 1619 | throw new ExceptionFleetInvalid($validateResult[$this->mission_type], $validateResult[$this->mission_type]); |
1620 | 1620 | } else { |
1621 | 1621 | throw new ExceptionFleetInvalid(FLIGHT_MISSION_IMPOSSIBLE, FLIGHT_MISSION_IMPOSSIBLE); |
@@ -1844,7 +1844,7 @@ discard block |
||
1844 | 1844 | $template_result['.']['fleets'][] = $this->renderFleet(SN_TIME_NOW, $timeMissionJob); |
1845 | 1845 | |
1846 | 1846 | $template_result += array( |
1847 | - 'mission' => classLocale::$lang['type_mission'][$this->_mission_type] . ($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' ' . pretty_time($timeMissionJob) : ''), |
|
1847 | + 'mission' => classLocale::$lang['type_mission'][$this->_mission_type].($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' '.pretty_time($timeMissionJob) : ''), |
|
1848 | 1848 | 'dist' => pretty_number($this->travelData['distance']), |
1849 | 1849 | 'speed' => pretty_number($this->travelData['fleet_speed']), |
1850 | 1850 | 'deute_need' => pretty_number($this->travelData['consumption']), |
@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | $query = $this->db->doSelect( |
199 | 199 | "SELECT |
200 | 200 | distinct({{{$location_info[P_TABLE_NAME]}}}.{$owner_data[P_OWNER_FIELD]}) AS parent_id |
201 | - FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
202 | - ($filter ? ' WHERE ' . $filter : '') . |
|
201 | + FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
202 | + ($filter ? ' WHERE '.$filter : ''). |
|
203 | 203 | ($fetch ? ' LIMIT 1' : '')); |
204 | 204 | while ($row = db_fetch($query)) { |
205 | 205 | // Исключаем из списка родительских ИД уже заблокированные записи |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | if ($indexes_str = implode(',', $parent_id_list)) { |
213 | 213 | $parent_id_field = static::$location_info[$owner_location_type][P_ID]; |
214 | 214 | classSupernova::$gc->cacheOperator->db_get_record_list($owner_location_type, |
215 | - $parent_id_field . (count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true); |
|
215 | + $parent_id_field.(count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true); |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
220 | 220 | $query = $this->db->doSelect( |
221 | - "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
221 | + "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
222 | 222 | (($filter = trim($filter)) ? " WHERE {$filter}" : '') |
223 | 223 | . " FOR UPDATE" |
224 | 224 | ); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | $condition = trim($condition); |
337 | 337 | $table_name = static::$location_info[$location_type][P_TABLE_NAME]; |
338 | 338 | |
339 | - if ($result = $this->db->doUpdateComplex("UPDATE {{{$table_name}}} SET " . $set . ($condition ? ' WHERE ' . $condition : ''))) { |
|
339 | + if ($result = $this->db->doUpdateComplex("UPDATE {{{$table_name}}} SET ".$set.($condition ? ' WHERE '.$condition : ''))) { |
|
340 | 340 | |
341 | 341 | if ($this->db->db_affected_rows()) { // Обновляем данные только если ряд был затронут |
342 | 342 | // Поскольку нам неизвестно, что и как обновилось - сбрасываем кэш этого типа полностью |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | public function db_lock_tables($tables) { |
403 | 403 | $tables = is_array($tables) ? $tables : array($tables => ''); |
404 | 404 | foreach ($tables as $table_name => $condition) { |
405 | - $this->db->doSelect("SELECT 1 FROM {{{$table_name}}}" . ($condition ? ' WHERE ' . $condition : '')); |
|
405 | + $this->db->doSelect("SELECT 1 FROM {{{$table_name}}}".($condition ? ' WHERE '.$condition : '')); |
|
406 | 406 | } |
407 | 407 | } |
408 | 408 | } |