[CDB] Digests 3.2.11

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Get Involved
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
Praggle
Registered User
Posts: 64
Joined: Thu Feb 26, 2015 6:07 pm

Re: [ALPHA] Digests 3.0.0

Post by Praggle »

Just for feedback:
The Umlaute-problem ist solved by changing Line 109 in /ext/phpbbservices/digests/acp/main_module.php as proposed here.

Addding the @ in front of set_time_limit(0); is working, for the moment.

The biggest problem is still existing in sending out any digest-mail. Until now I just work with the manual mailer function Manually run the mailer. No Cron-Job at all. Just direkt sending. This works pretty good with Send results to files instead of emailing: enabled. After sending I can find the TXT- or HTML-Digest in my cache-folder. But after disabling Send results to files instead of emailing: I get the Message Mailer was run successfully. and the log shows, that a digest was created, but not one email-digest did arrive in my mailbox yet - not with the Test-Email-Adress and not with the users Email-Adress. Normal Bord-Emails and -Notifications are arriving.
So where in phpBB can I see weather an Email was created and sent out correctly? I'm using smtp_delivery.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: [ALPHA] Digests 3.0.0

Post by MarkDHamill »

3Di wrote:to suppress those warnings just use the "@" in front of it
@set_time_limit(0);

Anyway, if set_time_limit is disallowed you should use a workaround.
I will use this trick. Thanks.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: [ALPHA] Digests 3.0.0

Post by MarkDHamill »

3Di wrote:On a side note, you should do some test on TravisCI there at your repository, configuring the right stuffs.

Also create a branch for this version and give the download link to this branch (ie 3.0.0-a1), then use the master as a dev branch, every time you release a new version create a branch and so on..). It is less confusional and doesn't lead to 'missing lines issues' or so on. ;)
Sounds like a good idea except for the small matter that I have punted on learning how to use GitHub in any meaningful way, including creating branches. Ditto for TravisCL. I am using GitHub Desktop for the Mac and I use it to publish to GitHub and am trying to be careful to defer publishing until I have a new version for others to test.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: [ALPHA] Digests 3.0.0

Post by MarkDHamill »

Praggle wrote:The biggest problem is still existing in sending out any digest-mail. Until now I just work with the manual mailer function Manually run the mailer. No Cron-Job at all. Just direkt sending. This works pretty good with Send results to files instead of emailing: enabled. After sending I can find the TXT- or HTML-Digest in my cache-folder. But after disabling Send results to files instead of emailing: I get the Message Mailer was run successfully. and the log shows, that a digest was created, but not one email-digest did arrive in my mailbox yet - not with the Test-Email-Adress and not with the users Email-Adress. Normal Bord-Emails and -Notifications are arriving.
So where in phpBB can I see weather an Email was created and sent out correctly? I'm using smtp_delivery.
If you are using SMTP then you probably have Windows hosting, in which case the instructions for setting up a phpBB system cron are useless, as Windows has no cron. (You can see the operating system on the PHP Information page in the ACP.) If your hosting is Linux/Unix then typically you don't use SMTP at all, but send everything through PHP's mail function, which gets information from php.ini. Sometimes the php.ini is set to direct to a SMTP server.

If you are using Windows hosting you still need the equivalent of a system cron but this will be done as a Windows scheduled task. There is no instructions on the Wiki on how to do this but you can Google the term and probably figure it out. I can post what I learned on this from my digest mod if this is helpful.

System cron installation instructions are here:

https://wiki.phpbb.com/PhpBB3.1/RFC/Mod ... ystem_cron

I think the queue is actually a file in the cache folder that has queue in the file name. It may not exist if there is nothing in the queue.

What often happens is that mail servers throw digests into a spam folder. Look there. I think I mentioned this and other stuff in the first post of the topic. It may also be going to the wrong email box. It will be sent to the address in the recipient's phpBB profile. Note: in digest general settings you can have the email address the digest was sent to put in the log.

You can use the Mass email function in the ACP to test if your forum can send email at all. Just send a test message to yourself.

A less likely possibility is that it is being held by your web host's mail server as potential blacklisted spam. I have seen cases where digests have to go out with a FROM email address that matches the domain of the forum to avoid being blacklisted. If you suspect this you may need to have your web host check its outgoing email logs.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: [ALPHA] Digests 3.0.0

Post by MarkDHamill »

Ignore.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
Praggle
Registered User
Posts: 64
Joined: Thu Feb 26, 2015 6:07 pm

Re: [ALPHA] Digests 3.0.0

Post by Praggle »

