Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

再構築時に一部のディレクトリを除外したい #4

Open
keita-i opened this issue Jun 5, 2018 · 2 comments
Open

再構築時に一部のディレクトリを除外したい #4

keita-i opened this issue Jun 5, 2018 · 2 comments

Comments

@keita-i
Copy link

keita-i commented Jun 5, 2018

AMIMOTO AMIを使ってEC2+RDS+Wordpress+S3の構成をAWSで作成いたしました。

再構築する際にauthorやwp-content/pluginsなどのフォルダを除外したいです。

いろいろ調べ、以下を/wp-content/plugins/staticpress/plugin.phpの末尾に
記述すれば除外できるというサイトを見つけたのですが、
実際に記述して再構築を行うとエラーになり、再構築自体が実行されませんでした。

add_action('StaticPress::file_put', 'static_rm', 1);
function static_rm($file_dest, $url){
if(strstr($file_dest, '/author/')
or strstr($file_dest, '/wp-content/plugins/')
or strstr($file_dest, '/wp-json/')){
unlink($file_dest);
}
}

どうすれば再構築時に一部のディレクトリ、ファイルを除外できますでしょうか?

@wokamoto
Copy link
Member

こちらですが、ご利用のPHPのバージョンはなんでしょうか?
上記コードは無名関数を使用しておりますので、PHPの5.3.0以降で使用可能となりますので、PHP 5.2.x を利用されている場合は使用できません。

@keita-i
Copy link
Author

keita-i commented Jun 15, 2018

PHPのバージョンは7.0.30です。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants