linux:dokuwiki

DokuWiki

The Development Manual - development [DokuWiki] - 開発マニュアル
Directory Layout - devel:dirlayout [DokuWiki] - ディレクトリ レイアウト

Release 2022-07-31 "Igor"

とにかく、DokuWiki を更新前に丸ごとバックアップする🤤

$ cp dokuwiki/conf/mime.conf dokuwiki/conf/mime.conf.bak
$ tar jcvf dokuwiki_20220804_1.tar.bz2 dokuwiki/

DokuWiki Upgrade Plugin で DokuWiki を PHP 8 対応版へアップグレードする。

アップグレード後の動作確認🤔
svg は標準対応されている😊

conf/mime.conf
svg     image/svg+xml

SD メモリーカード など svg を大量に使用しているページで動作チェックする😉

mime.conf.bak を元に アップグレードで上書きされた mime.conf を修正する😊
DokuWiki は mime.conf でアップロードするファイルの種類を許可しているので、個別に許可している場合はその情報を書き足す必要があるため😉

現時点の PHP バージョンを調べる🤔

$ php -v

PHP 7.4.29 (cli) (built: Apr 12 2022 10:55:38) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.29, Copyright (c), by Zend Technologies

$ rpm -qa | sort | grep php

php-7.4.29-1.fc36.remi.x86_64
php-cli-7.4.29-1.fc36.remi.x86_64
php-common-7.4.29-1.fc36.remi.x86_64
php-fedora-autoloader-1.0.1-8.fc36.noarch
php-fpm-7.4.29-1.fc36.remi.x86_64
php-gd-7.4.29-1.fc36.remi.x86_64
php-json-7.4.29-1.fc36.remi.x86_64
php-mbstring-7.4.29-1.fc36.remi.x86_64
php-mysqlnd-7.4.29-1.fc36.remi.x86_64
php-opcache-7.4.29-1.fc36.remi.x86_64
php-pdo-7.4.29-1.fc36.remi.x86_64
php-pear-1.10.13-2.fc36.noarch
php-pecl-apcu-5.1.21-1.fc36.remi.7.4.x86_64
php-pecl-apcu-bc-1.0.5-5.fc36.remi.7.4.x86_64
php-pecl-mcrypt-1.0.4-5.fc36.remi.7.4.x86_64
php-pecl-zip-1.20.1-1.fc36.remi.7.4.x86_64
php-process-7.4.29-1.fc36.remi.x86_64
php-sodium-7.4.29-1.fc36.remi.x86_64
php-xml-7.4.29-1.fc36.remi.x86_64

リポジトリ設定 (Remi リポジトリを利用する設定が必要)
Fedora で RPM Fusion, Remi リポジトリを利用する

$ sudo dnf install dnf-plugins-core

メタデータの期限切れの最終確認: 0:07:58 時間前の 2022年08月04日 03時51分10秒 に実施しました。
パッケージ dnf-plugins-core-4.2.1-1.fc36.noarch は既にインストールされています。
依存関係が解決しました。
行うべきことはありません。
完了しました!

$ sudo dnf config-manager --set-enabled remi

$ sudo dnf module reset php -y

Remi's RPM repository - Fedora 36 - x86_64                                              636  B/s | 833  B     00:01
依存関係が解決しました。
行うべきことはありません。
完了しました!

$ sudo dnf module install php:remi-8.1 -y

メタデータの期限切れの最終確認: 0:00:33 時間前の 2022年08月04日 03時59分35秒 に実施しました。
エラー:
 問題: 競合するリクエスト
  - php-common-8.1.8-1.fc36.remi.x86_64 と php-common-7.4.29-1.fc36.remi.x86_64 どちらもインストールできません
  - php-common-8.1.9-1.fc36.remi.x86_64 と php-common-7.4.29-1.fc36.remi.x86_64 どちらもインストールできません
  - パッケージ php-pecl-apcu-bc-1.0.5-5.fc36.remi.7.4.x86_64 には php(api) = 20190902-64 が必要ですが、どのプロバイダー からもインストールできません
  - パッケージ php-pecl-apcu-bc-1.0.5-5.fc36.remi.7.4.x86_64 には php(zend-abi) = 20190902-64 が必要ですが、どのプロバイダーからもインストールできません
  - インストール済パッケージの問題 php-pecl-apcu-bc-1.0.5-5.fc36.remi.7.4.x86_64
  - パッケージ php-common-7.4.29-1.fc36.remi.x86_64 はモジュラーフィルタリングに一致しません
  - パッケージ php-common-7.4.30-1.fc36.remi.x86_64 はモジュラーフィルタリングに一致しません
(競合するパッケージを置き換えるには、コマンドラインに '--allowerasing' を追加してみてください または、'--skip-broken' を追加して、インストール不可のパッケージをスキップしてください)

$ sudo dnf module install php:remi-8.1 -y --allowerasing

メタデータの期限切れの最終確認: 0:00:54 時間前の 2022年08月04日 03時59分35秒 に実施しました。
依存関係が解決しました。
========================================================================================================================
 パッケージ                    アーキテクチャー    バージョン                          リポジトリー               サイズ
