[3.1][3.2][RC] Prime Post Revision

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
RomaamoR
Registered User
Posts: 253
Joined: Tue Feb 24, 2015 4:45 pm
Location: Ukraine
Name: Roman
Contact:

Re: [3.1][3.2][RC] Prime Post Revision

Post by RomaamoR »

Code: Select all

SQL ERROR [ mysqli ]

Table 'vladr546_new.phpbb_ppr' doesn't exist [1146]

SQL

SHOW COLUMNS FROM phpbb_ppr

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 999
CALL: trigger_error()

FILE: [ROOT]/phpbb/db/driver/mysqli.php
LINE: 193
CALL: phpbb\db\driver\driver->sql_error()

FILE: [ROOT]/phpbb/db/tools/tools.php
LINE: 885
CALL: phpbb\db\driver\mysqli->sql_query()

FILE: [ROOT]/phpbb/db/tools/tools.php
LINE: 902
CALL: phpbb\db\tools\tools->sql_list_columns()

FILE: [ROOT]/phpbb/db/tools/tools.php
LINE: 541
CALL: phpbb\db\tools\tools->sql_column_exists()

FILE: (not given by php)
LINE: (not given by php)
CALL: phpbb\db\tools\tools->perform_schema_changes()

FILE: [ROOT]/phpbb/db/migrator.php
LINE: 711
CALL: call_user_func_array()

FILE: [ROOT]/phpbb/db/migrator.php
LINE: 658
CALL: phpbb\db\migrator->run_step()

FILE: [ROOT]/phpbb/db/migrator.php
LINE: 400
CALL: phpbb\db\migrator->process_data_step()

FILE: [ROOT]/phpbb/db/migrator.php
LINE: 288
CALL: phpbb\db\migrator->try_apply()

FILE: [ROOT]/phpbb/db/migrator.php
LINE: 241
CALL: phpbb\db\migrator->update_do()

FILE: [ROOT]/phpbb/extension/base.php
LINE: 78
CALL: phpbb\db\migrator->update()

FILE: [ROOT]/phpbb/extension/manager.php
LINE: 190
CALL: phpbb\extension\base->enable_step()

FILE: [ROOT]/includes/acp/acp_extensions.php
LINE: 209
CALL: phpbb\extension\manager->enable_step()

FILE: [ROOT]/includes/functions_module.php
LINE: 676
CALL: acp_extensions->main()

FILE: [ROOT]/adm/index.php
LINE: 82
CALL: p_master->load_active()
andreask
Registered User
Posts: 752
Joined: Fri Feb 27, 2009 6:13 pm
Name: Andreas

Re: [3.1][3.2][RC] Prime Post Revision

Post by andreask »

When exactly does this happen?
Here is what I am working on right now...
Inactive User Manager for phpBB
Give it a try...
If you would like to buy me a bier ;) for my work I will drink it on a hot summer day and thank you!!!
User avatar
RomaamoR
Registered User
Posts: 253
Joined: Tue Feb 24, 2015 4:45 pm
Location: Ukraine
Name: Roman
Contact:

Re: [3.1][3.2][RC] Prime Post Revision

Post by RomaamoR »

When I turn on the extension.
andreask
Registered User
Posts: 752
Joined: Fri Feb 27, 2009 6:13 pm
Name: Andreas

Re: [3.1][3.2][RC] Prime Post Revision

Post by andreask »

so the installation is working, but when you 'enable' the it show you this?
Here is what I am working on right now...
Inactive User Manager for phpBB
Give it a try...
If you would like to buy me a bier ;) for my work I will drink it on a hot summer day and thank you!!!
User avatar
RomaamoR
Registered User
Posts: 253
Joined: Tue Feb 24, 2015 4:45 pm
Location: Ukraine
Name: Roman
Contact:

Re: [3.1][3.2][RC] Prime Post Revision

Post by RomaamoR »

Yes
andreask
Registered User
Posts: 752
Joined: Fri Feb 27, 2009 6:13 pm
Name: Andreas

Re: [3.1][3.2][RC] Prime Post Revision

Post by andreask »

Thanks,

The weird thing is, that I do not have this behavior, I am working on it though!
Here is what I am working on right now...
Inactive User Manager for phpBB
Give it a try...
If you would like to buy me a bier ;) for my work I will drink it on a hot summer day and thank you!!!
User avatar
RomaamoR
Registered User
Posts: 253
Joined: Tue Feb 24, 2015 4:45 pm
Location: Ukraine
Name: Roman
Contact:

Re: [3.1][3.2][RC] Prime Post Revision

Post by RomaamoR »

Ok.
User avatar
spaceace
Registered User
Posts: 1999
Joined: Wed Jan 30, 2008 8:50 pm
Contact:

Re: [3.1][3.2][RC] Prime Post Revision

Post by spaceace »

andreask wrote: Fri Dec 15, 2017 9:21 pm Thanks,

The weird thing is, that I do not have this behavior, I am working on it though!
is it possible that it is not installing with the table prefix that RomaamoR has? but just installing with the default phpbb_ table prefix
andreask
Registered User
Posts: 752
Joined: Fri Feb 27, 2009 6:13 pm
Name: Andreas

Re: [3.1][3.2][RC] Prime Post Revision

Post by andreask »

