We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -2,10 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Backpack\CRUD; |
4 | 4 | |
5 | -use Route; |
|
6 | -use GuzzleHttp\Client; |
|
7 | -use Illuminate\Support\ServiceProvider; |
|
8 | 5 | use Backpack\CRUD\CrudUsageStats; |
6 | +use Illuminate\Support\ServiceProvider; |
|
9 | 7 | |
10 | 8 | class CrudServiceProvider extends ServiceProvider |
11 | 9 | { |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * Check if the application is running in normal conditions |
11 | 11 | * (production env, not in console, not in unit tests). |
12 | 12 | * |
13 | - * @return void |
|
13 | + * @return boolean |
|
14 | 14 | */ |
15 | 15 | private function runningInProduction() |
16 | 16 | { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param string $method HTTP Method to use for the request. |
87 | 87 | * @param string $url URL to point the request at. |
88 | 88 | * @param array $payload The data you want sent to the URL. |
89 | - * @return void |
|
89 | + * @return boolean |
|
90 | 90 | */ |
91 | 91 | private function makeCurlRequest($method, $url, $payload) |
92 | 92 | { |
@@ -39,34 +39,34 @@ |
||
39 | 39 | */ |
40 | 40 | private function sendUsageStats() |
41 | 41 | { |
42 | - // only send usage stats in production |
|
43 | - if (!$this->runningInProduction()) { |
|
44 | - return ; |
|
45 | - } |
|
42 | + // only send usage stats in production |
|
43 | + if (!$this->runningInProduction()) { |
|
44 | + return ; |
|
45 | + } |
|
46 | 46 | |
47 | - // only send stats every ~100 pageloads |
|
48 | - if (rand(1, 100) != 1) { |
|
49 | - return ; |
|
50 | - } |
|
47 | + // only send stats every ~100 pageloads |
|
48 | + if (rand(1, 100) != 1) { |
|
49 | + return ; |
|
50 | + } |
|
51 | 51 | |
52 | 52 | $url = "https://backpackforlaravel.com/api/stats"; |
53 | 53 | $method = "PUT"; |
54 | 54 | $stats = [ |
55 | - 'HTTP_HOST' => $_SERVER['HTTP_HOST'] ?? false, |
|
56 | - 'APP_URL' => $_SERVER['APP_URL'] ?? false, |
|
57 | - 'APP_ENV' => $this->app->environment() ?? false, |
|
58 | - 'APP_DEBUG' => $_SERVER['APP_DEBUG'] ?? false, |
|
59 | - 'SERVER_ADDR' => $_SERVER['SERVER_ADDR'] ?? false, |
|
60 | - 'SERVER_ADMIN' => $_SERVER['SERVER_ADMIN'] ?? false, |
|
61 | - 'SERVER_NAME' => $_SERVER['SERVER_NAME'] ?? false, |
|
62 | - 'SERVER_PORT' => $_SERVER['SERVER_PORT'] ?? false, |
|
63 | - 'SERVER_PROTOCOL' => $_SERVER['SERVER_PROTOCOL'] ?? false, |
|
64 | - 'SERVER_SOFTWARE' => $_SERVER['SERVER_SOFTWARE'] ?? false, |
|
65 | - 'DB_CONNECTION' => $_SERVER['DB_CONNECTION'] ?? false, |
|
66 | - 'LARAVEL_VERSION' => $this->app->version() ?? false, |
|
67 | - 'BACKPACK_BASE_VERSION' => $_SERVER['BACKPACK_BASE_VERSION'] ?? false, |
|
68 | - 'BACKPACK_CRUD_VERSION' => $_SERVER['BACKPACK_CRUD_VERSION'] ?? false, |
|
69 | - 'BACKPACK_LICENSE' => config('backpack.base.license_code') ?? false, |
|
55 | + 'HTTP_HOST' => $_SERVER['HTTP_HOST'] ?? false, |
|
56 | + 'APP_URL' => $_SERVER['APP_URL'] ?? false, |
|
57 | + 'APP_ENV' => $this->app->environment() ?? false, |
|
58 | + 'APP_DEBUG' => $_SERVER['APP_DEBUG'] ?? false, |
|
59 | + 'SERVER_ADDR' => $_SERVER['SERVER_ADDR'] ?? false, |
|
60 | + 'SERVER_ADMIN' => $_SERVER['SERVER_ADMIN'] ?? false, |
|
61 | + 'SERVER_NAME' => $_SERVER['SERVER_NAME'] ?? false, |
|
62 | + 'SERVER_PORT' => $_SERVER['SERVER_PORT'] ?? false, |
|
63 | + 'SERVER_PROTOCOL' => $_SERVER['SERVER_PROTOCOL'] ?? false, |
|
64 | + 'SERVER_SOFTWARE' => $_SERVER['SERVER_SOFTWARE'] ?? false, |
|
65 | + 'DB_CONNECTION' => $_SERVER['DB_CONNECTION'] ?? false, |
|
66 | + 'LARAVEL_VERSION' => $this->app->version() ?? false, |
|
67 | + 'BACKPACK_BASE_VERSION' => $_SERVER['BACKPACK_BASE_VERSION'] ?? false, |
|
68 | + 'BACKPACK_CRUD_VERSION' => $_SERVER['BACKPACK_CRUD_VERSION'] ?? false, |
|
69 | + 'BACKPACK_LICENSE' => config('backpack.base.license_code') ?? false, |
|
70 | 70 | ]; |
71 | 71 | |
72 | 72 | // send this info to the main website to store it in the db |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | { |
42 | 42 | // only send usage stats in production |
43 | 43 | if (!$this->runningInProduction()) { |
44 | - return ; |
|
44 | + return; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // only send stats every ~100 pageloads |
48 | 48 | if (rand(1, 100) != 1) { |
49 | - return ; |
|
49 | + return; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | $url = "https://backpackforlaravel.com/api/stats"; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | private function makeCurlRequest($method, $url, $payload) |
92 | 92 | { |
93 | 93 | $cmd = "curl -X ".$method." -H 'Content-Type: application/json'"; |
94 | - $cmd.= " -d '" . json_encode($payload) . "' " . "'" . $url . "'"; |
|
94 | + $cmd .= " -d '".json_encode($payload)."' "."'".$url."'"; |
|
95 | 95 | $cmd .= " > /dev/null 2>&1 &"; |
96 | 96 | |
97 | 97 | exec($cmd, $output, $exit); |