[ABD] @Mention System

Any abandoned Extensions will be moved to this forum.

WARNING: Extensions in this forum are not currently being supported or maintained by the original Extension author. Proceed at your own risk.
Forum rules
IMPORTANT: Extension Development Forum rules

WARNING: Extensions in this forum are not currently being supported nor updated by the original Extension author. Proceed at your own risk.
Locked
User avatar
nextgen
Jr. Style Validator
Posts: 2360
Joined: Mon Jul 26, 2010 10:58 pm
Location: Guatemala
Name: Melvin García
Contact:

Re: [DEV] @Mention System

Post by nextgen »

Nice extension :)
メルビン・ガルシア • phpBB Development StylesphpBB Argentina - Soporte en español 🇦🇷

Please do NOT contact for support via PM or email.

User avatar
VSE
Extensions Development Coordinator
Extensions Development Coordinator
Posts: 5041
Joined: Sat Jan 17, 2009 9:37 am
Location: Los Angeles, CA
Name: Matt Friedman
Contact:

Re: [DEV] @Mention System

Post by VSE »

Wolfsblvt wrote:I am using $this->path_helper->get_web_root_path() to generate the link. This strangely don't work like expected. I think the problem is that it generates a relative path.
Thought this function would be the correct thing to get the board path on php side.
Look in phpBB at how the ROOT_PATH variable is created. Try either update_web_root_path() or generate_board_url()
Official phpBB Extensions ⭐️ My Extensions & MODs 🔔 YES!!! They ALL work with phpBB 3.3.x 🔔
Please do not PM me for support.

User avatar
Volksdevil
Registered User
Posts: 2414
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [DEV] @Mention System

Post by Volksdevil »

Wolfsblvt wrote:
Question to all:
What would you say about an ACP option wich would make the mentions in the post text permanently parsed? So they will be kinda "converted" into the username mention.
This would speed up the loading extremely, but it will also have two "bad" things:
Can you expand a little on what this would actually mean? Do? etc? :oops: How would it affect the settings I showed on previous page? (Image)

PS: Yep, I think a default value of '1' for the post limit is good idea. :)
My phpBB Extensions
Finally found great Website Hosting from Image KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Mixer | My Volkswagen Corrado G60

User avatar
JoshyPHP
Code Contributor
Posts: 1081
Joined: Mon Jul 11, 2011 12:28 am

Re: [DEV] @Mention System

Post by JoshyPHP »

Hey Wolfsblvt, do you accept Pull Requests on GitHub? There's a couple of small things that could be fixed.

If you do accept PRs I'll go through the files in event/ and core/ and send you a few PRs with small fixes. Then I'll take a look at your performance woes and see if I can do something about it. My area of interest is mainly things related to text parsing/transformations.
I wrote the thing that does BBCodes in 3.3.

User avatar
Raul [ThE KuKa]
Style Customisations
Style Customisations
Posts: 7548
Joined: Mon Dec 08, 2003 9:24 pm
Location: Spain
Name: Raul Arroyo
Contact:

Re: [DEV] @Mention System

Post by Raul [ThE KuKa] »

Working in Spanish translation... ;)
All unsolicited PMs will be ignored.
:warning: Knowledge Base | Documentation | Board rules | phpBB Styles Rules & Policies :warning:


If you like my styles, translations, etc. and want to show some appreciation, then feel free to Donate with Image
:flag_es: phpBB Spain - Online Since 2003 :heart:



User avatar
Wolfsblvt
Registered User
Posts: 634
Joined: Sun Oct 26, 2014 9:12 pm
Location: Solingen, Germany
Contact:

Re: [DEV] @Mention System

Post by Wolfsblvt »

VSE wrote:Look in phpBB at how the ROOT_PATH variable is created. Try either update_web_root_path() or generate_board_url()
Thank you, I'll look for a solution here.
Volksdevil wrote:Can you expand a little on what this would actually mean? Do? etc? :oops: How would it affect the settings I showed on previous page? (Image)
This will not change other settings at all. It will just add another setting where you can choose wich option you want to have for your board.

The real logic behind that what I want to do is a bit complicated, but I can give a short overview.
At the moment, my extension is parsing a text every time it is displayed. So it goes through the whole text and look for mentions, then convert it to the username link.
What the option enabled would do is do this parsing just once. Then the parsed code will be saved to the db, so it does not need to be parsed again. This would sava up a lot of time, but makes the parsing persistent in the post.
JoshyPHP wrote:Hey Wolfsblvt, do you accept Pull Requests on GitHub? There's a couple of small things that could be fixed.

