[RC] Digests 3.2.6

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: 3375
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC] Digests 3.2.6

Post by MarkDHamill » Sat Apr 21, 2018 4:18 pm

I can confirm the issue installing on phpBB 3.2.2. Not sure where my testing went wrong. It's possible I tested against phpBB 3.2.1 instead of 3.2.2. In any event, in migrations/release_3.0.2_data.php on line 33 change:

Code: Select all

		$helper = new common();
Replace with:

Code: Select all

		global $phpbb_container;
		$language = $phpbb_container->get('language');
		
		$helper = new common($language);
I got the error you described when I tried to install the extension. With this change, it installed for me. Next to test a migration against version of phpBB 3.2.2 upgraded from 3.0.14 with the Digest mod installed.
Get the latest versions of my Digests and Smartfeed mods and extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

User avatar
MarkDHamill
Registered User
Posts: 3375
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC] Digests 3.2.6

Post by MarkDHamill » Sat Apr 21, 2018 5:38 pm

The same issue exists in /migration/convert_mod_data.php. However, this affects only those who have a database with tables and data from the digest mod that will be upgraded. On line 45 replace:

Code: Select all

		$helper = new common();
with:

Code: Select all

		global $phpbb_container;
		$language = $phpbb_container->get('language');
		
		$helper = new common($language);
There are issues with old modules not deleting that I am still puzzling through.
Get the latest versions of my Digests and Smartfeed mods and extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 2760
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [RC] Digests 3.2.6

Post by kasimi » Sat Apr 21, 2018 7:27 pm

MarkDHamill wrote:
Sat Apr 21, 2018 5:38 pm
There are issues with old modules not deleting that I am still puzzling through.
Maybe this is what's causing your modules not getting deleted: https://tracker.phpbb.com/browse/PHPBB3-15595

User avatar
MarkDHamill
Registered User
Posts: 3375
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC] Digests 3.2.6

Post by MarkDHamill » Sat Apr 21, 2018 7:46 pm

Very likely. Thanks Kasimi. Is there a workaround?
Get the latest versions of my Digests and Smartfeed mods and extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 2760
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [RC] Digests 3.2.6

Post by kasimi » Sat Apr 21, 2018 7:54 pm

There's a fix available, see the linked PR in the ticket. It has been merged into 3.2.3-RC1, so give an update to that version a shot.

User avatar
MarkDHamill
Registered User
Posts: 3375
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC] Digests 3.2.6

Post by MarkDHamill » Sat Apr 21, 2018 8:35 pm

I tried it. For me the fix isn't working. It's possible it's my code. If hasn't changed much so I don't think that's the issue. If you see something off let me know. The symptom is that all the ACP modules and the digests category, if they are carried over from a phpBB 3.0 database that's been converted, remain at the bottom of the ACP General tab and you see all the various module name constants. ACP_DIGEST_SETTINGS definitely exists in the modules table, as does ACP_CAT_GENERAL.

Code: Select all

