public function testPhpIniFile()
 {
     $_phpLocation = M3_Util_Settings::getPhpIniFileLocation();
     $this->assertTrue(!empty($_phpLocation));
     $_php = new M3_Util_IniSettings($_phpLocation, false);
     $_php->readIniFile($_phpSettings, true);
     $this->assertArrayHasKey('PHP', $_phpSettings);
     $this->assertArrayHasKey('engine', $_phpSettings['PHP']);
     $this->assertEquals('on', strtolower($_phpSettings['PHP']['engine']));
 }
Beispiel #2
0
 /**
  * Returns an array consisting of the contents of the php.ini file.
  * Keep in mind that PHP ignores section headers - all settings are considered
  * to be in one global unnamed section. Because of this, you can ask for the returned
  * array to be "flat" (i.e. one-dimensional, removing the separation of
  * settings by section). Otherwise, you can get the data returned as
  * a multi-dimensional array - first dimension is the section
  * names and the second is the name/value pairs found in the section.
  * 
  * @param $flatten if true (the default) all data comes back in a flat array list without
  *                 any section information; if false, the returned value is multi-dimensional
  *                 with data separated in sections.
  * @return multi-dimensional array of php.ini data, false if it can't get the data
  */
 public static function getPhpIniSettings($flatten = true)
 {
     $_phpIniLocation = self::getPhpIniFileLocation();
     if (!$_phpIniLocation) {
         return false;
     }
     $_phpIni = new M3_Util_IniSettings($_phpIniLocation, false);
     if ($_phpIni->readIniFile($_phpIniSettings, true)) {
         if ($flatten) {
             $_flattenedData = array();
             foreach ($_phpIniSettings as $_section => $_nameValues) {
                 $_flattenedData = array_merge($_flattenedData, $_nameValues);
             }
             return $_flattenedData;
         } else {
             return $_phpIniSettings;
         }
     } else {
         return false;
     }
 }