ec-europa / phpdrush
此包已被废弃,不再维护。未建议替代包。
与Drush Drupal命令行工具交互的PHP库
0.2.0
2017-11-20 16:01 UTC
Requires
- php: >=5.3.0
- cheprasov/php-redis-client: ~1.7.2
Requires (Dev)
- drush/drush: 8.1.10
- phpunit/phpunit: 5.3.*
- squizlabs/php_codesniffer: ~3.0.1
README
与Drush Drupal命令行工具交互的PHP库
警告
请不要直接在网页中使用此库,因为运行这些方法中的一个将需要数分钟才能完成。相反,这个类是为了由命令行工具(如部署工具)使用而设计的。
安装 (使用composer)
composer install
使用
require 'vendor/autoload.php'; $drush = new \PhpDrush\PhpDrush( '/local/path/to/drush', '/local/path/to/site' ); // run updb : $drush->updateDatabase(); // run registry rebuild (rr) : $drush->registryRebuild(); // run full feature revert : $drush->featuresRevert(); // run selective feature revert : $drush->featuresRevert( ['feature1','feature2','feature3'] ); // enable maintenance mode : $drush->setMaintenanceMode(true); // clear all caches : $drush->clearCache(); // evaluate php code in the drush context $drush->ev('echo "Hello world!"');
测试
执行PHP_CodeSniffer分析
在提交之前,确保代码干净,可以通过运行composer phpcs或bin/phpcs来实现。
./bin/phpcs -p --report=full --report=source --report=summary -s --colors
执行PHPUnit测试
在提交之前,确保没有回归,可以通过运行composer phpunit或bin/phpunit来实现。
执行PHPUnit测试需要一个Drupal实例。它可以快速通过drush安装。
./bin/drush dl drupal-7 --drupal-project-rename=drupal --yes
./bin/drush -r drupal site-install standard --account-name=admin --account-pass=admin --db-url=mysql://username:password@hostname/database --yes