Content of post_text field in database

Get help with installation and running phpBB 3.1.x here. Please do not post bug reports, feature requests, or extension related questions here.
Get Involved
radders
Registered User
Posts: 19
Joined: Tue Aug 22, 2017 2:35 pm

Content of post_text field in database

Post by radders » Mon Oct 23, 2017 11:25 am

Hello,

I need to ascertain exactly how the post_text field is constructed when a user adds an image, smilie, text formatting, etc.

This is because I need to extract all the existing posts, and add them to another database.

Please point me in the direction of the technical documentation for this.

Thanks, Dave R

User avatar
Mick
Support Team Member
Support Team Member
Posts: 18126
Joined: Fri Aug 29, 2008 9:49 am
Location: Cardiff

Re: Content of post_text field in database

Post by Mick » Mon Oct 23, 2017 5:30 pm

Can you explain exactly what you’re trying to do please? I’m assuming you want to copy parts of one database to another (working?) database?
"The more connected we get the more alone we become" - Kyle Broflovski

There are no ‘threads’ in phpBB, they are topics.
Forza Garibaldi

radders
Registered User
Posts: 19
Joined: Tue Aug 22, 2017 2:35 pm

Re: Content of post_text field in database

Post by radders » Wed Oct 25, 2017 12:01 pm

Correct. I need to copy all the users' posts from the phpBB forum database,
and add them to another forum database.
I need to know how to handle the special encoding which phpBB uses for colours, smilies, etc.,
so that I can convert these into the correct equivalent in the destination database.

User avatar
Mick
Support Team Member
Support Team Member
Posts: 18126
Joined: Fri Aug 29, 2008 9:49 am
Location: Cardiff

Re: Content of post_text field in database

Post by Mick » Wed Oct 25, 2017 6:11 pm

Because of the internal structure (interlinking and such) of the database it’s almost impossible to swap and change ‘portions’ of the database. Can you explain why you need to do this?
"The more connected we get the more alone we become" - Kyle Broflovski

There are no ‘threads’ in phpBB, they are topics.
Forza Garibaldi

radders
Registered User
Posts: 19
Joined: Tue Aug 22, 2017 2:35 pm

Re: Content of post_text field in database

Post by radders » Thu Oct 26, 2017 1:11 pm

...swap and change ‘portions’ of the database...
I'm not planning to swap bits of the database... as I said
I need to copy all the users' posts
I'm explaining what I want to achieve because I'm a polite person, and am trying to be clear for you.
However, I find it strange that you query my motives instead of answering my simple question...

All I need is an explanation of HOW the special attributes are stored - There's nothing difficult about it.

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 20444
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Content of post_text field in database

Post by RMcGirr83 » Thu Oct 26, 2017 1:21 pm

radders wrote:
Thu Oct 26, 2017 1:11 pm
...swap and change ‘portions’ of the database...
I'm not planning to swap bits of the database... as I said
I need to copy all the users' posts
Uhmmm, isn't that just exactly "swapping bits of data"? Anyway
However, I find it strange that you query my motives instead of answering my simple question...
because there is always more than one way to skin a cat
All I need is an explanation of HOW the special attributes are stored - There's nothing difficult about it.
You can see how they are stored by going into the database within the posts table. EG,

Code: Select all

<r><QUOTE author="RMcGirr83" post_id="6" time="1448123564" user_id="2"><s>[quote=RMcGirr83 post_id=6 time=1448123564 user_id=2]</s>
<URL url="http://www.rmcgirr83.org">http://www.rmcgirr83.org</URL>
<e>[/quote]</e></QUOTE> <E>:mrgreen:</E></r>
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

radders
Registered User
Posts: 19
Joined: Tue Aug 22, 2017 2:35 pm

Re: Content of post_text field in database

Post by radders » Thu Oct 26, 2017 1:42 pm

...see how they are stored...
Whilst it is true that I could look at some examples of how they are stored, and thus determine the format used, by looking at the data, I don't think that is a sensible way to proceed - there may not be examples of every type.

A far better solution would be to consult the technical documentation which defines absolutely how they are stored, and work from that.