========================================================================================================================
アップグレード:
 php                           x86_64              8.1.9-1.fc36.remi                   remi-modular               1.7 M
 php-cli                       x86_64              8.1.9-1.fc36.remi                   remi-modular               5.3 M
 php-common                    x86_64              8.1.9-1.fc36.remi                   remi-modular               829 k
     置き換え  php-json.x86_64 7.4.29-1.fc36.remi
 php-fpm                       x86_64              8.1.9-1.fc36.remi                   remi-modular               1.8 M
 php-gd                        x86_64              8.1.9-1.fc36.remi                   remi-modular                62 k
 php-mbstring                  x86_64              8.1.9-1.fc36.remi                   remi-modular               517 k
 php-mysqlnd                   x86_64              8.1.9-1.fc36.remi                   remi-modular               216 k
 php-opcache                   x86_64              8.1.9-1.fc36.remi                   remi-modular               613 k
 php-pdo                       x86_64              8.1.9-1.fc36.remi                   remi-modular               115 k
 php-pecl-apcu                 x86_64              5.1.21-1.fc36.remi.8.1              remi-modular                75 k
 php-pecl-mcrypt               x86_64              1.0.5-1.fc36.remi.8.1               remi-modular                35 k
 php-pecl-zip                  x86_64              1.21.0-3.fc36.remi.8.1              remi-modular                70 k
 php-process                   x86_64              8.1.9-1.fc36.remi                   remi-modular                65 k
 php-sodium                    x86_64              8.1.9-1.fc36.remi                   remi-modular                58 k
 php-xml                       x86_64              8.1.9-1.fc36.remi                   remi-modular               210 k
依存関係パッケージの削除:
 php-pecl-apcu-bc              x86_64              1.0.5-5.fc36.remi.7.4               @remi-modular               49 k
モジュールプロファイルのインストール中:
 php/common
モジュールストリームの有効化中:
 php                                               remi-8.1

トランザクションの概要
========================================================================================================================
アップグレード  15 パッケージ
削除             1 パッケージ

ダウンロードサイズの合計: 12 M
パッケージのダウンロード:
(1/15): php-common-8.1.9-1.fc36.remi.x86_64.rpm                                         728 kB/s | 829 kB     00:01
(2/15): php-8.1.9-1.fc36.remi.x86_64.rpm                                                1.2 MB/s | 1.7 MB     00:01
(3/15): php-fpm-8.1.9-1.fc36.remi.x86_64.rpm                                            2.5 MB/s | 1.8 MB     00:00
(4/15): php-gd-8.1.9-1.fc36.remi.x86_64.rpm                                             170 kB/s |  62 kB     00:00
(5/15): php-cli-8.1.9-1.fc36.remi.x86_64.rpm                                            2.8 MB/s | 5.3 MB     00:01
(6/15): php-mbstring-8.1.9-1.fc36.remi.x86_64.rpm                                       3.2 MB/s | 517 kB     00:00
(7/15): php-mysqlnd-8.1.9-1.fc36.remi.x86_64.rpm                                        592 kB/s | 216 kB     00:00
(8/15): php-opcache-8.1.9-1.fc36.remi.x86_64.rpm                                        1.6 MB/s | 613 kB     00:00
(9/15): php-pdo-8.1.9-1.fc36.remi.x86_64.rpm                                            465 kB/s | 115 kB     00:00
(10/15): php-pecl-apcu-5.1.21-1.fc36.remi.8.1.x86_64.rpm                                650 kB/s |  75 kB     00:00
(11/15): php-pecl-mcrypt-1.0.5-1.fc36.remi.8.1.x86_64.rpm                               308 kB/s |  35 kB     00:00
(12/15): php-pecl-zip-1.21.0-3.fc36.remi.8.1.x86_64.rpm                                 597 kB/s |  70 kB     00:00
(13/15): php-process-8.1.9-1.fc36.remi.x86_64.rpm                                       568 kB/s |  65 kB     00:00
(14/15): php-sodium-8.1.9-1.fc36.remi.x86_64.rpm                                        506 kB/s |  58 kB     00:00
(15/15): php-xml-8.1.9-1.fc36.remi.x86_64.rpm                                           1.6 MB/s | 210 kB     00:00
------------------------------------------------------------------------------------------------------------------------
合計                                                                                    3.8 MB/s |  12 MB     00:03
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備             :                                                                                                1/1
  scriptletの実行中: php-common-8.1.9-1.fc36.remi.x86_64                                                            1/1
  scriptletの実行中: php-common-8.1.9-1.fc36.remi.x86_64                                                           1/32
  アップグレード中 : php-common-8.1.9-1.fc36.remi.x86_64                                                           1/32
