[MediaWiki-l] Hidden categories: page_props consistence

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[MediaWiki-l] Hidden categories: page_props consistence

Valerio Bozzolan
Hello!

Today I've learned that an hidden category (using __HIDDENCAT__) is just
a page with a certain property in the `page_props` database table. To be
precise, it should have 'pp_propname' => 'hiddencat'.

https://doc.wikimedia.org/mediawiki-core/master/php/WikiPage_8php_source.html#l03382
https://www.mediawiki.org/wiki/Manual:Page_props_table

Having said that:

1. Why the hell in my personal MediaWiki database I have
'68696464656e636174' as 'pp_propername' value (instead of the expected
'hiddencat' value)?
2. What does '68696464656e636174' mean?
3. Why does it work as expected?
3.1 Are there magic/obscure/evil lines of code behind the database
abstraction layer?

Yes, I admit that I'm using MediaWiki 1.27.3 but yes, my local
WikiPage.php looks exactly as the linked documentation.

Thanks for this clarification :D

--
Email sent from Ubuntu GNU/Linux GNOME using Mozilla Thunderbird
(Don't fight about it. I have to convert this client to Debian stable, like my laptop)

Valerio Bozzolan


_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hidden categories: page_props consistence

Bartosz Dziewoński
All text in MediaWiki's database uses MySQL's "BINARY" encoding by
default, even though it's encoded in UTF-8, for historical reasons
(MySQL's UTF-8 support used to be horribly broken).

The software you're using to view it therefore decides to show you the
binary bytes, rather than the actual text. I've seen this annoying
behavior in some versions of PHPMyAdmin and MySQLWorkbench, I don't know
what you're using.

You can "decode" the value '68696464656e636174' based on the ASCII
values for the hex codes:

0x68 = 'h'
0x69 = 'i'
0x64 = 'd'
0x64 = 'd'
0x65 = 'e'
0x6e = 'n'
0x63 = 'c'
0x61 = 'a'
0x74 = 't'
(https://en.wikipedia.org/wiki/ASCII#Printable_characters)

Or, you can cast it to the 'char' type in your query to make your
software behave:

   SELECT CAST(pp_propname as char) FROM page_props;

The actual data stored in your database has been 'hiddencat' all along,
and MediaWiki doesn't need to do anything special to get that. The
problem is with the viewer software being too clever.

--
Bartosz Dziewoński

_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hidden categories: page_props consistence

Valerio Bozzolan
I only have noticed now the varbinary type. This explains the phpMyAdmin
behaviour.

Thanks, you made my day.

On 20/07/2017 03:25, Bartosz Dziewoński wrote:

> All text in MediaWiki's database uses MySQL's "BINARY" encoding by
> default, even though it's encoded in UTF-8, for historical reasons
> (MySQL's UTF-8 support used to be horribly broken).
>
> The software you're using to view it therefore decides to show you the
> binary bytes, rather than the actual text. I've seen this annoying
> behavior in some versions of PHPMyAdmin and MySQLWorkbench, I don't
> know what you're using.
>
> You can "decode" the value '68696464656e636174' based on the ASCII
> values for the hex codes:
>
> 0x68 = 'h'
> 0x69 = 'i'
> 0x64 = 'd'
> 0x64 = 'd'
> 0x65 = 'e'
> 0x6e = 'n'
> 0x63 = 'c'
> 0x61 = 'a'
> 0x74 = 't'
> (https://en.wikipedia.org/wiki/ASCII#Printable_characters)
>
> Or, you can cast it to the 'char' type in your query to make your
> software behave:
>
>   SELECT CAST(pp_propname as char) FROM page_props;
>
> The actual data stored in your database has been 'hiddencat' all along,
> and MediaWiki doesn't need to do anything special to get that. The
> problem is with the viewer software being too clever.
>

--
Email sent from Ubuntu GNU/Linux GNOME using Mozilla Thunderbird
(Don't fight about it. I have to convert this client to Debian stable, like my laptop)

Valerio Bozzolan
https://boz.reyboz.it


_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Loading...