spaceace wrote: Fri Dec 15, 2017 9:43 pm is it possible that it is not installing with the table prefix that RomaamoR has? but just installing with the default phpbb_ table prefix
But in the two migrations where the db updates it uses the table prefix that is set in phpbb... (it's not hard coded)

Code: Select all

public function update_schema()
	{
return array(
			'add_tables'	=> array(
				$this->table_prefix . 'ppr'	=> array(
					'COLUMNS'	=> array(
						'revision_id'						=> array('UINT', null, 'auto_increment'),
						'post_id'						=> array('UINT', 0),
						'post_subject'						=> array('VCHAR', ''),
						'post_text'						=> array('TEXT', ''),
						'bbcode_uid'						=> array('VCHAR:8', ''),
						'bbcode_bitfield'						=> array('VCHAR:255', ''),
						'post_edit_time'							=> array('TIMESTAMP', 0),
						'post_edit_user'						=> array('UINT', 0),
					),
					'PRIMARY_KEY'	=> 'revision_id',
				),
			),
		);
	}
Here is what I am working on right now...
Inactive User Manager for phpBB
Give it a try...
If you would like to buy me a bier ;) for my work I will drink it on a hot summer day and thank you!!!
User avatar
RomaamoR
Registered User
Posts: 253
Joined: Tue Feb 24, 2015 4:45 pm
Location: Ukraine
Name: Roman
Contact:

Re: [3.1][3.2][RC] Prime Post Revision

Post by RomaamoR »

Can conflict with another extension?
andreask
Registered User
Posts: 752
Joined: Fri Feb 27, 2009 6:13 pm
Name: Andreas

Re: [3.1][3.2][RC] Prime Post Revision

Post by andreask »

This error has nothing to do with conflicts...
It looks like during the installation it does not create the required table.

Could you please
  1. disable ext
  2. delete data of the ext
  3. delete files
  4. just for the fun clean the cache
  5. re upload files of ext
  6. and enable
Here is what I am working on right now...
Inactive User Manager for phpBB
Give it a try...
If you would like to buy me a bier ;) for my work I will drink it on a hot summer day and thank you!!!
User avatar
takufner
Registered User
Posts: 216
Joined: Mon Oct 23, 2006 10:39 am
Location: Rio de Janeiro - Brasil
Name: Prof. Caju
Contact:

Re: [3.1][3.2][RC] Prime Post Revision

Post by takufner »

Hello andreask, thanks for your work. Very good extension :)

I'd like to give my contribution to this extension, since I could spot and fix one SQL error.

The problem arises when someone tries to edit a message that has UTF-8 characters with 4 bytes (like 𝑥). The error is:

Code: Select all

 SQL ERROR [ mysqli ]

Incorrect string value: '\xF0\x9D\x91\xA5' for column 'post_edit_reason' at row 1 [1366]

SQL

INSERT INTO phpbb_ppr (post_edit_user, post_id, post_edit_time, post_subject, post_text, bbcode_uid, bbcode_bitfield, post_edit_reason) VALUES ('2', 170608, 1521856338, 'good title', '<t>Good message with all the 20 characters needed.</t>', '2ueoh2lv', '', 'reason with character 𝑥')

In order to fix, I did the following code changes:

Open /ext/bruninoit/ppr/event/main_listener.php:

Search for:

Code: Select all

    	'post_text'	=> $pa['post_text'],
Replace with:

Code: Select all

    	'post_text'	=> utf8_clean_string($pa['post_text']),
Search for:

Code: Select all

    	'post_edit_reason' => $this->user->lang['PPR_ORIGINAL']
Replace with:

Code: Select all

    	'post_edit_reason' => utf8_clean_string($this->user->lang['PPR_ORIGINAL'])
Search for:

Code: Select all

    	'post_text'	=> $event['data']['message'],
Replace with:

Code: Select all

    	'post_text'	=> utf8_clean_string($event['data']['message']),
Search for:

Code: Select all

    	'post_edit_reason' => $post_edit_reason
Replace with:

Code: Select all

    	'post_edit_reason' => utf8_clean_string($post_edit_reason)
Kind regards,
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: [3.1][3.2][RC] Prime Post Revision

Post by 3Di »

Calling that function for just that stuff is a an overload IMO, the function itself calls the huge confusables.php file.
Not to mention that is not fully Emojis's proof.

Let's see how to solve it instead: convert 4-bytes Unicodes to relatives 3-bytes or a devoted char

Something like that:
preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xef\xbf\xbd", $pa['post_text'])

The whole range of Emojis/4-bytes unicode are ported each one to one specific UTF8 3-bytes devoted replacement character (�) as per the topic I above linked, in use in many of my works. Simply make a function of that line and use it everywhere you need it.
🆓 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
primehalo
Former Team Member
Posts: 2988
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [3.1][3.2][RC] Prime Post Revision

Post by primehalo »

If anyone here is interested, I finally got my Prime Post Revisions MOD converted into a phpBB 3.2 extension. The database table I use to house the revisions has some extra columns from the one used by the extension on this page so unfortunately they aren't directly compatible.

If someone is interested in writing a script that copies the post revision info from this table to the table from my extension, the additional columns in my table are revision_time, primepost_edit_time, primepost_edit_user, and primepost_edit_count . The primepost_edit_time column is simply the timestamp of when the revision was saved into the table and is currently only used for the auto-pruning feature. The primepost_edit_time, primepost_edit_user, and primepost_edit_count columns are basically equivalent to the current post_edit_time, post_edit_user, and post_edit_count columns except that they are updated on every edit where the regular post_edit_* columns are only updated in certain circumstances. So when copying rows, the post_edit_* columns should also be copied into the primepost_edit_* columns.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
Locked

Return to “Extensions in Development”