拡張プラグインのインストール・アンインストール - NetCommons3/NetCommons3 GitHub Wiki
AuthShibbolthを例に拡張プラグインのインストール・アンインストールする方法を説明します。
概要
項目 | 値 |
---|---|
拡張プラグイン名 | AuthShibbolth |
Githubのリポジトリ名 | NetCommons3/AuthShibbolth |
Packagistのパッケージ名 | netcommons/auth-shibboleth |
NetCommon3のインストールディレクトリ | /var/www/html/nc3/ |
インストール
composerから
(1) composer require
nc3をインストール後に追加でインストールする事を想定しています。
composer requireコマンドでプラグインの追加インストールを行います。
$ cd /var/www/html/nc3/
$ php -d allow_url_fopen=1 composer.phar require --update-no-dev --ignore-platform-reqs 【Packagistのパッケージ名】:@dev
例)$ php -d allow_url_fopen=1 composer.phar require --update-no-dev --ignore-platform-reqs netcommons/auth-shibboleth:@dev
(2) プラグインの一括アップデートをします
zipファイルから
(1) Pluginディレクトリ配下に拡張プラグインのソースを配置します。
ソースはgithubからzipをダウンロード後、解凍します
配置例)/var/www/html/nc3/app/Plugin/AuthShibboleth
(2) composer.lockに拡張プラグインの内容を追記する
これをすると一括アップデートで削除されなくなります。
# vi /var/www/html/nc3/composer.lock
composer.lockに追記する内容は、拡張プラグインのcomposer.jsonをコピーして作ります。
例)AuthShibbolethの場合 https://github.com/NetCommons3/AuthShibboleth/blob/master/composer.json
【ハッシュ値】はGithubの拡張プラグインのcommitsページからコピーして読み替えてください。
例)AuthShibbolethの場合 https://github.com/NetCommons3/AuthShibboleth/commits/master
開いたページで一番上の赤枠のボタン押すと、ハッシュ値がコピーされます
例)AuthShibbolethでcomposer.jsonをもとに追記する内容 ※ 追記する箇所は、"name": "netcommons系の最後の後ろに追記します
{
"name": "netcommons/auth-shibboleth",
// 以下追記
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/【Githubのリポジトリ名】.git",
"reference": "【ハッシュ値】"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/【Githubのリポジトリ名】/zipball/【ハッシュ値】",
"reference": "【ハッシュ値】",
"shasum": ""
},
"notification-url": "https://packagist.org/downloads/",
"time": "2017-12-28T06:50:17+00:00",
// ここまで
"description": "AuthShibboleth for NetCommons Plugin",
"homepage": "http://www.netcommons.org/",
"extra": {
"installer-paths": {
"app/Plugin/{$name}": ["type:cakephp-plugin"]
}
},
"require": {
"cakedc/migrations": "~2.2",
"netcommons/mails": "@dev",
"netcommons/net-commons": "@dev",
"netcommons/site-manager": "@dev",
"netcommons/user-attributes": "@dev",
"netcommons/users": "@dev"
},
"license": "NetCommons License",
"authors": [
{
"name": "Mitsuru Mutaguchi(OpenSource WorkShop)",
"email": "[email protected]",
"homepage": "https://opensource-workshop.jp/",
"role": "Developer"
},
{
"name": "NetCommons Community",
"homepage": "http://www.netcommons.org"
}
],
"type": "cakephp-plugin",
"keywords": ["cakephp", "auth", "shibboleth"],
"config": {
"vendor-dir": "vendors"
}
}, ←カンマ追記
(3) プラグインの一括アップデートをします
# cd /var/www/html/nc3/app
# Console/cake PluginManager.update_all update_all
(4) DBキャッシュファイルのオーナーをapacheのオーナーに変更する
CentOS6, 7の場合
# chown -R apache:apache /var/www/html/nc3/app/tmp/cache/*
アンインストール
(1) cakeコマンドを使ってmigrationのdownオプションを実行します。(実行するとDBデータが削除されます)
# cd /var/www/html/app
# Console/cake Migrations.migration run down -c master -p 【拡張プラグイン名】
例)# Console/cake Migrations.migration run down -c master -p AuthShibboleth
Cake Migration Shell
---------------------------------------------------------------
You did not set a migration connection (-i), which connection do you want to use? (master/slave1/test)
[master] > (←空エンター)
Running migrations:
(省略)
---------------------------------------------------------------
All migrations have completed.
(2) 複数回上記作業を繰り返します。下記メッセージが表示されたら、全て削除されています。
# Console/cake Migrations.migration run down -c master -p 【拡張プラグイン名】
例)# Console/cake Migrations.migration run down -c master -p AuthShibboleth
Cake Migration Shell
---------------------------------------------------------------
You did not set a migration connection (-i), which connection do you want to use? (master/slave1/test)
[master] > (←空エンター)
Not a valid migration version.
(3) DBキャッシュファイルのオーナーをapacheのオーナーに変更する
DBキャッシュファイルのオーナーをapacheのオーナーに変更する参照
これでアンインストール完了です。