====== DokuWiki ====== 本家: [[https://www.dokuwiki.org/dokuwiki|dokuwiki [DokuWiki]]]\\ ソースコード: [[https://github.com/splitbrain/dokuwiki|splitbrain/dokuwiki: The DokuWiki Open Source Wiki Engine]]\\ ===== 更新前に必ず確認‼️ ===== [[https://www.dokuwiki.org/changes|]] ([[https://www-dokuwiki-org.translate.goog/changes?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc|翻訳]])\\ ===== 技術資料 ===== [[https://www.dokuwiki.org/development#the_development_manual|The Development Manual - development [DokuWiki]]] - 開発マニュアル\\ [[https://www.dokuwiki.org/devel:dirlayout|Directory Layout - devel:dirlayout [DokuWiki]]] - ディレクトリ レイアウト\\ ===== PHP 8 へ移行 ===== ==== PHP 8 対応の新しい DokuWiki に更新 ==== [[https://www.dokuwiki.org/changes#release_2022-07-31_igor|Release 2022-07-31 "Igor"]]\\ とにかく、DokuWiki を更新前に丸ごとバックアップする🤤\\
$ cp dokuwiki/conf/mime.conf dokuwiki/conf/mime.conf.bak
$ tar jcvf dokuwiki_20220804_1.tar.bz2 dokuwiki/
**[[http://www.dokuwiki.org/plugin:upgrade|DokuWiki Upgrade Plugin]]** で DokuWiki を PHP 8 対応版へアップグレードする。\\ ==== DokuWiki 更新後の動作確認 ==== アップグレード後の動作確認🤔\\ svg は標準対応されている😊\\ svg image/svg+xml [[:hardware:sd_memory_card|SD メモリーカード]] など svg を大量に使用しているページで動作チェックする😉\\ mime.conf.bak を元に アップグレードで上書きされた mime.conf を修正する😊\\ DokuWiki は mime.conf でアップロードするファイルの種類を許可しているので、個別に許可している場合はその情報を書き足す必要があるため😉\\ ==== システムの PHP バージョンをアップデートする ==== 現時点の 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 リポジトリを利用する設定が必要)\\ [[linux:fedora:rpmfusion|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
参考: [[https://computingforgeeks.com/how-to-install-php-on-fedora/|How To Install PHP 8.0 on Fedora 36/35/34/33/32 | ComputingForGeeks]]\\   [[https://rpms.remirepo.net/fedora/36/|Remi's RPM repository - Fedora 36]]\\ ==== PHP 8.1 -> PHP 8.2 ====
$ sudo dnf module reset php -y
$ sudo dnf module install php:remi-8.2
$ sudo systemctl restart php-fpm
$ sudo systemctl restart httpd
===== PHP 8 対応状況 ===== [[git>splitbrain/dokuwiki/issues?q=is:issue is:open label:"PHP 8"|ラベル: PHP 8 で開いている Issues · splitbrain/dokuwiki]]\\ ===== DokuWiki プラグイン (Plugin) ===== [[:linux:dokuwiki:mathjax_plugin|MathJax Plugin]]\\ [[:linux:dokuwiki:mathpublish_plugin|mathpublish Plugin]]\\ [[:linux:dokuwiki:codeMirror_plugin|CodeMirror Plugin]]\\ ==== DokuFreaks ==== [[https://github.com/dokufreaks|{{https://avatars.githubusercontent.com/u/86480?&.png?100x100&recache|DokuFreaks }}]] [[git>dokufreaks|DokuFreaks]] GitHub 組織は、元の作成者によってほとんど放棄されたプラグインが **最小限** 維持される場所です。これは、言語の更新が適用され、簡単なプル リクエストが適用され、プラグインが通常、最近の DokuWiki リリースで動作する状態になる必要があることを意味します。 一方、これは、そこにリストされているプラ​​グインが**積極的に開発されていない**ことを意味します。機能リクエストはほとんど無視され、マージに大きな労力が必要なプル リクエストはおそらく永久に無視されるでしょう。 [[https://www.dokuwiki.org/dokufreaks|dokufreaks [DokuWiki]] より🤔\\ ===== DokuWiki プラグイン開発 (Devel) ===== [[https://mizunashi-mana.github.io/blog/posts/2019/07/dokuwiki-syntax-plugin/|続くといいな日記 – DokuWiki の構文拡張プラグインの作り方]]\\ DokuWiki ソースコード閲覧\\ [[https://xref.dokuwiki.org/reference/dokuwiki/nav.html|PHPXref: DokuWiki]]\\ [[https://www.dokuwiki.org/devel:plugin_file_structure|devel:plugin_file_structure [DokuWiki]]] ([[https://www-dokuwiki-org.translate.goog/devel:plugin_file_structure?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc|翻訳]])\\ [[https://www.dokuwiki.org/devel:syntax_plugins|devel:syntax_plugins [DokuWiki]]] ([[https://www-dokuwiki-org.translate.goog/devel:syntax_plugins?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc|翻訳]])\\ ===== DokuWiki テーマ カスタマイズ ===== ==== テンプレートのキャッシュ戦略 ==== 以降のカスタマイズではテーマの **main.php** にスタイルを直書きしていますが、検証のためであり本来は個別の **CSS** ファイルに分けるのが望ましい。直書きしたスタイルはページロードの都度 HTML ファイルに埋め込まれていて **CSS Minify (コード圧縮)** されないため、スタイル定義が増えるごとにダウンロードサイズも増加する。更に一般的にスタイルの変更は少ないので、ページ内容の変更とは切り分けてブラウザーにキャッシュさせた方が、よりページロード時間を高速化できて良い。\\ ブラウザーの開発者ツールで **CSS** ファイルに分けた場合は (from disk cache) ローカルディスクから読み込まれるので、キャッシュ期限で指定された時間が経過するまではインターネットを介してダウンロードされなくなる。更に DokuWiki のエンジンが自動的に style.ini で参照しているスタイルを **CSS Minify (コード圧縮)** して一つにまとめるので、スタイル定義を複数のファイルに分割している場合でも一度のリクエストで取得できるので、Web サーバーの負荷を減らすと伴にクライアントのページロード時間を高速化できる利点がある。\\ {{:linux:dokuwiki_template_cache_001.png?470|DokuWiki テンプレート ブラウザーキャッシュ}}\\ 安定したスタイル定義を **CSS** ファイルに分けるには、テンプレートディレクトリの style.ini に スタイルを含めるように指示して css ディレクトリにファイルを別途作成する。\\ [stylesheets] css/custom.less = screen @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
オリジナル\\ 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.ini** に **custom.less** を登録する🤤\\
$ nano style.ini
[stylesheets] ; DokuWiki core styles ... ; Template styles ... ; Tomoyan.NET Custom (追記登録) css/custom.less = all **main.php** に必要な変更を行うのを忘れずに😉\\ **Google AdSense Plugin** のための変更\\ ... ... **Google Fonts (Web フォント)** のための変更\\ ... ... **その他の CSS** のための変更\\ ... ... ==== DokuWiki テーマの Dark モード対応 ==== OS が Dark モードで実行されている場合の対応を追加する。\\ ... ... ※これらで対応が足りているか検証中である。\\ ==== DokuWiki テーマに Web フォントを定義 ==== Google Fonts の Sawarabi Gothic を定義する。\\ ... ... ※ Google Fonts の CSS の URL の末尾に **&display=swap** を記述すると CSS の **font-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"); } === 参考文献 === [[https://developer.mozilla.org/ja/docs/Web/CSS/@font-face|@font-face - CSS: カスケーディングスタイルシート | MDN]]\\ ==== ブロックに HackGen (白源) フォントを適用 ==== [[open_source:fonts#hackgen|HackGen (白源)]]\\ [[web:web_font#woffconverter|WOFFConverter]]\\ **** ブロックは HTML の **pre** タグであるため、**pre** タグのフォントを変更する。\\ ... ... ==== Apache MIME タイプの設定 ==== Apache に Web フォントの MIME タイプ定義を追加する。\\ $ sudo vi /etc/httpd/conf/httpd.conf ... ... # # 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 ... Web フォントを配信するに当たって Apache のキャッシュ期間を設定する。\\ $ sudo vi 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 ===== Open Graph プロトコル ===== [[https://www.dokuwiki.org/plugins?plugintag=opengraph#extension__table|plugins (opengraph) [DokuWiki]]]\\ [[https://dokuwiki.org/plugin:socialcards|SocialCards Plugin]]\\ [[https://www.dokuwiki.org/ja:plugin:semantic|Semantic Plugin]]\\ \\ [[https://cards-dev.twitter.com/validator|Twitter Card Validator]]\\ [[https://developers.facebook.com/tools/debug/|シェアデバッガー - Facebook for Developers]]\\ [[https://validator.schema.org|スキーマ マークアップ検証ツール]]\\ [[https://developers.google.com/search/docs/advanced/structured-data|構造化データマークアップをテストする | Google検索セントラル  |  Google Developers]]\\ ===== REST API ===== ==== API Plugin ==== [[https://www.dokuwiki.org/plugin:api|plugin:api [DokuWiki]]]\\ GitHub: [[https://github.com/gerardnico/dokuwiki-plugin-api/|gerardnico/dokuwiki-plugin-api: A rest api interface for Dokuwiki]]\\ ==== Call DokuWiki REST API ==== URL: [[https://www.tomoyan.net/lib/exe/ajax.php?call=api|]]\\ Return:\\ {"api":"api","version":"2019-06-21"} ^ 機能 (fn) ^ 引数 ^ 説明 ^ | version | - | DokuWiki のバージョンを取得する。 | | wiki | - | | URL: [[https://www.tomoyan.net/lib/exe/ajax.php?call=api&fn=version|]]\\ URL: [[https://www.tomoyan.net/lib/exe/ajax.php?call=api&fn=wiki|]]\\ URL: [[https://www.tomoyan.net/lib/exe/ajax.php?call=api&fn=pages&limit=10|]]\\ URL: [[https://www.tomoyan.net/lib/exe/ajax.php?call=api&fn=page&id=linux|]]\\ === Vue.js + axios で DokuWiki REST API をコールする === [[javascript:vuejs:dokuwiki_rest_api_sample|DokuWiki REST API Vue.js サンプルアプリ]]\\ ===== DokuWiki REST API Vue.js サンプルアプリ =====

Vue.js version: {{ vue_ver }}

Response Data(status: {{ response.status }}):

{{ response.data }}

axios response:

{{ response }}
※Vue.js, REST API バージョンを表示するだけの簡単なサンプルアプリケーション。\\
===== XML-RPC ===== [[https://www.dokuwiki.org/devel:xmlrpc|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 | ==== Call DokuWiki XML-RPC ==== URL: [[https://www.tomoyan.net/lib/exe/xmlrpc.php|]]\\ ===== 以前のリビジョン ===== ==== 特定のリビジョンを削除する方法 ==== /data/attic// を削除する。\\ は dokuwiki.1437393935.txt.gz の様に、 になっている。\\ \\ /data/meta//.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 ==== サーバーキャッシュのパージ ==== 公式: [[https://www.dokuwiki.org/caching|caching [DokuWiki]]] [[gtr>https://www.dokuwiki.org/caching|翻訳]]\\
$ touch dokuwiki/conf/local.php
===== アップグレード ===== **[[http://www.dokuwiki.org/plugin:upgrade|DokuWiki Upgrade Plugin]]** で DokuWiki をアップグレードする。\\ ===== 参考文献 ===== DokuWiki 高速化に関する議論\\ [[https://forum.dokuwiki.org/d/7766-optimizing-dokuwiki-load-time/5|]]\\ テンプレート カスタマイズ\\ [[https://itlogs.net/dokuwiki-css/|DokuWikiのCSS(スタイルシート)カスタマイズ方法を解説 | 俺の開発研究所]]\\ ===== トラブルシューティング ===== ==== GOTO Plugin リダイレクトしているページが Google Search Console がソフト 404 エラーを通知する場合の対処 ==== 送信された URL はソフト 404 エラーのようです [[https://support.google.com/webmasters/answer/181708|ソフト 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 バージョンアップ後に svg イメージが表示されない ==== **dokuwiki/conf/mime.conf** が更新時に上書きされているので、以下の設定が存在しないのが原因である。\\ svg image/svg+xml バックアップなどから **mime.conf** を復元するか、上記の設定をし直す。\\ ==== DokuWiki バージョンアップ後に JavaScript が動作しない ==== 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** オプションを**オフ**にする。\\ ===== crypt(2009-02-17) プラグイン ===== js が「addInitEvent is not defined」エラーになるので、addInitEvent を jQuery に修正する。\\ 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 に修正する。\\ 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 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; } }; } ===== geeklog の DokuWiki Plugin ===== ==== インストール ==== [[http://geeklog.fr/downloads/index.php/59|Free Content Management System GPL - Geeklog France]] からインストールできます。 ==== Geeklog Dokuwiki Plugin で SyntaxHighlighter3 を使えるようにする ==== 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行目付近。 // 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行目付近。 $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 に追記する。 {doctype} {page_title_and_site_name} {feed_url} {rel_links} {plg_headercode} {plg_extrascript} ==== forum.css の修正 ==== 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; } ===== ☢️古い資料です (Obsolete)☢️ ===== ==== geeklogのDokuWiki Plugin ==== === 管理者用のサイト設定 === 使用言語: ja で日本語化されない場合は、/dokuwiki/conf/local.protected.phpにて追加設定を行う。\\ **local.protected.php** に __**$conf['lang'] = 'ja';**__ を追加\\ ===== 参考文献 ===== [[https://dokuwiki.oreda.net/plugin/list.html|DokuWikiおすすめプラグイン一覧。まとめ [DokuWikiで情報発信]]]\\ [[qita>ruddy95/items/e12498ab7c0eb56611a2|WEBページをコンテントセキュリティポリシー(CSP)対応させる - Qiita]]\\ [[qita>tearoom6/items/30e3aacaa432860d4b36|HTTP CSP について - Qiita]]\\ [[https://you84815.blogspot.com/2017/01/dokuwikicontent-security-policy.html|tobijibu-ashiato: DokuWikiのContent-Security-Policy対応方法]]\\ [[https://laboradian.com/show-text-immediately-using-font-display/|Webフォントを使う場合に font-display 記述子を使ってすぐにテキストを表示させる – ラボラジアン]]\\ [[https://www.achiachi.net/blog/index.html|トップページ [あちあち情報局]]]\\ ==== 付録 ==== [[tw>tomoyan596/status/1462064104101888002|これはDokuWikiの編集画面ですけど、CSSも埋められますけど、LESSでスタイル定義できたり...🤤PHP?🤔テーマファイルはcustom.lessとかコンパイルされますけど、編集しながら試したいのでlessphp呼び出してしまえばねぇ可能な訳でつい😅💦 / Twitter]]\\ [[tw>tomoyan596/status/1490051770806005760|😱😱😱CodeMirror Pluginががががが😥 多分テンプレートのモバイルCSSと相性宜しくない😅]]\\ [[tw>tomoyan596/status/1492593642459914240|またもや、CodeMirrorプラグインがテーマのドラフトステータスによりヤラレテル😱😱😱これはテーマ側での対処は速いけど、どのテーマとも相性出るならCodeMirrorプラグイン側に対処を入れるべきか❓🤔自分のサイト専用カスタムのcustom.lessで対処入れられるか❓🤔編集側にしか影響は無いけど…😅]]\\ [[tw>tomoyan596sp/status/1514366405139103747|AVIFもWebPのように、このような対応が良いですね🥰]]\\ [[tw>tomoyan596sp/status/1554871221518422016|サーバーをPHP 8へ移行してる🤤Wikiを移行してるだけだけど😅先ずはフルバックアップしてPHP 8対応版の Release 2022-07-31 "Igor" へアップグレード完了した🤔PHP 7.4 から PHP 8系へシステムのパッケージを入れ替える😃移行ははじめてですけど...🤔]]\\ [[tw>tomoyan596sp/status/1569795203896320000|Bootstrapテーマの目次の折り畳みがおかしいのは、TocTweakプラグインとテーマが喧嘩⚔️してるから😅テーマやプラグインは確かに便利で楽だけど、組み合わせはユーザーが自由にやるので、作者さんも全てのパターンに対処しきれません🤔 !important 重要☝😅]]\\