Skip to content

Commit

Permalink
Merge branch '5.1.x' into fix-3819
Browse files Browse the repository at this point in the history
  • Loading branch information
seto1 committed Nov 7, 2024
2 parents 94b6bcc + 4ad5093 commit 20cd81f
Show file tree
Hide file tree
Showing 68 changed files with 986 additions and 195 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ node_modules
# db
/db/*
!/db/.gitkeep
# profiler
/profiler/*
# etc
LOCAL_TODO.md
LOCAL_Q&A.md
36 changes: 18 additions & 18 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,23 @@
}
},
"replace": {
"baserproject/baser-core": "5.1.2",
"baserproject/bc-admin-third": "5.1.2",
"baserproject/bc-blog": "5.1.2",
"baserproject/bc-column": "5.1.2",
"baserproject/bc-content-link": "5.1.2",
"baserproject/bc-custom-content": "5.1.2",
"baserproject/bc-editor-template": "5.1.2",
"baserproject/bc-favorite": "5.1.2",
"baserproject/bc-front": "5.1.2",
"baserproject/bc-installer": "5.1.2",
"baserproject/bc-mail": "5.1.2",
"baserproject/bc-plugin-sample": "5.1.2",
"baserproject/bc-search-index": "5.1.2",
"baserproject/bc-theme-config": "5.1.2",
"baserproject/bc-theme-file": "5.1.2",
"baserproject/bc-theme-sample": "5.1.2",
"baserproject/bc-uploader": "5.1.2",
"baserproject/bc-widget-area": "5.1.2"
"baserproject/baser-core": "5.1.3",
"baserproject/bc-admin-third": "5.1.3",
"baserproject/bc-blog": "5.1.3",
"baserproject/bc-column": "5.1.3",
"baserproject/bc-content-link": "5.1.3",
"baserproject/bc-custom-content": "5.1.3",
"baserproject/bc-editor-template": "5.1.3",
"baserproject/bc-favorite": "5.1.3",
"baserproject/bc-front": "5.1.3",
"baserproject/bc-installer": "5.1.3",
"baserproject/bc-mail": "5.1.3",
"baserproject/bc-plugin-sample": "5.1.3",
"baserproject/bc-search-index": "5.1.3",
"baserproject/bc-theme-config": "5.1.3",
"baserproject/bc-theme-file": "5.1.3",
"baserproject/bc-theme-sample": "5.1.3",
"baserproject/bc-uploader": "5.1.3",
"baserproject/bc-widget-area": "5.1.3"
}
}
21 changes: 20 additions & 1 deletion plugins/baser-core/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
5.1.3
5.1.4

///////////////////////////////////////////////////////////////////////////////////////////////////////////
// +---------------------------------------------------------------------------------------------------+ //
Expand All @@ -14,6 +14,25 @@
CHG: 変更内容 / BUG: バグフィックス / NEW: 機能追加


[2024-10-24] basercms-5.1.3
- NEW [BC] さくらのVPSのSSLに対応
- CHG [BC] baserCMS4系で使用していたときのパスワードが引き継げない問題を解決
- BUG [BC] プラグイン一覧に開発者の表記にbrタグが入ってる問題を調整
- BUG [BC] 初期ユーザー以外のシステム管理ユーザーは自分のユーザー情報を編集しようとすると運営ユーザーしか選択できなくなる問題を解決
- BUG [BC] 利用可能バージョンの取得処理を調整
- BUG [BC] サブフォルダ環境でログイン時のリダイレクト先が間違っている問題を改善
- BUG [BC] 固定ページをエレメントとして読み込めない問題を改善
- BUG [BC] メインサイトの管理画面からサブサイト記事にアクセスするとURLが正しく生成されない問題を解消
- BUG [BC] カスタムコンテンツ:エラーメッセージに情報不足な部分がある問題を改善
- BUG [BC] メインサイトでブログのエイリアスを作成すると、Blog->Posts()で呼び出された記事のURLがすべて1つ目のエイリアスのURLになってしまう問題を改善
- BUG [BC] SitesTable::findByUrl() の判定を調整
- BUG [BC] サブサイト(独自ドメイン)で作成したページがエイリアス付きサブサイトと混同される問題を改善
- BUG [BC] カスタムコンテンツにてファイル項目を含むエントリーをプレビュー時にエラーとなる問題を改善
- BUG [BC] エディタをなしに設定しても、ブログ記事の編集画面でCKEditorが選択されてしまう問題を改善
- BUG [BC] 管理画面テーマの選択の不具合を改善 fix #3884
- BUG [UL] フロント側のログインユーザーに公開期間外のアップロードファイルが表示されてしまう問題を改善


[2024-09-26] basercms-5.1.2
- NEW [BC] JWTキー生成コマンド追加
- BUG [BC] BcUploadで作成したフォルダの権限が書き込み可能になっていない問題を改善
Expand Down
10 changes: 10 additions & 0 deletions plugins/baser-core/config/setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,16 @@
*/
'enableRootRoutes' => false,

