yiic shell print html?!?

Hy,

in my application I use an own Controller with a beforeAction method which will check the permissions of the user to see this fired document. If the user have not the permission to show this site the user will redirected to a notAllowed action in my core module if he isn’t logged in the user will redirect to the login url in my application:


protected function beforeAction($action) {

        $module = (null !== $this->module) ? $this->module->id : '';

        $access =  $module.ucfirst($this->id).ucfirst($this->action->id);

        if(in_array($access, $this->allowedAccess())) {

            return true;

        }


        if(false === Yii::app()->user->checkAccess($access) && false === Yii::app()->user->isGuest) {

            return true;

        }

        elseif(false === Yii::app()->user->checkAccess($access) && true === Yii::app()->user->isGuest) {

            Yii::app()->request->redirect(Yii::app()->createUrl(Yii::app()->user->loginUrl));

        }

    }

With this method version the yiic shell will not prompt the shell but the profiling table?!? If i commented the line


Yii::app()->request->redirect(Yii::app()->createUrl(Yii::app()->user->loginUrl));

yiic shell will work fine. Any ideas to fix this problem?


$this->redirect(Yii::app()->user->loginUrl);

?

Hi.

I am facing the same issue.

When i execute >%YIIC SHELL command inside webapps folder, Output just displays index.html text on command prompt.

Can anyone fix this problem?

Hi all,

I have resolved the issue.

the problem was with Date(‘Y’) function mentioned in main.php(protected\views\layouts\main.php).

Add the following code at the top like “<?PHP date_default_timezone_set(‘UTC’); ?>”.

Now the "yiic shell" will work fine

Jiji Kurup

First of all, you choose wrong topic for your problem.[b]

[/b]

The problem is not in yii, but in your php.ini file. Find ‘date.timezone’ and set it to your time zone value, for example ‘Europe/Minsk’

changing php.ini - did not make any effect with "$yiic shell" printing html

<?PHP date_default_timezone_set(‘UTC’); ?> in main.php however make yiic shell working in spite of what has been set in php.ini

is this still bug, workaround, or quirk?

thank you for hint.

(I’m learning yii and finding it difficult to learn in spite of all claims that is easy. This quirk stopped me instatnly during followup of tutorial. Thank you all for already hitting this issue and existence of forum where I can find help)

Same issue here using Yii 1.1.6 and the TZ setting corrected the problem … thanks !

Easy or difficult, is relative and every tool has its peculiarities. I’m glad I got the book, that despite some minor glitches provides a glimpse to Yii potential :)

thanks again for your time saving comment !

Sergio

“Be kind whenever possible. It’s always possible” - 14th DL

Some times this will happen because your runtime path dosent have proper permission.