replace php_sapi_name() with PHP_SAPI
Closed, ResolvedPublic

Description

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 ) { }


Version: 1.20.x
Severity: enhancement

bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz37957.
hashar created this task.Via LegacyJun 26 2012, 9:13 AM
hashar added a comment.Via ConduitJun 26 2012, 9:14 AM

CCing Sam and Chad for input.

tstarling added a comment.Via ConduitFeb 4 2013, 2:05 AM

PHP_SAPI is also faster.

ori added a comment.Via ConduitFeb 4 2013, 3:14 AM

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é.

hashar added a comment.Via ConduitFeb 4 2013, 8:18 AM

Bug 44633 track the addition of a rule in PHP CodeSniffer

Krenair added a comment.Via ConduitFeb 4 2013, 9:04 PM

We could probably do the same for some extensions.

ori added a comment.Via ConduitFeb 5 2013, 4:36 AM

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.

gerritbot added a comment.Via ConduitAug 25 2013, 4:29 PM

Change 80866 had a related patch set uploaded by Yuvipanda:
Use PHP_SAPI instead of php_sapi_name()

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

yuvipanda added a comment.Via ConduitAug 25 2013, 4:34 PM
gerritbot added a comment.Via ConduitAug 25 2013, 5:34 PM

Change 80866 merged by jenkins-bot:
Use PHP_SAPI instead of php_sapi_name()

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

Add Comment