diff --git a/plugins/baser-core/src/Controller/Admin/PluginsController.php b/plugins/baser-core/src/Controller/Admin/PluginsController.php index 1d9f3b4e8d..bcdbbcf9da 100644 --- a/plugins/baser-core/src/Controller/Admin/PluginsController.php +++ b/plugins/baser-core/src/Controller/Admin/PluginsController.php @@ -106,7 +106,7 @@ public function install(PluginsAdminServiceInterface $service, string $name) } /** - * アップデート実行 + * プラグインアップデート実行 * @param PluginsAdminServiceInterface|PluginsAdminService $service * @param string $name * @return void|Response @@ -144,24 +144,41 @@ public function update(PluginsAdminServiceInterface $service, $name = '') } } catch (\Throwable $e) { $this->BcMessage->setError(__d('baser_core', 'アップデート処理に失敗しました。画面下部のアップデートログを確認してください。') . $e->getMessage()); - if($plugin->name === 'BaserCore') { - $request = $this->getRequest(); - try { - $service->rollbackCore( - $request->getData('currentVersion'), - $request->getData('php') - ); - $this->BcMessage->setError(__d('baser_core', 'コアファイルを元に戻しました。')); - } catch (\Throwable $e) { - $this->BcMessage->setError($e->getMessage()); - } - } } - if($plugin->name === 'BaserCore') { - return $this->redirect(['action' => 'update']); - } else { - return $this->redirect(['action' => 'update', $name]); + return $this->redirect(['action' => 'update', $name]); + } + + /** + * コアアップデート実行 + * @param PluginsAdminServiceInterface|PluginsAdminService $service + * @param string $name + * @return void|Response + * @checked + * @noTodo + */ + public function update_core(PluginsAdminServiceInterface $service) + { + if (!$this->request->is(['put', 'post'])) return; + try { + $request = $this->getRequest(); + $service->updateCore( + $request->getData('php')?? 'php', + $request->getData('connection') ?? 'default' + ); + $this->BcMessage->setInfo(__d('baser_core', 'アップデート処理が完了しました。画面下部のアップデートログを確認してください。')); + } catch (\Throwable $e) { + $this->BcMessage->setError(__d('baser_core', 'アップデート処理に失敗しました。画面下部のアップデートログを確認してください。') . $e->getMessage()); + try { + $service->rollbackCore( + $request->getData('currentVersion'), + $request->getData('php') + ); + $this->BcMessage->setError(__d('baser_core', 'コアファイルを元に戻しました。')); + } catch (\Throwable $e) { + $this->BcMessage->setError($e->getMessage()); + } } + return $this->redirect(['action' => 'update']); } /** diff --git a/plugins/baser-core/src/Controller/Api/Admin/PluginsController.php b/plugins/baser-core/src/Controller/Api/Admin/PluginsController.php index 220981b873..a281ede698 100644 --- a/plugins/baser-core/src/Controller/Api/Admin/PluginsController.php +++ b/plugins/baser-core/src/Controller/Api/Admin/PluginsController.php @@ -378,28 +378,4 @@ public function get_available_core_version_info(PluginsServiceInterface $service $this->viewBuilder()->setOption('serialize', ['availableCoreVersionInfo']); } - /** - * コアファイルの最新版を反映する - * - * @param PluginsServiceInterface $service - * @checked - * @noTodo - * @unitTest - */ - public function update_core_files(PluginsServiceInterface $service) - { - $this->request->allowMethod(['post', 'put']); - try { - $service->updateCoreFiles(); - $message = __d('baser_core', 'コアファイルの最新版への更新が完了しました。'); - } catch (\Throwable $e) { - $message = __d('baser_core', 'コアファイルの最新版への更新中にエラーが発生しました。' . $e->getMessage()); - $this->setResponse($this->response->withStatus(500)); - } - $this->set([ - 'message' => $message - ]); - $this->viewBuilder()->setOption('serialize', ['message']); - } - } diff --git a/plugins/baser-core/src/Service/PluginsService.php b/plugins/baser-core/src/Service/PluginsService.php index 0be17c002d..b37894529d 100644 --- a/plugins/baser-core/src/Service/PluginsService.php +++ b/plugins/baser-core/src/Service/PluginsService.php @@ -308,6 +308,29 @@ public function rollbackCore(string $currentVersion, string $php): void } } + /** + * BaserCoreをアップデートする + * + * @param string $currentVersion + * @param string $targetVersion + * @param string $connection + * @checked + * @noTodo + */ + public function updateCore($php, $connection = 'default') + { + $this->updateCoreFiles(); + + // マイグレーション、アップデートスクリプト実行、バージョン番号更新 + // マイグレーションファイルがプログラムに反映されないと実行できないため、別プロセスとして実行する + $command = $php . ' ' . ROOT . DS . 'bin' . DS . 'cake.php update --connection ' . $connection; + $out = $code = null; + exec($command, $out, $code); + if ($code !== 0) { + throw new BcException(__d('baser_core', 'マイグレーション処理が失敗しました。')); + } + } + /** * コアファイルを更新 * @return void diff --git a/plugins/baser-core/tests/TestCase/Controller/Api/Admin/PluginsControllerTest.php b/plugins/baser-core/tests/TestCase/Controller/Api/Admin/PluginsControllerTest.php index d6848d9bd4..088a174ca2 100644 --- a/plugins/baser-core/tests/TestCase/Controller/Api/Admin/PluginsControllerTest.php +++ b/plugins/baser-core/tests/TestCase/Controller/Api/Admin/PluginsControllerTest.php @@ -266,42 +266,4 @@ public function test_batch() $this->assertEquals('一括処理が完了しました。', $result->message); } - /** - * test update_core_files - */ - public function test_update_core_files() - { - // composer.json をバックアップ - copy(ROOT . DS . 'composer.json', ROOT . DS . 'composer.bak.json'); - copy(ROOT . DS . 'composer.lock', ROOT . DS . 'composer.bak.lock'); - - // composer.json を配布用に更新 - BcComposer::setupComposerForDistribution(ROOT . DS); - - // vendor を一時フォルダにコピー - (new Folder(ROOT . DS . 'vendor'))->copy(TMP . 'update' . DS . 'vendor'); - - // composer.json を一時フォルダにコピー - copy(ROOT . DS . 'composer.json', TMP . 'update' . DS . 'composer.json'); - copy(ROOT . DS . 'composer.lock', TMP . 'update' . DS . 'composer.lock'); - - // 最新版を反映 - $this->post('/baser/api/admin/baser-core/plugins/update_core_files.json?token=' . $this->accessToken); - $this->assertResponseOk(); - $result = json_decode((string)$this->_response->getBody()); - $this->assertEquals('コアファイルの最新版への更新が完了しました。', $result->message); - - // vendor を元に戻す - (new Folder())->delete(ROOT . DS . 'vendor'); - $zip = new BcZip(); - $zip->extract(TMP . 'update' . DS . 'vendor.zip', ROOT . DS . 'vendor'); - - // 一時ファイルを削除 - (new Folder())->delete(TMP . 'update'); - - // composer.json を元に戻す - rename(ROOT . DS . 'composer.bak.json', ROOT . DS . 'composer.json'); - rename(ROOT . DS . 'composer.bak.lock', ROOT . DS . 'composer.lock'); - } - } diff --git a/plugins/bc-admin-third/src/js/admin/plugins/update.js b/plugins/bc-admin-third/src/js/admin/plugins/update.js index 7fbdef5392..bbbea84afa 100644 --- a/plugins/bc-admin-third/src/js/admin/plugins/update.js +++ b/plugins/bc-admin-third/src/js/admin/plugins/update.js @@ -55,36 +55,8 @@ const updateForm = { */ update() { if (confirm(bcI18n.confirmMessage1)) { - if (updateForm.plugin !== 'BaserCore') { - $.bcUtil.showLoader(); - return true; - } - $.bcToken.check(function () { - $.bcUtil.showLoader(); - $.bcUtil.hideMessage(); - axios.post($.bcUtil.apiAdminBaseUrl + 'baser-core/plugins/update_core_files.json', {}, { - headers: { - 'X-CSRF-Token': $.bcToken.key - } - }) - .then(response => { - let message = response.data.message + bcI18n.updateMessage1; - $.bcUtil.showNoticeMessage(message); - $(window).scrollTop(0); - $.bcUtil.showLoader(); - // フォーム送信 - $("#PluginUpdateForm").submit(); - }) - .catch(error => { - if (error.response.status === 500) { - $.bcUtil.showAlertMessage(error.response.data.message); - } else { - $.bcUtil.showAlertMessage('予期せぬエラーが発生しました。システム管理者に連絡してください。'); - } - $.bcUtil.hideLoader(); - $(window).scrollTop(0); - }); - }, {hideLoader: false}); + $.bcUtil.showLoader(); + return true; } return false; }, @@ -102,6 +74,8 @@ const updateForm = { if ($inputPhp.val() !== ''){ if(updateForm.isUpdatable) { $btnUpdate.removeAttr('disabled'); + } else { + $btnUpdate.attr('disabled', 'disabled'); } $btnDownload.removeAttr('disabled'); } else { diff --git a/plugins/bc-admin-third/templates/Admin/element/Plugins/update_core.php b/plugins/bc-admin-third/templates/Admin/element/Plugins/update_core.php index fccd413ba6..22addc95f2 100644 --- a/plugins/bc-admin-third/templates/Admin/element/Plugins/update_core.php +++ b/plugins/bc-admin-third/templates/Admin/element/Plugins/update_core.php @@ -31,22 +31,23 @@ +

+

+ BcBaser->getLink('baserCMSの制作・開発パートナー', 'https://basercms.net/partners/', ['target' => '_blank']) + ) ?> +

