Skip to content

Commit 58c1ffd

Browse files
committed
Add support for phpBB v4
1 parent 33f4f3e commit 58c1ffd

File tree

7 files changed

+38
-39
lines changed

7 files changed

+38
-39
lines changed

.github/setup-extension.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ NOTESTS="${2}"
1010
composer update -n --prefer-dist --no-progress
1111

1212
# Prepare extension structure
13-
mkdir -p ../phpBB3/phpBB/ext/"${EXTNAME}"
13+
mkdir -p ../phpbb/phpBB/ext/"${EXTNAME}"
1414

1515
# Build extension package
1616
vendor/bin/phing
1717

1818
# Copy extension files and directories
19-
cp -a build/package/"${EXTNAME}"/* ../phpBB3/phpBB/ext/"${EXTNAME}"/
19+
cp -a build/package/"${EXTNAME}"/* ../phpbb/phpBB/ext/"${EXTNAME}"/
2020

2121
# Add required files for tests
2222
if [[ "${NOTESTS}" != 1 ]]; then
23-
cp -a {phpunit.xml.dist,tests/} ../phpBB3/phpBB/ext/"${EXTNAME}"/
23+
cp -a {phpunit.xml.dist,tests/} ../phpbb/phpBB/ext/"${EXTNAME}"/
2424
fi

.github/workflows/ci.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ env:
1111
IMAGE_ICC: 1
1212
EPV: 1
1313
EXECUTABLE_FILES: 1
14-
PHPBB_BRANCH: 3.3.x
14+
PHPBB_BRANCH: master # TODO: Use stable branch
1515

1616
jobs:
1717
basic-tests:
1818
if: ${{ !contains(github.event.head_commit.message, 'skip ci') }}
1919
name: php ${{ matrix.php-version }}, none none
20-
runs-on: ubuntu-22.04
20+
runs-on: ubuntu-latest
2121
env:
2222
PHP_VERSION: ${{ matrix.php-version }}
2323
strategy:
@@ -30,7 +30,7 @@ jobs:
3030
with:
3131
repository: phpbb/phpbb
3232
ref: ${{ env.PHPBB_BRANCH }}
33-
path: phpBB3
33+
path: phpbb
3434

3535
- name: Checkout extension
3636
uses: actions/checkout@v6
@@ -47,7 +47,7 @@ jobs:
4747

4848
- name: Setup Composer
4949
id: setup-composer
50-
working-directory: phpBB3/phpBB
50+
working-directory: phpbb/phpBB
5151
run: echo "cache-dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
5252

5353
- name: Setup cache
@@ -59,7 +59,7 @@ jobs:
5959
${{ runner.os }}-composer-
6060
6161
- name: Setup environment for phpBB
62-
working-directory: phpBB3
62+
working-directory: phpbb
6363
run: .github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS
6464

6565
- name: Setup Node
@@ -81,33 +81,33 @@ jobs:
8181
8282
- name: Setup EPV
8383
if: ${{ env.EPV == 1 }}
84-
working-directory: phpBB3/phpBB
84+
working-directory: phpbb/phpBB
8585
run: composer require -n --prefer-dist --no-progress phpbb/epv:dev-master
8686

8787
- name: Run code sniffer
8888
if: ${{ env.SNIFF == 1 }}
89-
working-directory: phpBB3
89+
working-directory: phpbb
9090
run: .github/ext-sniff.sh $EXTNAME $NOTESTS
9191

9292
- name: Check image ICC profiles
9393
if: ${{ env.IMAGE_ICC == 1 }}
94-
working-directory: phpBB3
94+
working-directory: phpbb
9595
run: .github/check-image-icc-profiles.sh
9696

9797
- name: Check executable files
9898
if: ${{ env.EXECUTABLE_FILES == 1 }}
99-
working-directory: phpBB3
99+
working-directory: phpbb
100100
run: .github/ext-check-executable-files.sh ./ $EXTNAME
101101

102102
- name: Run EPV
103103
if: ${{ env.EPV == 1 }}
104-
working-directory: phpBB3
104+
working-directory: phpbb
105105
run: phpBB/vendor/bin/EPV.php run --dir="phpBB/ext/$EXTNAME"
106106

107107
mysql-tests:
108108
if: ${{ !contains(github.event.head_commit.message, 'skip ci') }}
109109
name: php ${{ matrix.php-version }}, ${{ matrix.db-type }} ${{ matrix.db-version }}
110-
runs-on: ubuntu-22.04
110+
runs-on: ubuntu-latest
111111
services:
112112
mysql:
113113
image: ${{ (matrix.db-type == 'mysql' || matrix.db-type == 'mariadb') && matrix.db-type || 'mariadb' }}:${{ (matrix.db-type == 'mysql' || matrix.db-type == 'mariadb' && matrix.db-version != 'none') && matrix.db-version || 'latest' }}
@@ -153,7 +153,7 @@ jobs:
153153
with:
154154
repository: phpbb/phpbb
155155
ref: ${{ env.PHPBB_BRANCH }}
156-
path: phpBB3
156+
path: phpbb
157157

158158
- name: Checkout extension
159159
uses: actions/checkout@v6
@@ -170,7 +170,7 @@ jobs:
170170

171171
- name: Setup Composer
172172
id: setup-composer
173-
working-directory: phpBB3/phpBB
173+
working-directory: phpbb/phpBB
174174
run: echo "cache-dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
175175

176176
- name: Setup cache
@@ -182,7 +182,7 @@ jobs:
182182
${{ runner.os }}-composer-
183183
184184
- name: Setup environment for phpBB
185-
working-directory: phpBB3
185+
working-directory: phpbb
186186
run: .github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS
187187

188188
- name: Setup Node
@@ -203,23 +203,23 @@ jobs:
203203
.github/setup-extension.sh $EXTNAME $NOTESTS
204204
205205
- name: Setup database
206-
working-directory: phpBB3
206+
working-directory: phpbb
207207
run: .github/setup-database.sh $DB $MYISAM
208208

209209
- name: Setup PHPUnit files
210-
working-directory: phpBB3
210+
working-directory: phpbb
211211
run: |
212212
mkdir -p phpBB/ext/$EXTNAME/ci
213213
cp -a .github/phpunit* phpBB/ext/$EXTNAME/ci/
214214
215215
- name: Run unit tests
216-
working-directory: phpBB3
216+
working-directory: phpbb
217217
run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/ci/phpunit-$DB-github.xml --bootstrap tests/bootstrap.php
218218

219219
postgresql-tests:
220220
if: ${{ !contains(github.event.head_commit.message, 'skip ci') }}
221221
name: php ${{ matrix.php-version }}, ${{ matrix.db-type }} ${{ matrix.db-version }}
222-
runs-on: ubuntu-22.04
222+
runs-on: ubuntu-latest
223223
services:
224224
postgres:
225225
image: ${{ (matrix.db-type == 'postgres') && matrix.db-type || 'postgres' }}:${{ (matrix.db-type == 'postgres' && matrix.db-version != 'none') && matrix.db-version || 'alpine' }}
@@ -257,7 +257,7 @@ jobs:
257257
with:
258258
repository: phpbb/phpbb
259259
ref: ${{ env.PHPBB_BRANCH }}
260-
path: phpBB3
260+
path: phpbb
261261

262262
- name: Checkout extension
263263
uses: actions/checkout@v6
@@ -274,7 +274,7 @@ jobs:
274274

275275
- name: Setup Composer
276276
id: setup-composer
277-
working-directory: phpBB3/phpBB
277+
working-directory: phpbb/phpBB
278278
run: echo "cache-dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
279279

280280
- name: Setup cache
@@ -286,7 +286,7 @@ jobs:
286286
${{ runner.os }}-composer-
287287
288288
- name: Setup environment for phpBB
289-
working-directory: phpBB3
289+
working-directory: phpbb
290290
run: .github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS
291291

292292
- name: Setup Node
@@ -307,17 +307,17 @@ jobs:
307307
.github/setup-extension.sh $EXTNAME $NOTESTS
308308
309309
- name: Setup database
310-
working-directory: phpBB3
310+
working-directory: phpbb
311311
run: .github/setup-database.sh $DB $MYISAM
312312

313313
- name: Setup PHPUnit files
314-
working-directory: phpBB3
314+
working-directory: phpbb
315315
run: |
316316
mkdir -p phpBB/ext/$EXTNAME/ci
317317
cp -a .github/phpunit* phpBB/ext/$EXTNAME/ci/
318318
319319
- name: Run unit tests
320-
working-directory: phpBB3
320+
working-directory: phpbb
321321
run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/ci/phpunit-$DB-github.xml --bootstrap tests/bootstrap.php
322322

323323
lint:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ It uses the plugins [Litedown](https://s9etextformatter.readthedocs.io/Plugins/L
2727

2828
### Requirements
2929

30-
- PHP 8.1 or greater
31-
- phpBB 3.3 or greater
30+
- PHP 8.1.0 or greater
31+
- phpBB 4.0 or greater
3232

3333
### Support
3434

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"type": "phpbb-extension",
44
"description": "Markdown extension for phpBB",
55
"homepage": "https://github.com/AlfredoRamos/phpbb-ext-markdown",
6-
"version": "1.5.0",
7-
"time": "2025-09-12",
6+
"version": "2.0.0-dev",
7+
"time": "2025-09-30",
88
"keywords": [
99
"phpbb",
1010
"extension",
@@ -36,7 +36,7 @@
3636
"extra": {
3737
"display-name": "Markdown",
3838
"soft-require": {
39-
"phpbb/phpbb": "~3.3.2"
39+
"phpbb/phpbb": "~4.0.0"
4040
},
4141
"version-check": {
4242
"host": "alfredoramos.mx",

ext.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414
class ext extends base
1515
{
1616
/**
17-
* Check whether or not the extension can be enabled.
18-
*
19-
* @return bool
20-
*/
17+
* {@inheritdoc}
18+
*/
2119
public function is_enableable()
2220
{
23-
return phpbb_version_compare(PHPBB_VERSION, '3.3.2', '>=');
21+
return phpbb_version_compare(PHPBB_VERSION, '4.0.0-a1-dev', '>='); // TODO: Use stable version
2422
}
2523
}

styles/prosilver/theme/css/style.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ h6.markdown {
6969
table.markdown {
7070
margin-top: 1em;
7171
margin-bottom: 1em;
72+
border-spacing: 0;
7273
}
7374
table.markdown,
7475
table.markdown th,

tests/functional/markdown_test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ public function test_inline_spoiler()
275275
));
276276

277277
$expected = <<<EOT
278-
<p>This is a Reddit-style <span class="spoiler markdown" onclick="removeAttribute('style')" style="background:#444;color:transparent">spoiler</span>.<br>
279-
This is a Discord-style <span class="spoiler markdown" onclick="removeAttribute('style')" style="background:#444;color:transparent">spoiler</span>.</p>
278+
<p>This is a Reddit-style <span class="spoiler markdown" onclick="this.removeAttribute('style')" style="background:#444;color:transparent">spoiler</span>.<br>
279+
This is a Discord-style <span class="spoiler markdown" onclick="this.removeAttribute('style')" style="background:#444;color:transparent">spoiler</span>.</p>
280280
EOT;
281281

282282
$result = $crawler->filter(sprintf(

0 commit comments

Comments
 (0)