Skip to content

Commit 99e5361

Browse files
committed
Fix hardcoded PHP
1 parent 5477374 commit 99e5361

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

config/services.yml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ services:
2121
- '@user'
2222
- '@notification_manager'
2323
- '%core.root_path%'
24+
- '%core.php_ext%'
2425
tags:
2526
- { name: event.listener }
2627

event/listener.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ class listener implements EventSubscriberInterface
5353
/** @var string */
5454
protected $root_path;
5555

56+
/** @var string */
57+
protected $php_ext;
58+
5659
/**
5760
* Constructor
5861
*
@@ -65,8 +68,9 @@ class listener implements EventSubscriberInterface
6568
* @param user $user
6669
* @param manager $phpbb_notifications Notifications manager object
6770
* @param string $root_path
71+
* @param string $php_ext
6872
*/
69-
public function __construct(config $config, controller_helper $controller_helper, FastImageSize $imagesize, form_helper $form_helper, language $language, template $template, user $user, manager $phpbb_notifications, $root_path)
73+
public function __construct(config $config, controller_helper $controller_helper, FastImageSize $imagesize, form_helper $form_helper, language $language, template $template, user $user, manager $phpbb_notifications, $root_path, $php_ext)
7074
{
7175
$this->config = $config;
7276
$this->controller_helper = $controller_helper;
@@ -77,6 +81,7 @@ public function __construct(config $config, controller_helper $controller_helper
7781
$this->user = $user;
7882
$this->phpbb_notifications = $phpbb_notifications;
7983
$this->root_path = $root_path;
84+
$this->php_ext = $php_ext;
8085
}
8186

8287
public static function getSubscribedEvents()
@@ -143,7 +148,7 @@ public function compatibility_notice()
143148
public function pwa_manifest()
144149
{
145150
$this->template->assign_vars([
146-
'U_MANIFEST_URL' => 'ext/phpbb/webpushnotifications/manifest.php',
151+
'U_MANIFEST_URL' => 'ext/phpbb/webpushnotifications/manifest.' . $this->php_ext,
147152
'U_TOUCH_ICON' => $this->config['pwa_icon_small'] ? ext::PWA_ICON_DIR . '/' . $this->config['pwa_icon_small'] : null,
148153
'SHORT_SITE_NAME' => $this->config['pwa_short_name'] ?: $this->trim_shortname($this->config['sitename']),
149154
]);

tests/event/listener_test.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ class listener_test extends \phpbb_database_test_case
4343
/** @var string */
4444
protected $root_path;
4545

46+
/** @var string */
47+
protected $php_ext;
48+
4649
protected static function setup_extensions()
4750
{
4851
return ['phpbb/webpushnotifications'];
@@ -121,6 +124,7 @@ protected function setUp(): void
121124
);
122125

123126
$this->root_path = $phpbb_root_path;
127+
$this->php_ext = $phpEx;
124128
}
125129

126130
protected function set_listener()
@@ -134,7 +138,8 @@ protected function set_listener()
134138
$this->template,
135139
$this->user,
136140
$this->notifications,
137-
$this->root_path
141+
$this->root_path,
142+
$this->php_ext
138143
);
139144
}
140145

0 commit comments

Comments
 (0)