@@ -30,13 +30,6 @@ class PhpFpmProcess
3030 */
3131 private const DEFAULT_CONFIG_PATH = '/opt/ymir/etc/php-fpm.d/php-fpm.conf ' ;
3232
33- /**
34- * Path to the PHP-FPM PID file.
35- *
36- * @var string
37- */
38- private const PID_PATH = '/tmp/.ymir/php-fpm.pid ' ;
39-
4033 /**
4134 * Path to the PHP-FPM socket file.
4235 *
@@ -115,10 +108,6 @@ public function handle(ProvidesRequestData $request): ProvidesResponseData
115108 */
116109 public function start (): void
117110 {
118- if ($ this ->isStarted ()) {
119- $ this ->killExistingProcess ();
120- }
121-
122111 $ socketDirectory = dirname (self ::SOCKET_PATH );
123112
124113 if (!is_dir ($ socketDirectory )) {
@@ -151,51 +140,6 @@ private function isStarted(): bool
151140 return file_exists (self ::SOCKET_PATH );
152141 }
153142
154- /**
155- * Kill an existing PHP-FPM process.
156- */
157- private function killExistingProcess (): void
158- {
159- $ this ->logger ->info ('Killing existing PHP-FPM process ' );
160-
161- if (!file_exists (self ::PID_PATH )) {
162- unlink (self ::SOCKET_PATH );
163-
164- return ;
165- }
166-
167- $ pid = (int ) file_get_contents (self ::PID_PATH );
168-
169- if (0 <= $ pid || false === posix_getpgid ($ pid )) {
170- $ this ->removeProcessFiles ();
171-
172- return ;
173- }
174-
175- $ result = posix_kill ($ pid , SIGTERM );
176-
177- if (false === $ result ) {
178- $ this ->removeProcessFiles ();
179-
180- return ;
181- }
182-
183- $ this ->wait (function () use ($ pid ) {
184- return false !== posix_getpgid ($ pid );
185- }, 'Timeout while waiting for PHP-FPM process to stop ' , 1000000 );
186-
187- $ this ->removeProcessFiles ();
188- }
189-
190- /**
191- * Removes all the files associated with the PHP-FPM process.
192- */
193- private function removeProcessFiles (): void
194- {
195- unlink (self ::SOCKET_PATH );
196- unlink (self ::PID_PATH );
197- }
198-
199143 /**
200144 * Stop the PHP-FPM process.
201145 */
0 commit comments