That is why I am asking.

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 20444
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Content of post_text field in database

Post by RMcGirr83 » Thu Oct 26, 2017 2:21 pm

As far as I am aware there isn't any technical documentation. phpBB since 3.2 uses this. So I guess the best person to ask this question would be Joshyphp.

EDIT: found this which may help you http://s9etextformatter.readthedocs.io/ which then leads to this http://s9etextformatter.readthedocs.io/ ... Unparsing/
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

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

Re: Content of post_text field in database

Post by JoshyPHP » Thu Oct 26, 2017 3:08 pm

I don't see any questions in this topic. I think that radders wants to copy posts from one database to another.

In phpBB there's a text_formatter.utils service with a method named unparse() that returns the content of a parsed text to its original form.

I'm subscribed to this topic so if I see a question that I can answer, I will.
I wrote the thing that does the BBCodes in 3.2. Unless it broke yours, in which case it was somebody else with a similar name.

radders
Registered User
Posts: 19
Joined: Tue Aug 22, 2017 2:35 pm

Re: Content of post_text field in database

Post by radders » Thu Oct 26, 2017 3:13 pm

JoshyPHP,

There is a question, posed quite early on:
how to handle the special encoding which phpBB uses for colours, smilies, etc.,
so that I can convert these into the correct equivalent
I am asking for a description of that encoding.

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

Re: Content of post_text field in database

Post by JoshyPHP » Thu Oct 26, 2017 3:20 pm

Sorry, I usually just scan for "?".

What does "correct equivalent" mean? You should give an example of original input and expected output.
I wrote the thing that does the BBCodes in 3.2. Unless it broke yours, in which case it was somebody else with a similar name.

radders
Registered User
Posts: 19
Joined: Tue Aug 22, 2017 2:35 pm

Re: Content of post_text field in database

Post by radders » Thu Oct 26, 2017 3:25 pm

RMcGirr83,

So there's a library which encodes/decodes (parses/unparses) the strings.

The person who wrote that library must have been give a specification of what those functions have to do...
It is that specification which I think I need.

radders
Registered User
Posts: 19
Joined: Tue Aug 22, 2017 2:35 pm

Re: Content of post_text field in database

Post by radders » Thu Oct 26, 2017 3:28 pm

Joshy,
"correct equivalent" means whatever strings, tokens, etc the destination wants.
That's for me to worry about.

My question to this forum is where is the format used by phpBB defined?
Armed with that info, I can parse the existing posts, and locate the relevant artefacts,
stripping out the adornments required by the phpBB format.

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

Re: Content of post_text field in database

Post by JoshyPHP » Thu Oct 26, 2017 3:32 pm

The format is standard XML. The schema isn't defined anywhere.

I still don't understand what "correct equivalent" is and what "destination" is. If you can't give a practical example and every other question people ask you is answered by a variation of "it's none of your business" then there's nothing more I can do.
I wrote the thing that does the BBCodes in 3.2. Unless it broke yours, in which case it was somebody else with a similar name.

radders
Registered User
Posts: 19
Joined: Tue Aug 22, 2017 2:35 pm

Re: Content of post_text field in database

Post by radders » Thu Oct 26, 2017 3:35 pm

Examples of phpBB format:

a colour:
[color=#0000BF:2p33qpi0]text[/color:2p33qpi0]

a smilie:
<!-- s:!: --><img src="{SMILIES_PATH}/icon_exclaim.gif" alt=":!:" title="Exclamation" /><!-- s:!: -->

a URL:
<!-- m --><a class="postlink" href="http://www.xxx.uk/frames/set_prod.htm"> ... rod.htm</a><!-- m -->

These seem quite complex to me - more so than other forums use.

What are the strings like:
<!-- s:!: --> and <!-- m --> and :2p33qpi0 for, and what other similar structures are there?
Last edited by radders on Thu Oct 26, 2017 3:45 pm, edited 1 time in total.

Post Reply

Return to “[3.1.x] Support Forum”

Who is online

Users browsing this forum: cille and 24 guests

cron