警告: /etc/php.ini は /etc/php.ini.rpmnew として作成されました

  アップグレード中 : php-pdo-8.1.9-1.fc36.remi.x86_64                                                              2/32
  アップグレード中 : php-cli-8.1.9-1.fc36.remi.x86_64                                                              3/32
  アップグレード中 : php-fpm-8.1.9-1.fc36.remi.x86_64                                                              4/32
  scriptletの実行中: php-fpm-8.1.9-1.fc36.remi.x86_64                                                              4/32
  アップグレード中 : php-mbstring-8.1.9-1.fc36.remi.x86_64                                                         5/32
  アップグレード中 : php-opcache-8.1.9-1.fc36.remi.x86_64                                                          6/32
  アップグレード中 : php-sodium-8.1.9-1.fc36.remi.x86_64                                                           7/32
  アップグレード中 : php-xml-8.1.9-1.fc36.remi.x86_64                                                              8/32
  アップグレード中 : php-8.1.9-1.fc36.remi.x86_64                                                                  9/32
  アップグレード中 : php-mysqlnd-8.1.9-1.fc36.remi.x86_64                                                         10/32
  アップグレード中 : php-gd-8.1.9-1.fc36.remi.x86_64                                                              11/32
  アップグレード中 : php-pecl-apcu-5.1.21-1.fc36.remi.8.1.x86_64                                                  12/32
  アップグレード中 : php-pecl-mcrypt-1.0.5-1.fc36.remi.8.1.x86_64                                                 13/32
  アップグレード中 : php-pecl-zip-1.21.0-3.fc36.remi.8.1.x86_64                                                   14/32
  アップグレード中 : php-process-8.1.9-1.fc36.remi.x86_64                                                         15/32
  整理             : php-7.4.29-1.fc36.remi.x86_64                                                                16/32
  削除             : php-pecl-apcu-bc-1.0.5-5.fc36.remi.7.4.x86_64                                                17/32
  整理             : php-pecl-apcu-5.1.21-1.fc36.remi.7.4.x86_64                                                  18/32
  整理             : php-pecl-zip-1.20.1-1.fc36.remi.7.4.x86_64                                                   19/32
  整理             : php-pecl-mcrypt-1.0.4-5.fc36.remi.7.4.x86_64                                                 20/32
  整理             : php-cli-7.4.29-1.fc36.remi.x86_64                                                            21/32
  scriptletの実行中: php-fpm-7.4.29-1.fc36.remi.x86_64                                                            22/32
  整理             : php-fpm-7.4.29-1.fc36.remi.x86_64                                                            22/32
  整理             : php-mbstring-7.4.29-1.fc36.remi.x86_64                                                       23/32
  整理             : php-opcache-7.4.29-1.fc36.remi.x86_64                                                        24/32
  整理             : php-sodium-7.4.29-1.fc36.remi.x86_64                                                         25/32
  整理             : php-xml-7.4.29-1.fc36.remi.x86_64                                                            26/32
  整理             : php-process-7.4.29-1.fc36.remi.x86_64                                                        27/32
  整理             : php-mysqlnd-7.4.29-1.fc36.remi.x86_64                                                        28/32
  整理             : php-pdo-7.4.29-1.fc36.remi.x86_64                                                            29/32
  整理             : php-gd-7.4.29-1.fc36.remi.x86_64                                                             30/32
  整理             : php-common-7.4.29-1.fc36.remi.x86_64                                                         31/32
  廃止             : php-json-7.4.29-1.fc36.remi.x86_64                                                           32/32
  scriptletの実行中: php-json-7.4.29-1.fc36.remi.x86_64                                                           32/32
  検証             : php-8.1.9-1.fc36.remi.x86_64                                                                  1/32
  検証             : php-7.4.29-1.fc36.remi.x86_64                                                                 2/32
  検証             : php-cli-8.1.9-1.fc36.remi.x86_64                                                              3/32
  検証             : php-cli-7.4.29-1.fc36.remi.x86_64                                                             4/32
  検証             : php-common-8.1.9-1.fc36.remi.x86_64                                                           5/32
  検証             : php-common-7.4.29-1.fc36.remi.x86_64                                                          6/32
  検証             : php-json-7.4.29-1.fc36.remi.x86_64                                                            7/32
  検証             : php-fpm-8.1.9-1.fc36.remi.x86_64                                                              8/32
  検証             : php-fpm-7.4.29-1.fc36.remi.x86_64                                                             9/32
  検証             : php-gd-8.1.9-1.fc36.remi.x86_64                                                              10/32
  検証             : php-gd-7.4.29-1.fc36.remi.x86_64                                                             11/32
  検証             : php-mbstring-8.1.9-1.fc36.remi.x86_64                                                        12/32
  検証             : php-mbstring-7.4.29-1.fc36.remi.x86_64                                                       13/32
  検証             : php-mysqlnd-8.1.9-1.fc36.remi.x86_64                                                         14/32
  検証             : php-mysqlnd-7.4.29-1.fc36.remi.x86_64                                                        15/32
  検証             : php-opcache-8.1.9-1.fc36.remi.x86_64                                                         16/32
  検証             : php-opcache-7.4.29-1.fc36.remi.x86_64                                                        17/32
  検証             : php-pdo-8.1.9-1.fc36.remi.x86_64                                                             18/32
  検証             : php-pdo-7.4.29-1.fc36.remi.x86_64                                                            19/32
  検証             : php-pecl-apcu-5.1.21-1.fc36.remi.8.1.x86_64                                                  20/32
  検証             : php-pecl-apcu-5.1.21-1.fc36.remi.7.4.x86_64                                                  21/32
  検証             : php-pecl-mcrypt-1.0.5-1.fc36.remi.8.1.x86_64                                                 22/32
  検証             : php-pecl-mcrypt-1.0.4-5.fc36.remi.7.4.x86_64                                                 23/32
  検証             : php-pecl-zip-1.21.0-3.fc36.remi.8.1.x86_64                                                   24/32
  検証             : php-pecl-zip-1.20.1-1.fc36.remi.7.4.x86_64                                                   25/32
  検証             : php-process-8.1.9-1.fc36.remi.x86_64                                                         26/32
  検証             : php-process-7.4.29-1.fc36.remi.x86_64                                                        27/32
  検証             : php-sodium-8.1.9-1.fc36.remi.x86_64                                                          28/32
  検証             : php-sodium-7.4.29-1.fc36.remi.x86_64                                                         29/32
  検証             : php-xml-8.1.9-1.fc36.remi.x86_64                                                             30/32
  検証             : php-xml-7.4.29-1.fc36.remi.x86_64                                                            31/32
  検証             : php-pecl-apcu-bc-1.0.5-5.fc36.remi.7.4.x86_64                                                32/32

