Skip to content

Commit

Permalink
Merge branch '5.1.x' into custom-datepicker
Browse files Browse the repository at this point in the history
  • Loading branch information
seto1 committed Jul 1, 2024
2 parents 32c78b3 + a660aaf commit 4e98435
Show file tree
Hide file tree
Showing 23 changed files with 149 additions and 130 deletions.
38 changes: 17 additions & 21 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,11 @@
"BcInstaller\\": "plugins/bc-installer/src/",
"BcMail\\": "plugins/bc-mail/src/",
"BcSearchIndex\\": "plugins/bc-search-index/src/",
"BcSpaSample\\": "plugins/BcSpaSample/src/",
"BcThemeConfig\\": "plugins/bc-theme-config/src/",
"BcThemeFile\\": "plugins/bc-theme-file/src/",
"BcUploader\\": "plugins/bc-uploader/src/",
"BcWidgetArea\\": "plugins/bc-widget-area/src/",
"Cake\\Routing\\": "plugins/baser-core/src/Routing",
"SoftDelete\\": "plugins/cakephp-soft-delete/src"
"Cake\\Routing\\": "plugins/baser-core/src/Routing"
}
},
"autoload-dev": {
Expand All @@ -74,27 +72,25 @@
"BcThemeConfig\\Test\\": "plugins/bc-theme-config/tests/",
"BcThemeFile\\Test\\": "plugins/bc-theme-file/tests/",
"BcUploader\\Test\\": "plugins/bc-uploader/tests/",
"BcWidgetArea\\Test\\": "plugins/bc-widget-area/tests/",
"SoftDelete\\Test\\": "plugins/cakephp-soft-delete/tests"
"BcWidgetArea\\Test\\": "plugins/bc-widget-area/tests/"
}
},
"replace": {
"baserproject/baser-core": "5.0.18",
"baserproject/bc-admin-third": "5.0.18",
"baserproject/bc-blog": "5.0.18",
"baserproject/bc-column": "5.0.18",
"baserproject/bc-content-link": "5.0.18",
"baserproject/bc-custom-content": "5.0.18",
"baserproject/bc-editor-template": "5.0.18",
"baserproject/bc-favorite": "5.0.18",
"baserproject/bc-front": "5.0.18",
"baserproject/bc-installer": "5.0.18",
"baserproject/bc-mail": "5.0.18",
"baserproject/bc-search-index": "5.0.18",
"baserproject/bc-theme-config": "5.0.18",
"baserproject/bc-theme-file": "5.0.18",
"baserproject/bc-uploader": "5.0.18",
"baserproject/bc-widget-area": "5.0.18"
"baserproject/baser-core": "5.0.19",
"baserproject/bc-admin-third": "5.0.19",
"baserproject/bc-blog": "5.0.19",
"baserproject/bc-content-link": "5.0.19",
"baserproject/bc-custom-content": "5.0.19",
"baserproject/bc-editor-template": "5.0.19",
"baserproject/bc-favorite": "5.0.19",
"baserproject/bc-front": "5.0.19",
"baserproject/bc-installer": "5.0.19",
"baserproject/bc-mail": "5.0.19",
"baserproject/bc-search-index": "5.0.19",
"baserproject/bc-theme-config": "5.0.19",
"baserproject/bc-theme-file": "5.0.19",
"baserproject/bc-uploader": "5.0.19",
"baserproject/bc-widget-area": "5.0.19"
},
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall",
Expand Down
3 changes: 2 additions & 1 deletion monorepo-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@

