drush – Why is the –uri option needed to return absolute URLs?

I want to execute a View and export the JSON file to the files directory. I am using Views Data Export and VDE drush add-on modules. My view has a file/PDF field and I want to provide a direct link to the PDF file. So I added a Views relation for the field and a file URI formatter field. When I go to see the output the View creates at the Path. The URL is an absolute link directly to the PDF file. The URL includes the domain name when viewing it on development or production instances. And this is what I want. This is the correct URL path in the JSON:

href=u0022http://mysite.com/files/Allergens.pdf

But when I use this Drush command below provided by views_data_export or vde_drush

drush vde myview myviewid myfile.json 

the domain name is stripped out like this:

href=u0022http://default/files/Allergens.pdf

Why is this happening only when using the Drush command? I found I can fix it by adding this at the end of the command

--uri=mysite.com

So my new drush command looks like this:

drush vde myview myviewid myfile.json --uri=mysite.com

But doing this will hardcode the domain name into the URL. I want the URL to work on development, production and on my local. Thank you for any help you can provide.

9 – Issues with Drush 10.3.5 version in Ubuntu 20.04

I installed Drush 10.3.5 version via composer in Drupal 9.0.7 but I am getting a website error as follows after I ran command drush cache-rebuild. I can not access the admin page as well.

The website encountered an unexpected error. Please try again later.
Error: Class ‘DrushLogDrushLog’ not found in DrupalComponentDependencyInjectionContainer->createService() (line 257 of core/lib/Drupal/Component/DependencyInjection/Container.php).

