PHP   发布时间:2022-04-05  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了的Drush 9别名文件应位于Drupal 8中?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

我尝试了一些方法来为我的本地Drupal项目创建别名,我指的是:
https://www.drupal.org/node/1401522
https://www.drupal.org/project/drush/issues/831272
https://www.drupal.org/project/drush/issues/786766

我可以通过运行以下命令进行连接:

drush --root=C:/wamP64/www/executive-coaTings --uri=http://localhost:81/executive-coaTings status

输出

 Drupal version   : 8.6.13
 Site URI         : http://localhost:81/executive-coaTings
 DB driver        : MysqL
 DB hostname      : localhost
 DB port          : 3306
 DB username      : root
 DB name          : dev_ecc_new
 Database         : Connected
 Drupal bootstrap : successful
 Default theme    : ecc_front
 Admin theme      : adminimal_theme
 PHP binary       : C:\wamP64\bin\PHP\PHP7.2.10\PHP.exe
 PHP config       : C:\wamP64\bin\PHP\PHP7.2.10\PHP.ini
 PHP OS           : WINNT
 Drush script     : C:\wamP64\www\executive-coaTings\vendor\bin\drush.phar
 Drush version    : 9.6.2
 Drush temp       : C:\Users\k\ApPDAta\Local\Temp
 Drush configs    : C:/Users/k/.drush/drush.yml
                    C:/wamP64/www/executive-coaTings/vendor/drush/drush/drush.yml
 Install profile  : minimal
 Drupal root      : C:\wamP64\www\executive-coaTings
 Site path        : sites/default
 Files, Public    : sites/default/files
 Files, Temp      : /tmp

但是,当我尝试使用drush别名时,它不起作用.这是我的别名文件

$aliases['local'] = array(
      'uri' => 'localhost:81/executive-coaTings',
      'root' => 'C:/wamP64/www/executive-coaTings',
  'path-aliases' => array(
    '%dump-dir' => '/tmp',
  ),
);

运行drush @local状态返回[预检]找不到别名@local.

我想我将别名文件放在错误的目录中,您能提供正确的路径吗?

解决方法:

别名文件位置不是唯一的问题,因为您正在运行Drush9.x.这是Drush 8.x和Drush 9.x之间关于别名的主要变化:

>站点别名不再是PHP文件,而是YAML文件.希望Drush 9.x附带一个命令来转换旧的drush 8别名:

drush site:alias-convert

>认情况下,不再解析Drush 8中使用的用户别名位置(〜/ .drush /站点,/ etc / drush /站点),但是您可以在〜/ .drush /中注册可以放置别名文件的任何位置. drush.yml配置文件.可以通过运行以下命令自动设置旧的Drush 8路径:

drush core:init

它将以下内容写入〜/ .drush / drush.yml:

drush:
  paths:
    alias-path:
      - '${env.homE}/.drush/sites'
      - /etc/drush/sites

例如,在您的情况下,可以在文件中(前提是如上所述注册了此位置)为别名为ecc的网站执行涂层定义本地环境(请参见).//drush / sites / ecc.site.yml.
>您还可以在以下位置(在该网站的项目根目录下,在文件命名中使用self)为给定网站定义环境别名(例如@ dev,@ preprod等):

<DRUPAL_ROOT>/drush/sites/self.site.yml

有用的链接
https://github.com/drush-ops/drush/blob/master/examples/example.site.yml
https://github.com/consolidation/site-alias

大佬总结

以上是大佬教程为你收集整理的的Drush 9别名文件应位于Drupal 8中?全部内容,希望文章能够帮你解决的Drush 9别名文件应位于Drupal 8中?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: