Test Failed
Push — dependabot/submodules/master/l... ( 7a561d )
by
unknown
06:24
created
PrecacheGeolocation.php 3 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if (isset($_SERVER['REQUEST_METHOD'])) {
4
-    die();
4
+	die();
5 5
 } // Web clients die.
6 6
 
7 7
 ini_set('display_errors', 1);
@@ -17,21 +17,21 @@  discard block
 block discarded – undo
17 17
 $locationProvider = new IpLocationProvider($database, $locationProviderApiKey);
18 18
 
19 19
 while (true) {
20
-    echo "Beginning txn\n";
21
-    $database->beginTransaction();
20
+	echo "Beginning txn\n";
21
+	$database->beginTransaction();
22 22
 
23
-    try {
24
-        echo ". Fetching data...\n";
23
+	try {
24
+		echo ". Fetching data...\n";
25 25
 
26
-        // fetch a bunch of un-geolocated IPs from the database.
27
-        // note we have to parse the forwardedip field in the database so we can test against the geolocation table.
28
-        // This guarantees we get ten unlocated IPs back, unless there actually aren't 10 available.
29
-        // Alternatives include downloading a small set of forwarded IPs, splitting it in PHP, constructing an IN()
30
-        // clause dynamically, sending that back to the database to check if there are geolocation entries, then repeating
31
-        // until we have 10 to process - and the fact that we'd have to potentially retrieve all IPs from the database
32
-        // before we find any at all. This way keeps all of that legwork in the database, at the cost of a more complex
33
-        // query.
34
-        $statement = $database->query(<<<SQL
26
+		// fetch a bunch of un-geolocated IPs from the database.
27
+		// note we have to parse the forwardedip field in the database so we can test against the geolocation table.
28
+		// This guarantees we get ten unlocated IPs back, unless there actually aren't 10 available.
29
+		// Alternatives include downloading a small set of forwarded IPs, splitting it in PHP, constructing an IN()
30
+		// clause dynamically, sending that back to the database to check if there are geolocation entries, then repeating
31
+		// until we have 10 to process - and the fact that we'd have to potentially retrieve all IPs from the database
32
+		// before we find any at all. This way keeps all of that legwork in the database, at the cost of a more complex
33
+		// query.
34
+		$statement = $database->query(<<<SQL
35 35
             SELECT p.prox
36 36
             FROM (
37 37
               SELECT trim(substring_index(substring_index(r.forwardedip, ',', n.n), ',', -1)) prox
@@ -48,38 +48,38 @@  discard block
 block discarded – undo
48 48
             WHERE NOT EXISTS (SELECT 1 FROM geolocation g WHERE g.address = p.prox FOR UPDATE)
49 49
             LIMIT 10;
50 50
 SQL
51
-        );
51
+		);
52 52
 
53
-        $missingIps = $statement->fetchAll(PDO::FETCH_COLUMN);
53
+		$missingIps = $statement->fetchAll(PDO::FETCH_COLUMN);
54 54
 
55
-        $count = count($missingIps);
56
-        if ($count === 0) {
57
-            echo ". Found nothing to do.\n";
58
-            break;
59
-        }
55
+		$count = count($missingIps);
56
+		if ($count === 0) {
57
+			echo ". Found nothing to do.\n";
58
+			break;
59
+		}
60 60
 
61
-        echo ". Picked {$count} IP addresses\n";
61
+		echo ". Picked {$count} IP addresses\n";
62 62
 
63
-        foreach ($missingIps as $ip) {
64
-            echo ". . Getting location for {$ip}...\n";
65
-            $data = json_encode($locationProvider->getIpLocation($ip));
66
-            echo ". . . {$data}\n";
67
-        }
63
+		foreach ($missingIps as $ip) {
64
+			echo ". . Getting location for {$ip}...\n";
65
+			$data = json_encode($locationProvider->getIpLocation($ip));
66
+			echo ". . . {$data}\n";
67
+		}
68 68
 
69
-        echo ". IP location fetch complete.\n";
70
-        $database->commit();
71
-        echo ". Committed txn.\n";
72
-    } catch (Exception $ex) {
73
-        echo ". Encountered exception: " . $ex->getMessage(). "\n";
74
-        $database->rollBack();
75
-        echo ". Rolled back txn\n";
76
-        throw $ex;
77
-    } finally {
78
-        if($database->hasActiveTransaction()){
79
-            $database->rollBack();
80
-            echo ". Rolled back txn\n";
81
-        }
82
-    }
69
+		echo ". IP location fetch complete.\n";
70
+		$database->commit();
71
+		echo ". Committed txn.\n";
72
+	} catch (Exception $ex) {
73
+		echo ". Encountered exception: " . $ex->getMessage(). "\n";
74
+		$database->rollBack();
75
+		echo ". Rolled back txn\n";
76
+		throw $ex;
77
+	} finally {
78
+		if($database->hasActiveTransaction()){
79
+			$database->rollBack();
80
+			echo ". Rolled back txn\n";
81
+		}
82
+	}
83 83
 }
84 84
 
85 85
 echo "Done.\n";
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -69,13 +69,15 @@
 block discarded – undo
69 69
         echo ". IP location fetch complete.\n";
70 70
         $database->commit();
71 71
         echo ". Committed txn.\n";
72
-    } catch (Exception $ex) {
72
+    }
73
+    catch (Exception $ex) {
73 74
         echo ". Encountered exception: " . $ex->getMessage(). "\n";
74 75
         $database->rollBack();
75 76
         echo ". Rolled back txn\n";
76 77
         throw $ex;
77
-    } finally {
78
-        if($database->hasActiveTransaction()){
78
+    }
79
+    finally {
80
+        if($database->hasActiveTransaction()) {
79 81
             $database->rollBack();
80 82
             echo ". Rolled back txn\n";
81 83
         }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,12 +70,12 @@
 block discarded – undo
70 70
         $database->commit();
71 71
         echo ". Committed txn.\n";
72 72
     } catch (Exception $ex) {
73
-        echo ". Encountered exception: " . $ex->getMessage(). "\n";
73
+        echo ". Encountered exception: " . $ex->getMessage() . "\n";
74 74
         $database->rollBack();
75 75
         echo ". Rolled back txn\n";
76 76
         throw $ex;
77 77
     } finally {
78
-        if($database->hasActiveTransaction()){
78
+        if ($database->hasActiveTransaction()) {
79 79
             $database->rollBack();
80 80
             echo ". Rolled back txn\n";
81 81
         }
Please login to merge, or discard this patch.
includes/Helpers/Logger.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -360,8 +360,7 @@  discard block
 block discarded – undo
360 360
 			$countStatement->bindValue(":userFilter", 0, PDO::PARAM_INT);
361 361
 			$searchStatement->bindValue(":userid", 0, PDO::PARAM_INT);
362 362
 			$countStatement->bindValue(":userid", 0, PDO::PARAM_INT);
363
-		}
364
-		else {
363
+		} else {
365 364
 			$searchStatement->bindValue(":userFilter", 1, PDO::PARAM_INT);
366 365
 			$countStatement->bindValue(":userFilter", 1, PDO::PARAM_INT);
367 366
 			$searchStatement->bindValue(":userid", User::getByUsername($userFilter, $database)->getId(), PDO::PARAM_INT);
@@ -373,8 +372,7 @@  discard block
 block discarded – undo
373 372
 			$countStatement->bindValue(":actionFilter", 0, PDO::PARAM_INT);
374 373
 			$searchStatement->bindValue(":action", "", PDO::PARAM_STR);
375 374
 			$countStatement->bindValue(":action", "", PDO::PARAM_STR);
376
-		}
377
-		else {
375
+		} else {
378 376
 			$searchStatement->bindValue(":actionFilter", 1, PDO::PARAM_INT);
379 377
 			$countStatement->bindValue(":actionFilter", 1, PDO::PARAM_INT);
380 378
 			$searchStatement->bindValue(":action", $actionFilter, PDO::PARAM_STR);
Please login to merge, or discard this patch.
includes/API/Actions/StatsAction.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,8 +49,7 @@
 block discarded – undo
49 49
 
50 50
 		if ($username !== '') {
51 51
 			$this->user = \User::getByUsername($username, $this->database);
52
-		}
53
-		else {
52
+		} else {
54 53
 			$this->user = \User::getByOnWikiUsername($wikiusername, $this->database);
55 54
 		}
56 55
 
Please login to merge, or discard this patch.
includes/Providers/CachedApiAntispoofProvider.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@
 block discarded – undo
24 24
 			$cacheEntry->save();
25 25
 
26 26
 			$cacheResult = $cacheEntry;
27
-		}
28
-		else {
27
+		} else {
29 28
 			$data = $cacheResult->getData();
30 29
 		}
31 30
 
Please login to merge, or discard this patch.
includes/BootstrapSkin.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -119,8 +119,7 @@  discard block
 block discarded – undo
119 119
 		// not equal to one, as zero uses the plural form too.
120 120
 		if ($resultSetCount != 1) {
121 121
 			$onlinemessage = $resultSetCount . " Account Creators currently online (past 5 minutes): $creators";
122
-		}
123
-		else {
122
+		} else {
124 123
 			$onlinemessage = $resultSetCount . " Account Creator currently online (past 5 minutes): $creators";
125 124
 		}
126 125
 
@@ -128,8 +127,7 @@  discard block
 block discarded – undo
128 127
 
129 128
 		if (isset($_SESSION['user'])) {
130 129
 			$smarty->assign("onlineusers", $online);
131
-		}
132
-		else {
130
+		} else {
133 131
 			$emptystring = "";
134 132
 			$smarty->assign("onlineusers", $emptystring);
135 133
 		}
@@ -176,8 +174,7 @@  discard block
 block discarded – undo
176 174
 
177 175
 		if ($return) {
178 176
 			return $returnData;
179
-		}
180
-		else {
177
+		} else {
181 178
 			echo $returnData;
182 179
 			return null;
183 180
 		}
Please login to merge, or discard this patch.
includes/statistics/StatsMonthlyStats.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -145,8 +145,7 @@
 block discarded – undo
145 145
 				$out .= '<img src="' . $baseurl . '/render/' . $i[0] . '" alt="' . $i[1] . '"/>';
146 146
 			}
147 147
 
148
-		}
149
-		else {
148
+		} else {
150 149
 			$out .= BootstrapSkin::displayAlertBox("Graph drawing is currently disabled.", "alert-info", "", false, false, true);
151 150
 		}
152 151
 
Please login to merge, or discard this patch.
includes/statistics/StatsUsers.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,7 @@
 block discarded – undo
18 18
 	{
19 19
 		if (!isset($_GET['user'])) {
20 20
 			return $this->getUserList();
21
-		}
22
-		else {
21
+		} else {
23 22
 			return $this->getUserDetail($_GET['user']);
24 23
 		}
25 24
 	}
Please login to merge, or discard this patch.
includes/statistics/StatsIdUsers.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -14,31 +14,31 @@  discard block
 block discarded – undo
14 14
 
15 15
 class StatsIdUsers extends StatisticsPage
16 16
 {
17
-    protected function execute()
18
-    {
19
-        return $this->getUserList();
20
-    }
17
+	protected function execute()
18
+	{
19
+		return $this->getUserList();
20
+	}
21 21
 
22
-    public function getPageTitle()
23
-    {
24
-        return "User identification status";
25
-    }
22
+	public function getPageTitle()
23
+	{
24
+		return "User identification status";
25
+	}
26 26
 
27
-    public function getPageName()
28
-    {
29
-        return "IdUsers";
30
-    }
27
+	public function getPageName()
28
+	{
29
+		return "IdUsers";
30
+	}
31 31
 
32
-    public function isProtected()
33
-    {
34
-        return true;
35
-    }
32
+	public function isProtected()
33
+	{
34
+		return true;
35
+	}
36 36
 
37
-    private function getUserList()
38
-    {
39
-        global $currentIdentificationVersion, $forceIdentification;
37
+	private function getUserList()
38
+	{
39
+		global $currentIdentificationVersion, $forceIdentification;
40 40
 
41
-        $query = <<<SQL
41
+		$query = <<<SQL
42 42
 select username, status, checkuser, identified, case 
43 43
     when coalesce(identified, 0) = 0 then 'Not identified'
44 44
     when identified < ${forceIdentification} then 'Expired'
@@ -51,16 +51,16 @@  discard block
 block discarded – undo
51 51
 order by username;
52 52
 SQL;
53 53
 
54
-        $qb = new QueryBrowser();
55
-        $qb->rowFetchMode = PDO::FETCH_NUM;
56
-        $qb->overrideTableTitles = array("User name", "Access level", "Checkuser?", "Version", "Identification status");
57
-        $r = $qb->executeQueryToTable($query);
54
+		$qb = new QueryBrowser();
55
+		$qb->rowFetchMode = PDO::FETCH_NUM;
56
+		$qb->overrideTableTitles = array("User name", "Access level", "Checkuser?", "Version", "Identification status");
57
+		$r = $qb->executeQueryToTable($query);
58 58
 
59
-        return $r;
60
-    }
59
+		return $r;
60
+	}
61 61
 
62
-    public function requiresWikiDatabase()
63
-    {
64
-        return false;
65
-    }
62
+	public function requiresWikiDatabase()
63
+	{
64
+		return false;
65
+	}
66 66
 }
Please login to merge, or discard this patch.
includes/DataObjects/GeoLocation.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,12 +47,10 @@
 block discarded – undo
47 47
 			if ($statement->execute()) {
48 48
 				$this->isNew = false;
49 49
 				$this->id = $this->dbObject->lastInsertId();
50
-			}
51
-			else {
50
+			} else {
52 51
 				throw new Exception($statement->errorInfo());
53 52
 			}
54
-		}
55
-		else {
53
+		} else {
56 54
 // update
57 55
 			$statement = $this->dbObject->prepare("UPDATE `geolocation` SET address = :address, data = :data WHERE id = :id;");
58 56
 			$statement->bindValue(":address", $this->address);
Please login to merge, or discard this patch.