* redirect loops when "pretty URLs" are used.
*/
$wgUsePathInfo =
- ( strpos( php_sapi_name(), 'cgi' ) === false ) &&
- ( strpos( php_sapi_name(), 'apache2filter' ) === false ) &&
- ( strpos( php_sapi_name(), 'isapi' ) === false );
+ ( strpos( PHP_SAPI, 'cgi' ) === false ) &&
+ ( strpos( PHP_SAPI, 'apache2filter' ) === false ) &&
+ ( strpos( PHP_SAPI, 'isapi' ) === false );
/**
* The extension to append to script names by default. This can either be .php
const RESTART_ON_ERROR = 1;
public function __construct( $numProcs, $flags = 0 ) {
- if ( php_sapi_name() != 'cli' ) {
+ if ( PHP_SAPI != 'cli' ) {
throw new MWException( "ForkController cannot be used from the web." );
}
$this->procsToStart = $numProcs;
}
$canDl = false;
- $sapi = php_sapi_name();
- if( $sapi == 'cli' || $sapi == 'cgi' || $sapi == 'embed' ) {
+ if( PHP_SAPI == 'cli' || PHP_SAPI == 'cgi' || PHP_SAPI == 'embed' ) {
$canDl = ( function_exists( 'dl' ) && is_callable( 'dl' )
&& wfIniGetBool( 'enable_dl' ) && !wfIniGetBool( 'safe_mode' ) );
}
$data['sitename'] = $GLOBALS['wgSitename'];
$data['generator'] = "MediaWiki {$GLOBALS['wgVersion']}";
$data['phpversion'] = phpversion();
- $data['phpsapi'] = php_sapi_name();
+ $data['phpsapi'] = PHP_SAPI;
$data['dbtype'] = $GLOBALS['wgDBtype'];
$data['dbversion'] = $this->getDB()->getServerVersion();
$this->connContainerCache = new ProcessCacheLRU( 300 );
// Cache auth token information to avoid RTTs
if ( !empty( $config['cacheAuthInfo'] ) ) {
- if ( php_sapi_name() === 'cli' ) {
+ if ( PHP_SAPI === 'cli' ) {
$this->srvCache = wfGetMainCache(); // preferrably memcached
} else {
try { // look for APC, XCache, WinCache, ect...
* @ingroup UtfNormal
*/
-if( php_sapi_name() != 'cli' ) {
+if( PHP_SAPI != 'cli' ) {
die( "Run me from the command line please.\n" );
}
* @ingroup UtfNormal
*/
-if( php_sapi_name() != 'cli' ) {
+if( PHP_SAPI != 'cli' ) {
die( "Run me from the command line please.\n" );
}
$verbose = false;
#$verbose = true;
-if( php_sapi_name() != 'cli' ) {
+if( PHP_SAPI != 'cli' ) {
die( "Run me from the command line please.\n" );
}
define( 'BENCH_CYCLES', 5 );
-if( php_sapi_name() != 'cli' ) {
+if( PHP_SAPI != 'cli' ) {
die( "Run me from the command line please.\n" );
}
* @ingroup UtfNormal
*/
-if( php_sapi_name() != 'cli' ) {
+if( PHP_SAPI != 'cli' ) {
die( "Run me from the command line please.\n" );
}
define( 'BIGSIZE', 1024 * 1024 * 10); // 10m
ini_set('memory_limit', BIGSIZE + 120 * 1024 * 1024);
-if( php_sapi_name() != 'cli' ) {
+if( PHP_SAPI != 'cli' ) {
die( "Run me from the command line please.\n" );
}
require_once 'UtfNormalUtil.php';
require_once 'UtfNormal.php';
-if( php_sapi_name() != 'cli' ) {
+if( PHP_SAPI != 'cli' ) {
die( "Run me from the command line please.\n" );
}
* @ingroup UtfNormal
*/
-if( php_sapi_name() != 'cli' ) {
+if( PHP_SAPI != 'cli' ) {
die( "Run me from the command line please.\n" );
}
: 0; // profiling mismatch error?
uasort( $this->mCollated, array( 'self', 'sort' ) );
array_walk( $this->mCollated, array( 'self', 'format' ), $totalReal );
- if ( php_sapi_name() === 'cli' ) {
+ if ( PHP_SAPI === 'cli' ) {
print "<!--\n".self::$out."\n-->\n";
} elseif ( $this->getContentType() === 'text/html' ) {
if ( $this->visible ) {
}
function logData() {
- if ( php_sapi_name() === 'cli' ) {
+ if ( PHP_SAPI === 'cli' ) {
print "<!-- \n {$this->trace} \n -->";
} elseif ( $this->getContentType() === 'text/html' ) {
print "<!-- \n {$this->trace} \n -->";
// wikimarkup can be used.
$software = array();
$software['[https://www.mediawiki.org/ MediaWiki]'] = self::getVersionLinked();
- $software['[http://www.php.net/ PHP]'] = phpversion() . " (" . php_sapi_name() . ")";
+ $software['[http://www.php.net/ PHP]'] = phpversion() . " (" . PHP_SAPI . ")";
$software[$dbr->getSoftwareLink()] = $dbr->getServerInfo();
// Allow a hook to add/remove items.
*/
protected function error( $err, $die = 0 ) {
$this->outputChanneled( false );
- if ( php_sapi_name() == 'cli' ) {
+ if ( PHP_SAPI == 'cli' ) {
fwrite( STDERR, $err . "\n" );
} else {
print $err;
* @file
*/
-if ( php_sapi_name() != 'cli-server' ) {
+if ( PHP_SAPI != 'cli-server' ) {
die( "This script can only be run by php's cli-server sapi." );
}
* @ingroup LockManager Maintenance
*/
-if ( php_sapi_name() !== 'cli' ) {
+if ( PHP_SAPI !== 'cli' ) {
die( "This is not a valid entry point.\n" );
}
error_reporting( E_ALL );
# Variables / Configuration
#
-if ( php_sapi_name() != 'cli' ) {
+if ( PHP_SAPI != 'cli' ) {
echo 'Run "' . __FILE__ . '" from the command line.';
die( -1 );
}
* @ingroup Maintenance
*/
-if( php_sapi_name() != 'cli' ) {
+if( PHP_SAPI != 'cli' ) {
die( 1 );
}