アップグレード済み:
  php-8.1.9-1.fc36.remi.x86_64                                php-cli-8.1.9-1.fc36.remi.x86_64
  php-common-8.1.9-1.fc36.remi.x86_64                         php-fpm-8.1.9-1.fc36.remi.x86_64
  php-gd-8.1.9-1.fc36.remi.x86_64                             php-mbstring-8.1.9-1.fc36.remi.x86_64
  php-mysqlnd-8.1.9-1.fc36.remi.x86_64                        php-opcache-8.1.9-1.fc36.remi.x86_64
  php-pdo-8.1.9-1.fc36.remi.x86_64                            php-pecl-apcu-5.1.21-1.fc36.remi.8.1.x86_64
  php-pecl-mcrypt-1.0.5-1.fc36.remi.8.1.x86_64                php-pecl-zip-1.21.0-3.fc36.remi.8.1.x86_64
  php-process-8.1.9-1.fc36.remi.x86_64                        php-sodium-8.1.9-1.fc36.remi.x86_64
  php-xml-8.1.9-1.fc36.remi.x86_64
削除しました:
  php-pecl-apcu-bc-1.0.5-5.fc36.remi.7.4.x86_64

完了しました!

$ php -v

PHP 8.1.9 (cli) (built: Aug  2 2022 13:02:24) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.9, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.9, Copyright (c), by Zend Technologies

PHP 8.1 (新)

$ rpm -qa | sort | grep php

php-8.1.9-1.fc36.remi.x86_64
php-cli-8.1.9-1.fc36.remi.x86_64
php-common-8.1.9-1.fc36.remi.x86_64
php-fedora-autoloader-1.0.1-8.fc36.noarch
php-fpm-8.1.9-1.fc36.remi.x86_64
php-gd-8.1.9-1.fc36.remi.x86_64
php-mbstring-8.1.9-1.fc36.remi.x86_64
php-mysqlnd-8.1.9-1.fc36.remi.x86_64
php-opcache-8.1.9-1.fc36.remi.x86_64
php-pdo-8.1.9-1.fc36.remi.x86_64
php-pear-1.10.13-2.fc36.noarch
php-pecl-apcu-5.1.21-1.fc36.remi.8.1.x86_64
php-pecl-mcrypt-1.0.5-1.fc36.remi.8.1.x86_64
php-pecl-zip-1.21.0-3.fc36.remi.8.1.x86_64
php-process-8.1.9-1.fc36.remi.x86_64
php-sodium-8.1.9-1.fc36.remi.x86_64
php-xml-8.1.9-1.fc36.remi.x86_64

PHP 7.4 (旧)

$ rpm -qa | sort | grep php

php-7.4.29-1.fc36.remi.x86_64
php-cli-7.4.29-1.fc36.remi.x86_64
php-common-7.4.29-1.fc36.remi.x86_64
php-fedora-autoloader-1.0.1-8.fc36.noarch
php-fpm-7.4.29-1.fc36.remi.x86_64
php-gd-7.4.29-1.fc36.remi.x86_64
php-json-7.4.29-1.fc36.remi.x86_64
php-mbstring-7.4.29-1.fc36.remi.x86_64
php-mysqlnd-7.4.29-1.fc36.remi.x86_64
php-opcache-7.4.29-1.fc36.remi.x86_64
php-pdo-7.4.29-1.fc36.remi.x86_64
php-pear-1.10.13-2.fc36.noarch
php-pecl-apcu-5.1.21-1.fc36.remi.7.4.x86_64
php-pecl-apcu-bc-1.0.5-5.fc36.remi.7.4.x86_64
php-pecl-mcrypt-1.0.4-5.fc36.remi.7.4.x86_64
php-pecl-zip-1.20.1-1.fc36.remi.7.4.x86_64
php-process-7.4.29-1.fc36.remi.x86_64
php-sodium-7.4.29-1.fc36.remi.x86_64
php-xml-7.4.29-1.fc36.remi.x86_64

php-json は PHP 8 より標準で含まれて有効になっている🤔
php-pecl-apcu-bc はパッケージ削除🤔

$ sudo reboot

参考: How To Install PHP 8.0 on Fedora 36/35/34/33/32 | ComputingForGeeks
  Remi's RPM repository - Fedora 36

$ sudo dnf module reset php -y
$ sudo dnf module install php:remi-8.2
$ sudo systemctl restart php-fpm
$ sudo systemctl restart httpd

DokuFreaks DokuFreaks GitHub 組織は、元の作成者によってほとんど放棄されたプラグインが 最小限 維持される場所です。これは、言語の更新が適用され、簡単なプル リクエストが適用され、プラグインが通常、最近の DokuWiki リリースで動作する状態になる必要があることを意味します。

