soxft / commenttomail Goto Github PK
View Code? Open in Web Editor NEWA typecho comment push plugin
License: GNU General Public License v3.0
A typecho comment push plugin
License: GNU General Public License v3.0
插件不支持STARTTLS协议,也就无法支持到Outlook邮箱
最外部的系统是Ubuntu 20.04
里面装了docker,使用的joyqi/typecho:1.2.0-php8.0-fpm-alpine镜像。
安装之后一开始报错,发现是PHP8.0的问题,然后自己手动改了代码:
之前 $files = glob($this->_template_dir . '.{html,HTML}', GLOB_BRACE);
之后 $files = glob($this->_template_dir . '.html');
后来发现还是不能用,于是自己手动添加了postgres的一个文件内容如下:
CREATE TABLE IF NOT EXISTS typecho_mail (
id SERIAL PRIMARY KEY,
content text NOT NULL,
sent int DEFAULT 0
);
然后没有出现任何报错了,同时测试邮件可以发出去,但是评论之后没有邮件。
我用输出log的方式调试了一下,发现Plugin.php里面的函数都可以正常执行,但是Action.php中的函数没有一个得到了执行。看typecho的官方文档也没有提到Action的作用,我也不明白这个文件中的函数是怎么被调用的,所以过来求助。
发送邮件时提示typecho.typecho_email这张表不存在,看了一下Plugin.php中的dbInstall
Lines 245 to 251 in 07c5df1
发现是type字段的问题,我这里返回的type是mysqli而不是mysql
复制一份/sql下的Mysql.sql,重命名为Mysqli.sql
如下错误是需要使用PHP8.0么,因为现在是PHP7.2。如果是PHP7.2,应该如何修改,谢谢
syntax error, unexpected 'Db' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)
安装,启用,配置都没有问题,但是一评论就报错。
在评论邮件提醒中看到了这个报错。
Error: Undefined constant "TypechoPlugin\CommentToMail\GLOB_BRACE" in /app/usr/plugins/CommentToMail/Console.php:49
Stack trace:
#0 /app/var/Typecho/Widget.php(155): TypechoPlugin\CommentToMail\Console->execute()
#1 /app/usr/plugins/CommentToMail/page/console.php(54): Typecho\Widget::widget('TypechoPlugin\C...')
#2 /app/admin/extending.php(14): require_once('/app/usr/plugin...')
#3 {main}
在StackOverflow中看到了解释,我用的是dockers alpine镜像导致了报错。
https://stackoverflow.com/questions/48377176/notice-use-of-undefined-constant-glob-brace
具体报错:syntax error, unexpected '|', expecting ';' or '{'
具体环境:php7.4、Typecho1.2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.