Last modified: 2013-08-25 17:34:50 UTC
This bug is about replacing our calls to `php_sapi_name()` by the PHP building constant `PHP_SAPI`. PHP_SAPI has been available since PHP 4.2 and provide the same string that php_sapi_name() provides. I find it shorter and cleaner to read. Consider: if( php_sapi_name() !== 'cli ) { } if( PHP_SAPI !== 'cli ) { }
CCing Sam and Chad for input.
PHP_SAPI is also faster.
Patch in Gerrit: https://gerrit.wikimedia.org/r/#/c/47379/ (In reply to comment #2) > PHP_SAPI is also faster. I will now add "MediaWiki performance engineering" to my résumé.
Bug 44633 track the addition of a rule in PHP CodeSniffer
We could probably do the same for some extensions.
CentralNotice: https://gerrit.wikimedia.org/r/47554/ GeoData: https://gerrit.wikimedia.org/r/47555/ Scribunto: https://gerrit.wikimedia.org/r/47556/ SwiftCloudFiles: https://gerrit.wikimedia.org/r/47557/ mediawiki-config: https://gerrit.wikimedia.org/r/47558/ That covers all extensions currently deployed, I think.
Change 80866 had a related patch set uploaded by Yuvipanda: Use PHP_SAPI instead of php_sapi_name() https://gerrit.wikimedia.org/r/80866
https://github.com/search?l=&q=php_sapi_name+%40wikimedia&ref=advsearch&type=Code if people want to knock off some more extensions :)
Change 80866 merged by jenkins-bot: Use PHP_SAPI instead of php_sapi_name() https://gerrit.wikimedia.org/r/80866