一方、これは、そこにリストされているプラ​​グインが積極的に開発されていないことを意味します。機能リクエストはほとんど無視され、マージに大きな労力が必要なプル リクエストはおそらく永久に無視されるでしょう。 dokufreaks [DokuWiki より🤔

以降のカスタマイズではテーマの main.php にスタイルを直書きしていますが、検証のためであり本来は個別の CSS ファイルに分けるのが望ましい。直書きしたスタイルはページロードの都度 HTML ファイルに埋め込まれていて CSS Minify (コード圧縮) されないため、スタイル定義が増えるごとにダウンロードサイズも増加する。更に一般的にスタイルの変更は少ないので、ページ内容の変更とは切り分けてブラウザーにキャッシュさせた方が、よりページロード時間を高速化できて良い。

ブラウザーの開発者ツールで CSS ファイルに分けた場合は (from disk cache) ローカルディスクから読み込まれるので、キャッシュ期限で指定された時間が経過するまではインターネットを介してダウンロードされなくなる。更に DokuWiki のエンジンが自動的に style.ini で参照しているスタイルを CSS Minify (コード圧縮) して一つにまとめるので、スタイル定義を複数のファイルに分割している場合でも一度のリクエストで取得できるので、Web サーバーの負荷を減らすと伴にクライアントのページロード時間を高速化できる利点がある。
DokuWiki テンプレート ブラウザーキャッシュ

安定したスタイル定義を CSS ファイルに分けるには、テンプレートディレクトリの style.ini に スタイルを含めるように指示して css ディレクトリにファイルを別途作成する。

temprate_dir/style.ini
[stylesheets]
css/custom.less           = screen
temprate_dir/css/custom.less
@font-face {
  font-family: "HackGenNerd";
  font-display: swap;
  src: url("/fonts/hackgen_v2.6.3/HackGenNerd-Regular.woff2") format("woff2"),
       url("/fonts/hackgen_v2.6.3/HackGenNerd-Regular.woff") format("woff")
}
@font-face {
  font-family: "HackGenNerd Console";
  font-display: swap;
  src: url("/fonts/hackgen_v2.6.3/HackGenNerdConsole-Regular.woff2") format("woff2")
       url("/fonts/hackgen_v2.6.3/HackGenNerdConsole-Regular.woff") format("woff")
}
pre, code, samp, kbd {
  font-family: "HackGenNerd Console", "Sawarabi Gothic", "Helvetica Neue", Helvetica, /*"Open Sans", "M PLUS 1p", */"ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "メイリオ", Meiryo, Osaka, "MS Pゴシック", "MS PGothic", Arial, sans-serif;
  font-size: 12px;
}
@media (min-width: 980px) {
  pre, code, samp, kbd {
    font-size: 10px;
  }
}
body {
  font-family: "Sawarabi Gothic", "Helvetica Neue", Helvetica, /*"Open Sans", "M PLUS 1p", */"ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "メイリオ", Meiryo, Osaka, "MS Pゴシック", "MS PGothic", Arial, sans-serif;
}

拡張機能管理でインストールした既存のテンプレートをコピーして、サイト専用テンプレートを作成する😃
サイト専用テンプレートを作成すると、既存のテンプレートの更新で影響受けることが無くなる🤤

既存の bootstrap3 テンプレートをコピーする🤤

$ cd dokuwiki/lib/tpl/
$ cp -r bootstrap3 bs3tomoyannet

コピーしたテンプレート情報 (template.info.txt) を修正する🤤 (特に base, name)

$ cd bs3tomoyannet
$ nano template.info.txt

コピー

template.info.txt
base     bs3tomoyannet
author   Tomoyan596
email    tomoyan@tomoyan.net
date     2022-08-04
name     Bootstrap3 Tomoyan.NET Template
desc     Bootstrap-based template for Dokuwiki Tomoyan.NET
url      https://www.dokuwiki.org/template:bootstrap3
build    stable/20220727

オリジナル

template.info.txt
base     bootstrap3
author   Giuseppe Di Terlizzi
email    giuseppe.diterlizzi@gmail.com
date     2022-07-27
name     Bootstrap3 Template
desc     Bootstrap-based template for Dokuwiki
url      https://www.dokuwiki.org/template:bootstrap3
build    stable/20220727

いつもの custom.less をコピーする🤤

$cp template_dir/css/custom.less bs3tomoyannet/css/custom.less

style.inicustom.less を登録する🤤

$ nano style.ini

style.ini
[stylesheets]
; DokuWiki core styles
...
; Template styles
...
; Tomoyan.NET Custom (追記登録)
css/custom.less                = all

main.php に必要な変更を行うのを忘れずに😉
Google AdSense Plugin のための変更

main.php
<head>
...
    <?php if (file_exists(DOKU_PLUGIN.'googleads/code.php')) include_once(DOKU_PLUGIN.'googleads/code.php');
          if (function_exists('gads_code')) gads_code();
    ?>
...
</head>

Google Fonts (Web フォント) のための変更

main.php
<head>
...
    <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
    <link href="https://fonts.googleapis.com/css?family=Sawarabi+Gothic&display=swap" rel="stylesheet">
...
</head>

その他の CSS のための変更

main.php
<head>
...
    <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
...
</head>

OS が Dark モードで実行されている場合の対応を追加する。

dokuwiki/lib/tpl/dokuwiki/main.php
<head>
    ...
    <style>
      ...
      @media (prefers-color-scheme: dark) {
          body, .dokuwiki div.page, .dokuwiki .pageId span, #dokuwiki__header h1 a, #dw__toc,
          .dokuwiki pre, .dokuwiki dl.code dt, .dokuwiki dl.file dt,
          .dokuwiki .page ol li, .dokuwiki .page li .li {
              background-color: #1a1a1a;
              background: #1a1a1a;
              color: lightgrey;
          }
          img {
              opacity: .75;
              transition: opacity .5s ease-in-out;
          }
          img:hover {
              opacity: 1;
          }
          th, div.dokuwiki table.pagelist th,
          input, textarea, button, select, optgroup, option, keygen, output, meter, progress,
          .dokuwiki .editBar .summary input.edit, .dokuwiki .editBar .summary input.missing {
              background-color: #323232;
              background: #323232;
              color: lightgrey;
          }
      }
      ...
    </style>
   ...
</head>

※これらで対応が足りているか検証中である。

Google Fonts の Sawarabi Gothic を定義する。

dokuwiki/lib/tpl/dokuwiki/main.php
<head>
    ...
    <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
    <link href="https://fonts.googleapis.com/css?family=Sawarabi+Gothic&display=swap" rel="stylesheet">
    <style>
      /*
      @import url('https://fonts.googleapis.com/css?family=M+PLUS+1p&display=swap');
      @import url('https://fonts.googleapis.com/css?family=Open+Sans:400,600,300&display=swap');
 
      @import url('https://fonts.googleapis.com/css?family=Sawarabi+Gothic&display=swap');
      */
      body {
        font-family: "Sawarabi Gothic", "Helvetica Neue", Helvetica, /*"Open Sans", "M PLUS 1p", */"ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "メイリオ", Meiryo, Osaka, "MS Pゴシック", "MS PGothic", Arial, sans-serif;
      }
    </style>
   ...
</head>

※ Google Fonts の CSSURL の末尾に &display=swap を記述すると CSSfont-display: swap; が適用されて、フォントがダウンロード中で利用可能になるまでの間、代替フォント(font-family 指定順で次に有効なフォント) が適用される。

font-display: swap;

CSS では font-display: swap; は次のように @font-face 内に定義する。

@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: normal;
  font-display: swap;
  src: url("/fonts/OpenSans-Regular-webfont.woff2") format("woff2"),
       url("/fonts/OpenSans-Regular-webfont.woff") format("woff");
}

