File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public function __construct(private IConnection $connection)
3131 mkdir ($ _ENV ['TEMP_DIR ' ], recursive: true );
3232 }
3333
34- if (!getenv ('BOLT_ANALYTICS_OPTOUT ' )) {
34+ if (!getenv ('BOLT_ANALYTICS_OPTOUT ' ) && is_writable ( $ _ENV [ ' TEMP_DIR ' ] . DIRECTORY_SEPARATOR ) ) {
3535 if (!file_exists ($ _ENV ['TEMP_DIR ' ] . DIRECTORY_SEPARATOR . 'php-bolt-analytics ' . DIRECTORY_SEPARATOR )) {
3636 mkdir ($ _ENV ['TEMP_DIR ' ] . DIRECTORY_SEPARATOR . 'php-bolt-analytics ' );
3737 }
Original file line number Diff line number Diff line change @@ -73,9 +73,11 @@ protected function write(iterable $generator): void
7373
7474 private function track (): void
7575 {
76- $ file = $ _ENV ['TEMP_DIR ' ] . DIRECTORY_SEPARATOR . 'php-bolt-analytics ' . DIRECTORY_SEPARATOR . 'queries. ' . strtotime ('today ' ) . '.cnt ' ;
77- $ count = file_exists ($ file ) ? intval (file_get_contents ($ file )) : 0 ;
78- file_put_contents ($ file , $ count + 1 );
76+ if (is_writable ($ _ENV ['TEMP_DIR ' ]. DIRECTORY_SEPARATOR )) {
77+ $ file = $ _ENV ['TEMP_DIR ' ] . DIRECTORY_SEPARATOR . 'php-bolt-analytics ' . DIRECTORY_SEPARATOR . 'queries. ' . strtotime ('today ' ) . '.cnt ' ;
78+ $ count = file_exists ($ file ) ? intval (file_get_contents ($ file )) : 0 ;
79+ file_put_contents ($ file , $ count + 1 );
80+ }
7981 }
8082
8183 /**
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ protected function setUp(): void
105105 mkdir ($ _ENV ['TEMP_DIR ' ], recursive: true );
106106 }
107107
108- if (!getenv ('BOLT_ANALYTICS_OPTOUT ' )) {
108+ if (!getenv ('BOLT_ANALYTICS_OPTOUT ' ) && is_writable ( $ _ENV [ ' TEMP_DIR ' ] . DIRECTORY_SEPARATOR ) ) {
109109 if (!file_exists ($ _ENV ['TEMP_DIR ' ] . DIRECTORY_SEPARATOR . 'php-bolt-analytics ' . DIRECTORY_SEPARATOR )) {
110110 mkdir ($ _ENV ['TEMP_DIR ' ] . DIRECTORY_SEPARATOR . 'php-bolt-analytics ' );
111111 }
You can’t perform that action at this time.
0 commit comments