Last modified: 2013-08-25 17:34:50 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T39957, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 37957 - replace php_sapi_name() with PHP_SAPI
replace php_sapi_name() with PHP_SAPI
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.20.x
All All
: Low enhancement (vote)
: 1.21.0 release
Assigned To: Nobody - You can work on this!
: platformeng
Depends on:
Blocks: code_quality
  Show dependency treegraph
 
Reported: 2012-06-26 09:13 UTC by Antoine "hashar" Musso (WMF)
Modified: 2013-08-25 17:34 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Antoine "hashar" Musso (WMF) 2012-06-26 09:13:49 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 ) { }
Comment 1 Antoine "hashar" Musso (WMF) 2012-06-26 09:14:45 UTC
CCing Sam and Chad for input.
Comment 2 Tim Starling 2013-02-04 02:05:37 UTC
PHP_SAPI is also faster.
Comment 3 Ori Livneh 2013-02-04 03:14:01 UTC
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é.
Comment 4 Antoine "hashar" Musso (WMF) 2013-02-04 08:18:26 UTC
Bug 44633 track the addition of a rule in PHP CodeSniffer
Comment 5 Alex Monk 2013-02-04 21:04:09 UTC
We could probably do the same for some extensions.
Comment 6 Ori Livneh 2013-02-05 04:36:51 UTC
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.
Comment 7 Gerrit Notification Bot 2013-08-25 16:29:42 UTC
Change 80866 had a related patch set uploaded by Yuvipanda:
Use PHP_SAPI instead of php_sapi_name()

https://gerrit.wikimedia.org/r/80866
Comment 8 Yuvi Panda 2013-08-25 16:34:40 UTC
https://github.com/search?l=&q=php_sapi_name+%40wikimedia&ref=advsearch&type=Code if people want to knock off some more extensions :)
Comment 9 Gerrit Notification Bot 2013-08-25 17:34:50 UTC
Change 80866 merged by jenkins-bot:
Use PHP_SAPI instead of php_sapi_name()

https://gerrit.wikimedia.org/r/80866

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links