I’m slogging through the conversion of mail_digests.php, which is now a run method on a mailer class in a cron folder of the extension. There are a couple of issues that are hard to puzzle through. First, I want the same program to be used both as a phpBB system cron (called once an hour) and be called manually from the Administration Control Panel when needed for troubleshooting purposes. (Previously you had to run mail_digests.php from a URL for initial testing. This won’t work with the new architecture.) Figuring out how to do this dual handshake though it pretty challenging.
Digests uses the messenger class to mail digests but the messenger class templating system is not smart enough to do loops, so I have to borrow from the templating system for the bulk of each digest’s content then copy and paste the results into the messenger class. I need loops in the template system to logically arrange posts into blocks of posts inside forums and topics. However, with the new architecture it’s not easy for an ACP program to use templates outside of an ACP environment. I eventually figured out that just copying these templates inside the ACP template area (ext/phpbbservices/digests/acp/style) worked when in an ACP mode.
Now I am focusing on how to save a digest to a file. So far I haven’t figured out how to do this, because the messenger class does not have an assign_display method like the template class has. I’m hoping the phpBB mod writers group can suggest something. It’s not a critical feature but I’d hate to remove it. I’ll most likely have to extend the messenger class to do this. Speaking of extending classes, I have to extend this class anyhow to allow it to send HTML formatted emails. I haven’t extended a class in any major way before, so that’s a learning curve I’ll be tackling soon.
The good news is that all the code from mail_digests.php is ported over. I am tweaking it so it can be used from the ACP. It will need extensive testing which will take time but to do this testing I have to send actual emails with digests out. And that’s a problem because I am doing development in a local environment. I can’t get XAMPP to send email. I tried configuring my development instance to send email via GMail and its SMTP server, but it won’t work. I think my iMac is blocking outgoing traffic and that’s the issue, but I can’t find anything on this with a web search. At some point I’m going to have to move it to my web host and finish development there and that will take some time. I can only go so far before I have to test actual emailing.
So it’s going about as I expected. My consulting work is light at the moment which helps. I’m guessing there is about a month more work before I have a development candidate to put out there for comment, but this may be optimistic. The major blocks of work remaining are:
- Thoroughly testing the new way of sending digests via phpBB system cron
- Completing the integration of all the features with the manual mailer and the digest cron job
- Extending the messenger class to send HTML emails
- General code review and cleanup
- Updating the migration program to properly migrate digest settings from the 3.0 mod to the 3.1 extension
- Updating documentation including how to set up a system cron
Today I was able to figure out how to save a digest to the file system successfully. I also tested many of the features of mailing digests manually, fixing a lot of bugs. I also added a feature to send the digest to the admin or an email address of his choosing. Good day’s work.