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

 
Apple thắng kiện, HTC bị cấm bán điện thoại vào năm sau

Apple thắng kiện, HTC bị cấm bán điện thoại vào năm sau

Ủy ban Thương mại Quốc tế (ITC) vừa ra phán quyết rằng HTC đã vi phạm một bản quyền của Apple. Điều này dẫn đến nhiều smartphone của công ty Đài Loan sẽ bị cấm bán ở Mỹ từ ngày 19/4/2012.

Các thiết bị Android sẽ cạnh tranh với iPod Touch

Các thiết bị Android sẽ cạnh tranh với iPod Touch

Các thiết bị đa phương tiện sử dụng phần mềm Android - do Archos, Philips, Samsung, Sony và sắp tới có thể là HTC sản xuất, sẽ cạnh tranh với iPod Touch.

5 Tips giúp bạn trở thành Gitt administer tại drupal.org

5 Tips giúp bạn trở thành Gitt administer tại drupal.org

Tips to become a git administer at drupal.org

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

 

Diet con trung