2727* @return array<string, mixed> $results
2828*/
2929function check_for_updates ( string $ api ,
30- ?string $ commit ,
31- ?string $ os_type ,
32- ?string $ os_arch ,
33- ?string $ os_version ) : array
30+ ?string $ commit ,
31+ ?string $ os_type ,
32+ ?string $ os_arch ,
33+ ?string $ os_version ) : array
3434{
3535 // Standalone maintenance mode
3636 /*
@@ -78,7 +78,7 @@ function check_for_updates( string $api,
7878 return $ results ;
7979 }
8080
81- // If the OS type does not match the allowed values
81+ // If the OS type does not match the allowed values
8282 if (!ctype_alpha ($ os_type ) || !in_array ($ os_type , array ("all " , "windows " , "linux " , "macos " )))
8383 {
8484 $ results ['return_code ' ] = -3 ;
@@ -101,8 +101,8 @@ function check_for_updates( string $api,
101101 }
102102
103103 // Get latest build information
104- $ platform = substr ($ api , 1 , 1 ) >= 3 && $ os_type !== "all " ? $ os_type : null ;
105- $ latest = $ version === "latest " ? Build::get_latest ($ platform ) : Build::get_version ($ version );
104+ $ platform = substr ($ api , 1 , 1 ) >= 3 && $ os_type !== "all " ? $ os_type : null ;
105+ $ latest = $ version === "latest " ? Build::get_latest ($ platform ) : Build::get_version ($ version );
106106
107107 if (is_null ($ latest ))
108108 {
@@ -116,35 +116,35 @@ function check_for_updates( string $api,
116116 $ results ['latest_build ' ]['version ' ] = $ latest ->version ;
117117
118118 if (substr ($ api , 1 , 1 ) < 3 ||
119- (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "x64 " && ($ os_type === "all " || $ os_type === "windows " )))
119+ (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "x64 " && ($ os_type === "all " || $ os_type === "windows " )))
120120 {
121121 $ results ['latest_build ' ]['windows ' ]['download ' ] = $ latest ->get_url_windows ();
122122 $ results ['latest_build ' ]['windows ' ]['size ' ] = $ latest ->size_win ;
123123 $ results ['latest_build ' ]['windows ' ]['checksum ' ] = $ latest ->checksum_win ;
124124 }
125125
126- if (substr ($ api , 1 , 1 ) < 3 ||
127- (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "x64 " && ($ os_type === "all " || $ os_type === "linux " )))
126+ if (substr ($ api , 1 , 1 ) < 3 ||
127+ (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "x64 " && ($ os_type === "all " || $ os_type === "linux " )))
128128 {
129129 $ results ['latest_build ' ]['linux ' ]['download ' ] = $ latest ->get_url_linux ();
130130 $ results ['latest_build ' ]['linux ' ]['size ' ] = $ latest ->size_linux ;
131131 $ results ['latest_build ' ]['linux ' ]['checksum ' ] = $ latest ->checksum_linux ;
132132 }
133- else if (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "arm64 " && ($ os_type === "all " || $ os_type === "linux " ))
134- {
135- $ results ['latest_build ' ]['linux ' ]['download ' ] = $ latest ->get_url_linux_arm64 ();
136- $ results ['latest_build ' ]['linux ' ]['size ' ] = $ latest ->size_linux_arm64 ;
137- $ results ['latest_build ' ]['linux ' ]['checksum ' ] = $ latest ->checksum_linux_arm64 ;
138- }
139-
140- if (substr ($ api , 1 , 1 ) < 3 ||
141- (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "x64 " && ($ os_type === "all " || $ os_type === "macos " )))
133+ else if (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "arm64 " && ($ os_type === "all " || $ os_type === "linux " ))
134+ {
135+ $ results ['latest_build ' ]['linux ' ]['download ' ] = $ latest ->get_url_linux_arm64 ();
136+ $ results ['latest_build ' ]['linux ' ]['size ' ] = $ latest ->size_linux_arm64 ;
137+ $ results ['latest_build ' ]['linux ' ]['checksum ' ] = $ latest ->checksum_linux_arm64 ;
138+ }
139+
140+ if (substr ($ api , 1 , 1 ) < 3 ||
141+ (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "x64 " && ($ os_type === "all " || $ os_type === "macos " )))
142142 {
143143 $ results ['latest_build ' ]['mac ' ]['download ' ] = $ latest ->get_url_mac ();
144144 $ results ['latest_build ' ]['mac ' ]['size ' ] = $ latest ->size_mac ;
145145 $ results ['latest_build ' ]['mac ' ]['checksum ' ] = $ latest ->checksum_mac ;
146146 }
147- else if (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "arm64 " && ($ os_type === "all " || $ os_type === "macos " ))
147+ else if (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "arm64 " && ($ os_type === "all " || $ os_type === "macos " ))
148148 {
149149 $ results ['latest_build ' ]['mac ' ]['download ' ] = $ latest ->get_url_mac_arm64 ();
150150 $ results ['latest_build ' ]['mac ' ]['size ' ] = $ latest ->size_mac_arm64 ;
@@ -158,10 +158,10 @@ function check_for_updates( string $api,
158158 $ current = array ();
159159 $ e_commit = mysqli_real_escape_string ($ db , substr ($ commit , 0 , 7 ));
160160 $ q_check = mysqli_query ($ db , "SELECT * FROM `builds`
161- WHERE `commit` LIKE ' {$ e_commit }%'
162- AND `type` = 'branch'
163- ORDER BY `merge_datetime` DESC
164- LIMIT 1; " );
161+ WHERE `commit` LIKE ' {$ e_commit }%'
162+ AND `type` = 'branch'
163+ ORDER BY `merge_datetime` DESC
164+ LIMIT 1; " );
165165 if (!is_bool ($ q_check ))
166166 {
167167 $ current = Build::query_to_builds ($ q_check );
@@ -180,36 +180,36 @@ function check_for_updates( string $api,
180180 $ results ['current_build ' ]['datetime ' ] = $ current ->merge ;
181181 $ results ['current_build ' ]['version ' ] = $ current ->version ;
182182
183- if (substr ($ api , 1 , 1 ) < 3 ||
184- (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "x64 " && $ os_type === "windows " ))
183+ if (substr ($ api , 1 , 1 ) < 3 ||
184+ (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "x64 " && ( $ os_type === "all " || $ os_type === " windows ") ))
185185 {
186186 $ results ['current_build ' ]['windows ' ]['download ' ] = $ current ->get_url_windows ();
187187 $ results ['current_build ' ]['windows ' ]['size ' ] = $ current ->size_win ;
188188 $ results ['current_build ' ]['windows ' ]['checksum ' ] = $ current ->checksum_win ;
189189 }
190190
191- if (substr ($ api , 1 , 1 ) < 3 ||
192- (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "x64 " && $ os_type === "linux " ))
191+ if (substr ($ api , 1 , 1 ) < 3 ||
192+ (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "x64 " && ( $ os_type === "all " || $ os_type === " linux ") ))
193193 {
194194 $ results ['current_build ' ]['linux ' ]['download ' ] = $ current ->get_url_linux ();
195195 $ results ['current_build ' ]['linux ' ]['size ' ] = $ current ->size_linux ;
196196 $ results ['current_build ' ]['linux ' ]['checksum ' ] = $ current ->checksum_linux ;
197197 }
198- else if (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "arm64 " && $ os_type === "linux " )
198+ else if (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "arm64 " && ( $ os_type === "all " || $ os_type === " linux ") )
199199 {
200- $ results ['current_build ' ]['linux ' ]['download ' ] = $ current ->get_url_linux_arm64 ();
200+ $ results ['current_build ' ]['linux ' ]['download ' ] = $ current ->get_url_linux_arm64 ();
201201 $ results ['current_build ' ]['linux ' ]['size ' ] = $ current ->size_linux_arm64 ;
202202 $ results ['current_build ' ]['linux ' ]['checksum ' ] = $ current ->checksum_linux_arm64 ;
203203 }
204204
205205 if (substr ($ api , 1 , 1 ) < 3 ||
206- (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "x64 " && $ os_type === "macos " ))
206+ (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "x64 " && ( $ os_type === "all " || $ os_type === " macos ") ))
207207 {
208208 $ results ['current_build ' ]['mac ' ]['download ' ] = $ current ->get_url_mac ();
209209 $ results ['current_build ' ]['mac ' ]['size ' ] = $ current ->size_mac ;
210210 $ results ['current_build ' ]['mac ' ]['checksum ' ] = $ current ->checksum_mac ;
211211 }
212- else if (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "arm64 " && $ os_type === "macos " )
212+ else if (substr ($ api , 1 , 1 ) >= 3 && $ os_arch === "arm64 " && ( $ os_type === "all " || $ os_type === " macos ") )
213213 {
214214 $ results ['current_build ' ]['mac ' ]['download ' ] = $ current ->get_url_mac_arm64 ();
215215 $ results ['current_build ' ]['mac ' ]['size ' ] = $ current ->size_mac_arm64 ;
@@ -224,11 +224,11 @@ function check_for_updates( string $api,
224224 if (substr ($ api , 1 , 1 ) >= 2 && !in_array ($ current ->pr , array ("15390 " , "15392 " , "15394 " , "15395 " )))
225225 {
226226 $ q_between = mysqli_query ($ db , "SELECT `version`, `title` FROM `builds`
227- WHERE `merge_datetime`
228- BETWEEN CAST(' {$ current ->merge }' AS DATETIME) + INTERVAL 1 SECOND
229- AND CAST(' {$ latest ->merge }' AS DATETIME)
230- ORDER BY `merge_datetime` DESC
231- LIMIT 500; " );
227+ WHERE `merge_datetime`
228+ BETWEEN CAST(' {$ current ->merge }' AS DATETIME) + INTERVAL 1 SECOND
229+ AND CAST(' {$ latest ->merge }' AS DATETIME)
230+ ORDER BY `merge_datetime` DESC
231+ LIMIT 500; " );
232232
233233 if (!is_bool ($ q_between ))
234234 {
@@ -242,23 +242,23 @@ function check_for_updates( string $api,
242242 }
243243
244244 $ results ['changelog ' ][] = array ("version " => $ row ->version ,
245- "title " => $ row ->title );
245+ "title " => $ row ->title );
246246 }
247247 }
248248 }
249249
250250 mysqli_query ($ db , "UPDATE `builds`
251- SET `ping_outdated` = `ping_outdated` + 1
252- WHERE `pr` = {$ current ->pr }
253- LIMIT 1; " );
251+ SET `ping_outdated` = `ping_outdated` + 1
252+ WHERE `pr` = {$ current ->pr }
253+ LIMIT 1; " );
254254 $ results ['return_code ' ] = 1 ;
255255 }
256256 else
257257 {
258258 mysqli_query ($ db , "UPDATE `builds`
259- SET `ping_updated` = `ping_updated` + 1
260- WHERE `pr` = {$ current ->pr }
261- LIMIT 1; " );
259+ SET `ping_updated` = `ping_updated` + 1
260+ WHERE `pr` = {$ current ->pr }
261+ LIMIT 1; " );
262262 }
263263 }
264264 mysqli_close ($ db );
@@ -297,7 +297,7 @@ function check_for_updates( string $api,
297297 }
298298
299299 if (isset ($ _GET ['os_type ' ]) && is_string ($ _GET ['os_type ' ]) &&
300- isset ($ _GET ['os_arch ' ]) && is_string ($ _GET ['os_arch ' ]))
300+ isset ($ _GET ['os_arch ' ]) && is_string ($ _GET ['os_arch ' ]))
301301 {
302302 $ os_type = $ _GET ['os_type ' ];
303303 $ os_arch = $ _GET ['os_arch ' ];
0 commit comments