MarkDHamill wrote: If you are using SMTP then you probably have Windows hosting, in which case the instructions for setting up a phpBB system cron are useless, as Windows has no cron. (You can see the operating system on the PHP Information page in the ACP.) If your hosting is Linux/Unix then typically you don't use SMTP at all, but send everything through PHP's mail function, which gets information from php.ini. Sometimes the php.ini is set to direct to a SMTP server.
It is a Linux-Server, "mail() has been disabled for security reasons". For this reason I use my SMTP-Server to deliver Emails. Using the Mass-Email-Function of phpBB works perfectly. Every Email sent from the board is landing in my inbox, no SMTP-Problems, no spam-filtering-problems. So why should there be a difference between Mas-Mails and digest-emails?

Once more about cron:
I am not using cron yet, I just try to manually sent out a digest from the ACP. Do you want to tell me, that digest-emails aren't sent out without programming a regular cron-job, when I press the send-button under the "Manually run the mailer"-form? Do you mean your function is totally different from pressing the send-button under the "Mass-E-mail"-form?
I think the queue is actually a file in the cache folder that has queue in the file name. It may not exist if there is nothing in the queue.
What I do:
1. "Send results to files instead of emailing:": making the check mark on "Yes". Klicking "Send" -> A digest file is created in the cache folder.
2. Leaving everything as it was before. Exception: "Send results to files instead of emailing:": making the check mark now on "No". -> The cache folder is now emptied, when I've checked "yes" at "Clear the digest extension's cache folder" -> "Information: Mailer was run successfully." -> phpBB3.1.7-Log sais "A digest was created for X Y ([email protected]) containing 3 posts and 0 private messages"
I can't find a way to check my smtp server weather the digest arrived there. I don't have access to the smtp-log-files
I tried different Email-Adresses and different types of digests (HTML/ Plain Text), but not one digest did arrive in my inbox although all other board-mails do so.

What I found out so far:
Line 207 in html_messenger.php isn't reached.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: [ALPHA] Digests 3.0.0

Post by MarkDHamill »

If line 207 of html_messenger.php is not being reached then the queue is enabled. These statements should be getting executed instead:

Code: Select all

		else
		{
			$this->queue->put('email', array(
				'to'			=> $to,
				'addresses'		=> $this->addresses,
				'subject'		=> $this->subject,
				'msg'			=> $this->msg,
				'headers'		=> $headers)
			);
		}
html_messenger.php is basically a cut and paste of functions_messenger.php, at least those functions that I needed to override to allow HTML formatted email to go out. You could add some debug code to verify that the queue is being used.

Whether the queue is used at all I think depends on the email package size number in ACP email settings. If set to 0 then it should be skipped. Have you tried this? You might do this and then add some code before and after lines 207 to see if smtpmail is being invoked. You can also test $result. It should return true.

Yes, if you say not to write to the cache it should go through email processing and be sent via email.

Thank you for your testing and the feedback.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
Praggle
Registered User
Posts: 64
Joined: Thu Feb 26, 2015 6:07 pm

Re: [ALPHA] Digests 3.0.0

Post by Praggle »

MarkDHamill wrote:Whether the queue is used at all I think depends on the email package size number in ACP email settings. If set to 0 then it should be skipped. Have you tried this?
You were right. Package size number was 20 in my ACP. When I changed it to 0 digest-emails started to be sent out via SMTP.

Thank you, Marc!
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: [ALPHA] Digests 3.0.0

Post by MarkDHamill »

Awesome! Wish all these problems were this easy to solve!

In the digests mod I had a switch to get around this setting but in the extension I decided it was better to not circumvent phpBB's defaults, so I removed it.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
dramaticpaws
Registered User
Posts: 9
Joined: Wed Feb 24, 2016 3:05 am

Re: [ALPHA] Digests 3.0.0

Post by dramaticpaws »

Hey there - awesome extension. I've almost got it working. I have successfully tested it manually but I'm having trouble with the cron job.

I've set the following cron job:

Code: Select all

*/15 * * * * /usr/local/bin/php -q /home/myname/public_html/forum/bin/phpbbcli.php cron:run
I'm getting the following in my email notices from the cron job, first I got this:

Code: Select all

 [Twig_Error_Loader]
  The "./ext/phpbbservices/digests/language/en/email/" directory does not exist.



cron:run [name]
(That directly does exist.)

And then I got this:

Code: Select all

Could not obtain cron lock.
Any ideas on what may be the issue?
Praggle
Registered User
Posts: 64
Joined: Thu Feb 26, 2015 6:07 pm

Re: [ALPHA] Digests 3.0.0

Post by Praggle »

I have another problem, when I click digests tab in UCP:
[phpBB Debug] PHP Notice: in file [ROOT]/ext/phpbbservices/digests/ucp/main_module.php on line 210: Undefined index: user_digests_type
[phpBB Debug] PHP Notice: in file [ROOT]/ext/phpbbservices/digests/ucp/main_module.php on line 243: Undefined index: user_digests_type
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5284: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3903)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5284: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3903)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5284: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3903)
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: [ALPHA] Digests 3.0.0

Post by MarkDHamill »

dramaticpaws wrote:Hey there - awesome extension. I've almost got it working. I have successfully tested it manually but I'm having trouble with the cron job.

I've set the following cron job:

Code: Select all

*/15 * * * * /usr/local/bin/php -q /home/myname/public_html/forum/bin/phpbbcli.php cron:run
I'm getting the following in my email notices from the cron job, first I got this:

Code: Select all

 [Twig_Error_Loader]
  The "./ext/phpbbservices/digests/language/en/email/" directory does not exist.



cron:run [name]
(That directly does exist.)

And then I got this:

Code: Select all

Could not obtain cron lock.
Any ideas on what may be the issue?
Please change line 110-112 of /ext/phpbbservices/digests/cron/tasks/digests.php from:

Code: Select all

			$email_templates_path = './ext/phpbbservices/digests/language/en/email/';
			$cache_path = './ext/phpbbservices/digests/cache/';
			$this->template->set_style(array('./ext/phpbbservices/digests/styles', 'styles'));	// Necessary because for system crons no styling information is set when the template class is instantiated, so template rendering can't happen. Likely phpBB bug/enhancement request.
to:

Code: Select all

			$email_templates_path = './../ext/phpbbservices/digests/language/en/email/';
			$cache_path = './../ext/phpbbservices/digests/cache/';
			$this->template->set_style(array('./../ext/phpbbservices/digests/styles', 'styles'));	// Necessary because for system crons no styling information is set when the template class is instantiated, so template rendering can't happen. Likely phpBB bug/enhancement request.
Since the cron program is being run from the bin directory it looks like you need to go up a node to find the directory.

Note: I was doing a lot of my testing by calling cron.php in the root folder, which was why it worked.

Thanks for testing.
Last edited by MarkDHamill on Wed Feb 24, 2016 8:45 pm, edited 1 time in total.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: [ALPHA] Digests 3.0.0

Post by MarkDHamill »

Praggle wrote:I have another problem, when I click digests tab in UCP:
[phpBB Debug] PHP Notice: in file [ROOT]/ext/phpbbservices/digests/ucp/main_module.php on line 210: Undefined index: user_digests_type
[phpBB Debug] PHP Notice: in file [ROOT]/ext/phpbbservices/digests/ucp/main_module.php on line 243: Undefined index: user_digests_type
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5284: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3903)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5284: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3903)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5284: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3903)
Please use an editor to replace the instances of "user_digests_type" to "user_digest_type". Thanks for testing.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: [ALPHA] Digests 3.0.0

Post by MarkDHamill »

Here's a bug noticed in the digests mod that I carried over to the extension that you can fix in ext/phpbbservices/digests/cron/digests.php. Basically the bug shifts the window for a daily or weekly digests because it assumes post time is stored at GMT when it is stored as server time. Strange that this has been missed for so long. It will get fixed in the next release.

Change lines 263-272 from:

Code: Select all

		else if ($weekly_digest_sql != '')	// Weekly
		{
			$this->date_limit = $this->gmt_time - (7 * 24 * 60 * 60);
			$date_limit_sql = ' AND p.post_time >= ' . $this->date_limit . ' AND p.post_time < ' . $this->gmt_time;
		}
		else	// Daily
		{
			$this->date_limit = $this->gmt_time - (24 * 60 * 60);
			$date_limit_sql = ' AND p.post_time >= ' . $this->date_limit. ' AND p.post_time < ' . $this->gmt_time;
		}
to:

Code: Select all

		else if ($weekly_digest_sql != '')	// Weekly
		{
			$this->date_limit = $this->time - (7 * 24 * 60 * 60);
			$date_limit_sql = ' AND p.post_time >= ' . $this->date_limit . ' AND p.post_time < ' . $this->time;
		}
		else	// Daily
		{
			$this->date_limit = $this->time - (24 * 60 * 60);
			$date_limit_sql = ' AND p.post_time >= ' . $this->date_limit. ' AND p.post_time < ' . $this->time;
		}
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
Praggle
Registered User
Posts: 64
Joined: Thu Feb 26, 2015 6:07 pm

Re: [ALPHA] Digests 3.0.0

Post by Praggle »

Another one:
phpBB Debug] PHP Notice: in file [ROOT]/ext/phpbbservices/digests/ucp/main_module.php on line 594: Undefined index: DIGEST_SIZE_ERROR
[phpBB Debug] PHP Notice: in file [ROOT]/ext/phpbbservices/digests/ucp/main_module.php on line 595: Undefined index: DIGEST_SIZE_ERROR
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5286: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3903)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5286: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3903)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5286: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3903)
Should be DIGESTS_SIZE_ERROR instead of DIGEST_SIZE_ERROR in Line 594 and 595

Return to “Extensions in Development”