- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个带有 drupal_goto() 的模块,如果用户没有通过 hook_init() 中的年龄要求( Wine 网站),它会重定向用户。该模块设置了较重的重量,因此它最后加载。
在 PHP 5.3 上,drush update 失败。使用 PHP 5.2 的不同服务器上的相同代码和数据库运行良好。
Drush 版本:7.x-4.4PHP 版本:5.3 示例:
当我运行:drush status 时,出现错误。这是带有调试和详细标志的输出。
$ drush -d -v status
Bootstrap to phase 0. [0.02 sec, 2.47 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.03 sec, 2.67 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.06 sec, 5.49 MB] [bootstrap]
Initialized Drupal 6.22 root directory at /var/www/example.com/public_html [0.07 sec, 6.28 MB] [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.07 sec, 6.29 MB] [bootstrap]
Initialized Drupal site default at sites/default [0.07 sec, 6.29 MB] [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.08 sec, 6.29 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.08 sec, 6.33 MB] [bootstrap]
Successfully connected to the Drupal database. [0.08 sec, 6.33 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.09 sec, 6.67 MB] [bootstrap]
Drush command terminated abnormally due to an unrecoverable error. [0.34 sec, 31.38 MB] [error]
现在的问题是:为什么 drupal_goto() 会导致 drush 在 PHP 5.3 服务器而不是 PHP 5.2 服务器上失败。
最佳答案
当访问被拒绝时,您不应该发出重定向。这是任何网络框架中的逻辑错误。当您想要拒绝访问时,您应该发出“访问被拒绝”。就像你在你的内容移动了的时候发出了一句“内容已经移动到那里了,请你去那里”。
使用 drupal_access_denied()
代替 drupal_goto()
。如果您真的希望人们被重定向到另一个 url,那么可以在显示拒绝访问的页面上。
也就是说,发出 drupal_access_denied()
,或者实际上,在 hook_init()
中发送任何 header 都是完全错误的。来自documentation :«执行设置任务。»发送 header 不是设置任务。此外,同一文档警告您的方法存在另一个潜在问题:«此 Hook 未在缓存页面上运行»,换句话说,一旦成人访问页面并且该页面被缓存,未成年访客将不会被重定向或拒绝访问,他们将获得缓存的页面。
现在,您应该做什么:一个模块,例如 Taxonomy Access (Lite) 或更合适的 Node Privacy By Role可用于授予对您的内容的访问权限。请注意,默认情况下, View 不会使用这些访问权限:它们将显示内容列表,而不管用户的访问权限如何:您必须重新配置所有 View 以遵守访问规则或完全不可访问,以某些角色。此外,您需要给“未成年人”一个单独的角色:这样您就可以授予他们与角色“经过身份验证的用户”甚至“成人”中的人不同的访问权限。您将需要一些机制来 automatically assign roles .
关于drupal - Drush状态: unrecoverable error caused by drupal_goto() in hook_init(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6825256/
目前我们正处于从 v4.5.7 到 v6.7.1 的升级过程中。 SonarQube已成功升级到v5.6.7(包括数据库升级),目前正在更新到v6.7.1。 新的 SonarQube 版本在空数据库
我正在尝试使用ghostscript压缩pdf文件,如下所示: gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dCompatibilityLevel=1.4 -
sonarqube 从 6.5(带 Debian 软件包)升级到 6.6 后,sonar 无法启动。升级前我没有更新插件。我只是让标准的 Debian 软件包升级。我正在使用外部数据库 (Postgr
前一段时间,我在构建任何Visual Studio部署项目时收到此错误。 “无法恢复的构建错误” 我以为我的VS安装已损坏或删除了一些重要文件,但是... 最佳答案 ...我要做的就是 关闭 Visu
我有一个带有 drupal_goto() 的模块,如果用户没有通过 hook_init() 中的年龄要求( Wine 网站),它会重定向用户。该模块设置了较重的重量,因此它最后加载。 在 PHP 5.
我正在尝试测试 new Stanford Dependency parser它与神经网络一起使用。我正在尝试运行 zip 文件中包含的演示。文件 ParserDemo.java 和 ParserDem
如何解决以下编译错误? SOApp.scala:7: error: encountered unrecoverable cycle resolving import. Note: this is of
我需要使用Java API 来使用StanfordTruecaser。我有这个代码: String text = "i love paris. i am with barack obama";
当我尝试启动 AndEngine Activity 时,我收到以下错误: ERROR/InputDispatcher(21374): channel '4122e148 my.package.AcGa
当我尝试从命令行运行 Drush 时,出现以下错误: Drush command terminated abnormally due to an unrecoverable error 我不确定为什么
我有一个应用程序在设备上启动 iOS 12 时立即崩溃。 控制台显示以下错误: kernel AMFI: 'AppName' does not pass CT evaluation, result:
在 Nexus 7 (4.3) 上,而不是在我的旧设备 LG Optimus 3d (Android 2.2) 上,当我执行 HttpPost 时,我得到了这个 E/InputDispatcher:
我正在尝试使用 StanfordCoreNLP 来区分句子中的单数名词和复数名词。作为开始,我正在使用 http://nlp.stanford.edu/software/corenlp.shtml 中
我有以下 2 条路线:- Route::get('resize/avatar', function() { $image = 'avatar.jpg'; $target_filenam
使用 VMware 工作站已有一段时间了。然而,前几天我在尝试启动我的 Windows7 虚拟机时收到了这条消息: VMware Workstation unrecoverable error: (s
我在我的根文件夹中安装了 wordpress, 直到昨天它工作正常,但今天它给出了以下错误,因为我猜想生成缩略图, Warning: imagejpeg() [function:imagejpeg]:
我是一名优秀的程序员,十分优秀!