If you do accept PRs I'll go through the files in event/ and core/ and send you a few PRs with small fixes. Then I'll take a look at your performance woes and see if I can do something about it. My area of interest is mainly things related to text parsing/transformations.
Of course I accept pull requests. Any help or tips is very appreciated, especially cause this is a very big extension.

I just want to "warn" you that I'll rework the parsing and stuff myself a lot, so we should try to not do the same thing and waste time. I am not doing anything in the code till monday, so yeah, feel free to do whatever you would like to.

I would be glad if you could do the same again after my next rework in the future (:
If you have a specific extension request and you are willing to pay for, you can write me a PM.
My extensions (Trending: @Mention SystemAdvanced PollsUser Online Time)

»Du kamst zu uns. Deine Stimme kam. Du zeigtest uns die Sterne. Sie funkelten. Wir konnten sehen.«

User avatar
JoshyPHP
Code Contributor
Posts: 1081
Joined: Mon Jul 11, 2011 12:28 am

Re: [DEV] @Mention System

Post by JoshyPHP »

I installed the extension on my local board and looked for the source of the slowdown. This is what I found:
  • Every public page calls generate_text_for_display() (most often to display the forum's description)
  • The extension subscribes to core.modify_text_for_display_before therefore the extension is called on every public page
  • The extension calls wolfsblvt\mentions\core\get_userlist() which loads a lot of users
    • Even if the query is cached, unserializing the cached data takes time
  • For each user, phpbb_get_user_avatar() is called, which has a big overhead
    • On my local board with 1,500 users it generates nearly 100,000 calls to preg_replace()
  • For each user, get_username_string() is called twice.
    • Each get_username_string() triggers a core.modify_username_string event
Quite simply, every page gets slower because many users are loaded, each user triggers two events (potentially generating thousands of events) and all of that overhead adds up to a significant amount of processing. The solution is to not load users unless you know for a fact that they've been mentionned.
I wrote the thing that does BBCodes in 3.3.

User avatar
Wolfsblvt
Registered User
Posts: 634
Joined: Sun Oct 26, 2014 9:12 pm
Location: Solingen, Germany
Contact:

Re: [DEV] @Mention System

Post by Wolfsblvt »

JoshyPHP wrote:I installed the extension on my local board and looked for the source of the slowdown. This is what I found:
Thank you for this detailed analysis. That's great (:

Some of the problems you've mentioned, or maybe most, are the ones I want to fix with issue #1 - Improve `get_userlist()` function by reducing data saved in the array and only store it when needed.
The user loading, avatar stuff etc I mean.

For parsing: Yeah, I've also seen that it is called on every text, also forum descriptions and PMs. I think I should find a way to also parse on posts, and also only if parsing is needed. This may be matched with the enhancement of permantly story mentions/matches.
If you have a specific extension request and you are willing to pay for, you can write me a PM.
My extensions (Trending: @Mention SystemAdvanced PollsUser Online Time)

»Du kamst zu uns. Deine Stimme kam. Du zeigtest uns die Sterne. Sie funkelten. Wir konnten sehen.«

User avatar
Volksdevil
Registered User
Posts: 2414
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: [DEV] @Mention System

Post by Volksdevil »

Great stuff from the both of you to look at making things like this (Superb extension) run as efficiently as possible. Keep up the good work, it's much appreciated!
My phpBB Extensions
Finally found great Website Hosting from Image KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Mixer | My Volkswagen Corrado G60

User avatar
JoshyPHP
Code Contributor
Posts: 1081
Joined: Mon Jul 11, 2011 12:28 am

Re: [DEV] @Mention System

Post by JoshyPHP »

Wolfsblvt wrote:I think I should find a way to also parse on posts, and also only if parsing is needed. This may be matched with the enhancement of permantly story mentions/matches.
I assume you meant "permanently store", in the post itself. That's definitely the way you should go so that you don't have to run any code on display. Ideally, what you should do is intercept @mentions before BBCode is parsed and replace them with a BBCode. I think the event is core.modify_submit_post_data. That's what XenForo does btw.

Then rely on the custom BBCodes system to display them. You'll have to stuff several pieces of information in the same BBCode but it might be doable despite the current system not supporting multiple attributes.
I wrote the thing that does BBCodes in 3.3.

User avatar
Wolfsblvt
Registered User
Posts: 634
Joined: Sun Oct 26, 2014 9:12 pm
Location: Solingen, Germany
Contact:

Re: [DEV] @Mention System

Post by Wolfsblvt »

JoshyPHP wrote:I assume you meant "permanently store", in the post itself. That's definitely the way you should go so that you don't have to run any code on display. Ideally, what you should do is intercept @mentions before BBCode is parsed and replace them with a BBCode. I think the event is core.modify_submit_post_data. That's what XenForo does btw.

Then rely on the custom BBCodes system to display them. You'll have to stuff several pieces of information in the same BBCode but it might be doable despite the current system not supporting multiple attributes.
Yeah, meant that.

That would be an option. Have thought about that (that was even the thing they have talked some time ago on area51), but I don't lake that idea at all. It will permanently change what users have written, heavily.

If I want to go this way, I think I will go another way. The way smileys are handled in phpBB. They are replaced with HTML comments, wich could contain any data in any format I need them. Then I could wrap the @mention with the comment and just parse the comment with a simple regex. It will not matter on post editing, cause html comments are stripped by default, even with this extension disabled. It will also not matter on display if this extension is disabled, cause HTML comments will not show up in the post.
How do you think about this solution?

Another one would be gn36 idea here on GitHub.
To store the data needed for replaces in an extra table. A little bit of extra load on the db, but shouldn't be really recognizeable. This would keep data consistent if this extension gets disabled.


And for parsing at all: I don't think that small parsing stuff on every post everytime is really bad. Not if it is optimized. I mean every BBCode get's parsed this way. So if I don't need to do this special matching with @mentions and don't need to query additional stuff, it would be simple BBCode parsing, wich should be okay, shouldn't it?

@Volksdevil: Thanks (:
Of course I'll try to get this the best extension possible. That's my passion :P
If you have a specific extension request and you are willing to pay for, you can write me a PM.
My extensions (Trending: @Mention SystemAdvanced PollsUser Online Time)

»Du kamst zu uns. Deine Stimme kam. Du zeigtest uns die Sterne. Sie funkelten. Wir konnten sehen.«

playgoods
Registered User
Posts: 60
Joined: Wed Jun 16, 2010 1:05 pm

Re: [DEV] @Mention System

Post by playgoods »

Is there a changelog for this extension? I'm sure you change the files a lot and I would like to keep up to date.

Great extension!!!

User avatar
frax
Registered User
Posts: 44
Joined: Thu Dec 11, 2014 4:10 pm
Location: Cosenza
Name: Frax C.
Contact:

Re: [DEV] @Mention System

Post by frax »

If instead of loading the entire table user invokes only the friends list from phpbb_zebra?

User avatar
VSE
Extensions Development Coordinator
Extensions Development Coordinator
Posts: 5041
Joined: Sat Jan 17, 2009 9:37 am
Location: Los Angeles, CA
Name: Matt Friedman
Contact:

Re: [DEV] @Mention System

Post by VSE »

By the way, the version should be -dev, as it's not a stable release yet.
Official phpBB Extensions ⭐️ My Extensions & MODs 🔔 YES!!! They ALL work with phpBB 3.3.x 🔔
Please do not PM me for support.

User avatar
Wolfsblvt
Registered User
Posts: 634
Joined: Sun Oct 26, 2014 9:12 pm
Location: Solingen, Germany
Contact:

Re: [DEV] @Mention System

Post by Wolfsblvt »

playgoods wrote:Is there a changelog for this extension? I'm sure you change the files a lot and I would like to keep up to date.
Changelog will be here: viewtopic.php?p=13932906#p13932906
frax wrote:If instead of loading the entire table user invokes only the friends list from phpbb_zebra?
Could be an ACP option, but I don't think anyone would need that.
VSE wrote:By the way, the version should be -dev, as it's not a stable release yet.
Is this really needed? I mean I could add this to the version number, but I thought the tag for the topic here would be enough.
but yeah, wouldn't be a problem. The next one would be 1.1.0-dev then.
If you have a specific extension request and you are willing to pay for, you can write me a PM.
My extensions (Trending: @Mention SystemAdvanced PollsUser Online Time)

»Du kamst zu uns. Deine Stimme kam. Du zeigtest uns die Sterne. Sie funkelten. Wir konnten sehen.«

Locked

Return to “Abandoned Extensions”