参考文献

HackGen (白源)
WOFFConverter
<code> ブロックは HTMLpre タグであるため、pre タグのフォントを変更する。

dokuwiki/lib/tpl/dokuwiki/main.php
<head>
    ...
    <link href="https://fonts.googleapis.com/css?family=Sawarabi+Gothic&display=swap" rel="stylesheet">
    <style>
      /*
      @import url('https://fonts.googleapis.com/css?family=M+PLUS+1p&display=swap');
      @import url('https://fonts.googleapis.com/css?family=Open+Sans:400,600,300&display=swap');
 
      @import url('https://fonts.googleapis.com/css?family=Sawarabi+Gothic&display=swap');
      */
      @font-face {
        font-family: "HackGen";
        font-display: swap;
        src: url("/fonts/hackgen_v1.4.1/HackGen35-Regular.woff2") format("woff2"),
             url("/fonts/hackgen_v1.4.1/HackGen35-Regular.woff") format("woff")
      }
      pre, code, samp, kbd {
        font-family: "HackGen", "Sawarabi Gothic", "Helvetica Neue", Helvetica, /*"Open Sans", "M PLUS 1p", */"ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "メイリオ", Meiryo, Osaka, "MS Pゴシック", "MS PGothic", Arial, sans-serif;
        font-size: 12px;
      }
      body {
        ...
      }
    </style>
   ...
</head>

Apache に Web フォントの MIME タイプ定義を追加する。

$ sudo vi /etc/httpd/conf/httpd.conf
/etc/httpd/conf/httpd.conf
...
<IfModule mime_module>
    ...
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
 
    # Web Font
    AddType application/font-sfnt         otf ttf
    AddType application/font-woff         woff
    AddType application/font-woff2        woff2
    AddType application/vnd.ms-fontobject eot
...
</IfModule>

Web フォントを配信するに当たって Apache のキャッシュ期間を設定する。

$ sudo vi dokuwiki/.htaccess
dokuwiki/.htaccess
...
ExpiresActive On
ExpiresByType application/font-woff "access plus 1 month"
ExpiresByType application/font-woff2 "access plus 1 month"
ExpiresByType application/font-sfnt "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
...

Apache をリロードして設定を反映させる。

$ sudo systemctl reload httpd

Vue.js + axios で DokuWiki REST API をコールする

DokuWiki REST API Vue.js サンプルアプリ

<html>
  <script src="/_media/javascript/requirejs/require-2.3.6.min.js?cache=recache"></script>
  <script>
    self.DEBUG = true;
  </script>
  <script src="/_media/javascript/requirejs/settings.js?cache=nocache"></script>
</html>
 
===== DokuWiki REST API Vue.js サンプルアプリ =====
<html>
  <div id="doku-vuejs-app">
    <p>Vue.js version: {{ vue_ver }}</p>
    <p>Response Data(status: {{ response.status }}):</p>
    <pre>{{ response.data }}</pre>
    <p>axios response:</p>
    <pre>{{ response }}</pre>
  </div>
  <script>
    "use strict";
 
    let doku_vuejs_app;
 
    require(['Vue','axios'], (Vue, axios) => {
      doku_vuejs_app = new Vue({
        el: '#doku-vuejs-app',
        data: {
          vue_ver: Vue.version,
          response: '',
        },
        created: function() {
          axios.get('/lib/exe/ajax.php?call=api')
            .then(response => {
              this.response = response;
            });
        }
      });
    });
  </script>
</html>
※Vue.js, REST API バージョンを表示するだけの簡単なサンプルアプリケーション。\\

devel:xmlrpc [DokuWiki]

XML-RPC の機能
関数名
dokuwiki.getPagelist
dokuwiki.getVersion
dokuwiki.getTime
dokuwiki.getXMLRPCAPIVersion
dokuwiki.login
dokuwiki.search
dokuwiki.getTitle
dokuwiki.appendPage
dokuwiki.setLocks
dokuwiki.deleteUsers
wiki.getRPCVersionSupported
wiki.aclCheck
wiki.getPage
wiki.getPageVersion
wiki.getPageVersions
wiki.getPageInfo
wiki.getPageInfoVersion
wiki.getPageHTML
wiki.getPageHTMLVersion
wiki.putPage
wiki.listLinks
wiki.getAllPages
wiki.getBackLinks
wiki.getRecentChanges
wiki.getRecentMediaChanges
wiki.getAttachments
wiki.getAttachment
wiki.getAttachmentInfo
wiki.putAttachment
wiki.deleteAttachment
plugin.acl.addAcl
plugin.acl.delAcl