/**
* bc_formのテンプレートを指定
* config/bc_form.phpを差し替える
* プラグイン記法 (プラグイン名.テンプレート名)
*/
//basercms/plugins/baser-core/src/View/AppView.php
'AppFormTemplate' => 'BaserCore.bc_form',
//basercms/plugins/baser-core/src/View/BcAdminAppView.php
'AdminFormTemplate' => 'BaserCore.bc_form',

/**
* システムナビ
*
Expand Down
118 changes: 84 additions & 34 deletions plugins/baser-core/src/BaserCorePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function bootstrap(PluginApplicationInterface $app): void
}

/**
* プラグインロード
* テーマ・プラグインロード
*/
if (!filter_var(env('USE_DEBUG_KIT', true), FILTER_VALIDATE_BOOLEAN)) {
// 明示的に指定がない場合、DebugKitは重すぎるのでデバッグモードでも利用しない
Expand All @@ -164,19 +164,19 @@ public function bootstrap(PluginApplicationInterface $app): void
}

if (BcUtil::isTest()) $app->addPlugin('CakephpFixtureFactories');
$app->addPlugin('Authentication');
$app->addPlugin('Migrations');

$this->addTheme($app);

$plugins = BcUtil::getEnablePlugins();
if ($plugins) {
foreach($plugins as $plugin) {
if (BcUtil::includePluginClass($plugin->name)) {
$this->loadPlugin($app, $plugin->name, $plugin->priority);
}
}
}
// 利用可能なテーマを取得
$themes = $this->getAvailableThemes();
// プラグインを追加する前にテーマが保有するプラグインのパスをセット
$this->setupThemePlugin($themes);
// テーマが保有するプラグインも含めてプラグインを読み込む
$this->addPlugin($app);
// ======================================================
// テーマはプラグインの後に読み込む
// テーマもプラグインとして扱う場合があるため、
// その場合に、テーマでプラグインの設定等を上書きできるようにする
// ======================================================
$this->addTheme($app, $themes);

/**
* デフォルトテンプレートを設定する
Expand All @@ -194,42 +194,66 @@ public function bootstrap(PluginApplicationInterface $app): void
$event->on(new BcAuthenticationEventListener());
}

/**
* プラグインを追加する
* @param PluginApplicationInterface $app
* @return void
* @checked
* @noTodo
*/
public function addPlugin(PluginApplicationInterface $app): void
{
$app->addPlugin('Authentication');
$app->addPlugin('Migrations');

$plugins = BcUtil::getEnablePlugins();
if(!$plugins) return;
foreach($plugins as $plugin) {
if (!BcUtil::includePluginClass($plugin->name)) continue;
$this->loadPlugin($app, $plugin->name, $plugin->priority);
}
}

