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

 
LG Cosmos 2 Verizon Wireless Phone Review

LG Cosmos 2 Verizon Wireless Phone Review

If it is time to upgrade somebody’s personal choice of LG Cosmos, then nothing can be as better as LG Cosmos 2 Verizon Wireless phone.

Vì sao nhân viên rời bỏ Google?

Vì sao nhân viên rời bỏ Google?

Google được xem là nơi làm việc thú vị và tốt nhất thế giới, nhưng có vẻ chưa đủ để níu chân các nhân tài?

 Lập trình Web chuyên sâu với CMS Drupal

Lập trình Web chuyên sâu với CMS Drupal

Khóa học được thiết kế dành cho các học viên là những người yêu thích việc xây dựng website, giúp học viên có đầy đủ kiến thức và kỹ năng để có thể xây dựng một website hoàn chỉnh, đẹp và dễ sử dụng.

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

 

Diet con trung