Thread:User talk:Pastakhov/Some ideas regarding PhpTags

While I haven't yet used PhpTags beyond some quick testing, I've had a look at it and it seems quite interesting overall, because it seems like it could be relatively easily extended so that scripts can bring together functionality from several extensions.

I don't know what you plan for it, or how it is likely to develop from here on. Anyway, some ideas for uses of and possible extensions to PhpTags functionality came to mind in looking at it, and I'll mention them in case any of them may be interesting to you as well. It would be interesting to hear your thoughts about them:
 * 1) Automating sortkey generation for pages. This could currently be done using PhpTags Functions as follows: take the title of the calling page, use string functions to transform it, then use the returned result inside . The same can be done using Scribunto. But with PhpTags, it could easily be improved by adding a function to PhpTags Wiki so that the default sortkey can be set directly – with no need for returning something to   any more.
 * 2) Querying similar to DynamicPageList. I see that you've begun working on some query code, though while it's in Gerrit, it's not been merged yet. One comment in case it is helpful: Have you looked at Extension:DynamicPageListEngine? It is a modular, more well-written DPL implementation that only offers PHP and Lua APIs. Perhaps, for a number of querying features, its code may be a good reference to look at?
 * 3) Processing results from Semantic MediaWiki queries. Semantic Result Formats includes support for Extension:Arrays and Extension:HashTables, in both cases the results are efficiently stored in a PHP array. I think it would be quite simple to make a PhpTags extension to get and set arrays from the Arrays and HashTables extensions. Then a query can be made in the usual way, and afterwards PhpTags can be used to process the results in whatever way is desired.
 * 4) Semantic MediaWiki queries. An extension that allows SMW querying using PhpTags. This would take much more effort than the previous item, but would allow greater flexibility. PhpTags could be used to extend the functionality of Semantic MediaWiki inside a wiki – combining queries and processing of results however one wants, without having to write further extensions. I think the code of the Semantic Query Interface extension could be worth looking at for this.

If I decide to use PhpTags, then for my own needs I would need to extend it according to at least one of the last two options. That means one new, or possibly two new, MediaWiki extensions (which would be the first one(s) I'll ever write). Especially if attempting the second option, supporting SMW queries directly, that may take some time and effort. Anyway, I may give it a try, though no idea if and when it may be completed.

The other options in the list (the top two) are not as high priority for me. Maybe you'd be interested in the ideas, or maybe not. The first in the list may however be trivial enough for me to quickly add just to get more familiar with PhpTags, if you'd like the functionality. The second, I guess it may or may not fit what you have in mind with the querying functionality you have begun working on.

Finally, regarding performance: What I've seen mentioned ("10 times slower" than Lua for large scripts) sounds good enough for my purposes. However, that might improve even further simply by using HHVM, if it significantly speeds up PHP (and then in turn also PhpTags). It seems Wikimedia is now focusing on HHVM, and as of recently, MediaWiki-Vagrant also uses HHVM by default – you may already be aware of this, but I thought I'd mention it just in case, in case it would be useful for testing.