/**
* テーマを追加する
*
* テーマ内のプラグインも追加する
*
* @param PluginApplicationInterface $application
* @noTodo
* @checked
*/
public function addTheme(PluginApplicationInterface $application)
public function addTheme(PluginApplicationInterface $application, array $themes): void
{
$application->addPlugin(Inflector::camelize(Configure::read('BcApp.coreAdminTheme'), '-'));
$application->addPlugin(Inflector::camelize(Configure::read('BcApp.coreFrontTheme'), '-'));
if (!BcUtil::isInstalled()) return;
$sitesTable = TableRegistry::getTableLocator()->get('BaserCore.Sites');
try {
$sites = $sitesTable->find()->where(['Sites.status' => true]);
} catch (MissingConnectionException) {
return;

foreach($themes as $theme) {
if(!BcUtil::includePluginClass($theme)) continue;
try {
$application->addPlugin($theme);
} catch (MissingPluginException $e) {
$this->log($e->getMessage());
}
}
}

/**
* テーマが保有するプラグインのパスを追加する
* @param array $themes
* @return void
* @checked
* @noTodo
*/
public function setupThemePlugin(array $themes): void
{
if (!BcUtil::isInstalled()) return;
if(!$themes) return;
$path = [];
foreach($sites as $site) {
if ($site->theme) {
if(!BcUtil::includePluginClass($site->theme)) continue;
try {
$application->addPlugin($site->theme);
$pluginPath = CorePlugin::path($site->theme) . 'plugins' . DS;
if (!is_dir($pluginPath)) continue;
$path[] = $pluginPath;
} catch (MissingPluginException $e) {
$this->log($e->getMessage());
}
}
foreach($themes as $theme) {
$pluginsPath = CorePlugin::path($theme) . 'plugins' . DS;
if (!is_dir($pluginsPath)) continue;
$path[] = $pluginsPath;
}
// テーマプラグインを追加
if($path) {
Configure::write('App.paths.plugins', array_merge(
Configure::read('App.paths.plugins'),
Expand All @@ -238,6 +262,32 @@ public function addTheme(PluginApplicationInterface $application)
}
}

/**
* 利用可能なテーマを取得する
* @return array
* @checked
* @noTodo
*/
public function getAvailableThemes(): array
{
if (!BcUtil::isInstalled()) return [];
$sitesTable = TableRegistry::getTableLocator()->get('BaserCore.Sites');
try {
$sites = $sitesTable->find()->where(['Sites.status' => true]);
} catch (MissingConnectionException) {
return [];
}
$themes = [];
foreach($sites as $site) {
if ($site->theme) {
if (!is_dir(CorePlugin::path($site->theme))) continue;
if(in_array($site->theme, $themes)) continue;
$themes[] = $site->theme;
}
}
return $themes;
}

/**
* デフォルトテンプレートを設定する
* @checked
Expand Down
1 change: 1 addition & 0 deletions plugins/baser-core/src/Command/ComposerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class ComposerCommand extends Command
* @return \Cake\Console\ConsoleOptionParser
* @checked
* @noTodo
* @unitTest
*/
protected function buildOptionParser(\Cake\Console\ConsoleOptionParser $parser): \Cake\Console\ConsoleOptionParser
{
Expand Down
2 changes: 2 additions & 0 deletions plugins/baser-core/src/Command/CreateReleaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ protected function buildOptionParser(\Cake\Console\ConsoleOptionParser $parser):
* @return int|void|null
* @checked
* @noTodo
* @unitTest
*/
public function execute(Arguments $args, ConsoleIo $io)
{
Expand Down Expand Up @@ -109,6 +110,7 @@ public function execute(Arguments $args, ConsoleIo $io)
* @param string $packagePath
* @checked
* @noTodo
* @unitTest
*/
public function clonePackage(string $packagePath, string $branch)
{
Expand Down
1 change: 1 addition & 0 deletions plugins/baser-core/src/Command/SetupInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class SetupInstallCommand extends Command
* @return int|void|null
* @checked
* @noTodo
* @unitTest
*/
public function execute(Arguments $args, ConsoleIo $io)
{
Expand Down
1 change: 1 addition & 0 deletions plugins/baser-core/src/Command/SetupTestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class SetupTestCommand extends Command
* @return int|void|null
* @checked
* @noTodo
* @unitTest
*/
public function execute(Arguments $args, ConsoleIo $io)
{
Expand Down
1 change: 1 addition & 0 deletions plugins/baser-core/src/Controller/AppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public function beforeFilter(EventInterface $event)
* @return bool
* @noTodo
* @checked
* @unitTest
*/
private function checkPermission()
{
Expand Down
1 change: 1 addition & 0 deletions plugins/baser-core/src/Controller/BcFrontAppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function beforeFilter(EventInterface $event)
* @param EventInterface $event
* @checked
* @noTodo
* @unitTest
*/
public function beforeRender(EventInterface $event): void
{
Expand Down
1 change: 1 addition & 0 deletions plugins/baser-core/src/Controller/UploadsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class UploadsController extends AppController
* @return \Cake\Http\Response
* @checked
* @noTodo
* @unitTest
*/
public function tmp()
{
Expand Down
1 change: 1 addition & 0 deletions plugins/baser-core/src/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class UsersController extends BcFrontAppController
* @return void
* @checked
* @noTodo
* @unitTest
*/
public function initialize(): void
{
Expand Down
2 changes: 2 additions & 0 deletions plugins/baser-core/src/Model/Behavior/BcContentsBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public function getType(): string
* アソシエーション時に alias を除外する
* @checked
* @noTodo
* @unitTest
*/
public function offAlias(): void
{
Expand All @@ -99,6 +100,7 @@ public function offAlias(): void
* アソシエーション時に alias を含める
* @checked
* @noTodo
* @unitTest
*/
public function onAlias(): void
{
Expand Down
4 changes: 2 additions & 2 deletions plugins/baser-core/src/Model/Table/ContentsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ public function getUniqueName($name, $parentId, $contentId = null)
$query = $this->find()->where(['name LIKE' => $name . '%', 'site_root' => false]);
if (isset($parentId)) $query = $query->andWhere(['parent_id' => $parentId]);
if ($contentId) {
$query = $query->andWhere(['id <>' => $contentId]);
$query = $query->andWhere(['Contents.id <>' => $contentId]);
}
$datas = $query->select('name')->orderBy('name')->all()->toArray();
$datas = Hash::extract($datas, '{n}.name');
Expand Down Expand Up @@ -1221,7 +1221,7 @@ public function getRelatedSiteContents(int $id, array $options = []): array
['Sites.status' => true]
];
if ($options['excludeIds']) {
$conditions['Contents.site_id <>'] = $options['excludeIds'];
$conditions['Contents.site_id NOT IN'] = $options['excludeIds'];
}
$conditions = array_merge($conditions, $this->getConditionAllowPublish());

Expand Down
4 changes: 2 additions & 2 deletions plugins/baser-core/src/Model/Table/SitesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public function pluginExistsByDasherize($value)
*/
public function getPublishedAll(): ResultSetInterface
{
return $this->find()->where(['status' => true])->all();
return $this->find()->where(['Sites.status' => true])->all();
}

/**
Expand All @@ -236,7 +236,7 @@ public function getList($mainSiteId = null, $options = [])

$conditions = [];
if (!is_null($options['status'])) {
$conditions = ['status' => $options['status']];
$conditions = ['Sites.status' => $options['status']];
}

if (!is_null($mainSiteId)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ public function getViewVarsForAdd()
* @return bool
* @checked
* @noTodo
* @unitTest
*/
public function isPluginsDirWritable()
{
Expand Down
Loading

0 comments on commit 20cd81f

Please sign in to comment.