本文整理汇总了PHP中task函数的典型用法代码示例。如果您正苦于以下问题:PHP task函数的具体用法?PHP task怎么用?PHP task使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了task函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: loadRecipe
protected function loadRecipe()
{
require __DIR__ . '/../../recipe/common.php';
task('deploy:timeout_test', function () {
$this->result = run('sleep 11 && echo $SSH_CLIENT');
});
task('deploy:ssh_test', function () {
$this->result = run('echo $SSH_CLIENT');
});
task('deploy:agent_test', function () {
$this->result = run('ssh -T deployer@localhost \'echo $SSH_CLIENT\'');
});
}
开发者ID:acorncom,项目名称:deployer,代码行数:13,代码来源:RemoteServerTest.php
示例2: desc
<?php
/* (c) Samuel Gordalina <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Deployer;
desc('Notifying New Relic of deployment');
task('deploy:newrelic', function () {
global $php_errormsg;
$config = get('newrelic', array());
if (!is_array($config) || !isset($config['license']) || !isset($config['app_name']) && !isset($config['application_id'])) {
throw new \RuntimeException("<comment>Please configure new relic:</comment> <info>set('newrelic', array('license' => 'xad3...', 'application_id' => '12873'));</info>");
}
$git = array('user' => trim(runLocally('git config user.name')), 'revision' => trim(runLocally('git log -n 1 --format="%h"')), 'description' => trim(runLocally('git log -n 1 --format="%an: %s" | tr \'"\' "\'"')));
$postdata = array_merge($git, $config);
unset($postdata['license']);
$options = array('http' => array('method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\n" . "X-License-Key: {$config['license']}\r\n", 'content' => http_build_query(array('deployment' => $postdata))));
$context = stream_context_create($options);
$result = @file_get_contents('https://api.newrelic.com/deployments.xml', false, $context);
if ($result === false) {
throw new \RuntimeException($php_errormsg);
}
});
开发者ID:deployphp,项目名称:recipes,代码行数:26,代码来源:newrelic.php
示例3: set
<?php
namespace Deployer;
require_once __DIR__ . '/common.php';
/**
* Silverstripe configuration
*/
// Silverstripe shared dirs
set('shared_dirs', ['assets']);
// Silverstripe writable dirs
set('writable_dirs', ['assets']);
/**
* Helper tasks
*/
task('silverstripe:build', function () {
return run('{{bin/php}} {{release_path}}/framework/cli-script.php /dev/build');
})->desc('Run /dev/build');
task('silverstripe:buildflush', function () {
return run('{{bin/php}} {{release_path}}/framework/cli-script.php /dev/build flush=all');
})->desc('Run /dev/build?flush=all');
/**
* Main task
*/
task('deploy', ['deploy:prepare', 'deploy:lock', 'deploy:release', 'deploy:update_code', 'deploy:vendors', 'deploy:shared', 'deploy:writable', 'silverstripe:buildflush', 'deploy:symlink', 'deploy:unlock', 'cleanup'])->desc('Deploy your project');
after('deploy', 'success');
开发者ID:elfet,项目名称:deployer,代码行数:26,代码来源:silverstripe.php
示例4: server
require 'recipe/drupal8.php';
server('prod', '146.185.128.63', 9999)->user('deploy')->identityFile()->stage('production')->env('deploy_path', '/usr/share/nginx/html/kristiankaadk');
set('repository', '[email protected]:kaa4ever/kristiankaadk.git');
task('deploy:permissions', function () {
run('if [ -d {{deploy_path}}/shared ]; then sudo chown -R deploy:deploy {{deploy_path}}/shared; fi');
run('if [ -d {{deploy_path}}/releases ]; then sudo chown -R deploy:deploy {{deploy_path}}/releases; fi');
});
task('docker:reboot', function () {
cd('{{release_path}}');
run('docker stop kristiankaa.site || true');
run('docker rm kristiankaa.site || true');
run('docker-compose -f docker-compose.prod.yml up -d');
});
task('drush:make', function () {
writeln("<info>Drush: Building site</info>");
run('docker exec kristiankaa.site bash -c "cd /var/www/html && drush make site.make -y"');
});
task('drush:updb', function () {
writeln("<info>Drush: Updating database</info>");
run('docker exec kristiankaa.site drush updb -y --root=/var/www/html');
});
task('drush:cache', function () {
writeln("<info>Drush: Rebuilding cache</info>");
run('docker exec kristiankaa.site drush cr --root=/var/www/html');
});
after('deploy:prepare', 'deploy:permissions');
after('deploy:update_code', 'docker:reboot');
after('deploy:update_code', 'drush:make');
after('deploy', 'drush:updb');
after('deploy', 'drush:cache');
开发者ID:kaa4ever,项目名称:kristiankaadk,代码行数:30,代码来源:deploy.php
示例5: option
<?php
use Deployer\Database\Database;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
option('from', null, InputOption::VALUE_OPTIONAL, 'The source server for copying the instance');
task('copy:database', function () {
if (!input()->getOption('from')) {
throw new Exception('The source server is required');
}
$from = input()->getArgument('stage');
if ($from == 'production') {
throw new \Exception('That is strictly prohibited to restore the dump to the production server');
}
/** @var string $dump */
$dump = Database::loadUsingStage($from)->dump();
Database::loadUsingStage(input()->getOption('from'))->restore($dump);
run("rm -f " . $dump);
});
task('copy', ['copy:database']);
开发者ID:voodoo-mobile,项目名称:deployer,代码行数:20,代码来源:yii2-instances.php
示例6: catch
}
}
} catch (\RuntimeException $e) {
}
return $opts;
});
desc('Migrating database by phinx');
task('phinx:migrate', function () {
$ALLOWED_OPTIONS = ['configuration', 'date', 'environment', 'target', 'parser'];
$conf = get('phinx_get_allowed_config')($ALLOWED_OPTIONS);
cd('{{release_path}}');
$phinxCmd = get('phinx_get_cmd')('migrate', $conf);
run($phinxCmd);
cd('{{deploy_path}}');
});
task('phinx:rollback', function () {
$ALLOWED_OPTIONS = ['configuration', 'date', 'environment', 'target', 'parser'];
$conf = get('phinx_get_allowed_config')($ALLOWED_OPTIONS);
cd('{{release_path}}');
$phinxCmd = get('phinx_get_cmd')('rollback', $conf);
run($phinxCmd);
cd('{{deploy_path}}');
});
task('phinx:seed', function () {
$ALLOWED_OPTIONS = ['configuration', 'environment', 'parser', 'seed'];
$conf = get('phinx_get_allowed_config')($ALLOWED_OPTIONS);
cd('{{release_path}}');
$phinxCmd = get('phinx_get_cmd')('seed:run', $conf);
run($phinxCmd);
cd('{{deploy_path}}');
});
开发者ID:deployphp,项目名称:recipes,代码行数:31,代码来源:phinx.php
示例7: env
<?php
/* (c) Anton Medvedev <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/common.php';
// Flow-Framework application-context
env('flow_context', 'Production');
// Flow-Framework cli-command
env('flow_command', 'flow');
// Flow-Framework shared directories
set('shared_dirs', ['Data/Persistent', 'Data/Logs', 'Configuration/{{flow_context}}']);
/**
* Apply database migrations
*/
task('deploy:run_migrations', function () {
run('FLOW_CONTEXT={{flow_context}} {{bin/php}} {{release_path}}/{{flow_command}} doctrine:migrate');
})->desc('Apply database migrations');
/**
* Publish resources
*/
task('deploy:publish_resources', function () {
run('FLOW_CONTEXT={{flow_context}} {{bin/php}} {{release_path}}/{{flow_command}} resource:publish');
})->desc('Publish resources');
/**
* Main task
*/
task('deploy', ['deploy:prepare', 'deploy:release', 'deploy:update_code', 'deploy:vendors', 'deploy:shared', 'deploy:run_migrations', 'deploy:publish_resources', 'deploy:symlink', 'cleanup'])->desc('Deploy your project');
after('deploy', 'success');
开发者ID:elfet,项目名称:deployer,代码行数:31,代码来源:flow_framework.php
示例8: run
run("echo '<?php' > {{release_path}}/db.php");
run("echo 'return [' >> {{release_path}}/db.php");
run("echo \" 'class' => 'yii\\db\\Connection',\" >> {{release_path}}/db.php");
run("echo \" 'dsn' => 'mysql:host=localhost;dbname=test_dep_aaaaa',\" >> {{release_path}}/db.php");
run("echo \" 'username' => 'test',\" >> {{release_path}}/db.php");
run("echo \" 'password' => '',\" >> {{release_path}}/db.php");
run("echo \" 'charset' => 'utf8',\" >> {{release_path}}/db.php");
run("echo \"];\" >> {{release_path}}/db.php");
})->desc('Configure database connection');
/**
* Run migrations
*/
task('deploy:run_migrations', function () {
run('{{bin/php}} {{release_path}}/yii migrate up --interactive=0');
})->desc('Run migrations');
/**
* Main task
*/
task('deploy', ['deploy:prepare', 'deploy:release', 'deploy:update_code', 'deploy:shared', 'deploy:vendors', 'deploy:configure_db', 'deploy:run_migrations', 'deploy:symlink', 'deploy:writable', 'cleanup'])->desc('Deploy your project');
after('deploy', 'success');
/**
* Restart php-fpm on success deploy.
*/
//task('php-fpm:restart', function () {
// // Attention: The user must have rights for restart service
// // Attention: the command "sudo /bin/systemctl restart php-fpm.service" used only on CentOS system
// // /etc/sudoers: username ALL=NOPASSWD:/bin/systemctl restart php-fpm.service
// run('sudo /bin/systemctl restart php-fpm.service');
//})->desc('Restart PHP-FPM service');
//
//after('success', 'php-fpm:restart');
开发者ID:mamontovdmitriy,项目名称:aaaaa,代码行数:31,代码来源:deploy.php
示例9: desc
desc('Execute artisan view:clear');
task('artisan:view:clear', function () {
run('{{bin/php}} {{release_path}}/artisan view:clear');
});
desc('Execute artisan optimize');
task('artisan:optimize', function () {
run('{{bin/php}} {{release_path}}/artisan optimize');
});
/**
* Task deploy:public_disk support the public disk.
* To run this task automatically, please add below line to your deploy.php file
*
* before('deploy:symlink', 'deploy:public_disk');
*
* @see https://laravel.com/docs/5.2/filesystem#configuration
*/
desc('Make symlink for public disk');
task('deploy:public_disk', function () {
// Remove from source.
run('if [ -d $(echo {{release_path}}/public/storage) ]; then rm -rf {{release_path}}/public/storage; fi');
// Create shared dir if it does not exist.
run('mkdir -p {{deploy_path}}/shared/storage/app/public');
// Symlink shared dir to release dir
run('{{bin/symlink}} {{deploy_path}}/shared/storage/app/public {{release_path}}/public/storage');
});
/**
* Main task
*/
desc('Deploy your project');
task('deploy', ['deploy:prepare', 'deploy:lock', 'deploy:release', 'deploy:update_code', 'deploy:shared', 'deploy:vendors', 'deploy:writable', 'artisan:view:clear', 'artisan:cache:clear', 'artisan:config:cache', 'artisan:optimize', 'deploy:symlink', 'deploy:unlock', 'cleanup']);
after('deploy', 'success');
开发者ID:elfet,项目名称:deployer,代码行数:31,代码来源:laravel.php
示例10: set
* file that was distributed with this source code.
*/
namespace Deployer;
require_once __DIR__ . '/common.php';
/**
* CakePHP 3 Project Template configuration
*/
// CakePHP 3 Project Template shared dirs
set('shared_dirs', ['logs', 'tmp']);
// CakePHP 3 Project Template shared files
set('shared_files', ['config/app.php']);
/**
* Create plugins' symlinks
*/
task('deploy:init', function () {
run('{{release_path}}/bin/cake plugin assets symlink');
})->desc('Initialization');
/**
* Run migrations
*/
task('deploy:run_migrations', function () {
run('{{release_path}}/bin/cake migrations migrate');
run('{{release_path}}/bin/cake orm_cache clear');
run('{{release_path}}/bin/cake orm_cache build');
})->desc('Run migrations');
/**
* Main task
*/
task('deploy', ['deploy:prepare', 'deploy:lock', 'deploy:release', 'deploy:update_code', 'deploy:shared', 'deploy:vendors', 'deploy:init', 'deploy:run_migrations', 'deploy:symlink', 'deploy:unlock', 'cleanup'])->desc('Deploy your project');
after('deploy', 'success');
开发者ID:elfet,项目名称:deployer,代码行数:31,代码来源:cakephp.php
示例11: task
<?php
namespace Bob\BuildConfig;
task("default", array("test"));
desc("Runs all tests.");
task("test", array("phpunit.xml", "composer.json"), function () {
sh("./vendor/bin/phpunit");
});
fileTask("phpunit.xml", array("phpunit.dist.xml"), function ($task) {
copy($task->prerequisites[0], $task->name);
});
fileTask("composer.json", array("composer.lock"), function ($task) {
if (!file_exists("composer.phar")) {
file_put_contents("composer.phar", file_get_contents("http://getcomposer.org/composer.phar"));
}
php("composer.phar install --dev");
});
开发者ID:chh,项目名称:itertools,代码行数:18,代码来源:bob_config.php
示例12: task
task('cachetool:clear:apc', function () {
$releasePath = env('release_path');
$env = env();
$options = $env->has('cachetool') ? $env->get('cachetool') : get('cachetool');
if (strlen($options)) {
$options = "--fcgi={$options}";
}
cd($releasePath);
$hasCachetool = run("if [ -e {$releasePath}/cachetool.phar ]; then echo 'true'; fi");
if ('true' !== $hasCachetool) {
run("curl -sO http://gordalina.github.io/cachetool/downloads/cachetool.phar");
}
run("{{bin/php}} cachetool.phar apc:cache:clear system {$options}");
})->desc('Clearing APC system cache');
/**
* Clear opcache cache
*/
task('cachetool:clear:opcache', function () {
$releasePath = env('release_path');
$env = env();
$options = $env->has('cachetool') ? $env->get('cachetool') : get('cachetool');
if (strlen($options)) {
$options = "--fcgi={$options}";
}
cd($releasePath);
$hasCachetool = run("if [ -e {$releasePath}/cachetool.phar ]; then echo 'true'; fi");
if ('true' !== $hasCachetool) {
run("curl -sO http://gordalina.github.io/cachetool/downloads/cachetool.phar");
}
run("{{bin/php}} cachetool.phar opcache:reset {$options}");
})->desc('Clearing OPcode cache');
开发者ID:lasselehtinen,项目名称:recipes,代码行数:31,代码来源:cachetool.php
示例13: env
env('current', function () {
return run("readlink {{deploy_path}}/current")->toString();
});
/**
* Show current release number.
*/
task('current', function () {
writeln('Current release: ' . basename(env('current')));
})->desc('Show current release.');
/**
* Cleanup old releases.
*/
task('cleanup', function () {
$releases = env('releases_list');
$keep = get('keep_releases');
while ($keep > 0) {
array_shift($releases);
--$keep;
}
foreach ($releases as $release) {
run("rm -rf {{deploy_path}}/releases/{$release}");
}
run("cd {{deploy_path}} && if [ -e release ]; then rm release; fi");
run("cd {{deploy_path}} && if [ -h release ]; then rm release; fi");
})->desc('Cleaning up old releases');
/**
* Success message
*/
task('success', function () {
writeln("<info>Successfully deployed!</info>");
})->once()->setPrivate();
开发者ID:benjamingauthier,项目名称:deployer,代码行数:31,代码来源:common.php
示例14: task
<?php
/* (c) Sergio Carracedo <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Deployer;
require_once __DIR__ . '/common.php';
task('deploy', ['deploy:prepare', 'deploy:lock', 'deploy:release', 'deploy:update_code', 'deploy:shared', 'deploy:symlink', 'deploy:unlock', 'cleanup']);
//Set drupal site. Change if you use different site
set('drupal_site', 'default');
//Drupal 8 shared dirs
set('shared_dirs', ['sites/{{drupal_site}}/files']);
//Drupal 8 shared files
set('shared_files', ['sites/{{drupal_site}}/settings.php', 'sites/{{drupal_site}}/services.yml']);
//Drupal 8 Writable dirs
set('writable_dirs', ['sites/{{drupal_site}}/files']);
开发者ID:elfet,项目名称:deployer,代码行数:19,代码来源:drupal8.php
示例15: set
<?php
/* (c) Anton Medvedev <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Deployer;
set('bin/npm', function () {
return (string) run('which npm');
});
desc('Install npm packages');
task('npm:install', function () {
$releases = get('releases_list');
if (isset($releases[1])) {
if (run("if [ -d {{deploy_path}}/releases/{$releases[1]}/node_modules ]; then echo 'true'; fi")->toBool()) {
run("cp --recursive {{deploy_path}}/releases/{$releases[1]}/node_modules {{release_path}}");
}
}
run("cd {{release_path}} && {{bin/npm}} install");
});
开发者ID:deployphp,项目名称:recipes,代码行数:22,代码来源:npm.php
示例16: task
<?php
/**
* Init WP with noncens data
*/
task('init:wp', function () {
writeln('Initialize WP to get WP-CLI working');
runLocally('cd web && wp core install --url=http://something.dev --title=wp --admin_user=admin --admin_password=admin [email protected]');
});
/**
* Gets the latest from prod
*/
task('init:pull', function () {
writeln('Pull remote version of WP');
runLocally('dep pull production', 999);
});
task('init', ['init:wp', 'init:pull']);
开发者ID:ekandreas,项目名称:dipwpe,代码行数:17,代码来源:init.php
示例17: task
<?php
/* (c) Lasse Lehtinen <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Restart php-fpm
*/
task('php-fpm:restart', function () {
run('service php-fpm restart');
})->desc('Restarting php-fpm process');
/**
* Reload php-fpm
*/
task('php-fpm:reload', function () {
run('service php-fpm reload');
})->desc('Reloading php-fpm process');
开发者ID:lasselehtinen,项目名称:recipes,代码行数:19,代码来源:php-fpm.php
示例18: task
<?php
if (!class_exists('EkAndreas\\DockerLaravel\\Helpers')) {
include_once 'src/DockerLaravel/Helpers.php';
}
use EkAndreas\DockerLaravel\Helpers;
$dir = Helpers::getProjectDir();
require_once $dir . '/vendor/autoload.php';
include_once 'common.php';
task('docker:start', function () {
Helpers::start();
}, 999);
task('docker:up', function () {
Helpers::start();
}, 999);
task('docker:stop', function () {
Helpers::stop();
});
task('docker:halt', function () {
Helpers::stop();
});
task('docker:kill', function () {
Helpers::kill();
});
task('docker:cleanup', function () {
Helpers::cleanup();
});
开发者ID:ekandreas,项目名称:docker-laravel,代码行数:27,代码来源:recipe.php
示例19: date_default_timezone_set
<?php
date_default_timezone_set('Europe/Stockholm');
include_once 'vendor/ekandreas/docker-bedrock/recipe.php';
include_once 'vendor/ekandreas/dipwpe/pull.php';
server('nordiciron.dev', 'default')->env('container', 'bedrock')->stage('development');
server('production', 'andreasek.se', 22)->env('deploy_path', '/mnt/persist/www/nordiciron.com')->user('root')->env('branch', 'master')->env('remote.name', 'nordiciron')->env('remote.database', 'nordiciron')->env('remote.ssh', '[email protected]')->env('remote.domain', 'www.nordiciron.com')->env('local.domain', 'nordiciron.dev')->env('remote.path', '/mnt/persist/www/nordiciron.com')->env('local.is_elastic', false)->stage('production')->identityFile();
set('repository', '[email protected]:ekandreas/nordiciron.git');
// Symlink the .env file for Bedrock
set('env', 'prod');
set('keep_releases', 10);
set('shared_dirs', ['web/app/uploads']);
set('shared_files', ['.env', 'web/.htaccess', 'web/robots.txt']);
set('env_vars', '/usr/bin/env');
task('deploy:restart', function () {
writeln('Purge cache...');
//run("curl -s http://www.skolporten.se/wp/wp-admin/admin-ajax.php?action=purge");
})->desc('Restarting apache2 and varnish');
task('deploy', ['deploy:prepare', 'deploy:release', 'deploy:update_code', 'deploy:vendors', 'deploy:shared', 'deploy:symlink', 'cleanup', 'deploy:restart', 'success'])->desc('Deploy your Bedrock project, eg dep deploy production');
开发者ID:ekandreas,项目名称:nordiciron,代码行数:19,代码来源:deploy.php
示例20: task
});
task('release:createGithubRelease', function () {
$ch = getGithubCurl();
$release = array('tag_name' => get('version'), 'name' => 'Release: ' . get('version'));
$uri = 'https://api.github.com/repos/' . get('repository') . '/releases';
curl_setopt($ch, CURLOPT_URL, $uri);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($release));
curl_setopt($ch, CURLOPT_POST, 1);
$release = json_decode(curl_exec($ch));
$releaseId = $release->id;
set('releaseId', $releaseId);
});
task('release:destroyGithubRelease', function () {
$ch = getGithubCurl();
$uri = 'https://api.github.com/repos/' . get('repository') . '/releases/tags/' . get('version');
curl_setopt($ch, CURLOPT_URL, $uri);
$release = json_decode(curl_exec($ch));
$releaseId = $release->id;
$uri = 'https://api.github.com/repos/' . get('repository') . '/releases/' . $releaseId;
$ch = getGithubCurl();
curl_setopt($ch, CURLOPT_URL, $uri);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_exec($ch);
});
set('username', 'mneuhaus');
set('repository', 'mia3/koseki');
task('release:patch', ['release:askPasswort', 'release:increaseVersionPatch', 'release:commitComposer', 'release:tagRelease', 'release:pushTags', 'release:createGithubRelease']);
task('release:minor', ['release:askPasswort', 'release:increaseVersionMinor', 'release:commitComposer', 'release:tagRelease', 'release:pushTags', 'release:createGithubRelease']);
task('release:major', ['release:askPasswort', 'release:increaseVersionMajor', 'release:commitComposer', 'release:tagRelease', 'release:pushTags', 'release:createGithubRelease']);
task('release:replaceCurrent', ['release:askPasswort', 'release:fetchVersion', 'release:destroyGithubRelease', 'release:removeCurrentTagFromRemote', 'release:tagRelease', 'release:pushTags', 'release:createGithubRelease']);
开发者ID:mia3,项目名称:koseki,代码行数:30,代码来源:deploy.php
注:本文中的task函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论