Open ramonov opened 12 years ago
Try to add the 'role' submodule to your modules section and import the role submodule:
Yii::import('applications.modules.role.models.*');
Hi,
There is another solution to this case? This occurs when submitting the form to login.
PHP warning include(RoleModule.php) [function.include]: failed to open stream: No such file or directory
my config/main.php 'import'=>array( 'application.modules.role.models.', 'application.modules.user.models.', 'application.modules.user.components.', 'application.models.', 'application.components.*', ),
I am using Yii version 1.1.13. Note: The source I am using is the github / master.
Do you have the file: protected/modules/role/RoleModule.php ?
If yes paste protected/config/main.php (delete the passes) on gisthub - maybe something is missing there.
The file exists in the path referred.
Below is my config/main.php
return array(
'basePath'=>dirname(FILE).DIRECTORY_SEPARATOR.'..',
'name'=>'My Web Application',
// preloading 'log' component
'preload'=>array('log'),
// autoloading model and component classes
'import'=>array(
'application.modules.user.models.*',
'application.models.*',
'application.components.*',
),
'modules'=>array(
// uncomment the following to enable the Gii tool
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'Enter Your Password Here',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('127.0.0.1','::1'),
),
'user' => array(
'debug' => false,
'userTable' => 'user',
'translationTable' => 'translation',
),
'usergroup' => array(
'usergroupTable' => 'usergroup',
'usergroupMessageTable' => 'user_group_message',
),
'membership' => array(
'membershipTable' => 'membership',
'paymentTable' => 'payment',
),
'friendship' => array(
'friendshipTable' => 'friendship',
),
'profile' => array(
'privacySettingTable' => 'privacysetting',
'profileFieldTable' => 'profile_field',
'profileTable' => 'profile',
'profileCommentTable' => 'profile_comment',
'profileVisitTable' => 'profile_visit',
),
'role' => array(
'roleTable' => 'role',
'userRoleTable' => 'user_role',
'actionTable' => 'action',
'permissionTable' => 'permission',
),
'message' => array(
'messageTable' => 'message',
),
),
// application components
'components'=>array(
/*'User'=>array(
'class' => 'User',
),*/
'user'=>array(
'class' => 'application.modules.user.components.YumWebUser',
//'allowAutoLogin'=>true,
'loginUrl' => array('//user/user/login'),
// enable cookie-based authentication
'allowAutoLogin'=>true,
),
// uncomment the following to enable URLs in path-format
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
/*
'db'=>array(
'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
),
*/
// uncomment the following to use a MySQL database
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=templateinicial',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'mysql',
'charset' => 'utf8',
'tablePrefix' => '',
),
'errorHandler'=>array(
// use 'site/error' action to display errors
'errorAction'=>'site/error',
),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
// uncomment the following to show log messages on web pages
array(
'class'=>'CWebLogRoute',
),
),
),
'cache' => array('class' => 'system.caching.CDummyCache'),
),
// application-level parameters that can be accessed
// using Yii::app()->params['paramName']
'params'=>array(
// this is used in contact page
'adminEmail'=>'webmaster@example.com',
),
);
This looks OK to me. What about the read permissions for www-data user or whatever is your web server user?
Actually did you use the GitHub version of the module? If not replace yours with this - the most recent one!
another possibility is that you do not have php short tags enabled (if using github version)
Last error i got was on user login page. now i got another error include(RoleModule.php): failed to open stream: No such file or directory here is stack trace
PHP warning
include(RoleModule.php): failed to open stream: No such file or directory
D:\projectphp\YiiRoot\framework\YiiBase.php(423)
411 { 412 include($classFile); 413 if(YII_DEBUG && basename(realpath($classFile))!==$className.'.php') 414 throw new CException(Yii::t('yii','Class name "{class}" does not match class file "{file}".', array( 415 '{class}'=>$className, 416 '{file}'=>$classFile, 417 ))); 418 break; 419 } 420 } 421 } 422 else 423 include($className.'.php'); 424 } 425 else // class name with namespace in PHP 5.3 426 { 427 $namespace=str_replace('\','.',ltrim($className,'\')); 428 if(($path=self::getPathOfAlias($namespace))!==false) 429 include($path.'.php'); 430 else 431 return false; 432 } 433 return class_exists($className,false) || interface_exists($className,false); 434 } 435 return true;
Stack Trace
0
– D:\projectphp\YiiRoot\framework\YiiBase.php(423): YiiBase::autoload()
418 break; 419 } 420 } 421 } 422 else 423 include($className.'.php'); 424 } 425 else // class name with namespace in PHP 5.3 426 { 427 $namespace=str_replace('\','.',ltrim($className,'\')); 428 if(($path=self::getPathOfAlias($namespace))!==false)
1
unknown(0): YiiBase::autoload("RoleModule")
2
– D:\projectphp\YiiRoot\framework\YiiBase.php(208): spl_autoload_call("RoleModule")
203 if($n===2) 204 $object=new $type($args[1]); 205 else if($n===3) 206 $object=new $type($args[1],$args[2]); 207 else if($n===4) 208 $object=new $type($args[1],$args[2],$args[3]); 209 else 210 { 211 unset($args[0]); 212 $class=new ReflectionClass($type); 213 // Note: ReflectionClass::newInstanceArgs() is available for PHP 5.1.3+
3
– D:\projectphp\YiiRoot\framework\base\CModule.php(283): YiiBase::createComponent("role.RoleModule", "role", null, array("debug" => "true", "roleTable" => "role", "userRoleTable" => "user_role", "actionTable" => "action", ...))
278 { 279 Yii::trace("Loading \"$id\" module",'system.base.CModule'); 280 $class=$config['class']; 281 unset($config['class'], $config['enabled']); 282 if($this===Yii::app()) 283 $module=Yii::createComponent($class,$id,null,$config); 284 else 285 $module=Yii::createComponent($class,$this->getId().'/'.$id,$this,$config); 286 return $this->_modules[$id]=$module; 287 } 288 }
4
– D:\projectphp\YiiRoot\demos\testdrive\protected\modules\user\models\Yum.php(148): CModule->getModule("role")
143 } 144 145 // returns the Yii User Management module. Frequently used for accessing 146 // options by calling Yum::module()->option 147 public static function module($module = 'user') { 148 return Yii::app()->getModule($module); 149 } 150 151 public static function hasModule($module) { 152 return array_key_exists($module, Yii::app()->modules); 153 }
5
– D:\projectphp\YiiRoot\demos\testdrive\protected\modules\user\models\YumUser.php(386): Yum::module("role")
381 $relations['managed_by'] = array( 382 self::HAS_MANY, 'YumPermission', 'subordinate_id'); 383 384 $relations['roles'] = array( 385 self::MANY_MANY, 'YumRole', 386 Yum::module('role')->userRoleTable . '(user_id, role_id)'); 387 } 388 389 if (Yum::hasModule('message')) { 390 Yii::import('application.modules.message.models.*'); 391 $relations['messages'] = array(
6
– D:\projectphp\YiiRoot\framework\db\ar\CActiveRecord.php(2337): YumUser->relations()
2332 { 2333 if(!$column->isPrimaryKey && $column->defaultValue!==null) 2334 $this->attributeDefaults[$name]=$column->defaultValue; 2335 } 2336 2337 foreach($model->relations() as $name=>$config) 2338 { 2339 $this->addRelation($name,$config); 2340 } 2341 } 2342
7
– D:\projectphp\YiiRoot\framework\db\ar\CActiveRecord.php(388): CActiveRecordMetaData->__construct(YumUser)
383 if(isset(self::$_models[$className])) 384 return self::$_models[$className]; 385 else 386 { 387 $model=self::$_models[$className]=new $className(null); 388 $model->_md=new CActiveRecordMetaData($model); 389 $model->attachBehaviors($model->behaviors()); 390 return $model; 391 } 392 } 393
8
– D:\projectphp\YiiRoot\demos\testdrive\protected\modules\user\models\YumUser.php(52): CActiveRecord::model("YumUser")
47 'class' => 'application.modules.user.components.CAdvancedArBehavior')); 48 } 49 50 public static function model($className = CLASS) 51 { 52 return parent::model($className); 53 } 54 55 public function delete() 56 { 57 if (Yum::module()->trulyDelete)
9
– D:\projectphp\YiiRoot\demos\testdrive\protected\modules\user\controllers\YumAuthController.php(152): YumUser::model()
147 return false; 148 } 149 150 public function loginByUsername() { 151 if(Yum::module()->caseSensitiveUsers){ 152 $user = YumUser::model()->find('username = :username', array( 153 ':username' => $this->loginForm->username)); 154
155 } 156 else 157 $user = YumUser::model()->find('upper(username) = :username', array(
10
– D:\projectphp\YiiRoot\demos\testdrive\protected\modules\user\controllers\YumAuthController.php(265): YumAuthController->loginByUsername()
260 $t = Yum::module()->loginType; 261 262 // validate user input for the rest of login methods 263 if ($this->loginForm->validate()) { 264 if ($t & UserModule::LOGIN_BY_USERNAME) { 265 $success = $this->loginByUsername(); 266 if ($success) 267 $login_type = 'username'; 268 } 269 if ($t & UserModule::LOGIN_BY_EMAIL && !$success) { 270 $success = $this->loginByEmail();
11
– D:\projectphp\YiiRoot\framework\web\actions\CInlineAction.php(50): YumAuthController->actionLogin()
45 $controller=$this->getController(); 46 $method=new ReflectionMethod($controller, $methodName); 47 if($method->getNumberOfParameters()>0) 48 return $this->runWithParamsInternal($controller, $method, $params); 49 else 50 return $controller->$methodName(); 51 } 52 53 }
12
– D:\projectphp\YiiRoot\framework\web\CController.php(309): CInlineAction->runWithParams(array("r" => "user/auth/login"))
304 { 305 $priorAction=$this->_action; 306 $this->_action=$action; 307 if($this->beforeAction($action)) 308 { 309 if($action->runWithParams($this->getActionParams())===false) 310 $this->invalidActionParams($action); 311 else 312 $this->afterAction($action); 313 } 314 $this->_action=$priorAction;
13
– D:\projectphp\YiiRoot\framework\web\filters\CFilterChain.php(134): CController->runAction(CInlineAction)
129 $filter=$this->itemAt($this->filterIndex++); 130 Yii::trace('Running filter '.($filter instanceof CInlineFilter ? get_class($this->controller).'.filter'.$filter->name.'()':get_class($filter).'.filter()'),'system.web.filters.CFilterChain'); 131 $filter->filter($this); 132 } 133 else 134 $this->controller->runAction($this->action); 135 } 136 }
14
– D:\projectphp\YiiRoot\framework\web\filters\CFilter.php(41): CFilterChain->run()
36 / 37 public function filter($filterChain) 38 { 39 if($this->preFilter($filterChain)) 40 { 41 $filterChain->run(); 42 $this->postFilter($filterChain); 43 } 44 } 45 46 /*
15
– D:\projectphp\YiiRoot\framework\web\CController.php(1146): CFilter->filter(CFilterChain)
1141 / 1142 public function filterAccessControl($filterChain) 1143 { 1144 $filter=new CAccessControlFilter; 1145 $filter->setRules($this->accessRules()); 1146 $filter->filter($filterChain); 1147 } 1148 1149 / 1150 * Returns a persistent page state value. 1151 \ A page state is a variable that is persistent across POST requests of the same page.
16
– D:\projectphp\YiiRoot\framework\web\filters\CInlineFilter.php(59): CController->filterAccessControl(CFilterChain)
54 * @param CFilterChain $filterChain the filter chain that the filter is on. 55 */ 56 public function filter($filterChain) 57 { 58 $method='filter'.$this->name; 59 $filterChain->controller->$method($filterChain); 60 } 61 }
17
– D:\projectphp\YiiRoot\framework\web\filters\CFilterChain.php(131): CInlineFilter->filter(CFilterChain)
126 { 127 if($this->offsetExists($this->filterIndex)) 128 { 129 $filter=$this->itemAt($this->filterIndex++); 130 Yii::trace('Running filter '.($filter instanceof CInlineFilter ? get_class($this->controller).'.filter'.$filter->name.'()':get_class($filter).'.filter()'),'system.web.filters.CFilterChain'); 131 $filter->filter($this); 132 } 133 else 134 $this->controller->runAction($this->action); 135 } 136 }
18
– D:\projectphp\YiiRoot\framework\web\CController.php(292): CFilterChain->run()
287 $this->runAction($action); 288 else 289 { 290 $priorAction=$this->_action; 291 $this->_action=$action; 292 CFilterChain::create($this,$action,$filters)->run(); 293 $this->_action=$priorAction; 294 } 295 } 296 297 /**
19
– D:\projectphp\YiiRoot\framework\web\CController.php(266): CController->runActionWithFilters(CInlineAction, array("accessControl"))
261 { 262 if(($parent=$this->getModule())===null) 263 $parent=Yii::app(); 264 if($parent->beforeControllerAction($this,$action)) 265 { 266 $this->runActionWithFilters($action,$this->filters()); 267 $parent->afterControllerAction($this,$action); 268 } 269 } 270 else 271 $this->missingAction($actionID);
20
– D:\projectphp\YiiRoot\framework\web\CWebApplication.php(283): CController->run("login")
278 { 279 list($controller,$actionID)=$ca; 280 $oldController=$this->_controller; 281 $this->_controller=$controller; 282 $controller->init(); 283 $controller->run($actionID); 284 $this->_controller=$oldController; 285 } 286 else 287 throw new CHttpException(404,Yii::t('yii','Unable to resolve the request "{route}".', 288 array('{route}'=>$route===''?$this->defaultController:$route)));
21
– D:\projectphp\YiiRoot\framework\web\CWebApplication.php(142): CWebApplication->runController("user/auth/login")
137 foreach(array_splice($this->catchAllRequest,1) as $name=>$value) 138 $_GET[$name]=$value; 139 } 140 else 141 $route=$this->getUrlManager()->parseUrl($this->getRequest()); 142 $this->runController($route); 143 } 144 145 /* 146 * Registers the core application components. 147 \ This method overrides the parent implementation by registering additional core components.
22
– D:\projectphp\YiiRoot\framework\base\CApplication.php(162): CWebApplication->processRequest()
157 / 158 public function run() 159 { 160 if($this->hasEventHandler('onBeginRequest')) 161 $this->onBeginRequest(new CEvent($this)); 162 $this->processRequest(); 163 if($this->hasEventHandler('onEndRequest')) 164 $this->onEndRequest(new CEvent($this)); 165 } 166 167 /*
23
– D:\projectphp\YiiRoot\demos\testdrive\index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true); 09 // specify how many levels of call stack should be shown in each log message 10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3); 11 12 require_once($yii); 13 Yii::createWebApplication($config)->run();
2012-10-08 11:01:34 Apache/2.4.2 (Win32) OpenSSL/1.0.1c PHP/5.4.4 Yii Framework/1.1.12