dongxiang3648 2015-05-26 16:20
浏览 68

全球拒绝访问网站进行更新,Laravel

This is a fairly open question as i am not sure what the best practice could/should be for this type of activity.

The scenario; A user based website (with logged in user areas and user editable content) needs to have several operations performed that will manipulate live data. To stop any errors occurring due to users simultaneously editing as the update is taking place, i need to shut out the users temporarily.

I don't currently have a config database table, just a config file. Two things need to happen;

  • An update to the config happens to stop the users accessing certain areas of the website during the update - this is then reverted once the update is complete.
  • The website (or at least portions on the site) need to be checked before every request for said portions of the site - so whatever the method, it needs to be lightweight

This is site built on Laravel.

Thanks!

  • 写回答

2条回答 默认 最新

  • doqpm82240 2015-05-26 17:14
    关注

    I'll use serveral measures in this case.

    1. put the code in try - catch block so that if something goes wrong, you can grcefully show an error message.

    2. If there are mulitple executions invovled, then better use DB::transaction() and the system will roll back automatically if it encounters an error.

    3. If you really want to put certain features on maintence mode, then put those routes in Route::group() and use a middleware for that group only. In that middleware, return response with 503 status. This way, you can put certain routes into maintanace mode while the rest will give 200 ok response.

    评论

报告相同问题?

悬赏问题

  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行