Example #1
0
 /**
  * Get the current configuration data.
  * @return array the configuration data
  */
 function &getData()
 {
     static $configData;
     if (!isset($configData)) {
         // Load configuration data only once per request
         $configData = Config::reloadData();
     }
     return $configData;
 }
Example #2
0
 /**
  * Get the current configuration data.
  * @return array the configuration data
  */
 function &getData()
 {
     $configData =& Registry::get('configData', true, null);
     if ($configData === null) {
         // Load configuration data only once per request, implicitly
         // sets config data by ref in the registry.
         $configData = Config::reloadData();
     }
     return $configData;
 }
Example #3
0
 /**
  * @depends testSetConfigFileName
  * @covers Config::reloadData
  */
 public function testReloadDataAndGetData()
 {
     Config::setConfigFileName('lib/pkp/tests/config/config.mysql.inc.php');
     $result = Config::reloadData();
     $expectedResult = array('installed' => true, 'base_url' => 'http://pkp.sfu.ca/ojs', 'registry_dir' => 'lib/pkp/tests/registry', 'session_cookie_name' => 'OJSSID', 'session_lifetime' => 30, 'scheduled_tasks' => false, 'date_format_trunc' => '%m-%d', 'date_format_short' => '%Y-%m-%d', 'date_format_long' => '%B %e, %Y', 'datetime_format_short' => '%Y-%m-%d %I:%M %p', 'datetime_format_long' => '%B %e, %Y - %I:%M %p', 'disable_path_info' => false);
     // We'll only check part of the configuration data to
     // keep the test less verbose.
     self::assertEquals($expectedResult, $result['general']);
     $result =& Config::getData();
     self::assertEquals($expectedResult, $result['general']);
 }