+

アップデートの前にプログラムのバージョンに合わせて データベースの site_configs テーブルの version フィールドを更新してください。') ?>

-

-

- BcBaser->getLink('baserCMSの制作・開発パートナー', 'https://basercms.net/partners/', ['target' => '_blank']) - ) ?> -

+

- -

BcAdminForm->create($plugin, [ + 'url' => ['action' => 'update_core'], 'id' => 'PluginUpdateForm' ]) ?> BcAdminForm->control('update', ['type' => 'hidden', 'value' => true]) ?> diff --git a/plugins/bc-admin-third/webroot/js/admin/plugins/update.bundle.js b/plugins/bc-admin-third/webroot/js/admin/plugins/update.bundle.js index c173e0aa30..c45db69de2 100644 --- a/plugins/bc-admin-third/webroot/js/admin/plugins/update.bundle.js +++ b/plugins/bc-admin-third/webroot/js/admin/plugins/update.bundle.js @@ -1,4 +1,4 @@ -(()=>{"use strict";var e,t={1096:(e,t,a)=>{var i=a(8071),r={plugin:null,isWritablePackage:!1,isUpdatable:!1,mounted:function(){var e=$("#AdminPluginsUpdateScript");this.plugin=e.attr("data-plugin"),this.isUpdatable=e.attr("data-isUpdatable"),void 0===this.isUpdatable&&(this.isUpdatable=!1),this.registerEvents(),this.toggleUpdate()},registerEvents:function(){$("#BtnUpdate").on("click",this.update),$("#BtnDownload").on("click",$.bcUtil.showLoader),$("#php").on("change",this.toggleUpdate)},update:function(){if(confirm(bcI18n.confirmMessage1)){if("BaserCore"!==r.plugin)return $.bcUtil.showLoader(),!0;$.bcToken.check((function(){$.bcUtil.showLoader(),$.bcUtil.hideMessage(),i.Z.post($.bcUtil.apiAdminBaseUrl+"baser-core/plugins/update_core_files.json",{},{headers:{"X-CSRF-Token":$.bcToken.key}}).then((function(e){var t=e.data.message+bcI18n.updateMessage1;$.bcUtil.showNoticeMessage(t),$(window).scrollTop(0),$.bcUtil.showLoader(),$("#PluginUpdateForm").submit()})).catch((function(e){500===e.response.status?$.bcUtil.showAlertMessage(e.response.data.message):$.bcUtil.showAlertMessage("予期せぬエラーが発生しました。システム管理者に連絡してください。"),$.bcUtil.hideLoader(),$(window).scrollTop(0)}))}),{hideLoader:!1})}return!1},toggleUpdate:function(){var e=$("#BtnUpdate"),t=$("#BtnDownload"),a=$(".php-notice"),i=$("#php");"BaserCore"===r.plugin?(""!==i.val()?(r.isUpdatable&&e.removeAttr("disabled"),t.removeAttr("disabled")):(e.attr("disabled","disabled"),t.attr("disabled","disabled")),i.val()?a.hide():a.show()):r.isUpdatable?(e.removeAttr("disabled"),t.removeAttr("disabled")):(e.attr("disabled","disabled"),t.attr("disabled","disabled"))}}; +(()=>{"use strict"; /** * baserCMS : Based Website Development Project * Copyright (c) NPO baser foundation @@ -7,5 +7,6 @@ * @link https://basercms.net baserCMS Project * @since 5.0.0 * @license https://basercms.net/license/index.html MIT License - */r.mounted()}},a={};function i(e){var r=a[e];if(void 0!==r)return r.exports;var o=a[e]={exports:{}};return t[e].call(o.exports,o,o.exports,i),o.exports}i.m=t,e=[],i.O=(t,a,r,o)=>{if(!a){var n=1/0;for(c=0;c=o)&&Object.keys(i.O).every((e=>i.O[e](a[d])))?a.splice(d--,1):(s=!1,o0&&e[c-1][2]>o;c--)e[c]=e[c-1];e[c]=[a,r,o]},i.d=(e,t)=>{for(var a in t)i.o(t,a)&&!i.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.j=1106,(()=>{var e={1106:0};i.O.j=t=>0===e[t];var t=(t,a)=>{var r,o,[n,s,d]=a,l=0;if(n.some((t=>0!==e[t]))){for(r in s)i.o(s,r)&&(i.m[r]=s[r]);if(d)var c=d(i)}for(t&&t(a);li(1096)));r=i.O(r)})(); + */ +var t={plugin:null,isWritablePackage:!1,isUpdatable:!1,mounted:function(){var t=$("#AdminPluginsUpdateScript");this.plugin=t.attr("data-plugin"),this.isUpdatable=t.attr("data-isUpdatable"),void 0===this.isUpdatable&&(this.isUpdatable=!1),this.registerEvents(),this.toggleUpdate()},registerEvents:function(){$("#BtnUpdate").on("click",this.update),$("#BtnDownload").on("click",$.bcUtil.showLoader),$("#php").on("change",this.toggleUpdate)},update:function(){return!!confirm(bcI18n.confirmMessage1)&&($.bcUtil.showLoader(),!0)},toggleUpdate:function(){var a=$("#BtnUpdate"),e=$("#BtnDownload"),d=$(".php-notice"),i=$("#php");"BaserCore"===t.plugin?(""!==i.val()?(t.isUpdatable?a.removeAttr("disabled"):a.attr("disabled","disabled"),e.removeAttr("disabled")):(a.attr("disabled","disabled"),e.attr("disabled","disabled")),i.val()?d.hide():d.show()):t.isUpdatable?(a.removeAttr("disabled"),e.removeAttr("disabled")):(a.attr("disabled","disabled"),e.attr("disabled","disabled"))}};t.mounted()})(); //# sourceMappingURL=update.bundle.js.map \ No newline at end of file diff --git a/plugins/bc-admin-third/webroot/js/admin/plugins/update.bundle.js.map b/plugins/bc-admin-third/webroot/js/admin/plugins/update.bundle.js.map index 6cd138621f..e9ac3630e1 100644 --- a/plugins/bc-admin-third/webroot/js/admin/plugins/update.bundle.js.map +++ b/plugins/bc-admin-third/webroot/js/admin/plugins/update.bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"js/admin/plugins/update.bundle.js","mappings":"uBAAIA,E,gCCWEC,EAAa,CAKfC,OAAQ,KAKRC,mBAAmB,EAKnBC,aAAa,EAKbC,QAAO,WACH,IAAMC,EAASC,EAAE,6BACjBC,KAAKN,OAASI,EAAOG,KAAK,eAC1BD,KAAKJ,YAAcE,EAAOG,KAAK,yBACPC,IAArBF,KAAKJ,cAA2BI,KAAKJ,aAAc,GACtDI,KAAKG,iBACLH,KAAKI,cACT,EAKAD,eAAc,WACVJ,EAAE,cAAcM,GAAG,QAASL,KAAKM,QACjCP,EAAE,gBAAgBM,GAAG,QAASN,EAAEQ,OAAOC,YACvCT,EAAE,QAAQM,GAAG,SAAUL,KAAKI,aAChC,EAQAE,OAAM,WACF,GAAIG,QAAQC,OAAOC,iBAAkB,CACjC,GAA0B,cAAtBlB,EAAWC,OAEX,OADAK,EAAEQ,OAAOC,cACF,EAEXT,EAAEa,QAAQC,OAAM,WACZd,EAAEQ,OAAOC,a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["webpack://bc-admin-third/webpack/runtime/chunk loaded","webpack://bc-admin-third/./src/js/admin/plugins/update.js","webpack://bc-admin-third/webpack/bootstrap","webpack://bc-admin-third/webpack/runtime/define property getters","webpack://bc-admin-third/webpack/runtime/global","webpack://bc-admin-third/webpack/runtime/hasOwnProperty shorthand","webpack://bc-admin-third/webpack/runtime/make namespace object","webpack://bc-admin-third/webpack/runtime/runtimeId","webpack://bc-admin-third/webpack/runtime/jsonp chunk loading","webpack://bc-admin-third/webpack/startup"],"sourcesContent":["var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","/**\n * baserCMS : Based Website Development Project \n * Copyright (c) NPO baser foundation \n *\n * @copyright Copyright (c) NPO baser foundation\n * @link https://basercms.net baserCMS Project\n * @since 5.0.0\n * @license https://basercms.net/license/index.html MIT License\n */\nimport axios from \"axios\";\n\nconst updateForm = {\n\n /**\n * プラグイン名\n */\n plugin: null,\n\n /**\n * vendor / composer に書き込み権限があるか\n */\n isWritablePackage: false,\n\n /**\n * アップデートできるかどうか\n */\n isUpdatable: false,\n\n /**\n * 起動処理\n */\n mounted() {\n const script = $(\"#AdminPluginsUpdateScript\");\n this.plugin = script.attr('data-plugin');\n this.isUpdatable = script.attr('data-isUpdatable');\n if(this.isUpdatable === undefined) this.isUpdatable = false;\n this.registerEvents();\n this.toggleUpdate();\n },\n\n /**\n * イベント登録\n */\n registerEvents() {\n $(\"#BtnUpdate\").on('click', this.update);\n $(\"#BtnDownload\").on('click', $.bcUtil.showLoader);\n $(\"#php\").on('change', this.toggleUpdate);\n },\n\n /**\n * アップデート実行\n * コアのアップデートの場合、ダウンロードした最新版のファイルを適用してからリクエストを送信する\n * マイグレーションファイルがプログラムに反映されないと実行できないため、別プロセスとして実行する\n * @returns {boolean}\n */\n update() {\n if (confirm(bcI18n.confirmMessage1)) {\n if (updateForm.plugin !== 'BaserCore') {\n $.bcUtil.showLoader();\n return true;\n }\n $.bcToken.check(function () {\n $.bcUtil.showLoader();\n $.bcUtil.hideMessage();\n axios.post($.bcUtil.apiAdminBaseUrl + 'baser-core/plugins/update_core_files.json', {}, {\n headers: {\n 'X-CSRF-Token': $.bcToken.key\n }\n })\n .then(response => {\n let message = response.data.message + bcI18n.updateMessage1;\n $.bcUtil.showNoticeMessage(message);\n $(window).scrollTop(0);\n $.bcUtil.showLoader();\n // フォーム送信\n $(\"#PluginUpdateForm\").submit();\n })\n .catch(error => {\n if (error.response.status === 500) {\n $.bcUtil.showAlertMessage(error.response.data.message);\n } else {\n $.bcUtil.showAlertMessage('予期せぬエラーが発生しました。システム管理者に連絡してください。');\n }\n $.bcUtil.hideLoader();\n $(window).scrollTop(0);\n });\n }, {hideLoader: false});\n }\n return false;\n },\n\n /**\n * アップデートボタン切り替え\n */\n toggleUpdate() {\n const $btnUpdate = $(\"#BtnUpdate\");\n const $btnDownload = $(\"#BtnDownload\");\n const $phpNotice = $(\".php-notice\");\n const $inputPhp = $(\"#php\");\n\n if (updateForm.plugin === 'BaserCore') {\n if ($inputPhp.val() !== ''){\n if(updateForm.isUpdatable) {\n $btnUpdate.removeAttr('disabled');\n }\n $btnDownload.removeAttr('disabled');\n } else {\n $btnUpdate.attr('disabled', 'disabled');\n $btnDownload.attr('disabled', 'disabled');\n }\n if ($inputPhp.val()) {\n $phpNotice.hide();\n } else {\n $phpNotice.show();\n }\n } else {\n if (updateForm.isUpdatable) {\n $btnUpdate.removeAttr('disabled');\n $btnDownload.removeAttr('disabled');\n } else {\n $btnUpdate.attr('disabled', 'disabled');\n $btnDownload.attr('disabled', 'disabled');\n }\n }\n }\n\n};\n\nupdateForm.mounted();\n\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.j = 1106;","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t1106: 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkbc_admin_third\"] = self[\"webpackChunkbc_admin_third\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [5000], () => (__webpack_require__(1096)))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n"],"names":["deferred","updateForm","plugin","isWritablePackage","isUpdatable","mounted","script","$","this","attr","undefined","registerEvents","toggleUpdate","on","update","bcUtil","showLoader","confirm","bcI18n","confirmMessage1","bcToken","check","hideMessage","axios","post","apiAdminBaseUrl","headers","key","then","response","message","data","updateMessage1","showNoticeMessage","window","scrollTop","submit","error","status","showAlertMessage","hideLoader","$btnUpdate","$btnDownload","$phpNotice","$inputPhp","val","removeAttr","hide","show","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","__webpack_modules__","call","m","O","result","chunkIds","fn","priority","notFulfilled","Infinity","i","length","fulfilled","j","Object","keys","every","splice","r","d","definition","o","defineProperty","enumerable","get","g","globalThis","Function","e","obj","prop","prototype","hasOwnProperty","Symbol","toStringTag","value","installedChunks","chunkId","webpackJsonpCallback","parentChunkLoadingFunction","moreModules","runtime","some","id","chunkLoadingGlobal","self","forEach","bind","push","__webpack_exports__"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"js/admin/plugins/update.bundle.js","mappings":";;;;;;;;;;AAWA,IAAMA,EAAa,CAKfC,OAAQ,KAKRC,mBAAmB,EAKnBC,aAAa,EAKbC,QAAO,WACH,IAAMC,EAASC,EAAE,6BACjBC,KAAKN,OAASI,EAAOG,KAAK,eAC1BD,KAAKJ,YAAcE,EAAOG,KAAK,yBACPC,IAArBF,KAAKJ,cAA2BI,KAAKJ,aAAc,GACtDI,KAAKG,iBACLH,KAAKI,cACT,EAKAD,eAAc,WACVJ,EAAE,cAAcM,GAAG,QAASL,KAAKM,QACjCP,EAAE,gBAAgBM,GAAG,QAASN,EAAEQ,OAAOC,YACvCT,EAAE,QAAQM,GAAG,SAAUL,KAAKI,aAChC,EAQAE,OAAM,WACF,QAAIG,QAAQC,OAAOC,mBACfZ,EAAEQ,OAAOC,cACF,EAGf,EAKAJ,aAAY,WACR,IAAMQ,EAAab,EAAE,cACfc,EAAed,EAAE,gBACjBe,EAAaf,EAAE,eACfgB,EAAYhB,EAAE,QAEM,cAAtBN,EAAWC,QACa,KAApBqB,EAAUC,OACPvB,EAAWG,YACVgB,EAAWK,WAAW,YAEtBL,EAAWX,KAAK,WAAY,YAEhCY,EAAaI,WAAW,cAExBL,EAAWX,KAAK,WAAY,YAC5BY,EAAaZ,KAAK,WAAY,aAE9Bc,EAAUC,MACVF,EAAWI,OAEXJ,EAAWK,QAGX1B,EAAWG,aACXgB,EAAWK,WAAW,YACtBJ,EAAaI,WAAW,cAExBL,EAAWX,KAAK,WAAY,YAC5BY,EAAaZ,KAAK,WAAY,YAG1C,GAIJR,EAAWI,S","sources":["webpack://bc-admin-third/./src/js/admin/plugins/update.js"],"sourcesContent":["/**\n * baserCMS : Based Website Development Project \n * Copyright (c) NPO baser foundation \n *\n * @copyright Copyright (c) NPO baser foundation\n * @link https://basercms.net baserCMS Project\n * @since 5.0.0\n * @license https://basercms.net/license/index.html MIT License\n */\nimport axios from \"axios\";\n\nconst updateForm = {\n\n /**\n * プラグイン名\n */\n plugin: null,\n\n /**\n * vendor / composer に書き込み権限があるか\n */\n isWritablePackage: false,\n\n /**\n * アップデートできるかどうか\n */\n isUpdatable: false,\n\n /**\n * 起動処理\n */\n mounted() {\n const script = $(\"#AdminPluginsUpdateScript\");\n this.plugin = script.attr('data-plugin');\n this.isUpdatable = script.attr('data-isUpdatable');\n if(this.isUpdatable === undefined) this.isUpdatable = false;\n this.registerEvents();\n this.toggleUpdate();\n },\n\n /**\n * イベント登録\n */\n registerEvents() {\n $(\"#BtnUpdate\").on('click', this.update);\n $(\"#BtnDownload\").on('click', $.bcUtil.showLoader);\n $(\"#php\").on('change', this.toggleUpdate);\n },\n\n /**\n * アップデート実行\n * コアのアップデートの場合、ダウンロードした最新版のファイルを適用してからリクエストを送信する\n * マイグレーションファイルがプログラムに反映されないと実行できないため、別プロセスとして実行する\n * @returns {boolean}\n */\n update() {\n if (confirm(bcI18n.confirmMessage1)) {\n $.bcUtil.showLoader();\n return true;\n }\n return false;\n },\n\n /**\n * アップデートボタン切り替え\n */\n toggleUpdate() {\n const $btnUpdate = $(\"#BtnUpdate\");\n const $btnDownload = $(\"#BtnDownload\");\n const $phpNotice = $(\".php-notice\");\n const $inputPhp = $(\"#php\");\n\n if (updateForm.plugin === 'BaserCore') {\n if ($inputPhp.val() !== ''){\n if(updateForm.isUpdatable) {\n $btnUpdate.removeAttr('disabled');\n } else {\n $btnUpdate.attr('disabled', 'disabled');\n }\n $btnDownload.removeAttr('disabled');\n } else {\n $btnUpdate.attr('disabled', 'disabled');\n $btnDownload.attr('disabled', 'disabled');\n }\n if ($inputPhp.val()) {\n $phpNotice.hide();\n } else {\n $phpNotice.show();\n }\n } else {\n if (updateForm.isUpdatable) {\n $btnUpdate.removeAttr('disabled');\n $btnDownload.removeAttr('disabled');\n } else {\n $btnUpdate.attr('disabled', 'disabled');\n $btnDownload.attr('disabled', 'disabled');\n }\n }\n }\n\n};\n\nupdateForm.mounted();\n\n"],"names":["updateForm","plugin","isWritablePackage","isUpdatable","mounted","script","$","this","attr","undefined","registerEvents","toggleUpdate","on","update","bcUtil","showLoader","confirm","bcI18n","confirmMessage1","$btnUpdate","$btnDownload","$phpNotice","$inputPhp","val","removeAttr","hide","show"],"sourceRoot":""} \ No newline at end of file