drush redfin-db: hiển thị thông tin connect Database

drush redfin-db: hiển thị thông tin connect Database

Here at Redfin we've come up with a couple of helpful Drush commands that help us with our everyday workflows. The first shows a database string as a URI for Drush aliases, and the second reverts all views that are in an overridden state without any prompting or confirmation.

The power of Drush aliases really help you to easily sync database from your staging or production environments down to your local development environment. When creating a drush alias, it likes database connection strings in URI format, like mysql://username:password@server/database.

The first command in the script is "drush rdb" (or "drush redfin-db" for long). This will read the settings.php (works with Drupal 6 and 7) and spit out a URI-formatted version of the connection string. We automate the creation of our aliases so it's nice to be able to call this from drush inside a bash script which generates the full alias file.

The second command is "drush rvr" ("drush redfin-vr"). **DANGER, DANGER** Ok, now that I have your attention, this command will revert ALL views currently in a state of "Overridden" to code. We use this as part of a deployment script to sites where the Views UI is completely disabled and all the views are managed in code. This means that when you push up your new view code, it gets pulled into the site. It's also helpful for local development when you've just synced down new views code from your fellow developers. You can also use the regular "drush vr" command for this, but that command first prompts you as to which views you'd like to revert, and you have to choose all as an option, which appears as a different number each time, preventing its use in automated scripts (like git post-receive hooks).

The code is available as a Gist. Just put this file in your home's .drush folder as redfin.drush.inc and you'll be able to use these two commands as-is, or modify them to suit your own needs.

DOWNLOAD/VIEW CODE

File: 
Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Improving Drupal's Clean URLs with the Pathauto Module

Tạo URL đẹp cho Drupal site với Pathauto Module

This tutorial was requested by a student who is learning the Drupal basics. They turned on "Clean URLs" in the Drupal admin area and were surprised to see that the URLs remained largely unchanged:

Hướng dẫn migrating content sang Drupal 8 năm 2015

Hướng dẫn migrating content sang Drupal 8 năm 2015

When Drupal 7 was released, it came with an upgrade script that would convert a Drupal 6 database into a Drupal 7 database

Giá rẻ - Xu thế đang lên của tablet

Giá rẻ - Xu thế đang lên của tablet

Không phải là quá khó để chúng ta có thể nhận thấy việc tablet giá rẻ đang chiếm lĩnh trên thị trường hiện nay. Khởi đầu với Kindle Fire, chiếc tablet có mức giá chưa tới 200 USD (4 triệu đồng) của Amazon. Được bán ra với mức giá chấp nhận lỗ của Amazon để kiếm lợi từ những nội dung số, Kindle Fire thực sự là một cú hích lớn đối với tablet Android.

Công ty diệt chuột T&C

 

Diet con trung