better DISABLE_ACCEL

This commit is contained in:
Shish 2019-07-07 17:40:24 +01:00
parent cf98e4bf43
commit 1bd7e1a547

View File

@ -200,7 +200,7 @@ class Image
public static function get_accelerated_result(array $tag_conditions, array $img_conditions, int $offset, ?int $limit): ?PDOStatement public static function get_accelerated_result(array $tag_conditions, array $img_conditions, int $offset, ?int $limit): ?PDOStatement
{ {
if (!SEARCH_ACCEL || !empty($img_conditions)) { if (!SEARCH_ACCEL || !empty($img_conditions) || isset($_GET['DISABLE_ACCEL'])) {
return null; return null;
} }
@ -214,8 +214,8 @@ class Image
$req["limit"] = $limit; $req["limit"] = $limit;
$response = Image::query_accelerator($req); $response = Image::query_accelerator($req);
if ($response) {
$list = implode(",", $response); $list = implode(",", $response);
if ($list) {
$result = $database->execute("SELECT * FROM images WHERE id IN ($list) ORDER BY images.id DESC"); $result = $database->execute("SELECT * FROM images WHERE id IN ($list) ORDER BY images.id DESC");
} else { } else {
$result = $database->execute("SELECT * FROM images WHERE 1=0 ORDER BY images.id DESC"); $result = $database->execute("SELECT * FROM images WHERE 1=0 ORDER BY images.id DESC");
@ -225,7 +225,7 @@ class Image
public static function get_accelerated_count(array $tag_conditions, array $img_conditions): ?int public static function get_accelerated_count(array $tag_conditions, array $img_conditions): ?int
{ {
if (!SEARCH_ACCEL || !empty($img_conditions)) { if (!SEARCH_ACCEL || !empty($img_conditions) || isset($_GET['DISABLE_ACCEL'])) {
return null; return null;
} }
@ -240,8 +240,6 @@ class Image
public static function query_accelerator($req) public static function query_accelerator($req)
{ {
if(isset($_GET['DISABLE_ACCEL'])) return null;
global $_tracer; global $_tracer;
$fp = @fsockopen("127.0.0.1", 21212); $fp = @fsockopen("127.0.0.1", 21212);
if (!$fp) { if (!$fp) {