@@ -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) { |
@@ -301,6 +301,11 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | |
| 303 | 303 | // INSERT/REPLACE |
| 304 | + |
|
| 305 | + /** |
|
| 306 | + * @param string $table |
|
| 307 | + * @param integer $replace |
|
| 308 | + */ |
|
| 304 | 309 | protected function doSet($table, $fieldsAndValues, $replace = DB_INSERT_PLAIN) { |
| 305 | 310 | $query = DbQuery::build($this) |
| 306 | 311 | ->setTable($table) |
@@ -338,6 +343,10 @@ discard block |
||
| 338 | 343 | |
| 339 | 344 | |
| 340 | 345 | // INSERTERS |
| 346 | + |
|
| 347 | + /** |
|
| 348 | + * @param string $query |
|
| 349 | + */ |
|
| 341 | 350 | public function doInsertComplex($query) { |
| 342 | 351 | return $this->doSql($query); |
| 343 | 352 | } |
@@ -355,7 +364,7 @@ discard block |
||
| 355 | 364 | * Values should be passed as-is |
| 356 | 365 | * |
| 357 | 366 | * @param string $table |
| 358 | - * @param array $fields |
|
| 367 | + * @param string[] $fields |
|
| 359 | 368 | * @param string[] $values |
| 360 | 369 | * |
| 361 | 370 | * @return array|bool|mysqli_result|null |
@@ -407,7 +416,7 @@ discard block |
||
| 407 | 416 | * Self-contained - means no params used |
| 408 | 417 | * Such queries usually used to make large amount of in-base calculations |
| 409 | 418 | * |
| 410 | - * @param $query |
|
| 419 | + * @param string $query |
|
| 411 | 420 | * |
| 412 | 421 | * @return array|bool|mysqli_result|null |
| 413 | 422 | */ |
@@ -425,13 +434,16 @@ discard block |
||
| 425 | 434 | } |
| 426 | 435 | |
| 427 | 436 | /** |
| 428 | - * @param $DbQuery DbQuery |
|
| 437 | + * @param DbQuery $DbQuery DbQuery |
|
| 429 | 438 | */ |
| 430 | 439 | public function doUpdateDbQueryAdjust($DbQuery) { |
| 431 | 440 | return $this->doUpdateDbQuery($DbQuery); |
| 432 | 441 | } |
| 433 | 442 | |
| 434 | 443 | |
| 444 | + /** |
|
| 445 | + * @param boolean $isOneRecord |
|
| 446 | + */ |
|
| 435 | 447 | protected function doUpdateWhere($table, $fieldsSet, $fieldsAdjust = array(), $where = array(), $isOneRecord = DB_RECORDS_ALL, $whereDanger = array()) { |
| 436 | 448 | // $query = DbQuery::build($this) |
| 437 | 449 | // ->setTable($table) |
@@ -467,10 +479,16 @@ discard block |
||
| 467 | 479 | return $this->doSql($query); |
| 468 | 480 | } |
| 469 | 481 | |
| 482 | + /** |
|
| 483 | + * @param string $table |
|
| 484 | + */ |
|
| 470 | 485 | public function doUpdateRowSet($table, $fieldsAndValues, $where) { |
| 471 | 486 | return $this->doUpdateWhere($table, $fieldsAndValues, array(), $where, DB_RECORD_ONE); |
| 472 | 487 | } |
| 473 | 488 | |
| 489 | + /** |
|
| 490 | + * @param string $table |
|
| 491 | + */ |
|
| 474 | 492 | public function doUpdateTableSet($table, $fieldsAndValues, $where = array()) { |
| 475 | 493 | return $this->doUpdateWhere($table, $fieldsAndValues, array(), $where, DB_RECORDS_ALL); |
| 476 | 494 | } |
@@ -677,6 +695,10 @@ discard block |
||
| 677 | 695 | } |
| 678 | 696 | |
| 679 | 697 | // TODO Заменить это на новый логгер |
| 698 | + |
|
| 699 | + /** |
|
| 700 | + * @param string $query |
|
| 701 | + */ |
|
| 680 | 702 | protected function security_watch_user_queries($query) { |
| 681 | 703 | global $user; |
| 682 | 704 | |
@@ -700,6 +722,9 @@ discard block |
||
| 700 | 722 | } |
| 701 | 723 | |
| 702 | 724 | |
| 725 | + /** |
|
| 726 | + * @param string $query |
|
| 727 | + */ |
|
| 703 | 728 | public function security_query_check_bad_words($query) { |
| 704 | 729 | if ($this->skipQueryCheck) { |
| 705 | 730 | return; |
@@ -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 | } |