I found somewhere i.e. (https://gorannikolovski.com/blog/drupal-9-and-drush-10) that Drush does not support symfony/var-dumper version 5.*. But I can’t change symfony/var-dumper version in Drupal because Drupal core requires symfony/var-dumper v5.1.10 as follows:

$ composer why symfony/var-dumper

drupal/core-recommended 9.0.7 requires symfony/var-dumper (v5.1.0)
symfony/error-handler v4.4.9 requires symfony/var-dumper (^4.4|^5.0)

So please help me to fix this issue.

Please let me know which Drush version I should use with the latest
Drupal version 9.0.7.

The website issue screenshot as follows:

enter image description here

Also how to fix this website issue so that I can see the front page
and admin page.

Thank You

composer – Issues with Drush 10.3.5 version with Drupal 9.0.7 version in Ubuntu 20.04

I installed Drush 10.3.5 version via composer in Drupal 9.0.7 but I am getting a website error as follows after I ran command drush cache-rebuild. I can not access the admin page as well.

The website encountered an unexpected error. Please try again later.
Error: Class ‘DrushLogDrushLog’ not found in DrupalComponentDependencyInjectionContainer->createService() (line 257 of core/lib/Drupal/Component/DependencyInjection/Container.php).

I found somewhere i.e. (https://gorannikolovski.com/blog/drupal-9-and-drush-10) that Drush does not support symfony/var-dumper version 5.*. But I can’t change symfony/var-dumper version in Drupal because Drupal core requires symfony/var-dumper v5.1.10 as follows:

$ composer why symfony/var-dumper

drupal/core-recommended 9.0.7 requires symfony/var-dumper (v5.1.0)
symfony/error-handler v4.4.9 requires symfony/var-dumper (^4.4|^5.0)

So please help me to fix this issue.

Please let me know which Drush version I should use with the latest
Drupal version 9.0.7.

The website issue screenshot as follows:

enter image description here

Also how to fix this website issue so that I can see the front page
and admin page.

Thank You

drush – How can I export only one paragraph type, the fields, the form settings and the display settings?

That’s exactly what the Features module is for. Syncing partial config across multi-site instances.

The features module enables the capture and management of features in
Drupal. A feature is a collection of Drupal entities which taken
together satisfy a certain use-case.

Features provides a UI and API for taking different site building
components from modules with exportables and bundling them together in
a single feature module. A feature module is like any other Drupal
module except that it contains additional information in its info file
so that configuration can be checked, updated, or reverted
programmatically.

That means you would create a feature on your main multi-site instance that contains the paragraph type. Have it placed under modules/features. Related config will be added automatically. You then enable the feature on another multi-site instance. The config will be imported. On both multi-site instances you then export config as usual.

As soon as you add another field to the paragraph type on either multi-site instance Features will recognise the changes. You then can recreate your paragraph feature and import the changes on another multi-site instance. Finally, on both sites again export config as usual. Features enables you to keep track of changes to a feature via built-in diffing, which after you recreated the feature can be synced on other multi-site instances again.

importing exporting – Export 1 paragraph type, the fields, the form settings and the display settings using Drush

Some days ago I’ve exported and imported a full configuration with drush cex and drush cim.

What are the steps to export 1 paragraph type including the fields, form settings, display settings etc …

I’m using a multisite, so it would be great to copy them from one site to the other sites within the multisite.

Can I:

  1. drush cex site 1
  2. copy exported .yml files to other site in folder (sites/site1.multisite.com/files/config_HASH/sync)
  3. Delete all .yml files except those needed for the import of my paragraph type?

I guess there are better methods to establish this?

8 – Drush not picking up rsync parameters from site alias

In self.yml I’ve got two site aliases defined like this:

dev:
  root: /var/www/example-dev/web
  uri: https://dev.example.co.uk
  paths:
    public: 'sites/default/files'
    private: '../private'
  command:
    core:
      rsync:
        options:
          mode: rlpgoDk

live:
  root: /var/www/example-live/web
  uri: https://example.co.uk
  paths:
    public: 'sites/default/files'
    private: '../private'
  command:
    core:
      rsync:
        options:
          mode: rlpgoDk

When I run drush --debug rsync @live:%public @dev:%public it shows that the actual command it’s running is rsync -e 'ssh -o PasswordAuthentication=no' -akzv --stats --progress /var/www/example-live/web/sites/default/files/ /var/www/example-dev/web/sites/default/files which means that most of the info is picked up from this file, but the rsync ‘mode’ parameter is being ignored. When I pass --mode rlpgoDkon the command line it works as expected but it doesn’t seem to be picking it up from the alias settings.

Is this a bug or am I missing something?

I’m using Drush version 9.7.2 and Drupal 8.9.6.

Drush can’t bootstrap Drupal 7 sites

I have an Ubuntu 18.04 server where I have one Drupal 8 and two Drupal 7 sites. I have installed drush 8.4.5 which works great for the Drupal 8 site but on the 7 ones it can’t bootstrap.

After some googling I found that a very common reason for this is when the mysql command is not in the PATH, but this is not the case here, in fact all db commands like drush sqlc work fine.

Here is the output when I run drush status -d

Cache HIT cid: 8.4.5-commandfiles-0-a3cd8cb920bcde827cc232180c6d7f26 (0.01 sec, 3.07 MB)                                                                                                             (debug)
Loaded alias @widgets from file /home/user/.drush/lsv.aliases.drushrc.php (0.07 sec, 8.05 MB)                                                                                                    (notice)
Cache SET cid: 8.4.5-alias-path--043cb3d69eb478aa2b3e38377546b6de (0.07 sec, 8.05 MB)                                                                                                                (debug)
Bootstrap to phase 0. (0.07 sec, 8.06 MB)                                                                                                                                                        (bootstrap)
Trying to bootstrap as far as we can. (0.07 sec, 8.07 MB)                                                                                                                                            (debug)
Drush bootstrap phase : bootstrap_drupal_root() (0.08 sec, 8.42 MB)                                                                                                                              (bootstrap)
Initialized Drupal 7.59 root directory at /var/www/html/widgets (0.08 sec, 8.42 MB)                                                                                                              (bootstrap)
Find command files for phase 1 (max=7) (0.08 sec, 6.93 MB)                                                                                                                                           (debug)
Cache HIT cid: 8.4.5-commandfiles-1-5c1ee58258b6846d7827dff1da4d928c (0.08 sec, 6.93 MB)                                                                                                             (debug)
Cache HIT cid: 8.4.5-annotationfiles-1-47d8cbe4e8ce28c2c1c5b0f779e97f8a (0.08 sec, 6.93 MB)                                                                                                          (debug)
Drush bootstrap phase : bootstrap_drupal_site() (0.08 sec, 6.94 MB)                                                                                                                              (bootstrap)
Initialized Drupal site widgets.bb at sites/default (0.08 sec, 6.94 MB)                                                                                                                          (bootstrap)
Find command files for phase 2 (max=7) (0.09 sec, 6.94 MB)                                                                                                                                           (debug)
Drush bootstrap phase : bootstrap_drupal_configuration() (0.09 sec, 6.94 MB)                                                                                                                     (bootstrap)
Find command files for phase 3 (max=7) (0.09 sec, 6.96 MB)                                                                                                                                           (debug)
sql-query: SELECT 1; (0.09 sec, 7.02 MB)                                                                                                                                                            (notice)
Executing: mysql --defaults-extra-file=/tmp/drush_teStTK --database=widgets --host=127.0.0.1 --silent  < /tmp/drush_79ibgU
  1
sql-query: SHOW TABLES; (0.1 sec, 7.02 MB)                                                                                                                                                          (notice)
Executing: mysql --defaults-extra-file=/tmp/drush_Rwkses --database=widgets --host=127.0.0.1 --silent  < /tmp/drush_VA3WyB
  actions
  authmap
  (...remaining site db tables)
Bootstrap phase bootstrap_drupal_database() failed to validate; continuing at bootstrap_drupal_configuration(). (0.12 sec, 7.05 MB)                                                                  (debug)
Found command: core-status (commandfile=core) (0.12 sec, 7.05 MB)                                                                                                                                (bootstrap)
Loading outputformat engine. (0.14 sec, 8.55 MB)                                                                                                                                                    (notice)
Calling hook drush_core_status (0.15 sec, 8.81 MB)                                                                                                                                                   (debug)
Returned from hook drush_core_status (0.15 sec, 8.82 MB)                                                                                                                                             (debug)
 Drupal version         :  7.59
 Site URI               :  mysite.com
 Database driver        :  mysql                                                       
 Database hostname      :  127.0.0.1                                                   
 Database port          :                                                              
 Database username      :  dbuser
 Database name          :  dbname
 PHP executable         :  /usr/bin/php                                                
 PHP configuration      :  /etc/php/7.2/cli/php.ini                                    
 PHP OS                 :  Linux                                                       
 Drush script           :  /home/user/.config/composer/vendor/drush/drush/drush.php 
 Drush version          :  8.4.5                                                       
 Drush temp directory   :  /tmp                                                        
 Drush configuration    :                                                              
 Drush alias files      :  /home/user/.drush/mysite.aliases.drushrc.php                
 Drupal root            :  /var/www/html/mysite                                       
 Drupal Settings File   :  sites/default/settings.php                                  
 Site path              :  sites/default                                               

Command dispatch complete (0.15 sec, 8.86 MB)                                                                                                                                                       (notice)
 Timer  Cum (sec)  Count  Avg (msec) 
 page   0.067      1      66.81

As you can see I’ve already tried using a drush alias (no special configuration there) but without changing anything.

Drush download, what port does it use?

I work on a Drupal 7 intranet site for a large company. The firewall on the server it is housed on currently does not allow any access to the Internet. I’ve been upgrading Drupal core and modules by downloading them to my pc and accessing the server with remote desktop client.

What are the most minimal holes that we’d have to punch in the firewall for Drush to be able to download updates from drupal.org.

Would just opening up port 22 do the trick?

drush – Migrating contents and config from drupal 8.7.1 to drupal 9.0.6

I need to migrate all the content and configs (entities and all of that stuff) from a drupal 8.7.1 site to a different drupal 9.0.6 site.

The point of making a new site is that I can’t update the old one to a newer version and it has been made in a… Not totally proper way. So, I need to transfer all the content to a different site that I’m making from 0, in order to replace the old one.

I’ve been investigating about it but I haven’t got any clear clue on how I should proceed or which method I could use. I don’t know even if it’s possible to make it using drush or something like that.

P.S: The old site is a multisite with 3 different sites. I suppose that’s important.

Thanks in advance 🙂

installing – Why is drush dl removed and how to use composer properly to download modules via the command line now?

Drush dl was removed because it served no more purpose (it was supplanted by composer)

The way to add dependencies to composer is with ‘composer require ’

So to require a specific module like group would be ‘composer require drupal/group’

To add version constraints you specify then after to name with a ‘:’ in between. The Drupal projects pages and getcomposer.org tell you more about how to limit versions. By aware, limiting versions is usually not what you want to do. Usually you just want the version that works with your setup and composer will figure out what version that is.