@@ -104,6 +104,9 @@ discard block |
||
104 | 104 | return $result; |
105 | 105 | } |
106 | 106 | |
107 | + /** |
|
108 | + * @param integer $config_user_birthday_range |
|
109 | + */ |
|
107 | 110 | public static function db_user_list_to_celebrate($config_user_birthday_range) { |
108 | 111 | $query = static::buildDBQ() |
109 | 112 | ->field('id', 'username', 'user_birthday', 'user_birthday_celebrated') |
@@ -193,6 +196,9 @@ discard block |
||
193 | 196 | } |
194 | 197 | |
195 | 198 | |
199 | + /** |
|
200 | + * @param string $username_unsafe |
|
201 | + */ |
|
196 | 202 | public static function db_user_by_username($username_unsafe, $for_update = false, $fields = '*', $player = null, $like = false) { |
197 | 203 | // TODO Проверить, кстати - а везде ли нужно выбирать юзеров или где-то все-таки ищутся Альянсы ? |
198 | 204 | if (!($username_unsafe = trim($username_unsafe))) { |
@@ -247,7 +253,6 @@ discard block |
||
247 | 253 | |
248 | 254 | /** |
249 | 255 | * @param $user_id |
250 | - * @param array $set |
|
251 | 256 | * @param array $adjust |
252 | 257 | * |
253 | 258 | * @return array|bool|mysqli_result|null |
@@ -264,8 +269,8 @@ discard block |
||
264 | 269 | * <p>array - запись пользователя с установленным полем ['id']</p> |
265 | 270 | * @param bool $for_update @deprecated |
266 | 271 | * @param string $fields @deprecated список полей или '*'/'' для всех полей |
267 | - * @param null $player |
|
268 | - * @param bool|null $player Признак выбора записи пользователь типа "игрок" |
|
272 | + * @param boolean $player |
|
273 | + * @param boolean $player Признак выбора записи пользователь типа "игрок" |
|
269 | 274 | * <p>null - Можно выбрать запись любого типа</p> |
270 | 275 | * <p>true - Выбирается только запись типа "игрок"</p> |
271 | 276 | * <p>false - Выбирается только запись типа "альянс"</p> |
@@ -16,7 +16,6 @@ discard block |
||
16 | 16 | * @param $user |
17 | 17 | * @param $planet |
18 | 18 | * @param array $unit_list |
19 | - * @param null $query |
|
20 | 19 | */ |
21 | 20 | function db_change_resources(&$user, &$planet, $unit_list) { |
22 | 21 | $group = sn_get_groups('resources_loot'); |
@@ -56,6 +55,9 @@ discard block |
||
56 | 55 | |
57 | 56 | } |
58 | 57 | |
58 | +/** |
|
59 | + * @param boolean $transaction_should_be_started |
|
60 | + */ |
|
59 | 61 | function sn_db_transaction_check($transaction_should_be_started = null) { |
60 | 62 | return classSupernova::$gc->db->getTransaction()->check($transaction_should_be_started); |
61 | 63 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | /** |
158 | 158 | * @param string $query |
159 | 159 | * |
160 | - * @return mixed|string |
|
160 | + * @return string |
|
161 | 161 | */ |
162 | 162 | public function replaceTablePlaceholders($query) { |
163 | 163 | $sql = $query; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
174 | - * @param $query |
|
174 | + * @param string $query |
|
175 | 175 | */ |
176 | 176 | protected function logQuery($query) { |
177 | 177 | if (!classSupernova::$config->debug) { |
@@ -286,6 +286,7 @@ discard block |
||
286 | 286 | * @param array $fields |
287 | 287 | * @param array $where |
288 | 288 | * @param bool $isOneRecord |
289 | + * @param boolean $forUpdate |
|
289 | 290 | * |
290 | 291 | * @return array|bool|mysqli_result|null |
291 | 292 | */ |
@@ -332,6 +333,11 @@ discard block |
||
332 | 333 | |
333 | 334 | |
334 | 335 | // INSERT/REPLACE |
336 | + |
|
337 | + /** |
|
338 | + * @param string $table |
|
339 | + * @param integer $replace |
|
340 | + */ |
|
335 | 341 | protected function doSet($table, $fieldsAndValues, $replace = DB_INSERT_PLAIN) { |
336 | 342 | $query = DbQuery::build($this) |
337 | 343 | ->setTable($table) |
@@ -369,6 +375,10 @@ discard block |
||
369 | 375 | |
370 | 376 | |
371 | 377 | // INSERTERS |
378 | + |
|
379 | + /** |
|
380 | + * @param string $query |
|
381 | + */ |
|
372 | 382 | public function doInsertComplex($query) { |
373 | 383 | return $this->doSql($query); |
374 | 384 | } |
@@ -386,7 +396,7 @@ discard block |
||
386 | 396 | * Values should be passed as-is |
387 | 397 | * |
388 | 398 | * @param string $table |
389 | - * @param array $fields |
|
399 | + * @param string[] $fields |
|
390 | 400 | * @param string[] $values |
391 | 401 | * |
392 | 402 | * @return array|bool|mysqli_result|null |
@@ -438,7 +448,7 @@ discard block |
||
438 | 448 | * Self-contained - means no params used |
439 | 449 | * Such queries usually used to make large amount of in-base calculations |
440 | 450 | * |
441 | - * @param $query |
|
451 | + * @param string $query |
|
442 | 452 | * |
443 | 453 | * @return array|bool|mysqli_result|null |
444 | 454 | */ |
@@ -456,13 +466,16 @@ discard block |
||
456 | 466 | } |
457 | 467 | |
458 | 468 | /** |
459 | - * @param $DbQuery DbQuery |
|
469 | + * @param DbQuery $DbQuery DbQuery |
|
460 | 470 | */ |
461 | 471 | public function doUpdateDbQueryAdjust($DbQuery) { |
462 | 472 | return $this->doUpdateDbQuery($DbQuery); |
463 | 473 | } |
464 | 474 | |
465 | 475 | |
476 | + /** |
|
477 | + * @param boolean $isOneRecord |
|
478 | + */ |
|
466 | 479 | protected function doUpdateWhere($table, $fieldsSet, $fieldsAdjust = array(), $where = array(), $isOneRecord = DB_RECORDS_ALL, $whereDanger = array()) { |
467 | 480 | // $query = DbQuery::build($this) |
468 | 481 | // ->setTable($table) |
@@ -498,10 +511,16 @@ discard block |
||
498 | 511 | return $this->doSql($query); |
499 | 512 | } |
500 | 513 | |
514 | + /** |
|
515 | + * @param string $table |
|
516 | + */ |
|
501 | 517 | public function doUpdateRowSet($table, $fieldsAndValues, $where) { |
502 | 518 | return $this->doUpdateWhere($table, $fieldsAndValues, array(), $where, DB_RECORD_ONE); |
503 | 519 | } |
504 | 520 | |
521 | + /** |
|
522 | + * @param string $table |
|
523 | + */ |
|
505 | 524 | public function doUpdateTableSet($table, $fieldsAndValues, $where = array()) { |
506 | 525 | return $this->doUpdateWhere($table, $fieldsAndValues, array(), $where, DB_RECORDS_ALL); |
507 | 526 | } |
@@ -708,6 +727,10 @@ discard block |
||
708 | 727 | } |
709 | 728 | |
710 | 729 | // TODO Заменить это на новый логгер |
730 | + |
|
731 | + /** |
|
732 | + * @param string $query |
|
733 | + */ |
|
711 | 734 | protected function security_watch_user_queries($query) { |
712 | 735 | global $user; |
713 | 736 | |
@@ -731,6 +754,9 @@ discard block |
||
731 | 754 | } |
732 | 755 | |
733 | 756 | |
757 | + /** |
|
758 | + * @param string $query |
|
759 | + */ |
|
734 | 760 | public function security_query_check_bad_words($query) { |
735 | 761 | if ($this->skipQueryCheck) { |
736 | 762 | return; |
@@ -155,10 +155,17 @@ discard block |
||
155 | 155 | return $this->field(DbSqlLiteral::build($this->db)->literal($field)); |
156 | 156 | } |
157 | 157 | |
158 | + /** |
|
159 | + * @param string $functionName |
|
160 | + * @param string $alias |
|
161 | + */ |
|
158 | 162 | public function fieldSingleFunction($functionName, $field = '*', $alias = DbSqlLiteral::SQL_LITERAL_ALIAS_NONE) { |
159 | 163 | return $this->field(DbSqlLiteral::build($this->db)->buildSingleArgument($functionName, $field, $alias)); |
160 | 164 | } |
161 | 165 | |
166 | + /** |
|
167 | + * @param string $alias |
|
168 | + */ |
|
162 | 169 | public function fieldCount($field = '*', $alias = DbSqlLiteral::SQL_LITERAL_ALIAS_NONE) { |
163 | 170 | return $this->field(DbSqlLiteral::build($this->db)->count($field, $alias)); |
164 | 171 | } |
@@ -240,7 +247,7 @@ discard block |
||
240 | 247 | |
241 | 248 | /** |
242 | 249 | * @param db_mysql|null $db |
243 | - * @param string|object|DBStaticRecord|DbSqlAware $className |
|
250 | + * @param string $className |
|
244 | 251 | * |
245 | 252 | * @return static |
246 | 253 | */ |
@@ -444,7 +451,6 @@ discard block |
||
444 | 451 | } |
445 | 452 | |
446 | 453 | /** |
447 | - * @param bool $skip_query_check |
|
448 | 454 | * |
449 | 455 | * @return array |
450 | 456 | */ |
@@ -455,7 +461,6 @@ discard block |
||
455 | 461 | } |
456 | 462 | |
457 | 463 | /** |
458 | - * @param bool $skip_query_check |
|
459 | 464 | * |
460 | 465 | * @return mixed|null |
461 | 466 | */ |