Drush 9别名文件应位于Drupal 8中的何处? [英] Where Drush 9 aliases file should be located in Drupal 8?

查看:88
本文介绍了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

I have tried some ways to create an alias for my local Drupal project, I'm referring to : https://www.drupal.org/node/1401522
https://www.drupal.org/project/drush/issues/831272
https://www.drupal.org/project/drush/issues/786766

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

I can connect by running this command :

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

但是当我尝试使用拖拉别名是行不通的。这是我的别名文件:

But when I try to use a drush alias it doesn't work. Here my alias file :

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

运行 drush @local status 返回 [preflight]找不到别名@local。

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

I think I put my alias file in the wrong directory, can you provide the correct path ?

推荐答案

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

Alias file location is not your only issue here, because you are running Drush 9.x. Here the major changes between Drush 8.x and Drush 9.x regarding aliases :


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

  • Site aliases are no longer PHP files but YAML files. Hopefully Drush 9.x comes with a command to convert your old drush 8 aliases :

drush site:alias-convert


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

  • The user alias locations used in Drush 8 (~/.drush/sites, /etc/drush/sites) are by default no longer parsed, but you can register any location where alias files may be placed in your ~/.drush/drush.yml configuration file. Setting the old Drush 8 paths can be done automatically by running :

    drush core:init
    

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

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

    例如,可以在文件中为别名 ecc 的网站 executive-coatings 定义 local 环境(前提是该位置已如上所述注册) 〜/ .drush / sites / ecc.site.yml

    For example in your case, defining a local environment for the website executive-coatings aliased ecc may be done in the file (provided this location is registered as mentioned above) ~/.drush/sites/ecc.site.yml.

    还可以定义环境别名(例如@ dev,@ preprod等)(在该网站的项目根目录下,在文件命名中使用 self ) :

    You can also define environment aliases (eg. @dev, @preprod, etc.) for a given website at the following location (under the project root of that website, using self in the file naming) :

    <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中的何处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