<dokuwiki>/data/attic/<namespace>/<attic file> を削除する。
<attic file> は dokuwiki.1437393935.txt.gz の様に、<pagename.連番.txt.gz> になっている。

<dokuwiki>/data/meta/<namespace>/<pagename>.changes というメタファイルを編集します。
メタファイルも行ごとに連番が振られているので、上記で削除した連番の行を削除します。

1376793743      122.249.153.239 E       linux:dokuwiki  tomoyan
1437393935      127.0.0.1       E       linux:dokuwiki          外部編集                0
1546495335      127.0.0.1       E       linux:dokuwiki  tomoyan [geeklogのDokuWiki Plugi(注意: 以下>は古い情報です)]            1

公式: caching [DokuWiki] 翻訳

$ touch dokuwiki/conf/local.php

DokuWiki Upgrade Plugin で DokuWiki をアップグレードする。

送信された URL はソフト 404 エラーのようです 

ソフト 404 エラー - Search Console ヘルプ

原因:
 古い URL をブックマークしているユーザーを考慮して、このページが存在しないことを表示して GOTO Plugin で移設先へ適切にリダイレクトするようにしたい。しかし、Google のクローラーのことを考慮すると本来であればこのようなページは 301 (移動した) スタータスを返すべきであるが、GOTO Plugin は一旦 200 (OK) ステータスを返してから一定時間経過後にリダイレクトする。
 つまり、このようなページは検索エンジンには登録されるべきではないので、以下のような対策を行う。

GOTO Plugin と HtmlMetaTags Plugin を併用して、ユーザーには移動したことをお知らせしつつリダイレクトして、Google のクローラーには検索エンジンには登録しないように通知する。

{{htmlmetatags>metatag-robots=(noindex,nofollow)}}
~~GOTO>windows:regex~~

 

dokuwiki/conf/mime.conf が更新時に上書きされているので、以下の設定が存在しないのが原因である。

dokuwiki/conf/mime.conf
svg image/svg+xml

バックアップなどから mime.conf を復元するか、上記の設定をし直す。

Indexmenu Plugin で dTree is not defined スクリプトエラーが発生する。(Plugin が最新ではない場合)
または、以下のエラーが表示される。

Indexmenu Plugin: If you use the 'js'-option of the indexmenu plugin, you have to disable the 'defer_js'-setting. This setting is temporary, in the future the indexmenu plugin will be improved.

様々な Plugin で jQuery not defined スクリプトエラーが発生する。(Chrome のデベロッパーツール Ctrl + Shift + I の Console)

対処方法:
[管理] - [サイト設定] - 機能フラグdefer_js オプションをオフにする。

js が「addInitEvent is not defined」エラーになるので、addInitEvent を jQuery に修正する。

dokuwiki/lib/plugins/crypt/ation.php
<?php
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'action.php');
 
class action_plugin_crypt extends DokuWiki_Action_Plugin {
    function register($controller) {
        $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, '_hookjs');
    }
    function _hookjs(&$event, $param) {
        $event->data['script'][]=array('type'=>'text/javascript','charset'=>'utf-8'
//        ,'_data'=>'','_data'=>"addInitEvent(function() { return(decryptEditSetup()); });");
        ,'_data'=>'','_data'=>"jQuery(function() { return(decryptEditSetup()); });");
    }
}

js が「locktimer is not defined」エラーになるので、locktimer を dw_locktimer に修正する。

dokuwiki/lib/plugins/crypt/script.js
function decryptEditSetup(msg) {
  var editform=null, wikitext=null, hiddentext=null, preview=null;
  if(!(editform=document.getElementById('dw__editform'))) {
    // alert("no form dw__editform\n");
    return(true);
  }
  if(!(wikitext=document.getElementById('wiki__text'))) {
   // alert("no wiki__text");
   return(false);
  }
  // if there is no preview button, then assume this is a
  // "Recover draft" page, dont do anything.
  if(!(preview=document.getElementById('edbtn__preview'))) {
    return(false);
  }
 
  // create a hidden element with id 'wiki__text_submit' and
  // name wikitext_edit (same as the wiki__text.  move the real
  // wikI__text element out of the form (so it is not submitted and
  // any <SECRET> text left unencrypted
  if(!(hiddentext=document.createElement('input'))) {
   return(false);
  }
  hiddentext.setAttribute('id', 'wiki__text_submit');
  hiddentext.setAttribute('name', 'wikitext');
  hiddentext.setAttribute('type','hidden');
  editform.insertBefore(hiddentext,null);
  editform.parentNode.insertBefore(wikitext,editform);
 
  if(!(decryptButton=document.createElement('input'))) {
   return(false);
  }
  decryptButton.setAttribute('id', 'decryptButton');
  decryptButton.setAttribute('name', 'decryptButton');
  decryptButton.setAttribute('type','Button');
  decryptButton.setAttribute('value','DecryptSecret');
  // decryptButton.setAttribute('onclick',decryptEditForm);
  decryptButton.onclick=decryptEditForm;
  decryptButton.setAttribute('class','button');
  decryptButton.setAttribute('className','button'); // required for IE
  preview.parentNode.insertBefore(decryptButton,preview);
 
  editform.onsubmit = function() {return editFormOnSubmit();};
 
  // the following is taken from lib/scripts/edit.js to make drafts work
  dw_locktimer.refresh = function(){
      var now = new Date();
      // refresh every minute only
      if(now.getTime() - dw_locktimer.lasttime.getTime() > 30*1000){ //FIXME decide on time
          var params = 'call=lock&id='+encodeURIComponent(dw_locktimer.pageid);
          if(dw_locktimer.draft){
              var dwform = $('dw__editform');
              // begin plugin modified code
              if(encryptForSubmit()===false) { return(false); }
              // end plugin modified code
              params += '&prefix='+encodeURIComponent(dwform.elements.prefix.value);
              params += '&wikitext='+encodeURIComponent(dwform.elements.wikitext.value);
              params += '&suffix='+encodeURIComponent(dwform.elements.suffix.value);
              params += '&date='+encodeURIComponent(dwform.elements.date.value);
          }
          dw_locktimer.sack.runAJAX(params);
          dw_locktimer.lasttime = now;
      }
  };
}

