Skip to content

Commit

Permalink
check if HTTP_ACCEPT header is set (#19)
Browse files Browse the repository at this point in the history
* check if HTTP_ACCEPT header is set

should fix:
> PHP Warning: Undefined array key "HTTP_ACCEPT" in lib/plugins/dokusioc/action.php on line 418

fixes #17

* Update plugin.info.txt

* Update CI.yml
  • Loading branch information
mprins authored Jun 10, 2024
1 parent 605f3e8 commit 8a46f0c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 44 deletions.
61 changes: 18 additions & 43 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,21 @@
name: CI
name: 'CI'

on: [push, pull_request]
on: [ push, pull_request, workflow_dispatch ]

jobs:
testLinux:
name: PHP Unit
runs-on: ubuntu-latest

strategy:
matrix:
php-version: ['8.0', '8.1', '8.2']
dokuwiki-branch: [ 'master', 'stable']
fail-fast: false

steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl, bz2

- name: Setup problem matchers
run: |
echo ::add-matcher::${{ runner.tool_cache }}/php.json
echo ::add-matcher::${{ runner.tool_cache }}/phpunit.json
- name: Download DokuWiki Test-setup
run: wget https://raw.github.com/splitbrain/dokuwiki-travis/master/travis.sh

- name: Install DokuWiki
env:
CI_SERVER: 1
DOKUWIKI: ${{ matrix.dokuwiki-branch }}
run: sh travis.sh

- name: Setup PHPUnit
run: |
php _test/fetchphpunit.php
./_test/phpunit.phar --version
- name: Run PHPUnit
run: |
cd _test && PRESERVE_TMP=false ./phpunit.phar --stderr --verbose --debug --group plugin_dokusioc
test:
strategy:
fail-fast: false
matrix:
php-version: [ '8.1', '8.2' ]
dokuwiki-branch: [ 'master', 'stable' ]
include:
- php-version: '8.0'
dokuwiki-branch: 'stable'
- php-version: '8.3'
dokuwiki-branch: 'master'

uses: mprins/.github/.github/workflows/test.yml@main
with:
php-version: "${{ matrix.php-version }}"
dokuwiki-branch: "${{ matrix.dokuwiki-branch }}"
2 changes: 2 additions & 0 deletions action.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ private function getDokuUrl($url = null)

public function isRdfXmlRequest(): bool
{
if (!isset($_SERVER['HTTP_ACCEPT']) return false;

// get accepted types
$http_accept = trim($_SERVER['HTTP_ACCEPT']);

Expand Down
2 changes: 1 addition & 1 deletion plugin.info.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
base dokusioc
author Mark C. Prins (previously Michael Haschke)
email mprins@users.sf.net
date 2023-06-26
date 2024-06-10
name DokuSIOC
desc It adds an alternate meta link of the SIOC-RDF/XML document to HTML head, creates SIOC version of wiki content (RDF/XML export), checks the requested application type (content negotiation) and it pings PTSW.com for pushing updates.
url https://www.dokuwiki.org/plugin:dokusioc
Expand Down

0 comments on commit 8a46f0c

Please sign in to comment.