Is there any way for web application components (like for example 'viewRenderer') to detect if application was initially started as ./protected/yiic shell ?
The problem is, I have a viewrenderer component, which rewrites some urls: http://www.yiiframew…aseurlappender/
This extension needs write support for some folders (assets). In case you are a linux user you can run into a problem that these folders are not write-accessible for you, e.g. they were created by a webserver user (user apache for example), so when yiic shell starts (as user 'you') it tries to run faked webapplication, which in turn generates default site/index view, and my custom viewRenderer will fail to save a file, will throw CHttpException and as result yiic shell will terminate.
Of course it is easy to fix permissions, but I would like to find a way to detect if application (and components) were initialised from yiic shell command.
At present I've implemented getViewFile() method as follows:
protected function getViewFile($file) { if(basename($_SERVER['PHP_SELF']) != 'index.php'){ return $file; } else { return parent::getViewFile($file); } }
But I don't like this solution. Is there any better one?