Free Content Management System GPL - Geeklog France からインストールできます。

geeklog 1.8.0 では、Javascript をフッターのテーマ変数{plg_footercode}で実行するようになったらしく、SyntaxHighlighter3 が動作しない。
そのため lib-common.php とテーマのヘッダーテンプレートを改造する。
※この改造による影響の有無は不明です。暫くこれで運用してみます。

COM_siteFooter関数内1,514行目(*1)付近(フッターに出力しているscriptを止める)
*1 - 1.8.0 の行番号, 2.0.0 では 1,570行目付近。

highlight:
    // Retrieve any JavaScript libraries, variables and functions
    //$footercode = $_SCRIPTS->getFooter();

COM_siteHeader関数内1,286行目(*2)付近(ヘッダーの新たなテーマ変数plg_extrascriptにscriptを出力する)
*2 - 1.8.0 の行番号, 2.0.0 では 1,337行目付近。

highlight:
    $headercode = $_SCRIPTS->getHeader() . $headercode;
    $header->set_var( 'plg_headercode', $headercode );
    // Retrieve any JavaScript libraries, variables and functions
    $header->set_var('plg_extrascript', $_SCRIPTS->getFooter());

使っているテーマの header.thtml に追記する。

highlight:
{doctype}
<html{html_attribute}{xmlns}>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"{xhtml}>
<title>{page_title_and_site_name}</title>
<meta http-equiv="Content-Script-Type" content="text/javascript"{xhtml}>
<meta http-equiv="Content-Style-Type" content="text/css"{xhtml}>
<link rel="SHORTCUT ICON" href="{layout_url}/images/favicon.ico"{xhtml}>
<!-- <meta http-equiv="Pragma" content="no-cache"{xhtml}> -->
{feed_url}
{rel_links}
{plg_headercode}
{plg_extrascript}
</head>

Geeklog Forum Plugin の forum.css が Dokuwiki の syntaxhighlighter3 に悪影響するので修正
/path/to/public_html/forum/forum/layout/forum.css

/* CSS Declarations for Code block feature - default will use the .php one */
.pluginSolidOutline div .php { max-height:400px; overflow:auto; height:auto; width:auto; min-height:100px; }
.pluginSolidOutline div .html { height:300px; overflow:auto; width:auto; min-height:100px; }
.pluginSolidOutline div .css { height:300px; overflow:auto; width:auto; min-height:100px; }

管理者用のサイト設定

使用言語: ja で日本語化されない場合は、/dokuwiki/conf/local.protected.phpにて追加設定を行う。
local.protected.php$conf['lang'] = 'ja'; を追加

<?php
/**
 * DokuWiki - Geeklog Integration Plugin
 *
 * This file holds configuration information specific to the
 * integration of DokuWiki with Geeklog.
 *
 * You will need to change the require_once() line below to
 * point to your Geeklog lib-common.php file.
 *
 * No other changes should be made to this protected file.
 */
 
//~省略~
$conf['lang'] = 'ja';
 
/* --- Do not change anything below this line --- */
//~省略~
?>

これはDokuWikiの編集画面ですけど、CSSも埋められますけど、LESSでスタイル定義できたり...🤤PHP?🤔テーマファイルはcustom.lessとかコンパイルされますけど、編集しながら試したいのでlessphp呼び出してしまえばねぇ可能な訳でつい😅💦 / Twitter
😱😱😱CodeMirror Pluginががががが😥 多分テンプレートのモバイルCSSと相性宜しくない😅
またもや、CodeMirrorプラグインがテーマのドラフトステータスによりヤラレテル😱😱😱これはテーマ側での対処は速いけど、どのテーマとも相性出るならCodeMirrorプラグイン側に対処を入れるべきか❓🤔自分のサイト専用カスタムのcustom.lessで対処入れられるか❓🤔編集側にしか影響は無いけど…😅
AVIFもWebPのように、このような対応が良いですね🥰
サーバーをPHP 8へ移行してる🤤Wikiを移行してるだけだけど😅先ずはフルバックアップしてPHP 8対応版の Release 2022-07-31 "Igor" へアップグレード完了した🤔PHP 7.4 から PHP 8系へシステムのパッケージを入れ替える😃移行ははじめてですけど...🤔
Bootstrapテーマの目次の折り畳みがおかしいのは、TocTweakプラグインとテーマが喧嘩⚔️してるから😅テーマやプラグインは確かに便利で楽だけど、組み合わせはユーザーが自由にやるので、作者さんも全てのパターンに対処しきれません🤔 !important 重要☝😅

  • linux/dokuwiki.txt
  • 最終更新: 2024/03/27 10:47
  • by ともやん