Skip to content

Commit

Permalink
Bug Fixes
Browse files Browse the repository at this point in the history
+Optimized a bad query, that took a lot of time to be executed
  • Loading branch information
iopietro authored Feb 19, 2019
1 parent 8edd6a8 commit a934c56
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions GameEngine/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -785,9 +785,13 @@ function updateResource($vid, $what, $number) {

// no need to cache this method
public function hasBeginnerProtection($vid) {
list($vid) = $this->escape_input($vid);

$q = "SELECT u.protect FROM ".TB_PREFIX."users u,".TB_PREFIX."vdata v,".TB_PREFIX."odata o WHERE (u.id = v.owner AND v.wref = ".(int) $vid.") OR (u.id = o.owner AND o.wref = ".(int) $vid.") LIMIT 1";
list($vid) = $this->escape_input((int) $vid);
$q = "SELECT u.protect
FROM s1_users u

This comment has been minimized.

Copy link
@mix5003

mix5003 Feb 20, 2019

@iopietro are you forgot to use TB_PREFIX?

This comment has been minimized.

Copy link
@iopietro

iopietro Feb 20, 2019

Author Owner

Yes, I have, thanks for reporting it.

JOIN s1_vdata v ON u.id = v.owner
JOIN s1_odata o ON u.id = o.owner
WHERE v.wref = ". $vid ." OR o.wref = ". $vid . "
LIMIT 1";
$result = mysqli_query($this->dblink,$q);
$dbarray = mysqli_fetch_array($result);

Expand Down

0 comments on commit a934c56

Please sign in to comment.