/usr/share/php/Composer/Util/IniHelper.php is in composer 1.6.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Util;
/**
* Provides ini file location functions that work with and without a restart.
* When the process has restarted it uses a tmp ini and stores the original
* ini locations in an environment variable.
*
* @author John Stevenson <john-stevenson@blueyonder.co.uk>
*/
class IniHelper
{
const ENV_ORIGINAL = 'COMPOSER_ORIGINAL_INIS';
/**
* Returns an array of php.ini locations with at least one entry
*
* The equivalent of calling php_ini_loaded_file then php_ini_scanned_files.
* The loaded ini location is the first entry and may be empty.
*
* @return array
*/
public static function getAll()
{
$env = getenv(self::ENV_ORIGINAL);
if (false !== $env) {
return explode(PATH_SEPARATOR, $env);
}
$paths = array(strval(php_ini_loaded_file()));
if ($scanned = php_ini_scanned_files()) {
$paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
}
return $paths;
}
/**
* Describes the location of the loaded php.ini file(s)
*
* @return string
*/
public static function getMessage()
{
$paths = self::getAll();
if (empty($paths[0])) {
array_shift($paths);
}
$ini = array_shift($paths);
if (empty($ini)) {
return 'A php.ini file does not exist. You will have to create one.';
}
if (!empty($paths)) {
return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
}
return 'The php.ini used by your command-line PHP is: '.$ini;
}
}
|