Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

尝试修复 PostgreSQL 兼容性问题 #54

Merged
merged 3 commits into from
Jul 30, 2022
Merged

尝试修复 PostgreSQL 兼容性问题 #54

merged 3 commits into from
Jul 30, 2022

Conversation

weilinfox
Copy link
Contributor

Typecho 同时兼容 PostgreSQL ,但是配合该主题会出现 500 数据库错误的问题。

尝试修复之,并在最新的 Typecho v1.2.0 和 PostgreSQL 13 与 PostgreSQL 14 测试正常。

另外还写了 Links 插件可用的 Pgsql.sql ,并不知道在哪里提 PR ,所以也附在这里。 https://gist.github.com/weilinfox/48f6ea365a8692b8da7fab890b7208f0

感谢~

index.php Outdated
$pageSize = $this->options->pageSize;
$select1 = $this->select()->where('type = ?', 'post');
$select2 = $this->select()->where('type = ? && status = ? && created < ?', 'post', 'publish', time());
if ('Pgsql' == $type)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实 Mysql 的 && 也是 AND,所以都改成 AND 应该就行了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗷嗷,这里我重新改了一下

@bhaoo
Copy link
Owner

bhaoo commented Jul 30, 2022

咱还需要康康其他用到数据库的地方是否需要修改噢

@weilinfox
Copy link
Contributor Author

咱还需要康康其他用到数据库的地方是否需要修改噢

emmm 我瞅了瞅其他部分的代码,看起来没有啥问题欸。还测试了一下之前没用到的功能,暂时没有发现 bug 。

小心附上我的博客~

@bhaoo
Copy link
Owner

bhaoo commented Jul 30, 2022

咱的 docker 安装 PostgreSQL 连接 Typecho 有点问题,可能需要你看下这些模块有没有问题力!

  1. 主题后台设置备份功能(主题后台 - 备份)
  2. 评论黄色小闪电图标(需要将邮箱添加到友链插件中的“自定义数据”中并使用该邮箱进行评论)
  3. 主题后台设置能否正常显示

谢谢力!

functions.php Outdated Show resolved Hide resolved
@weilinfox
Copy link
Contributor Author

weilinfox commented Jul 30, 2022

咱的 docker 安装 PostgreSQL 连接 Typecho 有点问题,可能需要你看下这些模块有没有问题力!

1. [主题后台设置备份功能(主题后台 - 备份)](https://github.com/bhaoo/Cuckoo/blob/master/includes/setting.php#L250)

2. [评论黄色小闪电图标(需要将邮箱添加到友链插件中的“自定义数据”中并使用该邮箱进行评论)](https://github.com/bhaoo/Cuckoo/blob/master/functions.php#L151)

3. [主题后台设置能否正常显示](https://github.com/bhaoo/Cuckoo/blob/master/includes/setting.php#L34)

谢谢力!

PostgreSQL 默认只允许本地连接来,可能要配置一下 pg_hba.conf

php 模块的话,装个 php-pgsql 就行~ (如果是 Debian 系)

后台备份功能测试了一下用起来没问题吼;黄色小闪电图标因为 user 是关键字所以要用双引号括起来;主题后台一切正常的样子。

关于黄色小闪电图标,我擅自将 bhaoo 加到友链了(疯狂逃),所以可以看到修复后效果正常惹。
image

image

@bhaoo bhaoo merged commit e2fdc4b into bhaoo:master Jul 30, 2022
@bhaoo
Copy link
Owner

bhaoo commented Jul 30, 2022

OK!可以啦!感谢 PR ~

@bhaoo bhaoo added the 优化 提供新想法&新意见 label Jul 30, 2022
bhaoo pushed a commit that referenced this pull request Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
优化 提供新想法&新意见
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants