@@ -184,7 +184,7 @@ function getRuntimeVersions()
184184
185185 if (getenv ('KUBERNETES_SERVICE_HOST ' )) {
186186 $ data ['container ' ] = 'Kubernetes ' ;
187- } elseif (file_exists ('/.dockerenv ' )) {
187+ } elseif (@ file_exists ('/.dockerenv ' )) {
188188 $ data ['container ' ] = 'Docker ' ;
189189 }
190190
@@ -199,14 +199,16 @@ function getRuntimeVersions()
199199 */
200200function getOsRelease ()
201201{
202+ $ reader = fn ($ file ) => @parse_ini_string (preg_replace ('/#.*$/m ' , '' , file_get_contents ($ file )));
203+
202204 $ osRelease = [];
203- if (file_exists ('/etc/os-release ' )) {
205+ if (@ file_exists ('/etc/os-release ' )) {
204206 // pretty much any common Linux distribution has this
205- $ osRelease = parse_ini_file ('/etc/os-release ' );
206- } elseif (file_exists ('/etc/synoinfo.conf ' ) && file_exists ('/etc/VERSION ' )) {
207+ $ osRelease = $ reader ('/etc/os-release ' );
208+ } elseif (@ file_exists ('/etc/synoinfo.conf ' ) && @ file_exists ('/etc/VERSION ' )) {
207209 // Synology DSM has its own way
208- $ synoInfo = parse_ini_file ('/usr/lib /synoinfo.conf ' );
209- $ synoVersion = parse_ini_file ('/etc/VERSION ' );
210+ $ synoInfo = $ reader ('/etc /synoinfo.conf ' );
211+ $ synoVersion = $ reader ('/etc/VERSION ' );
210212 $ osRelease ['NAME ' ] = 'Synology DSM ' ;
211213 $ osRelease ['ID ' ] = 'synology ' ;
212214 $ osRelease ['ID_LIKE ' ] = 'linux ' ;
@@ -218,6 +220,7 @@ function getOsRelease()
218220 return $ osRelease ;
219221}
220222
223+
221224/**
222225 * Run a few sanity checks
223226 *
0 commit comments