From 7e0b0798997b197d57d09ef5e690afdb1e6a2712 Mon Sep 17 00:00:00 2001
From: xue <>
Date: Thu, 29 Dec 2005 01:16:29 +0000
Subject: Changed module init() method signature.
---
framework/Data/TMemCache.php | 6 ++----
framework/Data/TSqliteCache.php | 6 ++----
framework/Exceptions/TErrorHandler.php | 4 +---
framework/Security/TAuthManager.php | 4 +---
framework/Security/TUserManager.php | 4 +---
framework/TApplication.php | 15 +++++++--------
framework/Web/Services/TPageService.php | 12 +++++-------
framework/Web/THttpRequest.php | 3 +--
framework/Web/THttpResponse.php | 4 +---
framework/Web/THttpSession.php | 4 +---
framework/Web/UI/TAssetManager.php | 4 +---
framework/Web/UI/TPageStatePersister.php | 3 +--
framework/Web/UI/TTemplateManager.php | 4 +---
framework/Web/UI/TThemeManager.php | 3 +--
framework/core.php | 8 ++++----
15 files changed, 30 insertions(+), 54 deletions(-)
diff --git a/framework/Data/TMemCache.php b/framework/Data/TMemCache.php
index a34cd9a6..08f5e099 100644
--- a/framework/Data/TMemCache.php
+++ b/framework/Data/TMemCache.php
@@ -44,7 +44,7 @@
* Some usage examples of TMemCache are as follows,
*
* $cache=new TMemCache; // TMemCache may also be loaded as a Prado application module
- * $cache->init();
+ * $cache->init(null);
* $cache->add('object',$object);
* $object2=$cache->get('object');
*
@@ -105,10 +105,8 @@ class TMemCache extends TModule implements ICache
* @param TXmlElement configuration for this module, can be null
* @throws TConfigurationException if memcache extension is not installed or memcache sever connection fails
*/
- public function init($config=null)
+ public function init($config)
{
- parent::init($config);
-
if(!extension_loaded('memcache'))
throw new TConfigurationException('memcache_extension_required');
$this->_cache=new Memcache;
diff --git a/framework/Data/TSqliteCache.php b/framework/Data/TSqliteCache.php
index d2955ccd..07cd91e0 100644
--- a/framework/Data/TSqliteCache.php
+++ b/framework/Data/TSqliteCache.php
@@ -47,7 +47,7 @@
*
* $cache=new TSqliteCache; // TSqliteCache may also be loaded as a Prado application module
* $cache->setDbFile($dbFilePath);
- * $cache->init();
+ * $cache->init(null);
* $cache->add('object',$object);
* $object2=$cache->get('object');
*
@@ -113,10 +113,8 @@ class TSqliteCache extends TModule implements ICache
* @throws TConfigurationException if sqlite extension is not installed,
* DbFile is set invalid, or any error happens during creating database or cache table.
*/
- public function init($config=null)
+ public function init($config)
{
- parent::init($config);
-
if(!function_exists('sqlite_open'))
throw new TConfigurationException('sqlitecache_extension_required');
if($this->_file===null)
diff --git a/framework/Exceptions/TErrorHandler.php b/framework/Exceptions/TErrorHandler.php
index c8137a09..fec4ce00 100644
--- a/framework/Exceptions/TErrorHandler.php
+++ b/framework/Exceptions/TErrorHandler.php
@@ -74,10 +74,8 @@ class TErrorHandler extends TModule
* This method is required by IModule and is invoked by application.
* @param TXmlElement module configuration
*/
- public function init($config=null)
+ public function init($config)
{
- parent::init($config);
-
$this->getApplication()->setErrorHandler($this);
}
diff --git a/framework/Security/TAuthManager.php b/framework/Security/TAuthManager.php
index d0dc6718..327104cc 100644
--- a/framework/Security/TAuthManager.php
+++ b/framework/Security/TAuthManager.php
@@ -63,10 +63,8 @@ class TAuthManager extends TModule
* @param TXmlElement configuration for this module, can be null
* @throws TConfigurationException if user manager does not exist or is not TUserManager
*/
- public function init($config=null)
+ public function init($config)
{
- parent::init($config);
-
if($this->_userManager===null)
throw new TConfigurationException('authmanager_usermanager_required');
$application=$this->getApplication();
diff --git a/framework/Security/TUserManager.php b/framework/Security/TUserManager.php
index 7ecf357d..06b5d321 100644
--- a/framework/Security/TUserManager.php
+++ b/framework/Security/TUserManager.php
@@ -227,10 +227,8 @@ class TUserManager extends TModule
* It loads user/role information from the module configuration.
* @param TXmlElement module configuration
*/
- public function init($config=null)
+ public function init($config)
{
- parent::init($config);
-
if($this->_userFile!==null)
{
if(is_file($this->_userFile))
diff --git a/framework/TApplication.php b/framework/TApplication.php
index c28c3da9..60fc25b3 100644
--- a/framework/TApplication.php
+++ b/framework/TApplication.php
@@ -536,7 +536,7 @@ class TApplication extends TComponent
if(!$this->_pageService)
{
$this->_pageService=new TPageService;
- $this->_pageService->init();
+ $this->_pageService->init(null);
}
return $this->_pageService;
}
@@ -559,7 +559,7 @@ class TApplication extends TComponent
if(!$this->_request)
{
$this->_request=new THttpRequest;
- $this->_request->init();
+ $this->_request->init(null);
}
return $this->_request;
}
@@ -580,7 +580,7 @@ class TApplication extends TComponent
if(!$this->_response)
{
$this->_response=new THttpResponse;
- $this->_response->init();
+ $this->_response->init(null);
}
return $this->_response;
}
@@ -601,7 +601,7 @@ class TApplication extends TComponent
if(!$this->_session)
{
$this->_session=new THttpSession;
- $this->_session->init();
+ $this->_session->init(null);
}
return $this->_session;
}
@@ -622,7 +622,7 @@ class TApplication extends TComponent
if(!$this->_errorHandler)
{
$this->_errorHandler=new TErrorHandler;
- $this->_errorHandler->init();
+ $this->_errorHandler->init(null);
}
return $this->_errorHandler;
}
@@ -643,7 +643,7 @@ class TApplication extends TComponent
if(!$this->_statePersister)
{
$this->_statePersister=new TApplicationStatePersister;
- $this->_statePersister->init();
+ $this->_statePersister->init(null);
}
return $this->_statePersister;
}
@@ -1155,9 +1155,8 @@ class TApplicationStatePersister extends TModule implements IStatePersister
* Initializes module.
* @param TXmlElement module configuration (may be null)
*/
- public function init($config=null)
+ public function init($config)
{
- parent::init($config);
$this->getApplication()->setApplicationStatePersister($this);
}
diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php
index 6288da5c..5723269f 100644
--- a/framework/Web/Services/TPageService.php
+++ b/framework/Web/Services/TPageService.php
@@ -144,10 +144,8 @@ class TPageService extends TService
* This method is required by IService interface and is invoked by application.
* @param TXmlElement service configuration
*/
- public function init($config=null)
+ public function init($config)
{
- parent::init($config);
-
$application=$this->getApplication();
$application->setPageService($this);
@@ -288,7 +286,7 @@ class TPageService extends TService
if(!$this->_templateManager)
{
$this->_templateManager=new TTemplateManager;
- $this->_templateManager->init();
+ $this->_templateManager->init(null);
}
return $this->_templateManager;
}
@@ -309,7 +307,7 @@ class TPageService extends TService
if(!$this->_assetManager)
{
$this->_assetManager=new TAssetManager;
- $this->_assetManager->init();
+ $this->_assetManager->init(null);
}
return $this->_assetManager;
}
@@ -330,7 +328,7 @@ class TPageService extends TService
if(!$this->_themeManager)
{
$this->_themeManager=new TThemeManager;
- $this->_themeManager->init();
+ $this->_themeManager->init(null);
}
return $this->_themeManager;
}
@@ -351,7 +349,7 @@ class TPageService extends TService
if(!$this->_pageStatePersister)
{
$this->_pageStatePersister=new TPageStatePersister;
- $this->_pageStatePersister->init();
+ $this->_pageStatePersister->init(null);
}
return $this->_pageStatePersister;
}
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php
index df8c8c3d..c3c9e33d 100644
--- a/framework/Web/THttpRequest.php
+++ b/framework/Web/THttpRequest.php
@@ -72,9 +72,8 @@ class THttpRequest extends TModule
* This method is required by IModule and is invoked by application.
* @param TXmlElement module configuration
*/
- public function init($config=null)
+ public function init($config)
{
- parent::init($config);
// Info about server variables:
// PHP_SELF contains real URI (w/ path info, w/o query string)
// SCRIPT_NAME is the real URI for the requested script (w/o path info and query string)
diff --git a/framework/Web/THttpResponse.php b/framework/Web/THttpResponse.php
index c947f9fb..ba2f607c 100644
--- a/framework/Web/THttpResponse.php
+++ b/framework/Web/THttpResponse.php
@@ -77,10 +77,8 @@ class THttpResponse extends TModule implements ITextWriter
* It starts output buffer if it is enabled.
* @param TXmlElement module configuration
*/
- public function init($config=null)
+ public function init($config)
{
- parent::init($config);
-
if($this->_bufferOutput)
ob_start();
$this->_initialized=true;
diff --git a/framework/Web/THttpSession.php b/framework/Web/THttpSession.php
index d7b1acfa..7dfc708d 100644
--- a/framework/Web/THttpSession.php
+++ b/framework/Web/THttpSession.php
@@ -83,10 +83,8 @@ class THttpSession extends TModule
* If AutoStart is true, the session will be started.
* @param TXmlElement module configuration
*/
- public function init($config=null)
+ public function init($config)
{
- parent::init($config);
-
if($this->_autoStart)
session_start();
$this->_initialized=true;
diff --git a/framework/Web/UI/TAssetManager.php b/framework/Web/UI/TAssetManager.php
index d15e4788..0cce2c27 100644
--- a/framework/Web/UI/TAssetManager.php
+++ b/framework/Web/UI/TAssetManager.php
@@ -73,10 +73,8 @@ class TAssetManager extends TModule
* This method is required by IModule and is invoked by application.
* @param TXmlElement module configuration
*/
- public function init($config=null)
+ public function init($config)
{
- parent::init($config);
-
$application=$this->getApplication();
if($this->_basePath===null)
$this->_basePath=dirname($application->getRequest()->getPhysicalApplicationPath()).'/'.self::DEFAULT_BASEPATH;
diff --git a/framework/Web/UI/TPageStatePersister.php b/framework/Web/UI/TPageStatePersister.php
index 988a2938..9c9954de 100644
--- a/framework/Web/UI/TPageStatePersister.php
+++ b/framework/Web/UI/TPageStatePersister.php
@@ -9,9 +9,8 @@ class TPageStatePersister extends TModule implements IStatePersister
* This method is required by IModule interface.
* @param TXmlElement module configuration
*/
- public function init($config=null)
+ public function init($config)
{
- parent::init($config);
$this->getService()->setPageStatePersister($this);
}
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php
index 544c346f..0187dfd9 100644
--- a/framework/Web/UI/TTemplateManager.php
+++ b/framework/Web/UI/TTemplateManager.php
@@ -44,10 +44,8 @@ class TTemplateManager extends TModule
* It starts output buffer if it is enabled.
* @param TXmlElement module configuration
*/
- public function init($config=null)
+ public function init($config)
{
- parent::init($config);
-
$this->getService()->setTemplateManager($this);
}
diff --git a/framework/Web/UI/TThemeManager.php b/framework/Web/UI/TThemeManager.php
index 8c7f40a7..bbcd35a6 100644
--- a/framework/Web/UI/TThemeManager.php
+++ b/framework/Web/UI/TThemeManager.php
@@ -60,9 +60,8 @@ class TThemeManager extends TModule
* This method is required by IModule and is invoked by application.
* @param TXmlElement module configuration
*/
- public function init($config=null)
+ public function init($config)
{
- parent::init($config);
$this->_initialized=true;
$this->getService()->setThemeManager($this);
}
diff --git a/framework/core.php b/framework/core.php
index c864dbfa..5c9156e5 100644
--- a/framework/core.php
+++ b/framework/core.php
@@ -58,7 +58,7 @@ interface IModule
* Initializes the module.
* @param TXmlElement the configuration for the module
*/
- public function init($configuration=null);
+ public function init($config);
/**
* @return string ID of the module
*/
@@ -85,7 +85,7 @@ interface IService
* Initializes the service.
* @param TXmlElement the configuration for the service
*/
- public function init($configuration=null);
+ public function init($config);
/**
* @return string ID of the service
*/
@@ -332,7 +332,7 @@ abstract class TModule extends TComponent implements IModule
* This method is required by IModule and is invoked by application.
* @param TXmlElement module configuration
*/
- public function init($config=null)
+ public function init($config)
{
}
@@ -376,7 +376,7 @@ abstract class TService extends TComponent implements IService
* This method is required by IService and is invoked by application.
* @param TXmlElement module configuration
*/
- public function init($config=null)
+ public function init($config)
{
}
--
cgit v1.2.3