Package Data | |
---|---|
Maintainer Username: | branchzero |
Maintainer Contact: | branchzero@elemenx.com (BranchZero Sun) |
Package Create Date: | 2018-02-27 |
Package Last Update: | 2018-12-03 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-15 15:10:56 |
Package Statistics | |
---|---|
Total Downloads: | 12 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 20 |
Total Watchers: | 2 |
Total Forks: | 3 |
Total Open Issues: | 2 |
本项目参考了如下项目,对此表示感谢
该项目的目的是为了将 Discuz 迁移到 Flarum 中
执行以下命令
sed -i "s#a-z0-9_-#-_a-z0-9\\x7f-\\xff#" \
vendor/flarum/core/src/Core/Validator/UserValidator.php
sed -i "s#a-z0-9_-#-_a-zA-Z0-9\\x7f-\\xff#" \
vendor/flarum/flarum-ext-mentions/src/Listener/FormatPostMentions.php \
vendor/flarum/flarum-ext-mentions/src/Listener/FormatUserMentions.php
sed -i "s#getIdForUsername(#getIdForUsername(rawurlencode(#; /getIdForUsername/s/'))/')))/" \
vendor/flarum/flarum-ext-mentions/src/Listener/FormatUserMentions.php
支持中文搜索
找到 vendor/flarum/core/src/Core/Search/Discussion/Fulltext/MySqlFulltextDriver.php
修改 match 方法为
public function match($string)
{
$discussionIds = Discussion::whereRaw("is_approved = 1")
->where('title', 'like', '%'.$string.'%')
->orderBy('id', 'desc')
->limit(50)
->lists('id','start_post_id');
$relevantPostIds = [];
foreach ($discussionIds as $postId => $discussionId) {
$relevantPostIds[$discussionId][] = $postId;
}
$discussionIds = Post::whereRaw("is_approved = 1")
->where('content', 'like', '%'.$string.'%')
->orderBy('id', 'desc')
->limit(50)
->lists('discussion_id', 'id');
foreach ($discussionIds as $postId => $discussionId) {
$relevantPostIds[$discussionId][] = $postId;
}
return $relevantPostIds;
}