Answer the question
In order to leave comments, you need to log in
How to crawl into a script before execution starts in Yii2?
You need to block access to the site.
There is a sign in the database whether the site is active or not (it is being checked out from another place), and if not, you need to interrupt the script and display a message. Those. this must be done after loading the configs, check the entry in the database and close it. And this should happen on all pages.
Where can this be written? In some base controller?
Answer the question
In order to leave comments, you need to log in
You can implement this functionality using the application's bootstrap mechanism
The catchAll route
Sometimes you may want to temporarily put your application into maintenance mode and display the same informational message for all requests. There are many options for accomplishing this task. But one of the simplest is to use the yii\web\Application::catchAll property , like so:
[
// ...
'catchAll' => ['site/offline'],
];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question