From 1dc67cada6ec362500efa06b7ae2722af38d990b Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Tue, 29 May 2018 12:31:54 +0900 Subject: [PATCH 01/38] =?UTF-8?q?=E6=8B=A1=E5=BC=B5=E3=83=A2=E3=82=B8?= =?UTF-8?q?=E3=83=A5=E3=83=BC=E3=83=AB=E3=81=A8=E3=81=97=E3=81=A6=E8=AA=8D?= =?UTF-8?q?=E8=AD=98=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=20https://github.com/NetCommons3/NetCommons3/issues/1?= =?UTF-8?q?233?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/PluginComposerBehavior.php | 7 +++---- Test/Case/Controller/PluginManagerControllerEditTest.php | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Model/Behavior/PluginComposerBehavior.php b/Model/Behavior/PluginComposerBehavior.php index 4e955cd..dd0102a 100644 --- a/Model/Behavior/PluginComposerBehavior.php +++ b/Model/Behavior/PluginComposerBehavior.php @@ -91,24 +91,23 @@ public function getComposer(Model $model, $namespace = null, $filePath = null) { * @SuppressWarnings(PHPMD.NPathComplexity) */ protected function _parseComposer($package) { + $composerExtType = true; foreach ($this->ignorePatterns as $pattern) { if (preg_match($pattern, $package['name'])) { $key = strtr(preg_replace($pattern, '', $package['name']), '-', '_'); $name = Inflector::humanize($key); $originalSource = Inflector::camelize($key); - $composerType = false; + $composerExtType = false; } } if (Hash::get($package, 'type') === 'cakephp-plugin') { $key = strtr(substr($package['name'], strrpos($package['name'], '/') + 1), '-', '_'); $name = Inflector::humanize(strtr($package['name'], '/', ' ')); $originalSource = Inflector::camelize($key); - $composerType = false; } elseif (empty($key)) { $key = $package['name']; $name = $package['name']; $originalSource = $package['name']; - $composerType = true; } $result = array( @@ -134,7 +133,7 @@ protected function _parseComposer($package) { } if (isset($package['plugin-type'])) { $result['type'] = $package['plugin-type']; - } elseif ($composerType) { + } elseif ($composerExtType) { $result['type'] = Plugin::PLUGIN_TYPE_FOR_EXT_COMPOSER; } diff --git a/Test/Case/Controller/PluginManagerControllerEditTest.php b/Test/Case/Controller/PluginManagerControllerEditTest.php index e86aafd..fec1f22 100644 --- a/Test/Case/Controller/PluginManagerControllerEditTest.php +++ b/Test/Case/Controller/PluginManagerControllerEditTest.php @@ -78,21 +78,21 @@ public function tearDown() { /** * testGetAction * - * @expectedException BadRequestException * @return void */ public function testGetAction() { + $this->setExpectedException('BadRequestException'); $this->testAction('plugin_manager/plugin_manager/edit', ['method' => 'GET']); } /** * testNoPluginData * - * @expectedException BadRequestException * @return void */ public function testNoPluginData() { $data['Plugin']['key'] = 'dummy'; + $this->setExpectedException('BadRequestException'); $this->testAction('plugin_manager/plugin_manager/edit/99', ['data' => $data]); } From 0c595c04833eee18c6bbbf7892edd852c50298a6 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 2 Jun 2018 07:30:20 +0900 Subject: [PATCH 02/38] =?UTF-8?q?=E3=83=9E=E3=82=A4=E3=82=B0=E3=83=AC?= =?UTF-8?q?=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E3=81=AE=E3=83=AD=E3=82=B0?= =?UTF-8?q?=E3=81=AB=E3=82=B3=E3=83=9E=E3=83=B3=E3=83=89=E3=82=92=E5=87=BA?= =?UTF-8?q?=E5=8A=9B=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/PluginBehavior.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Model/Behavior/PluginBehavior.php b/Model/Behavior/PluginBehavior.php index 79938dc..528db81 100644 --- a/Model/Behavior/PluginBehavior.php +++ b/Model/Behavior/PluginBehavior.php @@ -181,10 +181,12 @@ public static function staticRunMigration($plugin, $connection = null) { $messages = array(); $ret = null; - exec(sprintf( + $cmd = sprintf( 'cd %s && Console%scake Migrations.migration run all -p %s -c %s -i %s 2>&1', ROOT . DS . APP_DIR, DS, escapeshellcmd($plugin), $connection, $connection - ), $messages, $ret); + ); + CakeLog::info('[migration] ' . $cmd); + exec($cmd, $messages, $ret); // Write logs foreach ($messages as $message) { From 2bd4fe821c97cf84ec4b8c79572a19a70b2c097f Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 26 Oct 2018 18:15:05 +0900 Subject: [PATCH 03/38] =?UTF-8?q?=E9=80=9F=E5=BA=A6=E6=94=B9=E5=96=84?= =?UTF-8?q?=E3=81=AE=E3=81=9F=E3=82=81=E3=81=ABimg,css,js=E3=83=95?= =?UTF-8?q?=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92webroot=E3=81=AB=E3=82=B3?= =?UTF-8?q?=E3=83=94=E3=83=BC=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/PluginBehavior.php | 87 ++++++++++++++++++++++++++++++- 1 file changed, 86 insertions(+), 1 deletion(-) diff --git a/Model/Behavior/PluginBehavior.php b/Model/Behavior/PluginBehavior.php index 528db81..bf49f41 100644 --- a/Model/Behavior/PluginBehavior.php +++ b/Model/Behavior/PluginBehavior.php @@ -55,16 +55,25 @@ public function runVersionUp(Model $model, $plugin) { $model->begin(); if (! Hash::get($plugin, 'latest') && Hash::get($plugin, 'Plugin.id')) { - if (! $model->uninstallPlugin(Hash::get($plugin, 'Plugin.key'))) { + $pluginKey = Hash::get($plugin, 'Plugin.key'); + if (! $model->uninstallPlugin($pluginKey)) { throw new InternalErrorException(__d('net_commons', 'Internal Server Error')); } $model->deleteOldPackageDir($plugin, true); + + //img,js,cssをwebrootから削除。エラーとはしない + $this->deleteFromWebroot($model, $plugin); } else { if (Hash::get($plugin, 'latest.packageType') === 'cakephp-plugin') { if (! $model->runMigration(Hash::get($plugin, 'latest.key'))) { throw new InternalErrorException(__d('net_commons', 'Internal Server Error')); } } + + //img,js,cssをwebrootにコピー。エラーとはしない +CakeLog::debug(__METHOD__ . '(' . __LINE__ . ') ' . var_export($plugin, true)); + $this->copyToWebroot($model, $plugin); + if (! $model->updateVersion(array(Hash::get($plugin, 'latest')))) { throw new InternalErrorException(__d('net_commons', 'Internal Server Error')); } @@ -378,4 +387,80 @@ public function updateVersion(Model $model, $packages) { return true; } +/** + * 各プラグインにあるapp/webroot/img(css,js)にコピーする + * + * @param Model $model 呼び出し元Model + * @param array $plugin プラグイン情報 + * @return bool + */ + public function copyToWebroot(Model $model, $plugin) { + $pluginKey = Hash::get($plugin, 'Plugin.key'); + if (! $pluginKey) { + return true; + } + + //既存のapp/webroot/img(css,js)を削除する + $this->deleteFromWebroot($model, $plugin); + $camelPlugin = Inflector::camelize($pluginKey); + $originalSource = Hash::get($plugin, 'latest.originalSource'); + + if (CakePlugin::loaded($camelPlugin)) { + $pluginWebrootPath = CakePlugin::path($camelPlugin); + } elseif (file_exists(APP . 'View' . DS . 'Themed' . DS . $originalSource)) { + $pluginWebrootPath = APP . 'View' . DS . 'Themed' . DS . $originalSource . DS; + } else { + return true; + } + $pluginWebrootPath .= WEBROOT_DIR . DS; + + if (file_exists($pluginWebrootPath . 'img')) { + $Folder = new Folder($pluginWebrootPath . 'img'); + $Folder->copy(IMAGES . $pluginKey); + } + + if (file_exists($pluginWebrootPath . 'css')) { + $Folder = new Folder($pluginWebrootPath . 'css'); + $Folder->copy(CSS . DS . $pluginKey); + } + + if (file_exists($pluginWebrootPath . 'js')) { + $Folder = new Folder($pluginWebrootPath . 'js'); + $Folder->copy(JS . DS . $pluginKey); + } + + return true; + } + +/** + * app/webroot/img(css,js)から削除する + * + * @param Model $model 呼び出し元Model + * @param array $plugin プラグイン情報 + * @return bool + */ + public function deleteFromWebroot(Model $model, $plugin) { + $pluginKey = Hash::get($plugin, 'Plugin.key'); + if (! $pluginKey) { + return true; + } + + if (file_exists(IMAGES . $pluginKey)) { + $Folder = new Folder(IMAGES . $pluginKey); + $Folder->delete(); + } + + if (file_exists(CSS . $pluginKey)) { + $Folder = new Folder(CSS . $pluginKey); + $Folder->delete(); + } + + if (file_exists(JS . $pluginKey)) { + $Folder = new Folder(JS . $pluginKey); + $Folder->delete(); + } + + return true; + } + } From 2f033140ec70ab5bbd9770d2a9a8c0aafb918a09 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 26 Oct 2018 23:53:31 +0900 Subject: [PATCH 04/38] =?UTF-8?q?=E3=83=87=E3=83=90=E3=83=83=E3=82=B0?= =?UTF-8?q?=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/PluginBehavior.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Model/Behavior/PluginBehavior.php b/Model/Behavior/PluginBehavior.php index bf49f41..9b9c479 100644 --- a/Model/Behavior/PluginBehavior.php +++ b/Model/Behavior/PluginBehavior.php @@ -71,7 +71,6 @@ public function runVersionUp(Model $model, $plugin) { } //img,js,cssをwebrootにコピー。エラーとはしない -CakeLog::debug(__METHOD__ . '(' . __LINE__ . ') ' . var_export($plugin, true)); $this->copyToWebroot($model, $plugin); if (! $model->updateVersion(array(Hash::get($plugin, 'latest')))) { From 01ef319c373412aae60385ac968f2a4bb1904bfe Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 27 Oct 2018 00:11:32 +0900 Subject: [PATCH 05/38] =?UTF-8?q?phpmd=E3=82=A8=E3=83=A9=E3=83=BC=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/PluginBehavior.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Model/Behavior/PluginBehavior.php b/Model/Behavior/PluginBehavior.php index 9b9c479..90f00dd 100644 --- a/Model/Behavior/PluginBehavior.php +++ b/Model/Behavior/PluginBehavior.php @@ -395,9 +395,6 @@ public function updateVersion(Model $model, $packages) { */ public function copyToWebroot(Model $model, $plugin) { $pluginKey = Hash::get($plugin, 'Plugin.key'); - if (! $pluginKey) { - return true; - } //既存のapp/webroot/img(css,js)を削除する $this->deleteFromWebroot($model, $plugin); @@ -440,9 +437,6 @@ public function copyToWebroot(Model $model, $plugin) { */ public function deleteFromWebroot(Model $model, $plugin) { $pluginKey = Hash::get($plugin, 'Plugin.key'); - if (! $pluginKey) { - return true; - } if (file_exists(IMAGES . $pluginKey)) { $Folder = new Folder(IMAGES . $pluginKey); From ed2b83ea4be0a7886e136fdde8f5fabb61e1e307 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 27 Oct 2018 00:15:28 +0900 Subject: [PATCH 06/38] =?UTF-8?q?phpmd=E3=82=A8=E3=83=A9=E3=83=BC=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/PluginBehavior.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Model/Behavior/PluginBehavior.php b/Model/Behavior/PluginBehavior.php index 90f00dd..3ba8360 100644 --- a/Model/Behavior/PluginBehavior.php +++ b/Model/Behavior/PluginBehavior.php @@ -437,6 +437,9 @@ public function copyToWebroot(Model $model, $plugin) { */ public function deleteFromWebroot(Model $model, $plugin) { $pluginKey = Hash::get($plugin, 'Plugin.key'); + if (! $pluginKey) { + return true; + } if (file_exists(IMAGES . $pluginKey)) { $Folder = new Folder(IMAGES . $pluginKey); From aca9e5edb5092a4b801d53dfde5b5b4f7348a512 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 27 Oct 2018 07:18:59 +0900 Subject: [PATCH 07/38] =?UTF-8?q?phpmd=E3=82=A8=E3=83=A9=E3=83=BC=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/PluginBehavior.php | 77 +----------------- Model/Behavior/PluginWebrootBehavior.php | 99 ++++++++++++++++++++++++ Model/Plugin.php | 1 + 3 files changed, 102 insertions(+), 75 deletions(-) create mode 100644 Model/Behavior/PluginWebrootBehavior.php diff --git a/Model/Behavior/PluginBehavior.php b/Model/Behavior/PluginBehavior.php index 3ba8360..41ea384 100644 --- a/Model/Behavior/PluginBehavior.php +++ b/Model/Behavior/PluginBehavior.php @@ -62,7 +62,7 @@ public function runVersionUp(Model $model, $plugin) { $model->deleteOldPackageDir($plugin, true); //img,js,cssをwebrootから削除。エラーとはしない - $this->deleteFromWebroot($model, $plugin); + $model->deleteFromWebroot($plugin); } else { if (Hash::get($plugin, 'latest.packageType') === 'cakephp-plugin') { if (! $model->runMigration(Hash::get($plugin, 'latest.key'))) { @@ -71,7 +71,7 @@ public function runVersionUp(Model $model, $plugin) { } //img,js,cssをwebrootにコピー。エラーとはしない - $this->copyToWebroot($model, $plugin); + $model->copyToWebroot($plugin); if (! $model->updateVersion(array(Hash::get($plugin, 'latest')))) { throw new InternalErrorException(__d('net_commons', 'Internal Server Error')); @@ -386,77 +386,4 @@ public function updateVersion(Model $model, $packages) { return true; } -/** - * 各プラグインにあるapp/webroot/img(css,js)にコピーする - * - * @param Model $model 呼び出し元Model - * @param array $plugin プラグイン情報 - * @return bool - */ - public function copyToWebroot(Model $model, $plugin) { - $pluginKey = Hash::get($plugin, 'Plugin.key'); - - //既存のapp/webroot/img(css,js)を削除する - $this->deleteFromWebroot($model, $plugin); - $camelPlugin = Inflector::camelize($pluginKey); - $originalSource = Hash::get($plugin, 'latest.originalSource'); - - if (CakePlugin::loaded($camelPlugin)) { - $pluginWebrootPath = CakePlugin::path($camelPlugin); - } elseif (file_exists(APP . 'View' . DS . 'Themed' . DS . $originalSource)) { - $pluginWebrootPath = APP . 'View' . DS . 'Themed' . DS . $originalSource . DS; - } else { - return true; - } - $pluginWebrootPath .= WEBROOT_DIR . DS; - - if (file_exists($pluginWebrootPath . 'img')) { - $Folder = new Folder($pluginWebrootPath . 'img'); - $Folder->copy(IMAGES . $pluginKey); - } - - if (file_exists($pluginWebrootPath . 'css')) { - $Folder = new Folder($pluginWebrootPath . 'css'); - $Folder->copy(CSS . DS . $pluginKey); - } - - if (file_exists($pluginWebrootPath . 'js')) { - $Folder = new Folder($pluginWebrootPath . 'js'); - $Folder->copy(JS . DS . $pluginKey); - } - - return true; - } - -/** - * app/webroot/img(css,js)から削除する - * - * @param Model $model 呼び出し元Model - * @param array $plugin プラグイン情報 - * @return bool - */ - public function deleteFromWebroot(Model $model, $plugin) { - $pluginKey = Hash::get($plugin, 'Plugin.key'); - if (! $pluginKey) { - return true; - } - - if (file_exists(IMAGES . $pluginKey)) { - $Folder = new Folder(IMAGES . $pluginKey); - $Folder->delete(); - } - - if (file_exists(CSS . $pluginKey)) { - $Folder = new Folder(CSS . $pluginKey); - $Folder->delete(); - } - - if (file_exists(JS . $pluginKey)) { - $Folder = new Folder(JS . $pluginKey); - $Folder->delete(); - } - - return true; - } - } diff --git a/Model/Behavior/PluginWebrootBehavior.php b/Model/Behavior/PluginWebrootBehavior.php new file mode 100644 index 0000000..408d941 --- /dev/null +++ b/Model/Behavior/PluginWebrootBehavior.php @@ -0,0 +1,99 @@ + + * @author Shohei Nakajima + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + * @copyright Copyright 2014, NetCommons Project + */ + +App::uses('ModelBehavior', 'Model'); +App::uses('Folder', 'Utility'); + +/** + * Plugin Behavior + * + * @author Shohei Nakajima + * @package NetCommons\PluginManager\Model\Behavior + */ +class PluginWebrootBehavior extends ModelBehavior { + +/** + * 各プラグインにあるapp/webroot/img(css,js)にコピーする + * + * @param Model $model 呼び出し元Model + * @param array $plugin プラグイン情報 + * @return bool + */ + public function copyToWebroot(Model $model, $plugin) { + $pluginKey = Hash::get($plugin, 'Plugin.key'); + if (! $pluginKey) { + return true; + } + + //既存のapp/webroot/img(css,js)を削除する + $this->deleteFromWebroot($model, $plugin); + $camelPlugin = Inflector::camelize($pluginKey); + $originalSource = Hash::get($plugin, 'latest.originalSource'); + + if (CakePlugin::loaded($camelPlugin)) { + $pluginWebrootPath = CakePlugin::path($camelPlugin); + } elseif (file_exists(APP . 'View' . DS . 'Themed' . DS . $originalSource)) { + $pluginWebrootPath = APP . 'View' . DS . 'Themed' . DS . $originalSource . DS; + } else { + return true; + } + $pluginWebrootPath .= WEBROOT_DIR . DS; + + if (file_exists($pluginWebrootPath . 'img')) { + $Folder = new Folder($pluginWebrootPath . 'img'); + $Folder->copy(IMAGES . $pluginKey); + } + + if (file_exists($pluginWebrootPath . 'css')) { + $Folder = new Folder($pluginWebrootPath . 'css'); + $Folder->copy(CSS . DS . $pluginKey); + } + + if (file_exists($pluginWebrootPath . 'js')) { + $Folder = new Folder($pluginWebrootPath . 'js'); + $Folder->copy(JS . DS . $pluginKey); + } + + return true; + } + +/** + * app/webroot/img(css,js)から削除する + * + * @param Model $model 呼び出し元Model + * @param array $plugin プラグイン情報 + * @return bool + */ + public function deleteFromWebroot(Model $model, $plugin) { + $pluginKey = Hash::get($plugin, 'Plugin.key'); + if (! $pluginKey) { + return true; + } + + if (file_exists(IMAGES . $pluginKey)) { + $Folder = new Folder(IMAGES . $pluginKey); + $Folder->delete(); + } + + if (file_exists(CSS . $pluginKey)) { + $Folder = new Folder(CSS . $pluginKey); + $Folder->delete(); + } + + if (file_exists(JS . $pluginKey)) { + $Folder = new Folder(JS . $pluginKey); + $Folder->delete(); + } + + return true; + } + +} diff --git a/Model/Plugin.php b/Model/Plugin.php index 659552c..7c7e484 100644 --- a/Model/Plugin.php +++ b/Model/Plugin.php @@ -91,6 +91,7 @@ class Plugin extends AppModel { 'PluginManager.PluginBower', 'PluginManager.PluginComposer', 'PluginManager.PluginTheme', + 'PluginManager.PluginWebroot', ); /** From b7844c0f42da040b8fc84d47528eee22f41c959a Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 27 Oct 2018 10:51:07 +0900 Subject: [PATCH 08/38] =?UTF-8?q?img=E3=81=AE=E3=83=91=E3=82=B9=E3=83=9F?= =?UTF-8?q?=E3=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/PluginWebrootBehavior.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Model/Behavior/PluginWebrootBehavior.php b/Model/Behavior/PluginWebrootBehavior.php index 408d941..a27e7ab 100644 --- a/Model/Behavior/PluginWebrootBehavior.php +++ b/Model/Behavior/PluginWebrootBehavior.php @@ -49,7 +49,7 @@ public function copyToWebroot(Model $model, $plugin) { if (file_exists($pluginWebrootPath . 'img')) { $Folder = new Folder($pluginWebrootPath . 'img'); - $Folder->copy(IMAGES . $pluginKey); + $Folder->copy(IMAGES . DS . $pluginKey); } if (file_exists($pluginWebrootPath . 'css')) { From a2ae2f7bebffc4998c169206742a030ac4bb4920 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 27 Oct 2018 12:24:32 +0900 Subject: [PATCH 09/38] =?UTF-8?q?serialize=5Fdata=E3=81=AE=E3=83=87?= =?UTF-8?q?=E3=83=BC=E3=82=BF=E3=82=92=E3=82=B3=E3=83=B3=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=83=88=E3=81=99=E3=82=8B=E5=87=A6=E7=90=86=E3=82=92=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=82=B9=E3=83=88=E3=83=BC=E3=83=AB=E3=81=A7=E5=91=BC?= =?UTF-8?q?=E3=81=B3=E5=87=BA=E3=81=99=E3=81=9F=E3=82=81=E3=81=AB=E5=88=A5?= =?UTF-8?q?=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E3=81=A8=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/PluginWebrootBehavior.php | 2 +- Model/Plugin.php | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Model/Behavior/PluginWebrootBehavior.php b/Model/Behavior/PluginWebrootBehavior.php index a27e7ab..7c7604c 100644 --- a/Model/Behavior/PluginWebrootBehavior.php +++ b/Model/Behavior/PluginWebrootBehavior.php @@ -21,7 +21,7 @@ class PluginWebrootBehavior extends ModelBehavior { /** - * 各プラグインにあるapp/webroot/img(css,js)にコピーする + * 各プラグインにあるimg(css,js)をapp/webroot/img(css,js)にコピーする * * @param Model $model 呼び出し元Model * @param array $plugin プラグイン情報 diff --git a/Model/Plugin.php b/Model/Plugin.php index 7c7e484..e3bba44 100644 --- a/Model/Plugin.php +++ b/Model/Plugin.php @@ -235,6 +235,22 @@ public function getPlugins($type, $key = null) { if (! $plugins) { return array(); } + $plugins = $this->convertSerializeData($plugins); + + if (count($plugins) > 1) { + return $plugins; + } else { + return $plugins[0]; + } + } + +/** + * serialize_dataのデータをコンバートする + * + * @param array $plugins PluginモデルからfindAllしたもの + * @return array + */ + public function convertSerializeData($plugins) { foreach ($plugins as $i => $plugin) { $plugin['Plugin']['serialize_data'] = unserialize( Hash::get($plugin, 'Plugin.serialize_data', serialize(array())) @@ -252,11 +268,7 @@ public function getPlugins($type, $key = null) { $plugins[$i] = $plugin; } - if (count($plugins) > 1) { - return $plugins; - } else { - return $plugins[0]; - } + return $plugins; } /** From b00aec7f500dd80890e849c835917aef9500dd72 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 28 Oct 2018 16:13:18 +0900 Subject: [PATCH 10/38] =?UTF-8?q?theme=E3=81=AE=E3=82=B3=E3=83=94=E3=83=BC?= =?UTF-8?q?=E3=82=92webroot/theme=E3=81=AB=E5=A4=89=E6=9B=B4=20https://git?= =?UTF-8?q?hub.com/NetCommons3/NetCommons3/issues/1361?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/PluginWebrootBehavior.php | 64 +++++++++++++----------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/Model/Behavior/PluginWebrootBehavior.php b/Model/Behavior/PluginWebrootBehavior.php index 7c7604c..0349611 100644 --- a/Model/Behavior/PluginWebrootBehavior.php +++ b/Model/Behavior/PluginWebrootBehavior.php @@ -37,30 +37,31 @@ public function copyToWebroot(Model $model, $plugin) { $this->deleteFromWebroot($model, $plugin); $camelPlugin = Inflector::camelize($pluginKey); $originalSource = Hash::get($plugin, 'latest.originalSource'); - if (CakePlugin::loaded($camelPlugin)) { $pluginWebrootPath = CakePlugin::path($camelPlugin); + $pluginWebrootPath .= WEBROOT_DIR . DS; + if (file_exists($pluginWebrootPath . 'img')) { + $Folder = new Folder($pluginWebrootPath . 'img'); + $Folder->copy(IMAGES . DS . $pluginKey); + } + if (file_exists($pluginWebrootPath . 'css')) { + $Folder = new Folder($pluginWebrootPath . 'css'); + $Folder->copy(CSS . DS . $pluginKey); + } + if (file_exists($pluginWebrootPath . 'js')) { + $Folder = new Folder($pluginWebrootPath . 'js'); + $Folder->copy(JS . DS . $pluginKey); + } } elseif (file_exists(APP . 'View' . DS . 'Themed' . DS . $originalSource)) { $pluginWebrootPath = APP . 'View' . DS . 'Themed' . DS . $originalSource . DS; + $pluginWebrootPath .= WEBROOT_DIR; + if (file_exists($pluginWebrootPath)) { + $Folder = new Folder($pluginWebrootPath); + $Folder->copy(WWW_ROOT . 'theme' . DS . $originalSource); + } } else { return true; } - $pluginWebrootPath .= WEBROOT_DIR . DS; - - if (file_exists($pluginWebrootPath . 'img')) { - $Folder = new Folder($pluginWebrootPath . 'img'); - $Folder->copy(IMAGES . DS . $pluginKey); - } - - if (file_exists($pluginWebrootPath . 'css')) { - $Folder = new Folder($pluginWebrootPath . 'css'); - $Folder->copy(CSS . DS . $pluginKey); - } - - if (file_exists($pluginWebrootPath . 'js')) { - $Folder = new Folder($pluginWebrootPath . 'js'); - $Folder->copy(JS . DS . $pluginKey); - } return true; } @@ -77,19 +78,24 @@ public function deleteFromWebroot(Model $model, $plugin) { if (! $pluginKey) { return true; } + $camelPlugin = Inflector::camelize($pluginKey); + $originalSource = Hash::get($plugin, 'latest.originalSource'); - if (file_exists(IMAGES . $pluginKey)) { - $Folder = new Folder(IMAGES . $pluginKey); - $Folder->delete(); - } - - if (file_exists(CSS . $pluginKey)) { - $Folder = new Folder(CSS . $pluginKey); - $Folder->delete(); - } - - if (file_exists(JS . $pluginKey)) { - $Folder = new Folder(JS . $pluginKey); + if (CakePlugin::loaded($camelPlugin)) { + if (file_exists(IMAGES . $pluginKey)) { + $Folder = new Folder(IMAGES . $pluginKey); + $Folder->delete(); + } + if (file_exists(CSS . $pluginKey)) { + $Folder = new Folder(CSS . $pluginKey); + $Folder->delete(); + } + if (file_exists(JS . $pluginKey)) { + $Folder = new Folder(JS . $pluginKey); + $Folder->delete(); + } + } elseif (file_exists(WWW_ROOT . 'theme' . DS . $originalSource)) { + $Folder = new Folder(WWW_ROOT . 'theme' . DS . $originalSource); $Folder->delete(); } From d79b20636f14c2ad6ec2fd30e82c9515051f2f4e Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 9 Nov 2018 12:58:58 +0900 Subject: [PATCH 11/38] =?UTF-8?q?=E3=82=B5=E3=83=BC=E3=83=90=E6=A7=8B?= =?UTF-8?q?=E6=88=90=E3=81=AB=E3=82=88=E3=81=A3=E3=81=A6=E3=81=AF=E3=80=81?= =?UTF-8?q?=E4=B8=80=E6=8B=AC=E3=82=A2=E3=83=83=E3=83=97=E3=83=87=E3=83=BC?= =?UTF-8?q?=E3=83=88=E3=81=AE=E3=81=BB=E3=81=8B=E3=81=AB=E3=80=81=E4=B8=80?= =?UTF-8?q?=E6=8B=AC=E3=81=A7webroot=E3=81=AB=E3=82=B3=E3=83=94=E3=83=BC?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=81=A0=E3=81=91=E3=81=AE=E3=83=90=E3=83=83?= =?UTF-8?q?=E3=83=81=E3=81=8C=E3=81=82=E3=82=8B=E3=81=A8=E3=82=88=E3=81=84?= =?UTF-8?q?=E3=81=9F=E3=82=81=E3=80=81=E3=81=9D=E3=81=AE=E6=A9=9F=E8=83=BD?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0=E3=80=82=20https://github.com/NetCo?= =?UTF-8?q?mmons3/NetCommons3/issues/1360?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Command/Task/CopyAllWebrootFilesTask.php | 57 +++++++++++++++++++ Console/Command/UpdateAllShell.php | 5 ++ Model/Plugin.php | 53 +++++++++++++---- Utility/PluginUpdateUtil.php | 28 +++++---- 4 files changed, 122 insertions(+), 21 deletions(-) create mode 100644 Console/Command/Task/CopyAllWebrootFilesTask.php diff --git a/Console/Command/Task/CopyAllWebrootFilesTask.php b/Console/Command/Task/CopyAllWebrootFilesTask.php new file mode 100644 index 0000000..df218c4 --- /dev/null +++ b/Console/Command/Task/CopyAllWebrootFilesTask.php @@ -0,0 +1,57 @@ + + * @author Shohei Nakajima + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + * @copyright Copyright 2014, NetCommons Project + */ + +App::uses('AppShell', 'Console/Command'); +App::uses('PluginUpdateUtil', 'PluginManager.Utility'); + +/** + * webrootファイルの一括コピーシェル + * + * @author Shohei Nakajima + * @package NetCommons\PluginManager\Console\Command + */ +class CopyAllWebrootFilesTask extends AppShell { + +/** + * Execution method always used for tasks + * + * @return void + */ + public function execute() { + $this->Plugin = ClassRegistry::init('PluginManager.Plugin'); + + if (! isset($this->PluginUpdateUtil)) { + $this->PluginUpdateUtil = new PluginUpdateUtil(); + } + if ($this->PluginUpdateUtil->copyAllWebrootFiles()) { + $this->out( + '' . __d('plugin_manager', 'Successfully webroot files copy of all plugins.') . '' + ); + } else { + $this->out( + '' . __d('plugin_manager', 'Failure webroot files copy of all plugins.') . '' + ); + } + } + +/** + * Gets the option parser instance and configures it. + * + * @return ConsoleOptionParser + */ + public function getOptionParser() { + $parser = parent::getOptionParser(); + + $parser->description(__d('plugin_manager', 'Webroot files copy of all plugins')); + + return $parser; + } +} diff --git a/Console/Command/UpdateAllShell.php b/Console/Command/UpdateAllShell.php index 7ec894c..f30f9ff 100644 --- a/Console/Command/UpdateAllShell.php +++ b/Console/Command/UpdateAllShell.php @@ -26,6 +26,7 @@ class UpdateAllShell extends AppShell { */ public $tasks = array( 'PluginManager.UpdateAll', + 'PluginManager.CopyAllWebrootFiles', ); /** @@ -80,6 +81,10 @@ public function getOptionParser() { ->addSubcommand('update_all', array( 'help' => __d('plugin_manager', 'Update of all plugins'), 'parser' => $this->UpdateAll->getOptionParser(), + )) + ->addSubcommand('copy_all_webroot_files', array( + 'help' => __d('plugin_manager', 'Webroot files copy of all plugins'), + 'parser' => $this->UpdateAll->getOptionParser(), )); } diff --git a/Model/Plugin.php b/Model/Plugin.php index e3bba44..2187f5e 100644 --- a/Model/Plugin.php +++ b/Model/Plugin.php @@ -197,19 +197,22 @@ public function getMaxWeight($type) { * * @param int $type プラグインタイプ * @param string $key プラグインキー + * @param string|array|null $langId 取得する言語。nullの場合、typeにより共通言語もしくCurrentにセットされているものを使用する * @return array */ - public function getPlugins($type, $key = null) { - $notLangTypes = array( - self::PLUGIN_TYPE_CORE, - self::PLUGIN_TYPE_FOR_THEME, - self::PLUGIN_TYPE_FOR_EXT_COMPOSER, - self::PLUGIN_TYPE_FOR_EXT_BOWER - ); - if (! is_array($type) && in_array($type, $notLangTypes)) { - $langId = '0'; - } else { - $langId = Current::read('Language.id'); + public function getPlugins($type, $key = null, $langId = null) { + if (! $langId) { + $notLangTypes = array( + self::PLUGIN_TYPE_CORE, + self::PLUGIN_TYPE_FOR_THEME, + self::PLUGIN_TYPE_FOR_EXT_COMPOSER, + self::PLUGIN_TYPE_FOR_EXT_BOWER + ); + if (! is_array($type) && in_array($type, $notLangTypes)) { + $langId = '0'; + } else { + $langId = Current::read('Language.id'); + } } $conditions = array( @@ -476,4 +479,32 @@ public function hasUpdate() { return $return; } +/** + * プラグインの全タイプを取得 + * + * 一括アップデートで使用する + * + * @return array + */ + public function getTypes() { + //pluginsテーブルの取得 + $plugins = $this->find('all', array( + 'recursive' => -1, + 'fields' => ['type'], + 'group' => 'type', + 'order' => ['type' => 'asc'], + 'callbacks' => false, + )); + if (! $plugins) { + return array(); + } + + $result = []; + foreach ($plugins as $plugin) { + $result[] = $plugin[$this->alias]['type']; + } + + return $result; + } + } diff --git a/Utility/PluginUpdateUtil.php b/Utility/PluginUpdateUtil.php index 178f6df..7dd7877 100644 --- a/Utility/PluginUpdateUtil.php +++ b/Utility/PluginUpdateUtil.php @@ -33,17 +33,9 @@ public function __construct() { */ public function updateAll() { $result = true; - $types = array( - Plugin::PLUGIN_TYPE_CORE, - Plugin::PLUGIN_TYPE_FOR_FRAME, - Plugin::PLUGIN_TYPE_FOR_SITE_MANAGER, - Plugin::PLUGIN_TYPE_FOR_SYSTEM_MANGER, - Plugin::PLUGIN_TYPE_FOR_THEME, - Plugin::PLUGIN_TYPE_FOR_EXT_COMPOSER, - Plugin::PLUGIN_TYPE_FOR_EXT_BOWER - ); + $types = $this->Plugin->getTypes(); foreach ($types as $type) { - $plugins = $this->Plugin->getPlugins($type); + $plugins = $this->Plugin->getPlugins($type, null, ['0', '2']); if (! $this->__updatePackages($plugins)) { $result = false; break; @@ -89,4 +81,20 @@ private function __updatePackages($plugins) { return true; } +/** + * 一括アップデート + * + * @return bool + */ + public function copyAllWebrootFiles() { + $types = $this->Plugin->getTypes(); + foreach ($types as $type) { + $plugins = $this->Plugin->getPlugins($type, null, ['0', '2']); + foreach ($plugins as $plugin) { + $this->Plugin->copyToWebroot($plugin); + } + } + return true; + } + } From b25ed88c41af8e7f97ca2b3139cea7453f2b6533 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Mon, 12 Nov 2018 13:50:29 +0900 Subject: [PATCH 12/38] =?UTF-8?q?phpcs=E3=82=A8=E3=83=A9=E3=83=BC=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Console/Command/Task/CopyAllWebrootFilesTask.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Console/Command/Task/CopyAllWebrootFilesTask.php b/Console/Command/Task/CopyAllWebrootFilesTask.php index df218c4..5adf2ad 100644 --- a/Console/Command/Task/CopyAllWebrootFilesTask.php +++ b/Console/Command/Task/CopyAllWebrootFilesTask.php @@ -33,7 +33,9 @@ public function execute() { } if ($this->PluginUpdateUtil->copyAllWebrootFiles()) { $this->out( - '' . __d('plugin_manager', 'Successfully webroot files copy of all plugins.') . '' + '' . + __d('plugin_manager', 'Successfully webroot files copy of all plugins.') . + '' ); } else { $this->out( From 75ebec16dff76ad733d63a41c7cf03797b78c1e7 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 6 Jan 2019 10:12:31 +0900 Subject: [PATCH 13/38] =?UTF-8?q?Plugin=E3=83=A2=E3=83=87=E3=83=AB?= =?UTF-8?q?=E3=81=AE=E3=82=AF=E3=82=A8=E3=83=AA=E7=B5=90=E6=9E=9C=E3=82=92?= =?UTF-8?q?=E3=82=AD=E3=83=A3=E3=83=83=E3=82=B7=E3=83=A5=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=81=93=E3=81=A8=E3=81=AB=E3=82=88=E3=82=8B=E6=94=B9=E4=BF=AE?= =?UTF-8?q?=20=E4=BB=96=E3=80=81=E6=9C=AC=E4=BD=93=E3=81=AE=E3=83=90?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=92NetCommons?= =?UTF-8?q?=E3=83=97=E3=83=A9=E3=82=B0=E3=82=A4=E3=83=B3=E3=81=AE=E3=83=90?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=92=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=81=84=E3=81=9F=E3=81=8C=E3=80=81=E5=88=A5?= =?UTF-8?q?=E3=81=AB=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E4=BF=AE=E6=AD=A3=20https://github.com/NetCommons3/Ne?= =?UTF-8?q?tCommons3/issues/1337?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/PluginBehavior.php | 6 ++++++ Model/Plugin.php | 8 ++++++-- Model/PluginsRole.php | 5 ++++- View/Elements/PluginManager/title.ctp | 7 +++---- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Model/Behavior/PluginBehavior.php b/Model/Behavior/PluginBehavior.php index 41ea384..366bebd 100644 --- a/Model/Behavior/PluginBehavior.php +++ b/Model/Behavior/PluginBehavior.php @@ -80,6 +80,9 @@ public function runVersionUp(Model $model, $plugin) { $model->deleteOldPackageDir($plugin); } + //キャッシュのクリア + $model->cacheClear(); + CakeLog::info( sprintf('[version up] Successfully version up "%s"', Hash::get($plugin, 'Plugin.name')) ); @@ -145,6 +148,9 @@ public function uninstallPlugin(Model $model, $data) { CakeLog::info(sprintf('[uninstall] Successfully uninstall plugin "%s"', $key)); + //キャッシュのクリア + $model->Plugin->cacheClear(); + //トランザクションCommit $model->commit(); diff --git a/Model/Plugin.php b/Model/Plugin.php index 2187f5e..915d67b 100644 --- a/Model/Plugin.php +++ b/Model/Plugin.php @@ -92,6 +92,7 @@ class Plugin extends AppModel { 'PluginManager.PluginComposer', 'PluginManager.PluginTheme', 'PluginManager.PluginWebroot', + 'NetCommons.NetCommonsCache', ); /** @@ -230,7 +231,7 @@ public function getPlugins($type, $key = null, $langId = null) { } //pluginsテーブルの取得 - $plugins = $this->find('all', array( + $plugins = $this->cacheFindQuery('all', array( 'recursive' => -1, 'conditions' => $conditions, 'order' => $order, @@ -315,7 +316,7 @@ public function getNewPlugins($type, $key = null) { } $packages = Hash::combine($packages, '{s}.key', '{s}'); - $currents = $this->find('list', array( + $currents = $this->cacheFindQuery('list', array( 'recursive' => -1, 'fields' => array('key', 'commit_version'), 'conditions' => $conditions, @@ -446,6 +447,9 @@ public function saveEnableM17n($data) { throw new InternalErrorException(__d('net_commons', 'Internal Server Error')); } + //キャッシュのクリア + $this->cacheClear(); + return true; } diff --git a/Model/PluginsRole.php b/Model/PluginsRole.php index 9c68e4f..4985478 100644 --- a/Model/PluginsRole.php +++ b/Model/PluginsRole.php @@ -59,7 +59,7 @@ public function getPlugins($pluginType, $roleKey, $joinType = 'LEFT', $queryType return false; } - $plugins = $this->Plugin->find($queryType, array( + $plugins = $this->Plugin->cacheFindQuery($queryType, array( 'recursive' => -1, 'fields' => array( $this->alias . '.id', @@ -127,6 +127,9 @@ public function savePluginRoles($data) { } } + //キャッシュのクリア + $this->Plugin->cacheClear(); + return true; } diff --git a/View/Elements/PluginManager/title.ctp b/View/Elements/PluginManager/title.ctp index 1eb0e3f..e98c797 100644 --- a/View/Elements/PluginManager/title.ctp +++ b/View/Elements/PluginManager/title.ctp @@ -12,10 +12,9 @@ start('subtitle'); ?> end(); From 64bad14745cb1cb4174cdfca6cd01e07d2c1f861 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 6 Jan 2019 17:37:49 +0900 Subject: [PATCH 14/38] =?UTF-8?q?PluginsRole=E3=81=AE=E3=82=AF=E3=82=A8?= =?UTF-8?q?=E3=83=AA=E7=B5=90=E6=9E=9C=E3=82=92=E3=82=AD=E3=83=A3=E3=83=83?= =?UTF-8?q?=E3=82=B7=E3=83=A5=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20https://github.com/NetCommons3/NetCommons3?= =?UTF-8?q?/issues/1337?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/PluginsRole.php | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/Model/PluginsRole.php b/Model/PluginsRole.php index 4985478..027a763 100644 --- a/Model/PluginsRole.php +++ b/Model/PluginsRole.php @@ -45,6 +45,15 @@ class PluginsRole extends AppModel { ), ); +/** + * Behaviors + * + * @var array + */ + public $actsAs = array( + 'NetCommons.NetCommonsCache', + ); + /** * RoleKeyに対するプラグインデータ取得 * @@ -96,6 +105,23 @@ public function getPlugins($pluginType, $roleKey, $joinType = 'LEFT', $queryType return $plugins; } +/** + * Called after each successful save operation. + * + * @param bool $created True if this save created a new record + * @param array $options Options passed from Model::save(). + * @return void + * @throws InternalErrorException + * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#aftersave + * @see Model::save() + */ + public function afterSave($created, $options = array()) { + parent::afterSave($created, $options); + + //キャッシュクリア + $this->Plugin->cacheClear(); + } + /** * Save plugin roles * Here does not transaction. Please do the transaction and validation in the caller. @@ -127,9 +153,6 @@ public function savePluginRoles($data) { } } - //キャッシュのクリア - $this->Plugin->cacheClear(); - return true; } From cc78b15a04c4fc45c081465d2b6ceb003f0f7432 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Mon, 7 Jan 2019 23:43:38 +0900 Subject: [PATCH 15/38] =?UTF-8?q?VERSION=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=82=92=E5=AE=9A=E6=95=B0=E3=81=AB=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=81=AE=E3=81=A7=E3=81=AF=E3=81=AA=E3=81=8F=E3=80=81=E3=82=AD?= =?UTF-8?q?=E3=83=A3=E3=83=83=E3=82=B7=E3=83=A5=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=81=AB=E3=81=82=E3=82=8B=E3=82=82=E3=81=AE=E3=81=8C?= =?UTF-8?q?=E7=8F=BE=E5=9C=A8=E3=81=AE=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E3=81=A8=E3=81=97=E3=81=A6=E6=89=B1=E3=81=86=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3=20https://github.com/NetCo?= =?UTF-8?q?mmons3/NetCommons3/issues/1337?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/PluginManagerController.php | 14 +++++--------- Utility/PluginUpdateUtil.php | 6 ++++++ View/Elements/PluginManager/title.ctp | 5 +++++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Controller/PluginManagerController.php b/Controller/PluginManagerController.php index 5f9ea80..68c5635 100644 --- a/Controller/PluginManagerController.php +++ b/Controller/PluginManagerController.php @@ -117,10 +117,11 @@ public function index() { $this->set('plugins', $plugins); $this->set('pluginsMap', $pluginsMap); - $nc3plugin = $this->Plugin->getPlugins( - Plugin::PLUGIN_TYPE_CORE, 'net_commons' - ); - $this->set('nc3plugin', $nc3plugin); + if (file_exists(APP . 'VERSION')) { + $this->set('nc3version', trim(file_get_contents(APP . 'VERSION'))); + } else { + $this->set('nc3version', '3.2.1'); + } $this->set('hasNewPlugin', (bool)$this->Plugin->getNewPlugins(Plugin::PLUGIN_TYPE_FOR_NOT_YET)); $this->set('hasUpdate', $this->Plugin->hasUpdate()); @@ -153,11 +154,6 @@ public function view() { $this->set('plugin', $plugins); } - $nc3plugin = $this->Plugin->getPlugins( - Plugin::PLUGIN_TYPE_CORE, 'net_commons' - ); - $this->set('nc3plugin', $nc3plugin); - $this->set('pluginType', $pluginType); //レイアウトの設定 diff --git a/Utility/PluginUpdateUtil.php b/Utility/PluginUpdateUtil.php index 7dd7877..a95df47 100644 --- a/Utility/PluginUpdateUtil.php +++ b/Utility/PluginUpdateUtil.php @@ -9,6 +9,8 @@ * @copyright Copyright 2014, NetCommons Project */ +App::uses('NetCommonsCache', 'NetCommons.Utility'); + /** * PluginUpdate Utility * @@ -58,6 +60,10 @@ public function updateAll() { } } + if (file_exists(APP . 'VERSION')) { + $ncCache = new NetCommonsCache('version', false, 'netcommons_core'); + $ncCache->write(trim(file_get_contents(APP . 'VERSION'))); + } return $result; } diff --git a/View/Elements/PluginManager/title.ctp b/View/Elements/PluginManager/title.ctp index e98c797..b2dd950 100644 --- a/View/Elements/PluginManager/title.ctp +++ b/View/Elements/PluginManager/title.ctp @@ -16,5 +16,10 @@ + + ( ' . $nc3version; + ?>) + end(); From 2ca1dac987f5121260486771822ae2613750c2f1 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Tue, 8 Jan 2019 00:09:38 +0900 Subject: [PATCH 16/38] =?UTF-8?q?phpunit=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20https://github.com/NetCommons3/NetCommons3?= =?UTF-8?q?/issues/1337?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/Case/Controller/PluginManagerControllerIndexTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Test/Case/Controller/PluginManagerControllerIndexTest.php b/Test/Case/Controller/PluginManagerControllerIndexTest.php index eadf224..06197a7 100644 --- a/Test/Case/Controller/PluginManagerControllerIndexTest.php +++ b/Test/Case/Controller/PluginManagerControllerIndexTest.php @@ -140,9 +140,9 @@ public function testNgClickValue($type) { 'latest' => null ]; - $count = 2; + $count = 1; if ($type == Plugin::PLUGIN_TYPE_FOR_NOT_YET) { - $count = 1; + $count = 0; } $this->controller->Plugin ->expects($this->exactly($count)) From dc61b54e00c0ebf09263f05229beac538209c6c4 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 30 Jun 2019 16:59:13 +0900 Subject: [PATCH 17/38] =?UTF-8?q?=E3=83=86=E3=83=BC=E3=83=9E=E3=82=92packa?= =?UTF-8?q?gist=E3=81=A7=E7=AE=A1=E7=90=86=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F=E3=81=9F=E3=82=81=E4=B8=80?= =?UTF-8?q?=E6=8B=AC=E3=82=A2=E3=83=83=E3=83=97=E3=83=87=E3=83=BC=E3=83=88?= =?UTF-8?q?=E3=81=A7=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=AB=E3=81=AA=E3=81=A3?= =?UTF-8?q?=E3=81=A6=E3=81=97=E3=81=BE=E3=81=A3=E3=81=9F=E3=81=9F=E3=82=81?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/PluginComposerBehavior.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Model/Behavior/PluginComposerBehavior.php b/Model/Behavior/PluginComposerBehavior.php index dd0102a..aca7cbd 100644 --- a/Model/Behavior/PluginComposerBehavior.php +++ b/Model/Behavior/PluginComposerBehavior.php @@ -67,7 +67,10 @@ public function getComposer(Model $model, $namespace = null, $filePath = null) { $composers = array(); foreach ($packages['packages'] as $package) { $composer = $this->_parseComposer($package); - $composers[$composer['namespace']] = $composer; + if ($composer['packageType'] !== 'netcommons-theme') { + //テーマは別途設定するため除外する + $composers[$composer['namespace']] = $composer; + } } if (! $filePath) { From 4ed93fa47ac63dfce25886ad0c9cb47f55321544 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 22 Sep 2019 18:23:01 +0900 Subject: [PATCH 18/38] =?UTF-8?q?fix:=20test:=20=E4=B8=8B=E8=A8=98?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=9F=E3=81=93=E3=81=A8?= =?UTF-8?q?=E3=81=AB=E3=82=88=E3=82=8A=E3=80=81Fixture=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=20https://github.com/NetCommons3/NetCommons/commit/25424295caf?= =?UTF-8?q?4112b7f6ce89ccdda5863ded96806?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/Fixture/Plugin4managerFixture.php | 53 ++++++++++++++++++++++++++ Test/Fixture/PluginFixture.php | 24 ------------ 2 files changed, 53 insertions(+), 24 deletions(-) create mode 100644 Test/Fixture/Plugin4managerFixture.php diff --git a/Test/Fixture/Plugin4managerFixture.php b/Test/Fixture/Plugin4managerFixture.php new file mode 100644 index 0000000..5218e6e --- /dev/null +++ b/Test/Fixture/Plugin4managerFixture.php @@ -0,0 +1,53 @@ + + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + * @copyright Copyright 2014, NetCommons Project + */ + +App::uses('PluginFixture', 'PluginManager.Test/Fixture'); + +/** + * PluginFixture + * + * @author Shohei Nakajima + * @package NetCommons\PluginManager\Test\Fixture + */ +class Plugin4managerFixture extends PluginFixture { + +/** + * Records + * + * @var array + */ + public $records = array( + //サイト管理プラグイン + array( + 'id' => 3, + 'language_id' => 2, + 'key' => 'test_plugin', + 'name' => 'Lorem ipsum dolor sit amet', + 'namespace' => 'Lorem ipsum dolor sit amet', + 'weight' => 1, + 'type' => 2, + 'default_action' => '', + 'default_setting_action' => '', + ), + //システム管理プラグイン + array( + 'id' => 4, + 'language_id' => 2, + 'key' => 'test_plugin', + 'name' => 'Lorem ipsum dolor sit amet', + 'namespace' => 'Lorem ipsum dolor sit amet', + 'weight' => 1, + 'type' => 3, + 'default_action' => '', + 'default_setting_action' => '', + ), + ); + +} diff --git a/Test/Fixture/PluginFixture.php b/Test/Fixture/PluginFixture.php index eebf3d1..5c1757b 100644 --- a/Test/Fixture/PluginFixture.php +++ b/Test/Fixture/PluginFixture.php @@ -45,30 +45,6 @@ class PluginFixture extends CakeTestFixture { 'default_action' => '', 'default_setting_action' => '', ), - //サイト管理プラグイン - array( - 'id' => 3, - 'language_id' => 2, - 'key' => 'test_plugin', - 'name' => 'Lorem ipsum dolor sit amet', - 'namespace' => 'Lorem ipsum dolor sit amet', - 'weight' => 1, - 'type' => 2, - 'default_action' => '', - 'default_setting_action' => '', - ), - //システム管理プラグイン - array( - 'id' => 4, - 'language_id' => 2, - 'key' => 'test_plugin', - 'name' => 'Lorem ipsum dolor sit amet', - 'namespace' => 'Lorem ipsum dolor sit amet', - 'weight' => 1, - 'type' => 3, - 'default_action' => '', - 'default_setting_action' => '', - ), ); /** From 13a3af2462b69e5672aea87d1b0c5ceb1308c710 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 22 Sep 2019 18:23:33 +0900 Subject: [PATCH 19/38] =?UTF-8?q?fix:=20test:=20=E4=B8=8B=E8=A8=98?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=9F=E3=81=93=E3=81=A8?= =?UTF-8?q?=E3=81=AB=E3=82=88=E3=82=8A=E3=80=81Fixture=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=20https://github.com/NetCommons3/NetCommons/commit/25424295caf?= =?UTF-8?q?4112b7f6ce89ccdda5863ded96806?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/Fixture/Plugin4managerFixture.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Test/Fixture/Plugin4managerFixture.php b/Test/Fixture/Plugin4managerFixture.php index 5218e6e..e758b7d 100644 --- a/Test/Fixture/Plugin4managerFixture.php +++ b/Test/Fixture/Plugin4managerFixture.php @@ -18,6 +18,20 @@ */ class Plugin4managerFixture extends PluginFixture { +/** + * Model name + * + * @var string + */ + public $name = 'Plugin'; + +/** + * Full Table Name + * + * @var string + */ + public $table = 'plugins'; + /** * Records * From 20f2ca86c69f23c4ef9b4df679bab4de9170c25b Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 29 Sep 2019 16:21:23 +0900 Subject: [PATCH 20/38] =?UTF-8?q?fix:=20test:=20UnitTest=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=20https://github.com/NetCommons3/NetCommons3/issues/1468?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/PluginBehavior.php | 2 +- .../PluginManagerControllerEditTest.php | 27 ++++++++++++++++--- .../Case/Model/PluginsRole/GetPluginsTest.php | 4 ++- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Model/Behavior/PluginBehavior.php b/Model/Behavior/PluginBehavior.php index 366bebd..83dd349 100644 --- a/Model/Behavior/PluginBehavior.php +++ b/Model/Behavior/PluginBehavior.php @@ -32,7 +32,7 @@ class PluginBehavior extends ModelBehavior { public function setup(Model $model, $config = array()) { parent::setup($model, $config); - $this->connection = Hash::get($config, 'connection', 'master'); + $this->connection = Hash::get($config, 'connection', $model->useDbConfig); $this->corePluginPatterns = Hash::get($config, 'corePluginPatterns', [ '#^netcommons/#' => Plugin::PLUGIN_TYPE_CORE, diff --git a/Test/Case/Controller/PluginManagerControllerEditTest.php b/Test/Case/Controller/PluginManagerControllerEditTest.php index fec1f22..89dc49f 100644 --- a/Test/Case/Controller/PluginManagerControllerEditTest.php +++ b/Test/Case/Controller/PluginManagerControllerEditTest.php @@ -104,6 +104,13 @@ public function testNoPluginData() { public function testRunVersionUpTrue() { $this->__setMockPluginRunVersionUp(true); + $data['Plugin']['key'] = 'plugin_manager'; + + $this->controller->Plugin + ->expects($this->once()) + ->method('getPlugins') + ->will($this->returnValue($data)); + $MockNetCommons = $this->getMock('NetCommonsComponent', ['setFlashNotification'], [$this->controller->Components]); $MockNetCommons ->expects($this->once()) @@ -115,7 +122,6 @@ public function testRunVersionUpTrue() { $this->controller->Components->set('NetCommons', $MockNetCommons); $this->controller->Components->enable('NetCommons'); - $data['Plugin']['key'] = 'plugin_manager'; $this->testAction('plugin_manager/plugin_manager/edit/2', ['data' => $data]); $this->assertStringEndsWith('plugin_manager/plugin_manager/index/2', $this->headers['Location']); } @@ -128,6 +134,13 @@ public function testRunVersionUpTrue() { public function testRunVersionUpFalse() { $this->__setMockPluginRunVersionUp(false); + $data['Plugin']['key'] = 'plugin_manager'; + + $this->controller->Plugin + ->expects($this->once()) + ->method('getPlugins') + ->will($this->returnValue($data)); + $MockNetCommons = $this->getMock('NetCommonsComponent', ['setFlashNotification'], [$this->controller->Components]); $MockNetCommons ->expects($this->once()) @@ -142,7 +155,6 @@ public function testRunVersionUpFalse() { $this->controller->Components->set('NetCommons', $MockNetCommons); $this->controller->Components->enable('NetCommons'); - $data['Plugin']['key'] = 'plugin_manager'; $this->testAction('plugin_manager/plugin_manager/edit/2', ['data' => $data]); $this->assertStringEndsWith('plugin_manager/plugin_manager/index/2', $this->headers['Location']); } @@ -156,6 +168,12 @@ public function testTypeSystem() { $this->__setMockPluginRunVersionUp(true); $data['Plugin']['key'] = 'plugin_manager'; + + $this->controller->Plugin + ->expects($this->once()) + ->method('getPlugins') + ->will($this->returnValue($data)); + $this->testAction('plugin_manager/plugin_manager/edit/3', ['data' => $data]); $this->assertStringEndsWith('plugin_manager/plugin_manager/index/2', $this->headers['Location']); } @@ -188,7 +206,10 @@ public function testTypeNotYet() { * @return void */ private function __setMockPluginRunVersionUp($returnValue) { - $this->controller->Plugin = $this->getMockForModel('PluginManager.Plugin', ['runVersionUp', 'getNewPlugins']); + $this->controller->Plugin = $this->getMockForModel( + 'PluginManager.Plugin', + ['runVersionUp', 'getPlugins', 'getNewPlugins'] + ); $this->controller->Plugin ->expects($this->once()) ->method('runVersionUp') diff --git a/Test/Case/Model/PluginsRole/GetPluginsTest.php b/Test/Case/Model/PluginsRole/GetPluginsTest.php index fc8e60b..f462d85 100644 --- a/Test/Case/Model/PluginsRole/GetPluginsTest.php +++ b/Test/Case/Model/PluginsRole/GetPluginsTest.php @@ -10,6 +10,7 @@ */ App::uses('NetCommonsGetTest', 'NetCommons.TestSuite'); +App::uses('CurrentLib', 'NetCommons.Lib'); /** * PluginsRole::getPlugins()のテスト @@ -61,7 +62,8 @@ public function testGetPlugins() { $methodName = $this->_methodName; //データ生成 - $pluginType = '2'; + CurrentLib::write('Language.id', '2'); + $pluginType = '1'; $roleKey = 'system_administrator'; $joinType = 'LEFT'; From 25c6c1858a5a445e7e11fbe5bec156c424196fb2 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 29 Sep 2019 16:25:43 +0900 Subject: [PATCH 21/38] =?UTF-8?q?fix:=20test:=20travis=20php7.2=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C=20https://github.com/NetCommons3/NetCommons3/issues/1?= =?UTF-8?q?451?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 ++ phpunit.xml.dist | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a05bf85..2348845 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,10 @@ php: - 5.6 - 7.0 - 7.1 + - 7.2 sudo: false +dist: trusty env: matrix: diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 8f02b5d..0f067e5 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -15,6 +15,5 @@ - From 3ed02e1b2daa479200eee8fa27fc4b1eab1c834f Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 29 Nov 2019 18:21:37 +0900 Subject: [PATCH 22/38] =?UTF-8?q?change:=20=E3=83=9E=E3=82=A4=E3=82=B0?= =?UTF-8?q?=E3=83=AC=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E3=82=92=E5=AE=9F?= =?UTF-8?q?=E8=A1=8C=E3=81=99=E3=82=8Binstaller-types=E3=82=92=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/PluginBehavior.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Model/Behavior/PluginBehavior.php b/Model/Behavior/PluginBehavior.php index 83dd349..eb28d6a 100644 --- a/Model/Behavior/PluginBehavior.php +++ b/Model/Behavior/PluginBehavior.php @@ -37,6 +37,9 @@ public function setup(Model $model, $config = array()) { $this->corePluginPatterns = Hash::get($config, 'corePluginPatterns', [ '#^netcommons/#' => Plugin::PLUGIN_TYPE_CORE, ]); + $this->migrationPlugins = Hash::get($config, 'migrationPlugins', [ + 'cakephp-plugin', + ]); } /** @@ -64,7 +67,7 @@ public function runVersionUp(Model $model, $plugin) { //img,js,cssをwebrootから削除。エラーとはしない $model->deleteFromWebroot($plugin); } else { - if (Hash::get($plugin, 'latest.packageType') === 'cakephp-plugin') { + if (in_array(Hash::get($plugin, 'latest.packageType'), $this->migrationPlugins, true)) { if (! $model->runMigration(Hash::get($plugin, 'latest.key'))) { throw new InternalErrorException(__d('net_commons', 'Internal Server Error')); } From 86bd01c9569aec17c1fd6d35647ac8eee383eb80 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 13 Mar 2020 23:43:31 +0900 Subject: [PATCH 23/38] =?UTF-8?q?change:=20test:=20travis.yml=E3=81=8B?= =?UTF-8?q?=E3=82=89php5.4,5.5=E3=82=92=E5=89=8A=E9=99=A4=E3=80=82php7.3,7?= =?UTF-8?q?.4=E3=82=92=E8=BF=BD=E5=8A=A0=20https://github.com/NetCommons3/?= =?UTF-8?q?NetCommons3/issues/1560?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2348845..ac3712c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,12 @@ language: php php: - - 5.4 - - 5.5 - 5.6 - 7.0 - 7.1 - 7.2 + - 7.3 + - 7.4 sudo: false dist: trusty From 666a2653a19c7ace924fcba49823e0376436b90c Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 7 Aug 2020 22:55:52 +0900 Subject: [PATCH 24/38] =?UTF-8?q?change:=20test:=20Travis=E3=81=8B?= =?UTF-8?q?=E3=82=89PHP5.6=E3=82=92=E5=89=8A=E9=99=A4,php72=E4=BB=A5?= =?UTF-8?q?=E9=99=8D=E3=81=A7UnitTest=E3=81=A7Warning=E3=81=8C=E5=87=BA?= =?UTF-8?q?=E3=82=8B=E3=81=9F=E3=82=81=E4=BF=AE=E6=AD=A3=20https://github.?= =?UTF-8?q?com/NetCommons3/NetCommons3/issues/1588?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 1 - phpunit.xml.dist | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ac3712c..56f70a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: php php: - - 5.6 - 7.0 - 7.1 - 7.2 diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0f067e5..5ff9c3b 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,5 +1,11 @@ + + + + + + app/Plugin/PluginManager From b039068c9270250a25826874fe43e03be56c4df3 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Wed, 26 Aug 2020 20:20:39 +0900 Subject: [PATCH 25/38] change: Version number to 3.3.2 --- VERSION.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 VERSION.txt diff --git a/VERSION.txt b/VERSION.txt new file mode 100644 index 0000000..4772543 --- /dev/null +++ b/VERSION.txt @@ -0,0 +1 @@ +3.3.2 From 911aa119c8cff2561285719f02ce9058f667ac5a Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 13 Dec 2020 18:36:25 +0900 Subject: [PATCH 26/38] =?UTF-8?q?fix:=20test:=20TravisCI=E3=81=AEphp7.3?= =?UTF-8?q?=E3=81=A7=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=8C=E5=87=BA=E3=82=8B?= =?UTF-8?q?=E3=81=9F=E3=82=81=E4=BF=AE=E6=AD=A3=20https://github.com/NetCo?= =?UTF-8?q?mmons3/NetCommons3/issues/1618?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 56f70a0..78a831c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ php: - 7.0 - 7.1 - 7.2 - - 7.3 + - 7.3.24 - 7.4 sudo: false From b26de6216b7b717231ac40d3f97b49b0a1ae0698 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 23 Jan 2021 14:01:52 +0900 Subject: [PATCH 27/38] =?UTF-8?q?add:=20release=E3=82=BF=E3=82=B0=E4=BB=98?= =?UTF-8?q?=E3=81=91=E3=81=AEgithub=20action=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/NetCommons3/NetCommons3/issues/1619 --- .github/workflows/release.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a3225bc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - '3*' + +name: Create Release + +jobs: + build: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + body: | + NetCommons ${{ github.ref }} released. + draft: false + prerelease: false From e522ab0223e6015bef795d49392f8379fec81d86 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 23 Jan 2021 14:01:58 +0900 Subject: [PATCH 28/38] change: Version number to 3.3.3 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index 4772543..619b537 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -3.3.2 +3.3.3 From b930c2cd85ae85e05a10d82aa30335c48ed1e024 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 31 Jul 2021 15:22:00 +0900 Subject: [PATCH 29/38] =?UTF-8?q?change:=20test:=20TravisCI=E3=81=8B?= =?UTF-8?q?=E3=82=89GithubAction=E3=81=AB=E5=A4=89=E6=9B=B4=20https://gith?= =?UTF-8?q?ub.com/NetCommons3/NetCommons3/issues/1650?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 137 ++++++++++++++++++++++++++++++++++++ .travis.yml | 44 ------------ README.md | 9 +-- phpunit.xml.dist | 4 +- 4 files changed, 140 insertions(+), 54 deletions(-) create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..d6bd01e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,137 @@ +on: + push: + branches: + - main + - master + - availability + pull_request: + branches: + - main + - master + - availability + +name: tests + +jobs: + tests: + name: tests + runs-on: ubuntu-18.04 + strategy: + matrix: + php: [ '7.1', '7.2', '7.3', '7.4' ] + + 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_ROOT_PASSWORD: root + MYSQL_DATABASE: cakephp_test + + steps: + - uses: actions/checkout@v2 + + - name: environment + run: | + echo "GITHUB_WORKSPACE=${GITHUB_WORKSPACE}" + echo "PLUGIN_BUILD_DIR=${PLUGIN_BUILD_DIR}" + echo "PHP_VERSION=${PHP_VERSION}" + ls -al ${PLUGIN_BUILD_DIR} + + - name: docker-compose install + run: | + curl -L https://github.com/docker/compose/releases/download/1.11.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) + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/phpcs.sh + + - name: phpmd (PHP Mess Detector) + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/phpmd.sh + + - name: phpcpd (PHP Copy/Paste Detector) + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/phpcpd.sh + + - name: gjslint (JavaScript Style Check) + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/gjslint.sh + + - name: phpdoc (PHP Documentor) + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/phpdoc.sh + + - name: phpunit (PHP UnitTest) + 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 + run: | + cd ${NC3_DOCKER_DIR} + docker-compose rm -f + + # テスト成功時はこちらのステップが実行される + - name: Slack Notification on Success + if: success() + uses: rtCamp/action-slack-notify@v2.2.0 + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + SLACK_CHANNEL: notify-netcommons3 + SLACK_TITLE: "${{ github.repository }}(${{ matrix.php }})" + SLACK_COLOR: good + + # テスト失敗時はこちらのステップが実行される + - name: Slack Notification on Failure + uses: rtCamp/action-slack-notify@v2.2.0 + if: failure() + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + SLACK_CHANNEL: notify-netcommons3 + SLACK_TITLE: "${{ github.repository }}(${{ matrix.php }})" + SLACK_COLOR: danger diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 78a831c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,44 +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: "FhZx+mu1fwG7ghoF5jKKwW672cRbAhiSG9IY3q0og1FaNfUjMVMzryAhoM9/76BgRFom9hLKBuM/5pKvhSHZCV9u4EdDoMB38TeJwCv0Fh7L/C7ubfcTrT2cbMFOD9JxkIgt8lOM5vHnnDWi0UFjaFrv3cBCZgVrLW4ejUoUD4RFi+hps5WoG6GcAwHw0nkyM01WZQjZ43YAciiD5/vC1cnaaXwXCzOugIUdjDISN9q/KeVjRp2bhD852GkvBT+qhGRph5+0msCG7ch+ve1xAfPO4QNcgl/+01Op8djj5T+c3TPpFDpOapE4vQ4dD0DWasSRdftlzCyiwyCBLAhYa/8AXJG6rVK2IKyoGyHUZcn8YGDANSLyB4UTdp/7QJKKX5PUrh3ejywr35kJvnCVVQ3o4oyQk5TOJ96i9tYkoOs0d2KZ4dF+bdCfKeyO1zmJp7ILtWBJJrPzE3Rw+OyDI7oqbVpvjHJDt7gKv7cUU/Gpn3vnPtqzTWKqEiTck/K6MEFlWv5T4LY5YtHuPNH2Pmko5Zg1ljnmkuBqHZLg6HCCRoYkYq9TVUL/4N4Q+rEDstrCocVytGecryh+RgNaCvtHxvrPNp3A306s1DrtzXcWZVQ1L3MS1Nj0gdodEAxugRM92Jy/0ouMxmu/0Juv1sXWOOi6GVzfa04BbJmLf9A=" - - GIT_COMMITTER_NAME=s-nakajima - - GIT_COMMITTER_EMAIL=nakajimashouhei@gmail.com - - GIT_AUTHOR_NAME=s-nakajima - - GIT_AUTHOR_EMAIL=nakajimashouhei@gmail.com - -sudo: required - -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 - - travis_wait . tools/build/plugins/cakephp/travis/pre.sh - - . tools/build/plugins/cakephp/travis/environment.sh - -script: - - . 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/README.md b/README.md index 74edda5..ef0a851 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,6 @@ PluginManager ============== -PluginManager Plugin for NetCommons - -[![Build Status](https://api.travis-ci.org/NetCommons3/PluginManager.svg?branch=master)](https://travis-ci.org/NetCommons3/PluginManager) +[![Tests Status](https://github.com/NetCommons3/PluginManager/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/NetCommons3/PluginManager/actions/workflows/tests.yml) [![Coverage Status](https://coveralls.io/repos/NetCommons3/PluginManager/badge.svg?branch=master)](https://coveralls.io/r/NetCommons3/PluginManager?branch=master) - -| dependencies | status | -| ------------- | ------ | -| composer.json | [![Dependency Status](https://www.versioneye.com/user/projects/55531fa006c31830550002f4/badge.svg?style=flat)](https://www.versioneye.com/user/projects/55531fa006c31830550002f4) | +[![Stable Version](https://img.shields.io/packagist/v/netcommons/plugin-manager.svg?label=stable)](https://packagist.org/packages/netcommons/plugin-manager) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 5ff9c3b..8518a86 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -3,9 +3,6 @@ - - - app/Plugin/PluginManager @@ -21,5 +18,6 @@ + From c300824657bcdb2965ed16dbb622979105ebfaea Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Wed, 11 Aug 2021 10:56:55 +0900 Subject: [PATCH 30/38] =?UTF-8?q?change:=20test:=20Slack=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3,=20mysql8.0=E3=83=86=E3=82=B9=E3=83=88?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=20https://github.com/NetCommons3/NetCommons3?= =?UTF-8?q?/issues/1650?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 35 ++++++++++++++++++++++++-- .github/workflows/tests.yml | 47 +++++++++++++++++++++++++---------- 2 files changed, 67 insertions(+), 15 deletions(-) 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 index d6bd01e..1477ea2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,12 +13,26 @@ on: name: tests jobs: + setup: + name: setup + runs-on: ubuntu-18.04 + steps: + - name: Slack Notification on Start + uses: rtCamp/action-slack-notify@v2.2.0 + 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-18.04 strategy: matrix: php: [ '7.1', '7.2', '7.3', '7.4' ] + mysql: [ '5.7', '8.0' ] env: NC3_BUILD_DIR: "/opt/nc3" @@ -27,6 +41,7 @@ jobs: 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 @@ -38,6 +53,7 @@ jobs: 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 @@ -116,22 +132,27 @@ jobs: cd ${NC3_DOCKER_DIR} docker-compose rm -f - # テスト成功時はこちらのステップが実行される - - name: Slack Notification on Success - if: success() - uses: rtCamp/action-slack-notify@v2.2.0 - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - SLACK_CHANNEL: notify-netcommons3 - SLACK_TITLE: "${{ github.repository }}(${{ matrix.php }})" - SLACK_COLOR: good - # テスト失敗時はこちらのステップが実行される - name: Slack Notification on Failure uses: rtCamp/action-slack-notify@v2.2.0 if: failure() env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - SLACK_CHANNEL: notify-netcommons3 - SLACK_TITLE: "${{ github.repository }}(${{ matrix.php }})" + 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-18.04 + needs: tests + steps: + # テスト成功時はこちらのステップが実行される + - name: Slack Notification on Success + if: success() + uses: rtCamp/action-slack-notify@v2.2.0 + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }} + SLACK_CHANNEL: notify-nc3-tests + SLACK_TITLE: "${{ github.repository }}" + SLACK_COLOR: good From b9f894ffebbd89b9eb1e936ec31516deed28b243 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 13 Aug 2021 16:57:49 +0900 Subject: [PATCH 31/38] change: Version number to 3.3.4 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index 619b537..a0891f5 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -3.3.3 +3.3.4 From 3de399dc68bee27e128ef6a132395f0c91f5a1c5 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 11 Feb 2022 20:48:21 +0900 Subject: [PATCH 32/38] change: Version number to 3.3.5 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index a0891f5..fa7adc7 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -3.3.4 +3.3.5 From fedab00dbe90f95c49dfd1aecdb8021a27bbb1db Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Wed, 2 Mar 2022 18:54:22 +0900 Subject: [PATCH 33/38] =?UTF-8?q?fix:=20=E4=B8=80=E6=8B=AC=E3=82=A2?= =?UTF-8?q?=E3=83=83=E3=83=97=E3=83=87=E3=83=BC=E3=83=88=E3=81=AE=E9=9A=9B?= =?UTF-8?q?=E3=80=81=E6=97=A2=E3=81=AB=E7=99=BB=E9=8C=B2=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=82=8B=E3=83=A9=E3=82=A4=E3=83=96=E3=83=A9=E3=83=AA?= =?UTF-8?q?=E3=82=92=E6=9B=B4=E6=96=B0=E3=81=99=E3=82=8B=E3=81=A8package?= =?UTF-8?q?=E3=81=AE=E5=86=85=E5=AE=B9=E3=81=AB=E3=82=88=E3=81=A3=E3=81=A6?= =?UTF-8?q?=E3=81=AFSQL=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=AB=E3=81=AA?= =?UTF-8?q?=E3=82=8A=E7=99=BB=E9=8C=B2=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=84?= =?UTF-8?q?=E5=A0=B4=E5=90=88=E3=81=8C=E3=81=82=E3=82=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/PluginBehavior.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Model/Behavior/PluginBehavior.php b/Model/Behavior/PluginBehavior.php index eb28d6a..419877d 100644 --- a/Model/Behavior/PluginBehavior.php +++ b/Model/Behavior/PluginBehavior.php @@ -338,7 +338,7 @@ public function updateVersion(Model $model, $packages) { 'version' => '\'' . $package['version'] . '\'', 'commit_version' => '\'' . $package['commit_version'] . '\'', 'commited' => '\'' . $package['commited'] . '\'', - 'serialize_data' => '\'' . serialize($package) . '\'', + 'serialize_data' => $model->Plugin->getDataSource()->value(serialize($package), 'string'), ); if (! $model->Plugin->updateAll($update, $conditions)) { CakeLog::info(sprintf('[update version] Line(' . __LINE__ . ') Error')); From 4081be867b587e79e7b561ebe9284b45dc796651 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Wed, 2 Mar 2022 19:22:24 +0900 Subject: [PATCH 34/38] =?UTF-8?q?fix:=20=E4=B8=80=E6=8B=AC=E3=82=A2?= =?UTF-8?q?=E3=83=83=E3=83=97=E3=83=87=E3=83=BC=E3=83=88=E3=81=AE=E9=9A=9B?= =?UTF-8?q?=E3=80=81=E6=97=A2=E3=81=AB=E7=99=BB=E9=8C=B2=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=82=8B=E3=83=A9=E3=82=A4=E3=83=96=E3=83=A9=E3=83=AA?= =?UTF-8?q?=E3=82=92=E6=9B=B4=E6=96=B0=E3=81=99=E3=82=8B=E3=81=A8package?= =?UTF-8?q?=E3=81=AE=E5=86=85=E5=AE=B9=E3=81=AB=E3=82=88=E3=81=A3=E3=81=A6?= =?UTF-8?q?=E3=81=AFSQL=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=AB=E3=81=AA?= =?UTF-8?q?=E3=82=8A=E7=99=BB=E9=8C=B2=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=84?= =?UTF-8?q?=E5=A0=B4=E5=90=88=E3=81=8C=E3=81=82=E3=82=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Behavior/PluginBehavior/UpdateVersionPhotoAlbumsTest.php | 2 +- Test/Case/Model/Behavior/PluginBehavior/UpdateVersionTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Test/Case/Model/Behavior/PluginBehavior/UpdateVersionPhotoAlbumsTest.php b/Test/Case/Model/Behavior/PluginBehavior/UpdateVersionPhotoAlbumsTest.php index 36d8cad..878b645 100644 --- a/Test/Case/Model/Behavior/PluginBehavior/UpdateVersionPhotoAlbumsTest.php +++ b/Test/Case/Model/Behavior/PluginBehavior/UpdateVersionPhotoAlbumsTest.php @@ -66,7 +66,7 @@ public function testUpdateVersion() { 'version' => '\'' . $package['version'] . '\'', 'commit_version' => '\'' . $package['commit_version'] . '\'', 'commited' => '\'' . $package['commited'] . '\'', - 'serialize_data' => '\'' . serialize($package) . '\'', + 'serialize_data' => $this->TestModel->Plugin->getDataSource()->value(serialize($package), 'string'), ); $expectedConditions = array( 'namespace' => array('netcommons/photo-albums', 'netcommons/photo_albums') diff --git a/Test/Case/Model/Behavior/PluginBehavior/UpdateVersionTest.php b/Test/Case/Model/Behavior/PluginBehavior/UpdateVersionTest.php index 946e52a..984498e 100644 --- a/Test/Case/Model/Behavior/PluginBehavior/UpdateVersionTest.php +++ b/Test/Case/Model/Behavior/PluginBehavior/UpdateVersionTest.php @@ -64,7 +64,7 @@ private function __prepareUpdateAll($namespace, $return) { 'version' => '\'' . $package['version'] . '\'', 'commit_version' => '\'' . $package['commit_version'] . '\'', 'commited' => '\'' . $package['commited'] . '\'', - 'serialize_data' => '\'' . serialize($package) . '\'', + 'serialize_data' => $this->TestModel->Plugin->getDataSource()->value(serialize($package), 'string'), ); $expectedConditions = array( 'namespace' => $namespace From 390cf44429b082b17cf6ac0230c3928419bb36c0 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 24 Feb 2023 15:57:19 +0900 Subject: [PATCH 35/38] =?UTF-8?q?test:=20Github=20Action=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1477ea2..7cfa881 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,10 +44,14 @@ jobs: 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}" @@ -58,7 +62,7 @@ jobs: - name: docker-compose install run: | - curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > ~/docker-compose + 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 From b38c88388fb78059664b6af170d947d1f6eefb26 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 26 Feb 2023 03:55:46 +0900 Subject: [PATCH 36/38] change: Version number to 3.3.6 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index fa7adc7..9c25013 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -3.3.5 +3.3.6 From c9421372ec5ca9a729e71e3efdf00d7f50e8780a Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Thu, 5 Oct 2023 21:06:10 +0900 Subject: [PATCH 37/38] =?UTF-8?q?test:=20github=20action=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7cfa881..6da4321 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,22 +3,21 @@ on: branches: - main - master - - availability pull_request: branches: - main - master - - availability name: tests jobs: setup: name: setup - runs-on: ubuntu-18.04 + 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 @@ -28,7 +27,7 @@ jobs: tests: name: tests needs: setup - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest strategy: matrix: php: [ '7.1', '7.2', '7.3', '7.4' ] @@ -92,46 +91,53 @@ jobs: 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: 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 @@ -139,7 +145,7 @@ jobs: # テスト失敗時はこちらのステップが実行される - name: Slack Notification on Failure uses: rtCamp/action-slack-notify@v2.2.0 - if: failure() + if: env.SLACK_WEBHOOK != '' && failure() env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }} SLACK_CHANNEL: notify-nc3-tests @@ -148,13 +154,13 @@ jobs: teardown: name: teardown - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest needs: tests steps: # テスト成功時はこちらのステップが実行される - name: Slack Notification on Success - if: 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 From e84824667fac54de4241c3d9480b49d08b6a757b Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Mon, 9 Oct 2023 21:13:10 +0900 Subject: [PATCH 38/38] change: Version number to 3.3.7 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index 9c25013..86fb650 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -3.3.6 +3.3.7