morrisonlevi / web-php

The www.php.net site
http://www.php.net
Other
2 stars 1 forks source link

Clean up manual-lookup.sqlite #9

Open philip opened 7 years ago

philip commented 7 years ago

The mechanism that generates manual-lookup.sqlite is old and somewhat broken.

For example, for APIs with both OOP/procedural commands, it does not find the procedural variant. For example, it finds mysqli::select_db() but not mysqli_select_db().

It's been a long time since I looked into it, but I vaguely also remember other problems and concerns.

Sobak commented 7 years ago

Yes, there is a tone of bugreports related to that. How is that index generated? Is PhD responsible for that?

philip commented 7 years ago

It was written before phd back in 2003, and untangling how the entire process works is a challenge but here's a big start. This script parses file names from the manual and creates manual-lookup.sqlite:

https://github.com/php/systems/blob/master/gen-phpweb-sqlite-db.php

There's also a related TODO in there:

This script is known to be imperfect, and future plans will use PhD to generate this data based on XML ids thus including ini settings, predefined constants, functions, etc.

There are a couple of pull requests against i, although those don't fix the main problem. I believe using phd will remove the need to maintain these hacks.

Related to this is the fancy php.net search functionality although I don't remember how that works or where it gets its data from, perhaps the same source.

Sobak commented 7 years ago

Related to this is the fancy php.net search functionality although I don't remember how that works or where it gets its data from, perhaps the same source.

It is generated by PhD. I saw the code responsible for it.

I'll try to work on that. But probably first I'd like to merge composer changes and code related to #10 I think Index handling needs to be refactored to allow its extending and altering by the Formats. I don't want to mix so many uncommited and unreviewed branches.

Thanks for the resources!

philip commented 7 years ago

That might be the key. Or at least, in most of these cases php.net/foo does not work while entering foo into the search box does. Example, mysqli_result::fetch_all where php.net/mysqli_result::fetch_all does not work but typing it in the search box finds mysqli-result.fetch-all.php.

I'm adding a 'temporary' hack now to make all these work for mysqli (in the 404 handler), but I suspect other extensions suffer from this too. Looking forward to seeing you take phd to the next level :)

philip commented 7 years ago

Related: https://bugs.php.net/bug.php?id=49956

philip commented 7 years ago

Temporary fix for mysqli was committed via fffcddab7984a82923df4a0300d4af243532c485