Thanks, but this wasn’t the solution for the exposed problem.
I already knew that a class can be expressed as a path.
Finally, I adopted that solution
'preload'=>array('log','phpdefinedfunctions','yumuseridentity'),
// and later
'components'=>array(
'phpdefinedfunctions'=>array(
'class' => 'application.extensions.phpDefinedFunctions'
),
'yumuseridentity'=>array(
'class'=>'application.components.YumUserIdentity',
),
This code helped to load at import process a class that replaced YumUserIdentity.
The trick has this appearance:
protected/extensions/phpDefinedFunctions.php
class phpDefinedFunctions extends CApplicationComponent{
}
if (!array_key_exists('tmp_files',$GLOBALS))
$GLOBALS['tmp_files'] = array();
if (!function_exists('destruct_tmp_files')){
function destruct_tmp_files(){
while (count($GLOBALS['tmp_files']))
file_exists($file=array_shift($GLOBALS['tmp_files'])) && @unlink($file);
}
register_shutdown_function("destruct_tmp_files");
}
if (!function_exists('include_code')){
function include_code($code){
$temp = tmpfile();
$GLOBALS['tmp_files'][] = array_search('uri', @array_flip(stream_get_meta_data($temp)));
fwrite($temp, $code);
include(end($GLOBALS['tmp_files']));
fclose($temp);
}
}
protected/components/YumUserIdentity.php
$parent_class = Yii::getPathOfAlias('application.modules.user.components.YumUserIdentity').'.php';
if (file_exists($parent_class)){
$parent_class=file_get_contents($parent_class);
$parent_class=preg_replace('/class YumUserIdentity/','class YumUserIdentityOld',$parent_class);
if (!class_exists('YumUserIdentityOld',$autoload=false)){
include_code($parent_class);
class YumUserIdentity extends YumUserIdentityOld{
public function __construct($username=null,$password=null)
{
parent::__construct($username,$password);
}
public function init(){
Yii::import('application.models.YumEncrypt',$forceInclude=true);
return true;
}
}
}
}