return static function (MBConfig $mbConfig): void {
$mbConfig->packageDirectories([__DIR__ . '/plugins']);
$version = (!empty($_SERVER['argv'][2]))?: '';
$version = (!empty($_SERVER['argv'][2]))? $_SERVER['argv'][2] : '';
if(!$version) return;
$mbConfig->packageDirectoriesExcludes([
__DIR__ . '/plugins/BcThemeSample',
__DIR__ . '/plugins/BcPluginSample',
__DIR__ . '/plugins/BcColumn',
]);
// for "merge" command
$mbConfig->dataToAppend([
Expand Down
13 changes: 0 additions & 13 deletions plugins/BcColumn/composer.json

This file was deleted.

17 changes: 17 additions & 0 deletions plugins/baser-core/VERSION.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@
CHG: 変更内容 / BUG: バグフィックス / NEW: 機能追加


[2024-06-27] basercms-5.0.19
- CHG [BC] Cake\ORM\Table::find()の前後にイベントを追加
- CHG [BC] BcFormHelperのcontrolメソッドに beforeControl追加
- CHG [BC] アップデーター取得、アップデートメッセージ取得について、アップデート用の一時ディレクトリを確認するオプションを追加
- CHG [UL] アップロードカテゴリにページネーションのUIを追加
- BUG [BC] コンテンツの並び替え時に不用意な動作となってしまう問題を改善
- BUG [BC] コンテンツ管理ちらつき軽減
- BUG [BC] 管理画面ログイン後のリダイレクトが動作していない問題を改善 #3523
- BUG [BC] 【システム】管理画面でお気に入りの削除を行った直後にお気に入りの追加を行えない問題を改善 fix #3537
- BUG [BC] ごみ箱にファイルがある状態でツリー構造チェックを行うと常にエラーになる問題を修正 fix #3488
- BUG [BC] アップデーターを改善
- BUG [BC] windows 環境にてプラグインのアップロードが正常にできない問題について調整
- BUG [BC] 【固定ページ】$this->BcPage->getPageList() でフォルダに属するページのデータを取得できない問題を改善 fix #3527
- BUG [BC] BcZipでZipファイルを解凍する場合、ZipArchiveライブラリが入っていないと失敗する問題について改善
- BUG [BC] baserCMSコアのアップデートがxdebug不足により失敗する事象の修正 fix #3509
- BUG [UL] アップロードファイル・カテゴリ ページネーション調整

[2024-06-08] basercms-5.0.18
- CHG [BC] プラグインアップロードにて plugins ディレクトリの書き込み権限チェックを追加
- BUG [BC] アップデート通知が正常に表示できない問題を改善
Expand Down
30 changes: 15 additions & 15 deletions plugins/baser-core/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
"josegonzalez/dotenv": "^3.2",
"mobiledetect/mobiledetectlib": "^4.8.03",
"ext-json": "*",
"baserproject/bc-admin-third": "5.1.x",
"baserproject/bc-blog": "5.1.x",
"baserproject/bc-content-link": "5.1.x",
"baserproject/bc-custom-content": "5.1.x",
"baserproject/bc-editor-template": "5.1.x",
"baserproject/bc-favorite": "5.1.x",
"baserproject/bc-front": "5.1.x",
"baserproject/bc-installer": "5.1.x",
"baserproject/bc-mail": "5.1.x",
"baserproject/bc-search-index": "5.1.x",
"baserproject/bc-theme-config": "5.1.x",
"baserproject/bc-theme-file": "5.1.x",
"baserproject/bc-uploader": "5.1.x",
"baserproject/bc-widget-area": "5.1.x",
"baserproject/bc-admin-third": "5.1.0",
"baserproject/bc-blog": "5.1.0",
"baserproject/bc-content-link": "5.1.0",
"baserproject/bc-custom-content": "5.1.0",
"baserproject/bc-editor-template": "5.1.0",
"baserproject/bc-favorite": "5.1.0",
"baserproject/bc-front": "5.1.0",
"baserproject/bc-installer": "5.1.0",
"baserproject/bc-mail": "5.1.0",
"baserproject/bc-search-index": "5.1.0",
"baserproject/bc-theme-config": "5.1.0",
"baserproject/bc-theme-file": "5.1.0",
"baserproject/bc-uploader": "5.1.0",
"baserproject/bc-widget-area": "5.1.0",
"ext-mbstring": "*",
"ext-zip": "*",
"ext-gd": "*"
Expand All @@ -40,7 +40,7 @@
"cakephp/debug_kit": "^5.0.0",
"josegonzalez/dotenv": "^4.0",
"phpunit/phpunit": "^10.1.0",
"symplify/monorepo-builder": "^10.2",
"symplify/monorepo-builder": "^11.2",
"vierge-noire/cakephp-fixture-factories": "^3.0",
"vierge-noire/cakephp-test-suite-light": "^3.0",
"ext-xdebug": "*"
Expand Down
10 changes: 5 additions & 5 deletions plugins/baser-core/src/Model/Table/AppTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,19 @@ public function find(string $type = 'all', mixed ...$args): Query
{
// EVENT beforeFind
$event = $this->dispatchLayerEvent('beforeFind', [
'type' => $type, 'options' =>
$args['options'] ?? []
'type' => $type,
'options' => $args // 後方互換のため options として渡す
]);
if ($event !== false) {
$args['options'] = ($event->getResult() === null || $event->getResult() === true) ? $event->getData('options') : $event->getResult();
$args = ($event->getResult() === null || $event->getResult() === true) ? $event->getData('options') : $event->getResult();
}

$result = $this->callFinder($type, $this->selectQuery(), ...$args);
$result = parent::find($type, ...$args);

// EVENT afterFind
$event = $this->dispatchLayerEvent('afterFind', [
'type' => $type,
'options' => $args['options'] ?? [],
'options' => $args,
'result' => $result
]);
if ($event !== false) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/baser-core/src/Service/PluginsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ public function getAvailableCoreVersionInfo()
* @noTodo
* @unitTest
*/
public function getCoreUpdate(string $targetVersion, string $php, bool $force = false)
public function getCoreUpdate(string $targetVersion, string $php, ?bool $force = false)
{
if (function_exists('ini_set')) {
ini_set('max_execution_time', 0);
Expand Down
3 changes: 1 addition & 2 deletions plugins/baser-core/src/Service/ThemesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,11 @@ public function add(array $postData): string
}
$name = $postData['file']->getClientFileName();
$postData['file']->moveTo(TMP . $name);
$srcDirName = basename($name, '.zip');
$zip = new BcZip();
if (!$zip->extract(TMP . $name, TMP)) {
throw new BcException(__d('baser_core', 'アップロードしたZIPファイルの展開に失敗しました。'));
}

$srcDirName = $zip->topArchiveName;
$dstName = $srcName = Inflector::camelize($srcDirName);
if (preg_match('/^(.+?)([0-9]+)$/', $srcName, $matches)) {
$baseName = $matches[1];
Expand Down
1 change: 1 addition & 0 deletions plugins/baser-core/src/View/Helper/BcXmlHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class BcXmlHelper extends Helper
* @return string XML宣言
* @checked
* @noTodo
* @unitTest
*/
public function header($attrib = [])
{
Expand Down
21 changes: 18 additions & 3 deletions plugins/baser-core/tests/TestCase/View/Helper/BcXmlHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

use BaserCore\TestSuite\BcTestCase;
use BaserCore\View\Helper\BcTextHelper;
use BaserCore\View\Helper\BcXmlHelper;
use Cake\View\View;

/**
* text helper library.
Expand All @@ -26,8 +28,7 @@ class BcXmlHelperTest extends BcTestCase
public function setUp(): void
{
parent::setUp();
// $View = new View();
// $this->BcXml = new BcXmlHelper($View);
$this->BcXml = new BcXmlHelper(new View());
}

/**
Expand All @@ -52,7 +53,6 @@ public function tearDown(): void
*/
public function testHeader($attrib, $agent, $expected)
{
$this->markTestIncomplete('このテストは、まだ実装されていません。');
$_SERVER['HTTP_USER_AGENT'] = $agent;

$result = $this->BcXml->header($attrib);
Expand Down Expand Up @@ -82,6 +82,21 @@ public static function headerDataProvider()
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1',
'<?xml version="1.0" encoding="SJIS" ?>'
],
[
'xml-stylesheet',
'Mozilla/5.0',
'<?xml-stylesheet ?>'
],
[
'stylesheet',
'Mozilla/5.0',
'<?xml stylesheet ?>'
],
[
[],
'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',
''
]
];
}

Expand Down
1 change: 0 additions & 1 deletion plugins/bc-admin-third/VERSION.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
<?php echo $this->BcAdminForm->control('currentVersion', ['type' => 'hidden', 'value' => $programVersion]) ?>
<?php echo $this->BcAdminForm->control('targetVersion', ['type' => 'hidden', 'value' => $availableVersion]) ?>

<p>
<?php echo __d('baser_core', 'ダウンロード対象バージョン') ?>
<?php echo $this->BcAdminForm->control('targetVersion', ['type' => 'text', 'value' => $availableVersion]) ?>
</p>
<p>
<?php echo __d('baser_core', 'PHP CLI の実行パス') ?>
<?php echo $this->BcAdminForm->control('php', [
Expand Down
8 changes: 4 additions & 4 deletions plugins/bc-blog/src/Controller/BlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function index(
*
* ### URL例
* - カテゴリ別記事一覧: /news/archives/category/category-name
* - 作成者別記事一覧: /news/archives/author/author-name
* - 作成者別記事一覧: /news/archives/author/user-id
* - タグ別記事一覧: /news/archives/tag/tag-name
* - 年別記事一覧: /news/archives/date/2022
* - 月別記事一覧: /news/archives/date/2022/12
Expand Down Expand Up @@ -198,15 +198,15 @@ public function archives(

case 'author':
if (count($pass) > 2) $this->notFound();
$author = isset($pass[1])? $pass[1] : '';
$userId = isset($pass[1]) ? (int) $pass[1] : '';
$this->set($service->getViewVarsForArchivesByAuthor(
$this->paginate($blogPostsService->getIndexByAuthor($author, array_merge([
$this->paginate($blogPostsService->getIndexByAuthor($userId, array_merge([
'status' => 'publish',
'blog_content_id' => $blogContent->id,
'direction' => $blogContent->list_direction,
'draft' => false
], $this->getRequest()->getQueryParams())), ['limit' => $blogContent->list_count]),
$author,
$userId,
$blogContent
));
break;
Expand Down
28 changes: 3 additions & 25 deletions plugins/bc-blog/src/Service/BlogPostsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ protected function createIndexConditions(Query $query, array $params)
'site_id' => null,
'category' => null,
'keyword' => null,
'author' => null,
'tag' => null,
'year' => null,
'month' => null,
Expand Down Expand Up @@ -342,10 +341,6 @@ protected function createIndexConditions(Query $query, array $params)
if ($params['keyword']) {
$conditions = $this->createKeywordCondition($conditions, $params['keyword']);
}
// 作成者
if ($params['author']) {
$conditions = $this->createAuthorCondition($conditions, $params['author']);
}
return $query->where($conditions);
}

Expand Down Expand Up @@ -538,23 +533,6 @@ public function createYearMonthDayCondition($conditions, $year, $month, $day)
return $conditions;
}

/**
* 作成者の条件を作成する
*
* @param array $conditions
* @param string $author
* @return array
* @checked
* @noTodo
* @unitTest
*/
public function createAuthorCondition($conditions, $author)
{
$user = $this->BlogPosts->Users->find()->where(['Users.name' => $author])->first();
$conditions['BlogPosts.user_id'] = $user->id;
return $conditions;
}

/**
* 初期データ用のエンティティを取得
*
Expand Down Expand Up @@ -809,16 +787,16 @@ public function getIndexByCategory($category, array $options = [])
/**
* 著者別記事一覧を取得
*
* @param string $author
* @param int $userId
* @param array $options
* @return Query
* @checked
* @noTodo
* @unitTest
*/
public function getIndexByAuthor(string $author, array $options = [])
public function getIndexByAuthor(int $userId, array $options = [])
{
$options['author'] = $author;
$options['user_id'] = $userId;
return $this->getIndex($options);
}

Expand Down
4 changes: 2 additions & 2 deletions plugins/bc-blog/src/Service/BlogPostsServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,14 @@ public function getIndexByCategory($category, array $options = []);
/**
* 著者別記事一覧を取得
*
* @param string $author
* @param int $userId
* @param array $options
* @return Query
* @checked
* @noTodo
* @unitTest
*/
public function getIndexByAuthor(string $author, array $options = []);
public function getIndexByAuthor(int $userId, array $options = []);

/**
* タグ別記事一覧を取得
Expand Down
Loading

0 comments on commit 4e98435

Please sign in to comment.