我尝试将排除路径和文件模式添加到我的drush别名中;它没有工作,但是在命令中添加带有-- with =的过滤器是有效的。
drush rsync --exclude=imagecache/* --exclude=ctools/* --exclude=js/* --exclude=tmp/* --exclude=xmlsitemap/* --exclude=*.doc* --exclude=*.DOC* --exclude=*.pdf* --exclude=*.PDF* --exclude=*.ppt* --exclude=*.PPT* --exclude=*.zip --exclude=*.ZIP --exclude=*.xls* --exclude=*.XLS* @sitename.live:%files @sitename.local:%files(我想创建目录,但跳过目录)
我看了一个相似问题,但我不知道我做错了什么。
钻核-rsync的文档解释如下:
-排除-要排除的路径列表,由:(基于Unix的系统)或;(Windows)分隔。
以下是我尝试过的:
$aliases['live'] = array(
'root' => '/var/www/[domain]/htdocs',
'uri' => '[site uri]',
'remote-host' => '[host ip]',
'remote-user' => 'rgoya',
'path-aliases' => array(
'%files' => 'sites/default/files',
),
'command-specific' => array(
'sql-sync' => array(
'no-cache' => TRUE,
),
'rsync' => array (
'mode' => 'rlptDz',
'exclude-paths' => 'css:imagecache:ctools:js:tmp::xmlsitemap',
'exclude' => '*.tmp',
'exclude' => '*.doc*',
'exclude' => '*.zip',
'exclude' => '*.xls*',
),
),
);我也尝试过‘=>’azv模式
另外,我可以在排除模式中使用regexp吗?一些扩展是小写的,有些是大写的.pdf / .PDF
发布于 2014-02-15 10:43:00
PHP数组中的后续“排除”项正在覆盖它们以前的项,因此上面的示例只包含- only =xls。
drush help rsync并没有显式地记录--排除的语法,但我假设它类似于--解释路径,这意味着您应该这样做:
'rsync' => array (
'mode' => 'rlptDz',
'exclude-paths' => 'css:imagecache:ctools:js:tmp::xmlsitemap',
'exclude' => '*.tmp:*.doc*:*.zip:*.xls*',
),编辑:查看example.aliases.drushrc.php,这里包括以下技巧:
// if you need multiple exludes, use an rsync exclude file
'exclude-from' => "'/etc/rsync/exclude.rules'",也许这是最好的方法。
发布于 2014-02-15 19:21:03
这就是现在对sql-sync和sql-dump -已不再执行drush-rsync的工作方式,因为在我最初的同步之后,它现在已经没有必要了。
$aliases['local'] = array(
'root' => '/var/www/[root dir]',
'uri' => '[uri]',
'path-aliases' => array(
'%files' => 'sites/default/files',
'%dump-dir' => '/home/decibelplaces/drush-dumps',
),
'command-specific' => array(
'sql-sync' => array(
'no-cache' => TRUE,
'structure-tables' => array(
'common' => array(
'cache', 'cache_filter', 'cache_menu', 'cache_page', 'history', 'sessions', 'watchdog','search_index',[some other custom tables],
),
),
),
'sql-dump' => array(
'structure-tables' => array(
'common' => array(
'cache', 'cache_filter', 'cache_menu', 'cache_page', 'history', 'sessions', 'watchdog','search_index',[some other custom tables],
),
),
),
'rsync' => array (
'mode' => 'avzu',
),
),);
使用drush语法:
drush sql-sync @yoursite.remote @yoursite.local --structure-tables-key=common --no-ordered-dump --sanitize=0 --no-cache此外,若要将sql转储保存在带有日期的指定文件中,请执行以下操作:
drush @yoursite.local sql-dump --structure-tables-key=common --result-file=[path to file result]/local_`date +"%Y_%m_%d-%H:%M"`.sql发布于 2014-02-16 18:27:16
除非命令支持严格的选项,否则Drush不支持具有相同键的多个选项(例如-)有关严格选项处理的更多信息,请参见drush topic docs-strict-options。基本上,严格的选项要求gloabl Drush选项出现在命令名之前,而命令名之后的每个选项都不需要Drush解析。这也意味着特定于命令的选项不能包含严格的选项,因为只有来自命令行的选项作为严格选项传递给rsync。
因此,如果要排除drush rsync中的多个项,则必须在命令特定选项中使用“排除-路径”。
https://drupal.stackexchange.com/questions/103376
复制相似问题