Skip to content

Commit 21a3961

Browse files
committed
Remove deprecated && and || operators.
1 parent d407408 commit 21a3961

File tree

8 files changed

+14
-14
lines changed

8 files changed

+14
-14
lines changed

server/Maintenance.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
$users = $db->execute("SELECT u.id as userId
4141
FROM users as u
4242
LEFT JOIN sessions as s ON s.userId=u.id
43-
WHERE u.type='temporary' && s.id IS NULL LIMIT 10000");
43+
WHERE u.type='temporary' AND s.id IS NULL LIMIT 10000");
4444

4545
$tmpUserCount = count($users);
4646

@@ -55,7 +55,7 @@
5555
$usersToDelete = quoteStringArray(array_column($users, "userId"));
5656

5757
$db->begin();
58-
$db->execute("DELETE FROM patterns WHERE visibility='private' && owner IN ($usersToDelete)");
58+
$db->execute("DELETE FROM patterns WHERE visibility='private' AND owner IN ($usersToDelete)");
5959
$db->execute("DELETE FROM favorites WHERE userId IN ($usersToDelete)");
6060
$db->execute("DELETE FROM users WHERE id IN ($usersToDelete)");
6161
$db->commit();

server/actions/account/login.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function tryLogin($type) {
6666
if ($sessionData->type == "temporary") {
6767
// Migrate all the temp users favorites / ratings / patterns to the correct user
6868
// Then delete the old user / session.
69-
$existingUser = $this->db->execute("SELECT * FROM users WHERE email=? && type=?", [
69+
$existingUser = $this->db->execute("SELECT * FROM users WHERE email=? AND type=?", [
7070
["s", $email],
7171
["s", $type]
7272
], true);
@@ -87,7 +87,7 @@ function tryLogin($type) {
8787
$this->db->execute("DELETE IGNORE
8888
FROM favorites
8989
WHERE userId=?
90-
&& patternId IN (SELECT patternId FROM (SELECT patternId FROM favorites WHERE userId=?) as child)
90+
AND patternId IN (SELECT patternId FROM (SELECT patternId FROM favorites WHERE userId=?) as child)
9191
", [
9292
["s", $temporaryUserId],
9393
["s", $existingUserId]
@@ -106,7 +106,7 @@ function tryLogin($type) {
106106
$this->db->execute("DELETE IGNORE
107107
FROM userRatings
108108
WHERE userId=?
109-
&& patternId IN (SELECT patternId FROM (SELECT patternId FROM userRatings WHERE userId=?) as child)
109+
AND patternId IN (SELECT patternId FROM (SELECT patternId FROM userRatings WHERE userId=?) as child)
110110
", [
111111
["s", $temporaryUserId],
112112
["s", $existingUserId]
@@ -159,7 +159,7 @@ function tryLogin($type) {
159159
]);
160160

161161
$accessToken = serialize($adapter->getAccessToken());
162-
$userIdData = $this->db->execute("SELECT * FROM users WHERE email=? && type=?", [
162+
$userIdData = $this->db->execute("SELECT * FROM users WHERE email=? AND type=?", [
163163
["s", $email],
164164
["s", $type]
165165
],true);

server/actions/patterns/delete.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public function execute() {
4040

4141
$sql = "SELECT id FROM patterns
4242
WHERE id=?
43-
&& owner=?
44-
&& visibility IN ('$privateConst', '$protectedConst')";
43+
AND owner=?
44+
AND visibility IN ('$privateConst', '$protectedConst')";
4545

4646
$exists = $this->db->execute($sql, [
4747
["s", $patternId],

server/actions/patterns/favorite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function execute() {
3939
["s", $patternId],
4040
]);
4141
} else {
42-
$sql = "DELETE IGNORE FROM favorites WHERE patternId=? && userId=?";
42+
$sql = "DELETE IGNORE FROM favorites WHERE patternId=? AND userId=?";
4343
$this->db->execute($sql, [
4444
["s", $patternId],
4545
["s", $userProfile->userId],

server/actions/patterns/rate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function execute() {
3535
$userProfile = $this->getUserProfile();
3636
$voteQuery = null;
3737

38-
$sql = "SELECT * FROM userRatings WHERE patternId=? && userId=? LIMIT 1";
38+
$sql = "SELECT * FROM userRatings WHERE patternId=? AND userId=? LIMIT 1";
3939
$existing = $this->db->execute($sql, [
4040
["s", $patternId],
4141
["s", $userProfile->userId]

server/actions/patterns/save.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function savePattern($userProfile) {
5454
$protectedState = \core\PatternVisibility::PROTECTED;
5555
$privateState = \core\PatternVisibility::PRIVATE;
5656

57-
$sql = "SELECT * FROM patterns WHERE id=? && owner=? && visibility IN (?, ?) LIMIT 1";
57+
$sql = "SELECT * FROM patterns WHERE id=? AND owner=? AND visibility IN (?, ?) LIMIT 1";
5858
$existingPattern = $this->db->execute($sql, [
5959
["s", $patternId],
6060
["s", $userProfile->userId],

server/actions/patterns/search.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ public function searchCommunity($query, $startIndex, $limit, $type) {
5454

5555
if (!is_null($type)) {
5656
$typeArray = quoteStringArray($type);
57-
$q .= " && p.flavor IN ($typeArray)";
57+
$q .= " AND p.flavor IN ($typeArray)";
5858
}
5959

6060
if (count($whereStatements) > 0) {
61-
$q .= " && (" . implode("||", $whereStatements) . ")";
61+
$q .= " AND (" . implode(" OR ", $whereStatements) . ")";
6262
}
6363

6464
$q .= " GROUP BY p.id ORDER by p.ratingSort DESC LIMIT ?, ?";

server/core/DB.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function exists($table, $values, &$result = null) {
129129
$params[] = ["s", $value];
130130
}
131131

132-
$where = implode(" && ", $where);
132+
$where = implode(" AND ", $where);
133133

134134
$q = "SELECT * FROM $table WHERE {$where} LIMIT 1";
135135
$result = $this->execute($q, $params);

0 commit comments

Comments
 (0)