[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!
Suggested Hosts
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)
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 »

I believe bots can be denied permissions. Bots are still external entities and there is no guarantee when they will hit a board and they are never continuously active, but can access the board at any time.

There is a phpBB function that creates a refresh meta tag, ex:

Code: Select all

meta_refresh(3, $this->u_action);
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
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

Re: [ALPHA] Digests 3.0.0

Post by 3Di »

MarkDHamill wrote:I believe bots can be denied permissions. Bots are still external entities and there is no guarantee when they will hit a board and they are never continuously active, but can access the board at any time.

There is a phpBB function that creates a refresh meta tag, ex:

Code: Select all

meta_refresh(3, $this->u_action);
That's not a phpBB function. https://en.wikipedia.org/wiki/Meta_refresh

Have a read to this: http://stackoverflow.com/questions/1238 ... -using-php .. for example.

Basically, as you said, we need to send an header content. I am quite sure I read it on the phpBB core, somewhere.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
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 »

meta_refresh is a phpBB function in includes/functions.php that creates a HTML <meta http-equiv="refresh"> tag. You assign the return value of the function to a template variable which should go into the <head> section of a HTML document.

Yes, it's also possible to send a HTTP header that does the same thing. The only difference is one shows in the markup and one does not.

Regardless, a browser is needed to interpret the header or the <meta> tag so that a refresh takes place.
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 »

I think I have the logic fully tested for running digests correctly in manual mode vs. cron mode. Lines 113-122 in /ext/phpbbservices/digests/cron/task/digests.php are:

Code: Select all

		if ($this->manual_mode)
		{
			$email_templates_path = './../ext/phpbbservices/digests/language/en/email/';
			$cache_path = './../ext/phpbbservices/digests/cache/';
		}
		else
		{
			$this->user->add_lang_ext('phpbbservices/digests', array('info_acp_common', 'common'));	// Language strings are already loaded if in manual mode
			$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.
		}
and should be:

Code: Select all

		// Paths should be adjusted if calling program is in either the /bin/ (for system cron) or /adm/ (for manual mailer) directories
		$path_prefix = (strstr($referer, '/adm/') || strstr($referer, '/bin/') || strstr(__FILE__, '/bin/')) ? './../' : './';
		$email_templates_path = $path_prefix . 'ext/phpbbservices/digests/language/en/email/';
		$cache_path = $path_prefix . 'ext/phpbbservices/digests/cache/';
		
		if (!$this->manual_mode)
		{
			// cron.php and phpbbcli.php assumes an interface where language variables and styles won't be needed, so it must be told where to find them.
			$this->user->add_lang_ext('phpbbservices/digests', array('info_acp_common', 'common'));
			$this->template->set_style(array($path_prefix . 'ext/phpbbservices/digests/styles', 'styles'));
		}
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
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

Re: [ALPHA] Digests 3.0.0

Post by 3Di »

MarkDHamill wrote:meta_refresh is a phpBB function in includes/functions.php that creates a HTML <meta http-equiv="refresh"> tag. You assign the return value of the function to a template variable which should go into the <head> section of a HTML document.

Yes, it's also possible to send a HTTP header that does the same thing. The only difference is one shows in the markup and one does not.

Regardless, a browser is needed to interpret the header or the <meta> tag so that a refresh takes place.
Yes, I see now.. strange thing uses the same name. :shock: :lol:
Well, I give up.
The sure thing is that the cron job have to be done, regardless if there are users online or not.
Needs to be automatic, else it is a bug. IMHO.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
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 »

And it can be automatic, if you program a system cron. That's the official phpBB solution, it's just not something that 100% of shared web hosts will provide. The right external monitoring service can be a workaround, or a browser that is left on all the time where there is a meta tag that refreshes hourly, as you suggested. I could add it on the digests user control panel page perhaps for those that want that option.
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 »

Well, Mark, I think it would be more important, to prevent a digest from getting lost totally, because of missing cron activity. From my view it is still better to get a digest late than getting the expected digest never.

I found a way to trigger the internal phpBB-Cron from an exterternal cron-service. You have to use the following URL: http://temp.pytalhost.de/phpBB3/cron.php?cron_type=cron.task.cron_task with the internal phpBB cron (ACP > Server settings > Run periodic tasks from system cron: No). This only triggers the delivery of digests, not the other tasks. So it is a workaround for exotic phpBB-users like me who have a shared hosting environment without cron. It works and I received my first digest now without any visitors inside my test-board.

I don't know what the extension review team will say to this, but for myself it is working. I think this is not really a problem of your digest extension. This should be discussed again by the core team. Maybe your digests extension is the first one that has an essential need for a regular cron.
leschek
Registered User
Posts: 860
Joined: Tue Jul 18, 2006 12:49 pm

Re: [ALPHA] Digests 3.0.0

Post by leschek »

I just started to test this extension on localhost and when I enable it in ACP I get this message:

Code: Select all

[phpBB Debug] PHP Notice: in file [ROOT]/phpbb/db/migration/tool/module.php on line 198: Undefined index: auth
also, in the basics tab in UCP I have this message:

Code: Select all

