sh db-update工厂钩子

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh db-update工厂钩子相关的知识,希望对你有一定的参考价值。

 #!/bin/sh
#
# Factory Hook: db-update
#
# The existence of one or more executable files in the
# /factory-hooks/db-update directory will prompt them to be run *instead of* the
# regular database update (drush updatedb) command. So that update command will
# normally be part of the commands executed below.
#
# Usage: post-code-deploy site env db-role domain custom-arg1 custom-arg2 ...
# Map the script inputs to convenient names.
# Acquia hosting site / environment names are site env db-role domain etc
site="$1"
env="$2"

# database role. This is needed to query the gardens data for the required information. 
db_role="$3"

# this is not used in this script to ensure the primary ACSF domain is used as the uri. 
domain="$4"

# The primary domain name of the website. Use this method to avoid committing rest api creds 
# and support automation for sites that do not have drush aliases committed to the repo.  
uri=`/usr/bin/env php /mnt/www/html/$site.$env/hooks/acquia/uri.php $site $env $db_role`

# The websites' document root can be derived from the site/env:
docroot="/var/www/html/$site.$env/docroot"

# When running drush, provide the docroot + url, rather than relying on
# aliases. This ensures that they do not need to be committed to the repo.  

DRUSH_CMD="drush --root=$docroot --uri=$uri"

# Run updb as required by ACSF
$DRUSH_CMD updatedb

  if [ $? -ne 0 ]; then
  	 # If updb fails, do not continue with deploy tasks for that site
  	 # because dependencies may not have been installed. 
      echo "Update errored for site $uri."
      exit 1
  fi

  # ensure cache tools drush commands are installed and executable

  $DRUSH_CMD en -y cache_tools

  $DRUSH_CMD cc drush

  # run purge 

  $DRUSH_CMD cache-tools-purge
  
  echo "Finished deployment updates for $uri."

 

以上是关于sh db-update工厂钩子的主要内容,如果未能解决你的问题,请参考以下文章

sh db-update Factory Hook

sh 用于eslint的pre-commit钩子,linting * only * staged更改。

sh 如何通过curl使用主机工厂令牌创建主机的示例

设计模式 创建者模式 -- 建造者模式扩展: 指挥者类的深入探究(钩子函数引入)& 创建者模式对比

svn钩子

Spring Boot 扩展点应用之工厂加载机制