Author: bhofmann
Date: Sat Nov 12 14:04:22 2011
New Revision: 1201264
URL: http://svn.apache.org/viewvc?rev=1201264&view=rev
Log:
small configuration refactoring
Modified:
shindig/branches/php_namespace_refactoring/php/config/container.php
shindig/branches/php_namespace_refactoring/php/config/test.php
shindig/branches/php_namespace_refactoring/php/index.php
shindig/branches/php_namespace_refactoring/php/src/apache/shindig/FrontController.php
shindig/branches/php_namespace_refactoring/php/src/apache/shindig/bootstrap.php
shindig/branches/php_namespace_refactoring/php/src/apache/shindig/common/Config.php
shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/GadgetFeatureRegistry.php
Modified: shindig/branches/php_namespace_refactoring/php/config/container.php
URL:
http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/config/container.php?rev=1201264&r1=1201263&r2=1201264&view=diff
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/config/container.php
(original)
+++ shindig/branches/php_namespace_refactoring/php/config/container.php Sat Nov
12 14:04:22 2011
@@ -44,7 +44,7 @@
* );
*
*/
-$shindigConfig = array(
+return array(
// Show debug backtrace's. Disable this on a production site
'debug' => true,
// do real file_exist checks? Turning this off can be a big performance gain
on prod servers but also risky & less verbose errors
Modified: shindig/branches/php_namespace_refactoring/php/config/test.php
URL:
http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/config/test.php?rev=1201264&r1=1201263&r2=1201264&view=diff
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/config/test.php (original)
+++ shindig/branches/php_namespace_refactoring/php/config/test.php Sat Nov 12
14:04:22 2011
@@ -22,7 +22,7 @@
* this configuration overrides some values for unit testing purposes
* you should not use these settings in production
*/
-$shindigConfig = array(
+return array(
'compress_javascript' => false,
'private_key_file' => realpath(dirname(__FILE__) . '/../test/certs') .
'/private.key',
'public_key_file' => realpath(dirname(__FILE__) . '/../test/certs') .
'/public.crt',
Modified: shindig/branches/php_namespace_refactoring/php/index.php
URL:
http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/index.php?rev=1201264&r1=1201263&r2=1201264&view=diff
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/index.php (original)
+++ shindig/branches/php_namespace_refactoring/php/index.php Sat Nov 12
14:04:22 2011
@@ -21,4 +21,5 @@
include 'src/apache/shindig/bootstrap.php';
$frontController = new \apache\shindig\FrontController();
+$frontController->setLocalConfig(__DIR__ . '/config/local.php');
$frontController->run();
\ No newline at end of file
Modified:
shindig/branches/php_namespace_refactoring/php/src/apache/shindig/FrontController.php
URL:
http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/FrontController.php?rev=1201264&r1=1201263&r2=1201264&view=diff
==============================================================================
---
shindig/branches/php_namespace_refactoring/php/src/apache/shindig/FrontController.php
(original)
+++
shindig/branches/php_namespace_refactoring/php/src/apache/shindig/FrontController.php
Sat Nov 12 14:04:22 2011
@@ -23,7 +23,15 @@ use apache\shindig\common\Config;
*/
class FrontController {
+ private $localConfig;
+
+ public function setLocalConfig($localConfig) {
+ $this->localConfig = $localConfig;
+ }
+
public function run() {
+ Config::loadConfig($this->localConfig);
+
$this->checkServerConfig();
//get servlet map and prefix the servlet paths
Modified:
shindig/branches/php_namespace_refactoring/php/src/apache/shindig/bootstrap.php
URL:
http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/bootstrap.php?rev=1201264&r1=1201263&r2=1201264&view=diff
==============================================================================
---
shindig/branches/php_namespace_refactoring/php/src/apache/shindig/bootstrap.php
(original)
+++
shindig/branches/php_namespace_refactoring/php/src/apache/shindig/bootstrap.php
Sat Nov 12 14:04:22 2011
@@ -57,10 +57,10 @@ $mapperLoader = new \Symfony\Component\C
$mapperLoader->register();
-$extensionClassPaths =
\apache\shindig\common\Config::get('extension_class_paths');
-
-if (! is_array($extensionClassPaths)) {
- $extensionClassPaths = array($extensionClassPaths);
-}
-
-$loader->registerPrefixFallbacks($extensionClassPaths);
\ No newline at end of file
+//$extensionClassPaths =
\apache\shindig\common\Config::get('extension_class_paths');
+//
+//if (! is_array($extensionClassPaths)) {
+// $extensionClassPaths = array($extensionClassPaths);
+//}
+//
+//$loader->registerPrefixFallbacks($extensionClassPaths);
\ No newline at end of file
Modified:
shindig/branches/php_namespace_refactoring/php/src/apache/shindig/common/Config.php
URL:
http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/common/Config.php?rev=1201264&r1=1201263&r2=1201264&view=diff
==============================================================================
---
shindig/branches/php_namespace_refactoring/php/src/apache/shindig/common/Config.php
(original)
+++
shindig/branches/php_namespace_refactoring/php/src/apache/shindig/common/Config.php
Sat Nov 12 14:04:22 2011
@@ -27,7 +27,7 @@ namespace apache\shindig\common;
class Config {
/**
*
- * @var boolean
+ * @var array
*/
private static $config = false;
@@ -36,19 +36,16 @@ class Config {
* @global array $shindigConfig
* @param string $local
*/
- static public function loadConfig($local = 'local') {
- global $shindigConfig;
+ public static function loadConfig($localConfigPath = null) {
if (! self::$config) {
// load default configuration
- require realpath(dirname(__FILE__) . "/../../../../config") .
'/container.php';
- self::$config = $shindigConfig;
- if ($local) {
- $localConfigPath = realpath(dirname(__FILE__) . "/../../../../config")
. '/' . $local . '.php';
+ self::$config = require realpath(dirname(__FILE__) .
"/../../../../config") . '/container.php';
+ if ($localConfigPath) {
if (file_exists($localConfigPath)) {
// include local.php if it exists and merge the config arrays.
// the second array values overwrites the first one's
- require $localConfigPath;
- self::$config = array_merge(self::$config, $shindigConfig);
+ $localConfig = require $localConfigPath;
+ self::$config = array_merge(self::$config, $localConfig);
}
}
}
@@ -59,10 +56,7 @@ class Config {
*
* @param array $tconfig
*/
- static function setConfig($tconfig) {
- if (!is_array(self::$config))
- self::loadConfig();
-
+ public static function setConfig($tconfig) {
self::$config = array_merge(self::$config, $tconfig);
}
@@ -72,10 +66,7 @@ class Config {
* @return array
* @throws ConfigException
*/
- static function get($key) {
- if (! self::$config) {
- self::loadConfig();
- }
+ public static function get($key) {
if (isset(self::$config[$key])) {
return self::$config[$key];
} else {
@@ -92,10 +83,7 @@ class Config {
* @param $key string Configuration key to set the value of.
* @param $value string Value to assign to the specified key.
*/
- static function set($key, $value) {
- if (! self::$config) {
- self::loadConfig();
- }
+ public static function set($key, $value) {
self::$config[$key] = $value;
}
}
Modified:
shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/GadgetFeatureRegistry.php
URL:
http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/GadgetFeatureRegistry.php?rev=1201264&r1=1201263&r2=1201264&view=diff
==============================================================================
---
shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/GadgetFeatureRegistry.php
(original)
+++
shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/GadgetFeatureRegistry.php
Sat Nov 12 14:04:22 2011
@@ -24,8 +24,6 @@ use apache\shindig\common\File;
* under the License.
*/
-require_once 'external/jsmin-php/jsmin.php';
-
/**
* Class that deals with the processing, loading and dep resolving of the
gadget features
* Features are javascript libraries that provide an API, like 'opensocial' or
'settitle'