diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index a3225bc..592d72f 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -4,16 +4,25 @@ on:
tags:
- '3*'
-name: Create Release
+name: create_release
jobs:
build:
- name: Create Release
+ name: create_release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
+ - name: Slack Notification on Start
+ uses: rtCamp/action-slack-notify@v2.2.0
+ env:
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASE }}
+ SLACK_CHANNEL: notify-nc3-release
+ SLACK_TITLE: "${{ github.repository }}"
+ SLACK_COLOR: "#f0ad4e"
+ SLACK_MESSAGE: "Start Job"
+
- name: Create Release
id: create_release
uses: actions/create-release@v1
@@ -26,3 +35,25 @@ jobs:
NetCommons ${{ github.ref }} released.
draft: false
prerelease: false
+
+ # テスト成功時はこちらのステップが実行される
+ - name: Slack Notification on Finish
+ uses: rtCamp/action-slack-notify@v2.2.0
+ if: success()
+ env:
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASE }}
+ SLACK_CHANNEL: notify-nc3-release
+ SLACK_TITLE: "${{ github.repository }}"
+ SLACK_COLOR: good
+ SLACK_MESSAGE: "Job Success"
+
+ # テスト失敗時はこちらのステップが実行される
+ - name: Slack Notification on Failure
+ uses: rtCamp/action-slack-notify@v2.2.0
+ if: failure()
+ env:
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASE }}
+ SLACK_CHANNEL: notify-nc3-tests
+ SLACK_TITLE: "${{ github.repository }}"
+ SLACK_COLOR: danger
+ SLACK_MESSAGE: "Job Failure"
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..eb2068b
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,170 @@
+on:
+ push:
+ branches:
+ - main
+ - master
+ - availability
+ pull_request:
+ branches:
+ - main
+ - master
+ - availability
+
+name: tests
+
+jobs:
+ setup:
+ name: setup
+ runs-on: ubuntu-latest
+ steps:
+ - name: Slack Notification on Start
+ uses: rtCamp/action-slack-notify@v2.2.0
+ if: env.SLACK_WEBHOOK != ''
+ env:
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }}
+ SLACK_CHANNEL: notify-nc3-tests
+ SLACK_TITLE: "${{ github.repository }}"
+ SLACK_COLOR: "#f0ad4e"
+
+ tests:
+ name: tests
+ needs: setup
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ php: [ '7.1', '7.2', '7.3', '7.4' ]
+ mysql: [ '5.7', '8.0' ]
+
+ env:
+ NC3_BUILD_DIR: "/opt/nc3"
+ NC3_DOCKER_DIR: "/opt/docker"
+ NC3_GIT_URL: "git://github.com/NetCommons3/NetCommons3.git"
+ NC3_GIT_BRANCH: "master"
+ PLUGIN_BUILD_DIR: ${{ github.workspace }}
+ PHP_VERSION: ${{ matrix.php }}
+ MYSQL_VERSION: ${{ matrix.mysql }}
+ MYSQL_ROOT_PASSWORD: root
+ MYSQL_DATABASE: cakephp_test
+ COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Fix up git URLs
+ run: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig
+
+ - name: environment
+ run: |
+ echo "GITHUB_WORKSPACE=${GITHUB_WORKSPACE}"
+ echo "PLUGIN_BUILD_DIR=${PLUGIN_BUILD_DIR}"
+ echo "PHP_VERSION=${PHP_VERSION}"
+ echo "MYSQL_VERSION=${MYSQL_VERSION}"
+ ls -al ${PLUGIN_BUILD_DIR}
+
+ - name: docker-compose install
+ run: |
+ curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
+ chmod +x ~/docker-compose
+ sudo mv ~/docker-compose /usr/local/bin/docker-compose
+ docker-compose --version
+
+ - name: git clone nc3
+ run: git clone -b ${NC3_GIT_BRANCH} ${NC3_GIT_URL} ${NC3_BUILD_DIR}
+
+ - name: git clone nc3_docker
+ run: git clone https://github.com/NetCommons3/nc3app-docker.git ${NC3_DOCKER_DIR}
+
+ - name: docker-compose start
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose up -d
+ docker-compose start
+
+ - run: docker ps
+
+ - name: check libraries
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose exec -T nc3app bash /opt/scripts/start-on-docker.sh
+
+ - name: nc3 build
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose exec -T nc3app bash /opt/scripts/app-build.sh
+
+ - name: phpcs (PHP CodeSniffer)
+ if: always()
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose exec -T nc3app bash /opt/scripts/phpcs.sh
+
+ - name: phpmd (PHP Mess Detector)
+ if: always()
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose exec -T nc3app bash /opt/scripts/phpmd.sh
+
+ - name: phpcpd (PHP Copy/Paste Detector)
+ if: always()
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose exec -T nc3app bash /opt/scripts/phpcpd.sh
+
+ - name: gjslint (JavaScript Style Check)
+ if: always()
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose exec -T nc3app bash /opt/scripts/gjslint.sh
+
+ - name: phpdoc (PHP Documentor)
+ if: always()
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose exec -T nc3app bash /opt/scripts/phpdoc.sh
+
+ - name: phpunit (PHP UnitTest)
+ if: always()
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose exec -T nc3app bash /opt/scripts/phpunit.sh
+ sudo -s chmod a+w -R ${NC3_BUILD_DIR}/build
+
+# - name: push coveralls
+# env:
+# COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+# COVERALLS_FLAG_NAME: ${{ matrix.php }}
+# run: |
+# cd ${NC3_BUILD_DIR}
+# ls -la ${NC3_BUILD_DIR}
+# vendors/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v
+
+ - name: docker-compose remove
+ if: always()
+ run: |
+ cd ${NC3_DOCKER_DIR}
+ docker-compose rm -f
+
+ # テスト失敗時はこちらのステップが実行される
+ - name: Slack Notification on Failure
+ uses: rtCamp/action-slack-notify@v2.2.0
+ if: env.SLACK_WEBHOOK != '' && failure()
+ env:
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }}
+ SLACK_CHANNEL: notify-nc3-tests
+ SLACK_TITLE: "${{ github.repository }}(php${{ matrix.php }}, mysql${{ matrix.mysql }})"
+ SLACK_COLOR: danger
+
+ teardown:
+ name: teardown
+ runs-on: ubuntu-latest
+ needs: tests
+ steps:
+ # テスト成功時はこちらのステップが実行される
+ - name: Slack Notification on Success
+ uses: rtCamp/action-slack-notify@v2.2.0
+ if: env.SLACK_WEBHOOK != '' && success()
+ env:
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }}
+ SLACK_CHANNEL: notify-nc3-tests
+ SLACK_TITLE: "${{ github.repository }}"
+ SLACK_COLOR: good
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 202ca75..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,41 +0,0 @@
-language: php
-
-php:
- - 7.0
- - 7.1
- - 7.2
- - 7.3.24
- - 7.4
-
-sudo: false
-dist: trusty
-
-env:
- matrix:
- - NETCOMMONS_VERSION=master DB=mysql
- global:
- - secure: "S190W5bNgSM35uMwyHrUM4/5ipE1SemyfcjGQyRAVtcuQwAug/P5P5wDPrPeQyzgV7c5nDkxjBBr9pJ6xUG3dkPgiqTxchBeccishuMmUUs8pO1kd/o+DEJ3IoZyL5benFZyvTKGaSrZncqlHz0T/tARBQXiK7/ziAZ/qgtsyzXojRXD6Ro8BflphqhsZhpM45MesTSCr7oBfTryq9C6a6NBI7kByw01OpQWYh3F5EG/wEFTIR9gmcCUQzi4SHv9HixRAqjIKbdH1/4QQUVKJsQVvXbYDNbnrmw4scUJGwvFTx5sagLbnEuVGZ7o8ZA6DvUNWWFeaRft9V2NhJRu0hNO69DfyE/16CVqLLv8cSsM5BnMxU43NfzpPw2KkBg55QSLK7j53Tsy7WOSqSgx11Fek1E+TyyuVLLJAlQLuk7+mZBFlGXfMaU17DfFdUO+mZ4F+Bsa1OcTVABl1MmXnhntYADEBQ6bXrDk0I4GXNQ3xCklYGfKt8mbsb8gNRIJIkyRnYDLVB7lkXcMOL25DGORGftrSApQH7q1MRc8bLMtTcXdr+NZioOFrr1UgxQPgOfIEVZ2YepMw2sc0pkfYRWobm8zcIAjpJNPbM7JUYnlYi96OOFsabW4W3IisdPEA8mq8ALlS3kYpwN0jhBt+7/nPAwD8igRAOvjYoIU3t0="
- - GIT_COMMITTER_NAME=akagane99
- - GIT_COMMITTER_EMAIL=akagane99@gmail.com
- - GIT_AUTHOR_NAME=akagane99
- - GIT_AUTHOR_EMAIL=akagane99@gmail.com
-
-before_script:
- - export NETCOMMONS_BUILD_DIR=`dirname $TRAVIS_BUILD_DIR`/NetCommons3
- - git clone git://github.com/NetCommons3/NetCommons3 $NETCOMMONS_BUILD_DIR
- - cd $NETCOMMONS_BUILD_DIR
- - git checkout $NETCOMMONS_VERSION
- - . tools/build/plugins/cakephp/travis/pre.sh
-
-script:
- - travis_wait . tools/build/plugins/cakephp/travis/main.sh
-
-after_script:
- - . tools/build/plugins/cakephp/travis/post.sh
-
-notifications:
- email:
- recipients:
- - netcommons3@googlegroups.com
- on_success: never # default: change
- on_failure: always # default: always
diff --git a/Config/Migration/1616031325_modify_clean_up_records.php b/Config/Migration/1616031325_modify_clean_up_records.php
new file mode 100644
index 0000000..280b539
--- /dev/null
+++ b/Config/Migration/1616031325_modify_clean_up_records.php
@@ -0,0 +1,103 @@
+
+ * @link http://www.netcommons.org NetCommons Project
+ * @license http://www.netcommons.org/license.txt NetCommons License
+ * @copyright Copyright 2014, NetCommons Project
+ */
+
+App::uses('NetCommonsMigration', 'NetCommons.Config/Migration');
+
+/**
+ * clean up records migration
+ *
+ * @package NetCommons\CleanUp\Config\Migration
+ */
+class ModifyCleanUpRecordsColumn extends NetCommonsMigration {
+
+/**
+ * Migration description
+ *
+ * @var string
+ */
+ public $description = 'modify_clean_up_records';
+
+/**
+ * Actions to be performed
+ *
+ * @var array $migration
+ */
+ public $migration = array(
+ 'up' => array(
+ ),
+ 'down' => array(
+ ),
+ );
+
+/**
+ * records
+ * ファイルクリーンアップの対象にしたい場合、当マイグレーションを参考にマイグレーション作成して、
+ * 対象プラグインのデータをclean_upsテーブルに書き込む
+ *
+ * @var array $migration
+ */
+ public $records = array(
+ 'CleanUp' => array(
+ //登録フォーム
+ array (
+ 'plugin_key' => 'registrations',
+ 'model' => 'RegistrationQuestion',
+ 'class' => 'Registrations.RegistrationQuestion',
+ 'fields' => 'description',
+ 'alive_func' => 'getAliveCondition',
+ 'created_user' => '1',
+ 'modified_user' => '1',
+ ),
+ ),
+ );
+
+/**
+ * Before migration callback
+ *
+ * @param string $direction Direction of migration process (up or down)
+ * @return bool Should process continue
+ */
+ public function before($direction) {
+ return true;
+ }
+
+/**
+ * After migration callback
+ *
+ * @param string $direction Direction of migration process (up or down)
+ * @return bool Should process continue
+ */
+ public function after($direction) {
+ if ($direction === 'down') {
+ return true;
+ }
+
+ foreach ($this->records as $model => $records) {
+ $CleanUp = $this->generateModel('CleanUp');
+ foreach ($records as &$record) {
+ $targetRecord = $CleanUp->find('first', array(
+ 'recursive' => -1,
+ 'conditions' => array(
+ 'class' => $record['class']
+ )
+ ));
+ if (! $targetRecord) {
+ CakeLog::info('Not Found ' . $record['class'] . ' in clean_ups');
+ continue;
+ }
+ $record['id'] = $targetRecord['CleanUp']['id'];
+ }
+ if (!$this->updateRecords($model, $records)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/README.md b/README.md
index c6ea745..782977d 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,9 @@
-# CleanUp
-CleanUp for NetCommons3
+CleanUp
+=============
-[](https://travis-ci.org/NetCommons3/CleanUp)
+[](https://github.com/NetCommons3/CleanUp/actions/workflows/tests.yml)
[](https://coveralls.io/r/NetCommons3/CleanUp?branch=master)
+[](https://packagist.org/packages/netcommons/clean-up)
### [phpdoc](https://netcommons3.github.io/NetCommons3Docs/phpdoc/CleanUp/)
diff --git a/Test/Case/Console/Command/CleanUpShell/GetOptionParserTest.php b/Test/Case/Console/Command/CleanUpShell/GetOptionParserTest.php
index 179dc10..3885dae 100644
--- a/Test/Case/Console/Command/CleanUpShell/GetOptionParserTest.php
+++ b/Test/Case/Console/Command/CleanUpShell/GetOptionParserTest.php
@@ -23,7 +23,9 @@ class CleanUpConsoleCommandCleanUpShellGetOptionParserTest extends CleanUpConsol
*
* @var array
*/
- public $fixtures = array();
+ public $fixtures = array(
+ 'plugin.clean_up.clean_up',
+ );
/**
* Plugin name
diff --git a/Test/Fixture/CleanUpFixture.php b/Test/Fixture/CleanUpFixture.php
index e71c5c5..4f0f98f 100644
--- a/Test/Fixture/CleanUpFixture.php
+++ b/Test/Fixture/CleanUpFixture.php
@@ -16,29 +16,6 @@
*/
class CleanUpFixture extends CakeTestFixture {
-/**
- * Fields
- *
- * @var array
- */
- public $fields = array(
- 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'),
- 'plugin_key' => array('type' => 'string', 'null' => false, 'default' => null, 'key' => 'index', 'collate' => 'utf8_general_ci', 'comment' => 'プラグインKey', 'charset' => 'utf8'),
- 'model' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'モデル', 'charset' => 'utf8'),
- 'class' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'クラス記法', 'charset' => 'utf8'),
- 'fields' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'WYSIWYG対象フィールド名(複数はカンマ区切り)', 'charset' => 'utf8'),
- 'alive_func' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
- 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
- 'created' => array('type' => 'datetime', 'null' => true, 'default' => null),
- 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
- 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null),
- 'indexes' => array(
- 'PRIMARY' => array('column' => 'id', 'unique' => 1),
- 'plugin_key' => array('column' => 'plugin_key', 'unique' => 0)
- ),
- 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
- );
-
/**
* Records
*
@@ -51,6 +28,7 @@ class CleanUpFixture extends CakeTestFixture {
'model' => 'Announcement',
'class' => 'Announcements.Announcement',
'fields' => 'content',
+ 'alive_func' => null,
'created_user' => '1',
'modified_user' => '1',
),
@@ -60,6 +38,7 @@ class CleanUpFixture extends CakeTestFixture {
'model' => 'BbsArticle',
'class' => 'Bbses.BbsArticle',
'fields' => 'content',
+ 'alive_func' => null,
'created_user' => '1',
'modified_user' => '1',
),
@@ -69,6 +48,7 @@ class CleanUpFixture extends CakeTestFixture {
'model' => 'BlogEntry',
'class' => 'Blogs.BlogEntry',
'fields' => 'body1,body2', // 複数の場合カンマ区切り
+ 'alive_func' => null,
'created_user' => '1',
'modified_user' => '1',
),
@@ -78,6 +58,7 @@ class CleanUpFixture extends CakeTestFixture {
'model' => 'CalendarActionPlan',
'class' => 'Calendars.CalendarActionPlan',
'fields' => 'description',
+ 'alive_func' => null,
'created_user' => '1',
'modified_user' => '1',
),
@@ -87,6 +68,7 @@ class CleanUpFixture extends CakeTestFixture {
'model' => 'CircularNoticeContent',
'class' => 'CircularNotices.CircularNoticeContent',
'fields' => 'content',
+ 'alive_func' => null,
'created_user' => '1',
'modified_user' => '1',
),
@@ -96,6 +78,7 @@ class CleanUpFixture extends CakeTestFixture {
'model' => 'FaqQuestion',
'class' => 'Faqs.FaqQuestion',
'fields' => 'answer',
+ 'alive_func' => null,
'created_user' => '1',
'modified_user' => '1',
),
@@ -105,6 +88,7 @@ class CleanUpFixture extends CakeTestFixture {
'model' => 'MultidatabaseContent',
'class' => 'Multidatabases.MultidatabaseContent',
'fields' => 'value80,value81,value82,value83,value84,value85,value86,value87,value88,value89,value90,value91,value92,value93,value94,value95,value96,value97,value98,value99,value100',
+ 'alive_func' => null,
'created_user' => '1',
'modified_user' => '1',
),
@@ -114,6 +98,7 @@ class CleanUpFixture extends CakeTestFixture {
'model' => 'Questionnaire',
'class' => 'Questionnaires.Questionnaire',
'fields' => 'thanks_content, total_comment',
+ 'alive_func' => null,
'created_user' => '1',
'modified_user' => '1',
),
@@ -151,6 +136,7 @@ class CleanUpFixture extends CakeTestFixture {
'model' => 'Registration',
'class' => 'Registrations.Registration',
'fields' => 'thanks_content',
+ 'alive_func' => null,
'created_user' => '1',
'modified_user' => '1',
),
@@ -178,6 +164,7 @@ class CleanUpFixture extends CakeTestFixture {
'model' => 'ReservationActionPlan',
'class' => 'Reservations.ReservationActionPlan',
'fields' => 'description',
+ 'alive_func' => null,
'created_user' => '1',
'modified_user' => '1',
),
@@ -187,6 +174,7 @@ class CleanUpFixture extends CakeTestFixture {
'model' => 'TaskContent',
'class' => 'Tasks.TaskContent',
'fields' => 'content',
+ 'alive_func' => null,
'created_user' => '1',
'modified_user' => '1',
),
@@ -196,9 +184,21 @@ class CleanUpFixture extends CakeTestFixture {
'model' => 'Video',
'class' => 'Videos.Video',
'fields' => 'description',
+ 'alive_func' => null,
'created_user' => '1',
'modified_user' => '1',
),
);
+/**
+ * Initialize the fixture.
+ *
+ * @return void
+ */
+ public function init() {
+ require_once App::pluginPath('CleanUp') . 'Config' . DS . 'Schema' . DS . 'schema.php';
+ $this->fields = (new CleanUpSchema())->tables['clean_ups'];
+ parent::init();
+ }
+
}
diff --git a/VERSION.txt b/VERSION.txt
index 619b537..86fb650 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-3.3.3
+3.3.7
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 5dff37c..3e7c4ee 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -3,9 +3,6 @@
-
-
-
app/Plugin/CleanUp
@@ -21,5 +18,6 @@
+