[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
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:Well, Mark, I think it would be more important, to prevent a digest from getting lost totally, because of missing cron activity. From my view it is still better to get a digest late than getting the expected digest never.
Good news. I am attempting a retrofit of the mailer so that if necessary it can send digests for more than one hour, based on when digests were last sent successfully. It seems to be working but needs further testing.

This will be a welcome feature. A digest may arrive a bit late but it should arrive when the board gets some traffic. No system cron will be needed but if accuracy is desired it can be programmed.

Your workaround using an external service is interesting but hopefully won't be needed.
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 »

leschek wrote:I just started to test this extension on localhost and when I enable it in ACP I get this message:

Code: Select all

[phpBB Debug] PHP Notice: in file [ROOT]/phpbb/db/migration/tool/module.php on line 198: Undefined index: auth
also, in the basics tab in UCP I have this message:

Code: Select all

[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
Thanks. The first issue is not mine, I don't think. The second can be fixed by changing each instance to user_digest_type, per an earlier post in this topic. Maybe it will fix the other issue.
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.
leschek
Registered User
Posts: 860
Joined: Tue Jul 18, 2006 12:49 pm

Re: [ALPHA] Digests 3.0.0

Post by leschek »

MarkDHamill wrote:The second can be fixed by changing each instance to user_digest_type, per an earlier post in this topic.
I found it and it fixed the issue, but it didn't fix the first issue:

Code: Select all

[phpBB Debug] PHP Notice: in file [ROOT]/phpbb/db/migration/tool/module.php on line 198: Undefined index: auth
I found another issue. When I manually send digest I have this message:

Code: Select all

[phpBB Debug] PHP Notice: in file [ROOT]/ext/phpbbservices/digests/cron/task/digests.php on line 1702: Undefined variable: row
Also: it seems that you use in emails several language variables in row - for example in file digest_html.txt are:

<h4>{L_UCP_DIGESTS_BASICS} {L_OPTIONS}:</h4>
<h4>{L_UCP_DIGESTS_FORUMS_SELECTION} {L_OPTIONS}:</h4>
<h4>{L_UCP_DIGESTS_POST_FILTERS} {L_OPTIONS}:</h4>
<h4>{L_UCP_DIGESTS_ADDITIONAL_CRITERIA} {L_OPTIONS}:</h4>

and while it works great in English it doesn't work so good in other languages (as Czech), because we use declension and write words in different order.
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 »

You can simulate other languages by moving the British England language files into a directory based on your language code, for example for French move /phpbbservices/digests/language/en to /phpbbservices/digests/language/fr. You will still see English but you can translate these if you want. I would not bother at this stage.

At some point I need to go through all the language variables to support declension.

Not sure what is causing the other issues except you are the first to report them. It suggests maybe the migration program didn't work right but an error should have been reported when it was installed. Disabling, removing the extension and then trying again might solve the problem.
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 »

Regarding declension/plural rules so far I see only one place where I need a plural rule. It will be in the next version. In language/en/info_acp_common.php I now have:

Code: Select all

	'DIGESTS_LIST_USERS'    								=> array(
																	1	=>	'1 User',
																	2	=>	'%s Users',
																),
and changed acp/main_module to be:

Code: Select all

					'TOTAL_USERS'       		=> sprintf($user->lang['DIGESTS_LIST_USERS'], $total_users),
If there are other examples you can point me to that cause issues, please let me know.
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.
leschek
Registered User
Posts: 860
Joined: Tue Jul 18, 2006 12:49 pm

Re: [ALPHA] Digests 3.0.0

Post by leschek »

Thank you for answer
MarkDHamill wrote:You can simulate other languages by moving the British England language files into a directory based on your language code, for example for French move /phpbbservices/digests/language/en to /phpbbservices/digests/language/fr. You will still see English but you can translate these if you want.
I do it the same way.
MarkDHamill wrote:Not sure what is causing the other issues except you are the first to report them. It suggests maybe the migration program didn't work right but an error should have been reported when it was installed. Disabling, removing the extension and then trying again might solve the problem.
I can replicate it on live (testing) board too. Just try to enable:

Code: Select all

@define('DEBUG', true);
@define('DEBUG_CONTAINER', true);

in config.php file. I can actually see more messages on live board now, when I try to enable the extension:

Code: Select all

[phpBB Debug] PHP Notice: in file [ROOT]/phpbb/db/migration/tool/module.php on line 198: Undefined index: auth
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_acp.php on line 134: 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_acp.php on line 134: 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_acp.php on line 134: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3903)
leschek
Registered User
Posts: 860
Joined: Tue Jul 18, 2006 12:49 pm

Re: [ALPHA] Digests 3.0.0

Post by leschek »

MarkDHamill wrote:If there are other examples you can point me to that cause issues, please let me know.
As I wrote before there are some multiple language string in row:
leschek wrote:for example in file digest_html.txt are:

<h4>{L_UCP_DIGESTS_BASICS} {L_OPTIONS}:</h4>
<h4>{L_UCP_DIGESTS_FORUMS_SELECTION} {L_OPTIONS}:</h4>
<h4>{L_UCP_DIGESTS_POST_FILTERS} {L_OPTIONS}:</h4>
<h4>{L_UCP_DIGESTS_ADDITIONAL_CRITERIA} {L_OPTIONS}:</h4>
The problem is that we write words in sentences in different order than it is in English. Also, there could be problem with translating extensions if authors of extensions use language strings from core phpBB. It is OK in English, but it doesn't look good in other languages.

Return to “Extensions in Development”