<?php
/**
*
* @package phpBB Extension - Digests
* @copyright (c) 2018 Mark D. Hamill (mark@phpbbservices.com)
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

namespace phpbbservices\digests\migrations;

class convert_mod_modules extends \phpbb\db\migration\migration
{
	public function effectively_installed()
	{
		$sql = 'SELECT module_id
			FROM ' . $this->table_prefix . "modules 
			WHERE module_class = 'acp'
				AND module_langname = 'ACP_DIGESTS_TEST'"; // This module is new with the extension so if exists, there are no modules to convert
		$result = $this->db->sql_query($sql);
		$module_id = $this->db->sql_fetchfield('module_id');
		$this->db->sql_freeresult($result);

		return $module_id == false;
	}

	static public function depends_on()
	{
		return array('\phpbb\db\migration\data\v31x\v319');
	}

	public function update_data()
	{
		return array(
			// ----- Remove old ACP Modules ----- //
			array('if', array(
				array('module.exists', array('acp', 'ACP_DIGEST_SETTINGS', 'ACP_DIGEST_GENERAL_SETTINGS')),
				array('module.remove', array('acp', 'ACP_DIGEST_SETTINGS', 'ACP_DIGEST_GENERAL_SETTINGS')),
			)),
			array('if', array(
				array('module.exists', array('acp', 'ACP_DIGEST_SETTINGS', 'ACP_DIGEST_USER_DEFAULT_SETTINGS')),
				array('module.remove', array('acp', 'ACP_DIGEST_SETTINGS', 'ACP_DIGEST_USER_DEFAULT_SETTINGS')),
			)),
			array('if', array(
				array('module.exists', array('acp', 'ACP_DIGEST_SETTINGS', 'ACP_DIGEST_EDIT_SUBSCRIBERS')), // Appeared in 2.2.16
				array('module.remove', array('acp', 'ACP_DIGEST_SETTINGS', 'ACP_DIGEST_EDIT_SUBSCRIBERS')),
			)),
			array('if', array(
				array('module.exists', array('acp', 'ACP_DIGEST_SETTINGS', 'ACP_DIGEST_BALANCE_LOAD')), // Appeared in 2.2.22
				array('module.remove', array('acp', 'ACP_DIGEST_SETTINGS', 'ACP_DIGEST_BALANCE_LOAD')),
			)),
			array('if', array(
				array('module.exists', array('acp', 'ACP_DIGEST_SETTINGS', 'ACP_DIGEST_MASS_SUBSCRIBE_UNSUBSCRIBE')), // Appeared in 2.2.25
				array('module.remove', array('acp', 'ACP_DIGEST_SETTINGS', 'ACP_DIGEST_MASS_SUBSCRIBE_UNSUBSCRIBE')),
			)),
			array('if', array(
				array('module.exists', array('acp', 'ACP_CAT_GENERAL', 'ACP_DIGEST_SETTINGS')),
				array('module.remove', array('acp', 'ACP_CAT_GENERAL', 'ACP_DIGEST_SETTINGS')),
			)),

			// ----- Remove UCP modules ----- //
			array('if', array(
				array('module.exists', array('ucp', 'UCP_DIGESTS', 'UCP_DIGESTS_BASICS')),
				array('module.remove', array('ucp', 'UCP_DIGESTS', 'UCP_DIGESTS_BASICS')),
			)),
			array('if', array(
				array('module.exists', array('ucp', 'UCP_DIGESTS', 'UCP_DIGESTS_POSTS_SELECTION')), // Only in 2.2.6, gone in 2.2.7
				array('module.remove', array('ucp', 'UCP_DIGESTS', 'UCP_DIGESTS_POSTS_SELECTION')),
			)),
			array('if', array(
				array('module.exists', array('ucp', 'UCP_DIGESTS', 'UCP_DIGESTS_FORUMS_SELECTION')), // Appeared in 2.2.7
				array('module.remove', array('ucp', 'UCP_DIGESTS', 'UCP_DIGESTS_FORUMS_SELECTION')),
			)),
			array('if', array(
				array('module.exists', array('ucp', 'UCP_DIGESTS', 'UCP_DIGESTS_POST_FILTERS')),
				array('module.remove', array('ucp', 'UCP_DIGESTS', 'UCP_DIGESTS_POST_FILTERS')),
			)),
			array('if', array(
				array('module.exists', array('ucp', 'UCP_DIGESTS', 'UCP_DIGESTS_ADDITIONAL_CRITERIA')),
				array('module.remove', array('ucp', 'UCP_DIGESTS', 'UCP_DIGESTS_ADDITIONAL_CRITERIA')),
			)),
			array('if', array(
				array('module.exists', array('ucp', false, 'UCP_DIGESTS')),
				array('module.remove', array('ucp', false, 'UCP_DIGESTS')),
			)),
		);
	}
}
Get the latest versions of my Digests and Smartfeed mods and extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 2760
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [RC] Digests 3.2.6

Post by kasimi » Sat Apr 21, 2018 9:17 pm

Code: Select all

// This module is new with the extension so if exists, there are no modules to convert
You return $module_id == false, so if the module does not exist, your migration is effectively installed and thus being skipped. I think you want to return $module_id != false here.

Also, you don't need to check if the the module exists before removing it, module.remove checks it for you and silently skips if it doesn't exist. Technically, for the migration code you posted, you don't need the effectively_installed() method at all.

User avatar
MarkDHamill
Registered User
Posts: 3375
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC] Digests 3.2.6

Post by MarkDHamill » Sat Apr 21, 2018 9:28 pm

I like skipping module.if(). I think I was prompted to use that at some point.
Get the latest versions of my Digests and Smartfeed mods and extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

User avatar
MarkDHamill
Registered User
Posts: 3375
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC] Digests 3.2.6

Post by MarkDHamill » Sun Apr 22, 2018 8:23 pm

After a lot of testing I've confirmed that the extension is impacted by bugs introduced in phpBB 3.2.2 to the migrator. It's not cleaning up modules correctly when the "delete data" option is used. What works on 3.2.0 won't work on 3.2.2 and appears not to work on 3.2.3-RC1 either, so I don't think the bug in the migrator Kasimi pointed out is quite fixed yet.

This bug makes testing quite frustrating, so I'm concentrating on making it work reliably with 3.2.0. There seems to be an issue with 3.2.1 as well but that requires further testing.
Get the latest versions of my Digests and Smartfeed mods and extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

User avatar
MarkDHamill
Registered User
Posts: 3375
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC] Digests 3.2.6

Post by MarkDHamill » Mon Apr 23, 2018 1:13 am

One thing I am learning is that when migrating from phpBB 3.0 where old digest modules are left in the database and appear as language strings in the APC, it's important to remove the old .MOD tab in the ACP first. This is created if AutoMOD was used on phpBB 3.0, as is typically the case when installing mods on phpBB 3.0. Since the language string won't exist after upgrading phpBB, it shows up as a tab ACP_CAT_MODS.

It's important to remove this tab by descending into it and removing all the modules and categories inside it first. I'm not sure why this has to be done but if it isn't there will be an error on install as the extension tries to clean up modules from phpBB 3.0 left in the database. I think somehow it is conflicting with ACP_CAT_DOT_MODS, which is the Extensions tab.
Get the latest versions of my Digests and Smartfeed mods and extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

terrymrowley
Registered User
Posts: 13
Joined: Sat Jun 20, 2009 11:35 pm

Re: [RC] Digests 3.2.6

Post by terrymrowley » Thu Apr 26, 2018 1:30 pm

Hi Mark,

I have a development suggestion. Many of my users are not savvy enough (or too lazy) to go to their UCP to unsubscribe from Digests.

Would it be possible to add an 'unsubscribe' link at the top / bottom of the email the user can click and it would unsubscribe them without their having to login and unsubscribe via the UCP?

Thx!

User avatar
MarkDHamill
Registered User
Posts: 3375
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC] Digests 3.2.6

Post by MarkDHamill » Thu Apr 26, 2018 1:45 pm

Possibly. It gets kind of hairy because some sort of authentication process is still needed so one click unsubscribe is probably not possible.
Get the latest versions of my Digests and Smartfeed mods and extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

User avatar
MarkDHamill
Registered User
Posts: 3375
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC] Digests 3.2.6

Post by MarkDHamill » Sun Apr 29, 2018 12:59 am

Regarding digest extension enabling issues on phpBB 3.2, after moving from a phpBB 3.0 database that had the digests modification installed, after extensive testing it looks like you need to manually remove modules before enabling the extension to avoid various module errors. Adding configuration variables, tables and table columns are unaffected. It's a pure module removal issue.

My suspicion is that these are due to quirks in the migration library but they occur on 3.0, 3.1, 3.2 and 3.2.3-RC1. I did not see this behavior on 3.1. So some additional manual steps are needed. Installing on a database that never had the digests mod installed does not seem to be an issue.

I've updated the first post as follows:

You should remove any old AutoMOD and digests modules before installing Digests.

Since the digests mod was often installed using AutoMOD, there may be a bogus ACP_CAT_MODS tab when you go into the Administration Control Panel. phpBB’s upgrade program isn’t smart enough to remove these. Clicking on the tab will usually trigger an error that tells you the module for AutoMOD no longer exists. (Of course it should not. The AutoMOD program should have been removed with the upgrade of your forum from 3.0 to 3.1 or 3.2.) These can be manually removed on the System Tab, Module Management, Administration Control Panel. You will have to descend the module tree and remove modules from the bottom up, eventually removing the tab altogether. You must do this prior to installing digests if you are importing digest settings from what was at one time a phpBB 3.0 database with the digest mod installed. If you don't, you will likely get errors when trying to enable the digests extension. Make sure you remove all modules under this tab and what used to be the .MOD tab (now ACP_CAT_MODS tab).

It's recommended that you remove old digest modules through the database before installing digests

The installer was designed to clean these up. However from what looks like quirks in the phpBB 3.2 modules library, you may get errors. Enabling the extension again usually solves the problem. It's better to be proactive and use a program like phpMyAdmin to remove these from the database instead:
  • Check your config.php file to make sure you have the correct table prefix. In the example below, phpbb_ is assumed for the table prefix.
  • Open a database manipulation program, typically phpMyAdmin
  • Make sure you have selected the correct database. The config.php file will indicate the database name.
  • If you are using phpMyAdmin, select the SQL tab
  • Execute the following SQL, changing the table prefix if necessary: DELETE FROM phpbb_modules WHERE module_langname LIKE '%DIGEST%'
  • In phpBB, purge the cache in the Administration Control Panel
Get the latest versions of my Digests and Smartfeed mods and extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

Papa J
Registered User
Posts: 14
Joined: Thu Mar 08, 2018 4:07 pm

Re: [RC] Digests 3.2.6

Post by Papa J » Tue May 08, 2018 4:02 pm

SUCCESS!! :lol: Coding changes to /migrations/release 3_0_2_data.php posted on 4/21/2018 did the trick once I have a sufficiently clean database. I couldn't get the extension to install on a clean (empty) 3.2.2 board until I used SELECT/COPY/PASTE to apply the edits for some reason. It looked the same when I typed it in, but didn't work :shock: It also worked like a charm on my site once I finally managed to clean up my database per instructions. Just a word to other noobs who might be going through this, be careful not to delete ACP_CAT_DOT_MODS while you're getting rid of AutoMOD and .MOD (ACP_CAT_MODS). Instructions on how to search tables using the dialogs in phpMyAdmin were also very useful.

I didn't try /migrations/convert_mod.php because I was not trying to save the data from the earlier version, though I might loop around and try to recover users' preference//subscription data once I have the site open again. I'll let youknow if I do. Thanks again for all the help, Mark.

User avatar
MarkDHamill
Registered User
Posts: 3375
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC] Digests 3.2.6

Post by MarkDHamill » Tue May 08, 2018 7:32 pm

Thank goodness! Sorry for all the hassle. I'm pretty sure most of it was due to phpBB group's change of the migrator library. If you remove affected modules before installing against an upgraded phpBB 3.0 database, I'm pretty sure the digest settings and users will be retained.
Get the latest versions of my Digests and Smartfeed mods and extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

Post Reply

Return to “Extensions in Development”

Who is online

Users browsing this forum: Froddelaar, RSvlado and 17 guests