On Server Ptoblem In Admin Module

Hi once I’ve upload my project to ftp strange things happend.

In attachment I’ve uploaded screen which I’ve got once a time. To repair that in my Module.php file in beforeAction i need to add die(); refresh site delete die and website works again. Has anyone problem like that?

Module.php




class Module extends \yii\base\Module

{

    public $controllerNamespace = 'app\modules\admin\controllers';


    public function init()

    {

        parent::init();

        // custom initialization code goes here

    }


    public function beforeAction($action)

    {

        if (parent::beforeAction($action)) {


            if (\Yii::$app->user->isGuest)

            {

                \Yii::$app->user->setReturnUrl(\Yii::$app->request->url);

                \Yii::$app->session->setFlash('alert', 'Dostęp tylko dla zalogowanych');

                \Yii::$app->controller->redirect('/user/login');

            }

            return true;

        } else {

            return false;

        }

    }

}



sorry for my english mistakes ;]

5627

Zrzut ekranu z 2014-05-29 17:05:01.png

Anyone? problem still exist ;/ CHeck it please.

Which place in the beforeAction method are you putting the die statement for testing?




class Module extends \yii\base\Module

{

    public $controllerNamespace = 'app\modules\admin\controllers';


    public function init()

    {

        parent::init();

        // custom initialization code goes here

    }


    public function beforeAction($action)

    {

        if (parent::beforeAction($action)) {

            die();

            if (\Yii::$app->user->isGuest)

            {

                \Yii::$app->user->setReturnUrl(\Yii::$app->request->url);

                \Yii::$app->session->setFlash('alert', 'Dostęp tylko dla zalogowanych');

                \Yii::$app->controller->redirect('/user/login');

            }

            return true;

        } else {

            return false;

        }

    }

}



like that. Since I run it and then remove die, module works fine for some time.

Can you just comment out the entire beforeAction method and report if it works? Your parent::beforeAction is working but not the extended beforeAction method what you have in here.

On initial thoughts… it seems some problem in running your beforeAction method due to possibly some user session problem (the session is generated properly once you run parentAction). You may want to debug your beforeAction method you have in here and how its affecting your session.

ok it’s hard to debug couse that problem happend only some time - but I don’t think the problem is session, Yii can’t find files or has wrong path…