_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q18600
BltLogStyle.formatMessage
train
protected function formatMessage($label, $message, $context, $taskNameStyle, $messageStyle = '') {
php
{ "resource": "" }
q18601
AcHooksCommand.dbScrub
train
public function dbScrub($site, $target_env, $db_name, $source_env) { if (!EnvironmentDetector::isAcsfEnv($site, $target_env)) { $password = RandomString::string(10, FALSE, function ($string) { return !preg_match('/[^\x{80}-\x{F7} a-z0-9@+_.\'-]/i', $string); }, 'abcdefghijklm...
php
{ "resource": "" }
q18602
AcHooksCommand.sendPostCodeUpdateNotifications
train
protected function sendPostCodeUpdateNotifications($site, $target_env, $source_branch, $deployed_tag, $success) { $is_tag = $source_branch != $deployed_tag; if ($success) { if ($is_tag) { $message = "An updated deployment has been made to *$site.$target_env* using tag *$deployed_tag*."; } ...
php
{ "resource": "" }
q18603
AcHooksCommand.getSlackWebhookUrl
train
protected function getSlackWebhookUrl() { if ($this->getConfig()->has('slack.webhook-url')) { return $this->getConfigValue('slack.webhook-url'); } elseif (getenv('SLACK_WEBHOOK_URL')) { return getenv('SLACK_WEBHOOK_URL');
php
{ "resource": "" }
q18604
AcHooksCommand.sendSlackNotification
train
protected function sendSlackNotification($url, $payload) { $this->say("Sending slack notification..."); $data = "payload=" . json_encode($payload); $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch,
php
{ "resource": "" }
q18605
AcHooksCommand.updateSites
train
protected function updateSites($site, $target_env) { if (EnvironmentDetector::isAhOdeEnv($target_env)) { $this->updateOdeSites();
php
{ "resource": "" }
q18606
Plugin.onPostPackageEvent
train
public function onPostPackageEvent(PackageEvent $event) { $package = $this->getBltPackage($event->getOperation()); if ($package) { // By explicitly setting the blt package,
php
{ "resource": "" }
q18607
Plugin.isNewProject
train
protected function isNewProject() { $composer_json = json_decode(file_get_contents($this->getRepoRoot() . '/composer.json'), TRUE); if (isset($composer_json['name']) && in_array($composer_json['name'],
php
{ "resource": "" }
q18608
Plugin.getVendorPath
train
public function getVendorPath() { $config = $this->composer->getConfig(); $filesystem = new Filesystem();
php
{ "resource": "" }
q18609
Plugin.getOptions
train
protected function getOptions() { $defaults = [ 'update' => TRUE, ]; $extra = $this->composer->getPackage()->getExtra() + ['blt' => []];
php
{ "resource": "" }
q18610
DrupalCommand.install
train
public function install() { // Allows for installs to define custom user 0 name. if ($this->getConfigValue('drupal.account.name') !== NULL) { $username = $this->getConfigValue('drupal.account.name'); } else { // Generate a random, valid username. // @see \Drupal\user\Plugin\Validation...
php
{ "resource": "" }
q18611
BehatCheck.checkBehat
train
protected function checkBehat() { $this->checkLocalConfig(); if ($this->behatLocalYmlExists()) { $behatDefaultLocalConfig
php
{ "resource": "" }
q18612
Executor.drush
train
public function drush($command) { // @todo Set to silent if verbosity is less than very verbose. $bin = $this->getConfigValue('composer.bin'); /** @var \Robo\Common\ProcessExecutor $process_executor */ $drush_alias = $this->getConfigValue('drush.alias'); $command_string = "'$bin/drush' @$drush_alias...
php
{ "resource": "" }
q18613
Executor.wait
train
public function wait(callable $callable, array $args, $message = '') { $maxWait = 60 * 1000; $checkEvery = 1 * 1000; $start = microtime(TRUE) * 1000; $end = $start + $maxWait; if (!$message) { $method_name = is_array($callable) ? $callable[1] : $callable; $message = "Waiting for $method...
php
{ "resource": "" }
q18614
Executor.checkUrl
train
public function checkUrl($url) { try { $client = new Client(); $res = $client->request('GET', $url, [ 'connection_timeout' => 2, 'timeout' => 2, 'exceptions' => FALSE, ]); if ($res->getStatusCode() && substr($res->getStatusCode(), 0, 1) != '5') { return TRUE; ...
php
{ "resource": "" }
q18615
DevDesktopCheck.checkDevDesktop
train
protected function checkDevDesktop() { if ($this->getInspector()->isDevDesktopInitialized()) { if (empty($_ENV['DEVDESKTOP_DRUPAL_SETTINGS_DIR'])) { $this->logProblem(__FUNCTION__, [ "DevDesktop usage is enabled, but \$DEVDESKTOP_DRUPAL_SETTINGS_DIR is not set in your environmental variables...
php
{ "resource": "" }
q18616
FilesetManager.registerFilesets
train
public function registerFilesets() { // @todo Assert that filesets from \Acquia\Blt\Custom\Filesets override // those from \Acquia\Blt\Custom\Filesets. $classes = [ // @codingStandardsIgnoreStart
php
{ "resource": "" }
q18617
FilesetManager.getFilesetsFromAnnotations
train
protected function getFilesetsFromAnnotations($fileset_annotations) { $filesets = []; $this->logger->debug("Gathering filesets from annotated methods...");; foreach ($fileset_annotations as $class => $fileset) { if (class_exists($class)) { $fileset_class = new $class(); $fileset_class-...
php
{ "resource": "" }
q18618
IO.yell
train
protected function yell($text, $length = 40, $color = 'green') { $format = "<fg=white;bg=$color;options=bold>%s</fg
php
{ "resource": "" }
q18619
IO.askChoice
train
protected function askChoice($question, $options, $default = NULL) { return $this->doAsk(new
php
{ "resource": "" }
q18620
IO.askRequired
train
protected function askRequired($message) { $question = new Question($this->formatQuestion($message)); $question->setValidator(function ($answer) {
php
{ "resource": "" }
q18621
IO.printArrayAsTable
train
protected function printArrayAsTable( array $array, array $headers = ['Property', 'Value'] ) {
php
{ "resource": "" }
q18622
IO.logConfig
train
protected function logConfig(array $array, $prefix = '', $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE) { if ($this->output()->getVerbosity() >= $verbosity) { if ($prefix) {
php
{ "resource": "" }
q18623
Blt.addBuiltInCommandsAndHooks
train
private function addBuiltInCommandsAndHooks() { $commands = $this->getCommands([ 'path' => __DIR__ . '/Commands', 'namespace' => 'Acquia\Blt\Robo\Commands', ]); $hooks = $this->getHooks([
php
{ "resource": "" }
q18624
Blt.getCommands
train
private function getCommands( array $options = ['path' => NULL, 'namespace' => NULL] ) { $discovery = new CommandFileDiscovery(); $discovery ->setSearchPattern('*Command.php')
php
{ "resource": "" }
q18625
Blt.getHooks
train
private function getHooks( array $options = ['path' => NULL, 'namespace' => NULL] ) { $discovery = new CommandFileDiscovery();
php
{ "resource": "" }
q18626
Blt.addDefaultArgumentsAndOptions
train
private function addDefaultArgumentsAndOptions(Application $app) { $app->getDefinition() ->addOption( new InputOption('--define', '-D', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Define a configuration item value.', []) ); $app->getDefinition() ->addOption( new...
php
{ "resource": "" }
q18627
Blt.configureContainer
train
public function configureContainer($container) { $container->share('logStyler', BltLogStyle::class); // We create our own builder so that non-command classes are able to // implement task methods, like taskExec(). Yes, there are now two builders // in the container. "collectionBuilder" used for the act...
php
{ "resource": "" }
q18628
Blt.run
train
public function run(InputInterface $input, OutputInterface $output) { $application = $this->getContainer()->get('application');
php
{ "resource": "" }
q18629
BltConfig.expandFileProperties
train
public function expandFileProperties($filename) { $expanded_contents = Expander::expandArrayProperties(file($filename), $this->export());
php
{ "resource": "" }
q18630
BltConfig.set
train
public function set($key, $value) { if ($value === 'false') { $value = FALSE; } elseif ($value === 'true') { $value = TRUE; } // Expand properties in string. We do this here so that one can pass // -D drush.alias=${drush.ci.aliases} at runtime and still expand
php
{ "resource": "" }
q18631
BltConfig.get
train
public function get($key, $defaultOverride = NULL) { $value = parent::get($key, $defaultOverride); // Last ditch effort to expand properties that may not have been processed. if (is_string($value) && strstr($value, '$')) {
php
{ "resource": "" }
q18632
DeployCommand.deploy
train
public function deploy($options = [ 'branch' => InputOption::VALUE_REQUIRED, 'tag' => InputOption::VALUE_REQUIRED, 'commit-msg' => InputOption::VALUE_REQUIRED, 'ignore-dirty' => FALSE, 'dry-run' => FALSE, 'ignore-platform-reqs' => FALSE, ]) { if ($options['dry-run']) { $this->logger-...
php
{ "resource": "" }
q18633
DeployCommand.getCommitMessage
train
protected function getCommitMessage($options) { if (!$options['commit-msg']) { chdir($this->getConfigValue('repo.root')); $log = explode(' ', shell_exec("git log --oneline -1"), 2); $git_last_commit_message = trim($log[1]); return $this->askDefault('Enter
php
{ "resource": "" }
q18634
DeployCommand.getBranchName
train
protected function getBranchName($options) { if ($options['branch']) { $this->say("Branch is set to <comment>{$options['branch']}</comment>."); return $options['branch']; } else
php
{ "resource": "" }
q18635
DeployCommand.getTagName
train
protected function getTagName($options) { if ($options['tag']) { $tag_name = $options['tag']; } else { $tag_name = $this->ask('Enter the tag name for the deployment artifact, e.g., 1.0.0-build'); } if (empty($tag_name)) { // @todo Validate tag name is valid, e.g., no spaces or spe...
php
{ "resource": "" }
q18636
DeployCommand.getDefaultBranchName
train
protected function getDefaultBranchName() { chdir($this->getConfigValue('repo.root')); $git_current_branch = trim(shell_exec("git rev-parse --abbrev-ref HEAD"));
php
{ "resource": "" }
q18637
DeployCommand.deployToTag
train
protected function deployToTag($options) { $this->tagName = $this->getTagName($options); // If we are building a tag, then we assume that we will NOT be pushing the // build branch from which the tag is created. However, we must still have a // local branch from which to cut the tag, so we create a tem...
php
{ "resource": "" }
q18638
DeployCommand.deployToBranch
train
protected function deployToBranch($options) { $this->branchName = $this->getBranchName($options); $this->prepareDir(); $this->addGitRemotes(); $this->checkoutLocalDeployBranch();
php
{ "resource": "" }
q18639
DeployCommand.prepareDir
train
protected function prepareDir() { $this->say("Preparing artifact directory..."); $deploy_dir = $this->deployDir; $this->taskDeleteDir($deploy_dir) ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE) ->run(); $this->taskFilesystemStack() ->mkdir($this->deployDir) ...
php
{ "resource": "" }
q18640
DeployCommand.checkoutLocalDeployBranch
train
protected function checkoutLocalDeployBranch() { $this->taskExecStack() ->dir($this->deployDir) // Create new branch locally.We intentionally use stopOnFail(FALSE) in // case the branch already exists. `git checkout -B` does not seem to work // as advertised. // @todo perform this in a...
php
{ "resource": "" }
q18641
DeployCommand.mergeUpstreamChanges
train
protected function mergeUpstreamChanges() { $git_remotes = $this->getConfigValue('git.remotes'); $remote_url = reset($git_remotes); $remote_name = md5($remote_url); $this->say("Merging upstream changes into local artifact..."); $this->taskExecStack() ->dir($this->deployDir) // This bran...
php
{ "resource": "" }
q18642
DeployCommand.build
train
public function build() { $this->say("Generating build artifact..."); $this->say("For more detailed output, use the -v flag."); $commands = [ // Execute `blt source:build:frontend` to ensure that frontend artifact // are generated in source repo. 'source:build:frontend', // Execute ...
php
{ "resource": "" }
q18643
DeployCommand.buildCopy
train
protected function buildCopy() { $exclude_list_file = $this->getExcludeListFile(); $source = $this->getConfigValue('repo.root'); $dest = $this->deployDir; $this->setMultisiteFilePermissions(0777); $this->say("Rsyncing files from source repo into the build artifact..."); $this->taskExecStack()->...
php
{ "resource": "" }
q18644
DeployCommand.composerInstall
train
protected function composerInstall() { if (!$this->getConfigValue('deploy.build-dependencies')) { $this->logger->warning("Dependencies will not be built because deploy.build-dependencies is not enabled"); $this->logger->warning("You should define a custom deploy.exclude_file to ensure that dependencies ...
php
{ "resource": "" }
q18645
DeployCommand.sanitize
train
protected function sanitize() { $this->say("Sanitizing artifact..."); $this->logger->info("Find Drupal core text files..."); $sanitizeFinder = Finder::create() ->files() ->name('*.txt') ->notName('LICENSE.txt') ->in("{$this->deployDir}/docroot/core"); $this->logger->info('Find ...
php
{ "resource": "" }
q18646
DeployCommand.getExcludeListFile
train
protected function getExcludeListFile() { $exclude_file = $this->getConfigValue('deploy.exclude_file'); $exclude_additions = $this->getConfigValue('deploy.exclude_additions_file'); if (file_exists($exclude_additions)) { $this->say("Combining exclusions from deploy.deploy-exclude-additions and
php
{ "resource": "" }
q18647
DeployCommand.mungeExcludeLists
train
protected function mungeExcludeLists($file1, $file2) { $file1_contents = file($file1); $file2_contents = file($file2); $merged = array_merge($file1_contents, $file2_contents); $merged_without_dups =
php
{ "resource": "" }
q18648
DeployCommand.setMultisiteFilePermissions
train
protected function setMultisiteFilePermissions($perms) { $taskFilesystemStack = $this->taskFilesystemStack(); $multisites = $this->getConfigValue('multisites'); foreach ($multisites as $multisite) { $multisite_dir = $this->getConfigValue('docroot') . '/sites/' . $multisite;
php
{ "resource": "" }
q18649
DeployCommand.commit
train
protected function commit() { $this->say("Committing artifact to <comment>{$this->branchName}</comment>..."); $result = $this->taskGit() ->dir($this->deployDir) ->exec("git rm -r --cached --ignore-unmatch --quiet .") ->add('-A') ->commit($this->commitMessage, '--quiet')
php
{ "resource": "" }
q18650
DeployCommand.push
train
protected function push($identifier, $options) { if ($options['dry-run']) { $this->logger->warning("Skipping push of deployment artifact. deploy.dryRun is set to true."); return FALSE; } else { $this->say("Pushing artifact to git.remotes..."); } $task = $this->taskExecStack() ...
php
{ "resource": "" }
q18651
DeployCommand.cutTag
train
protected function cutTag($repo = 'build') { $taskGit = $this->taskGit() ->tag($this->tagName, $this->commitMessage) ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE) ->stopOnFail(); if ($repo == 'build') { $taskGit->dir($this->deployDir); } $result = $tas...
php
{ "resource": "" }
q18652
DeployCommand.updateAll
train
public function updateAll() { // Disable alias since we are targeting specific uri. $this->config->set('drush.alias',
php
{ "resource": "" }
q18653
DeployCommand.syncRefresh
train
public function syncRefresh() { // Disable alias since we are targeting specific uri. $this->config->set('drush.alias', ''); // Sync files. $this->config->set('sync.files', TRUE); foreach ($this->getConfigValue('multisites') as $multisite) { $this->say("Syncing $multisite..."); if (!$t...
php
{ "resource": "" }
q18654
Updates.update_8006000
train
public function update_8006000() { // Move files to blt subdir. $this->updater->moveFile('project.yml', 'blt/project.yml', TRUE); $this->updater->moveFile('project.local.yml', 'blt/project.local.yml', TRUE); $this->updater->moveFile('example.project.local.yml', 'blt/example.project.local.yml...
php
{ "resource": "" }
q18655
Updates.update_8006002
train
public function update_8006002() { $composer_json = $this->updater->getComposerJson(); $composer_json = DoPackagistConverter::convertComposerJson($composer_json); // This package is not compatible with D.O style version constraints.
php
{ "resource": "" }
q18656
Updates.update_8006004
train
public function update_8006004() { $composer_json = $this->updater->getComposerJson(); $remove_packages = [ 'drupal/coder', 'drupal-composer/drupal-security-advisories', 'phing/phing', 'phpunit/phpunit', 'behat/mink-extension', 'behat/mink-goutte-driver', 'behat/mink-br...
php
{ "resource": "" }
q18657
Updates.update_8006006
train
public function update_8006006() { $composer_json = $this->updater->getComposerJson();
php
{ "resource": "" }
q18658
Updates.update_8006007
train
public function update_8006007() { $composer_json = $this->updater->getComposerJson(); if (!empty($composer_json['extra']['drupal-scaffold']['excludes'])) { $composer_json['extra']['drupal-scaffold']['excludes'] =
php
{ "resource": "" }
q18659
Updates.update_8009000
train
public function update_8009000() { $project_yml = $this->updater->getProjectYml(); if (!empty($project_yml['behat']['launch-phantomjs']) && $project_yml['behat']['launch-phantomjs']) { $project_yml['behat']['web-driver'] = 'phantomjs'; } else { $project_yml['behat']['web-driver'] = 'selenium...
php
{ "resource": "" }
q18660
Updates.update_8009001
train
public function update_8009001() { $project_yml = $this->updater->getProjectYml(); unset($project_yml['phpcs']['filesets']['files.php.custom.modules']); unset($project_yml['phpcs']['filesets']['files.php.custom.themes']);
php
{ "resource": "" }
q18661
Updates.update_8009003
train
public function update_8009003() { $composer_json = $this->updater->getComposerJson(); $composer_json['extra']['installer-types'][] = 'bower-asset'; $composer_json['extra']['installer-types'][] = 'npm-asset'; $composer_json['extra']['installer-paths']['docroot/libraries/{$name}'][] = 'type:bower-asset'...
php
{ "resource": "" }
q18662
Updates.update_8009007
train
public function update_8009007() { $this->updater->deleteFile('drush.wrapper'); $this->updater->deleteFile('.drush-use'); // Recommend drush upgrade. $messages = [ "You should replace your local global installation of drush with drush launcher:", "https://github.com/drush-ops/drush-launcher...
php
{ "resource": "" }
q18663
Updates.update_8009011
train
public function update_8009011() { $project_yml = $this->updater->getProjectYml(); if (isset($project_yml['vm']['enable'])) { // Add to project.local.yml. $project_local_yml = $this->updater->getProjectLocalYml();
php
{ "resource": "" }
q18664
Updates.update_9001000
train
public function update_9001000() { $this->updater->syncWithTemplate('.gitignore', TRUE); $messages = ['.gitignore has been updated. Review it for any custom changes that may have been overwritten.']; $formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice'); $this->updater->getOut...
php
{ "resource": "" }
q18665
Updates.update_9001001
train
public function update_9001001() { $this->updater->syncWithTemplate('.gitignore', TRUE); $composer_json = $this->updater->getComposerJson(); if (isset($composer_json['extra']['installer-paths']['drush/contrib/{$name}'])) { unset($composer_json['extra']['installer-paths']['drush/contrib/{$name}']); ...
php
{ "resource": "" }
q18666
Updates.update_9002000
train
public function update_9002000() { if (file_exists($this->updater->getRepoRoot() . '/factory-hooks')) { $messages = [ "This update will update the files in your existing factory hooks directory.", "Review the resulting files and ensure that any customizations have been re-added.", ]; ...
php
{ "resource": "" }
q18667
YamlCommand.lintFileSets
train
public function lintFileSets() { $this->say("Validating yaml syntax for all custom modules and exported config..."); /** @var \Acquia\Blt\Robo\Filesets\FilesetManager $fileset_manager */ $fileset_manager = $this->getContainer()->get('filesetManager'); $fileset_ids = $this->getConfigValue('validate.yaml...
php
{ "resource": "" }
q18668
YamlCommand.lintFileList
train
public function lintFileList($file_list) { $this->say("Linting YAML files..."); $files = explode("\n", $file_list); /** @var \Acquia\Blt\Robo\Filesets\FilesetManager $fileset_manager */ $fileset_manager = $this->getContainer()->get('filesetManager'); $fileset_ids = $this->getConfigValue('validate....
php
{ "resource": "" }
q18669
SimpleSamlPhpCommand.initializeSimpleSamlPhp
train
public function initializeSimpleSamlPhp() { $this->requireModule(); $this->initializeConfig(); $this->setSimpleSamlPhpInstalled(); $this->symlinkDocrootToLibDir();
php
{ "resource": "" }
q18670
SimpleSamlPhpCommand.initializeConfig
train
protected function initializeConfig() { $destinationDirectory = "{$this->repoRoot}/simplesamlphp/config"; $this->say("Copying config files to ${destinationDirectory}..."); $result = $this->taskFileSystemStack() ->copy("{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp/config-templates/authsources....
php
{ "resource": "" }
q18671
SimpleSamlPhpCommand.setSimpleSamlPhpInstalled
train
protected function setSimpleSamlPhpInstalled() { $project_yml = $this->getConfigValue('blt.config-files.project'); $this->say("Updating ${project_yml}..."); $project_config = YamlMunge::parseFile($project_yml); $project_config['simplesamlphp'] = TRUE; try {
php
{ "resource": "" }
q18672
SimpleSamlPhpCommand.symlinkDocrootToLibDir
train
protected function symlinkDocrootToLibDir() { $docroot = $this->getConfigValue('docroot'); $this->say("Creating a symbolic link from ${docroot}/simplesaml to web accessible directory in the simplesamlphp library..."); $result = $this->taskFileSystemStack() ->symlink("../vendor/simplesamlphp/simplesam...
php
{ "resource": "" }
q18673
SimpleSamlPhpCommand.simpleSamlPhpBuildConfig
train
public function simpleSamlPhpBuildConfig() { $this->say('Copying config files to the appropriate place in simplesamlphp library...'); $result = $this->taskCopyDir(["{$this->repoRoot}/simplesamlphp" => "{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp"]) ->overwrite(TRUE) ->setVerbosityThreshold(...
php
{ "resource": "" }
q18674
SimpleSamlPhpCommand.outputCompleteSetupInstructions
train
protected function outputCompleteSetupInstructions() { $instructions = [ 'To complete the setup you must manually modify several files:', '', "* {$this->repoRoot}/simplesamlphp/config/acquia_config.php", "* {$this->repoRoot}/simplesamlphp/config/authsources.php", "* {$this->repoRoot}/s...
php
{ "resource": "" }
q18675
SimpleSamlPhpCommand.addHtaccessPatch
train
protected function addHtaccessPatch() { $this->taskFilesystemStack() ->copy($this->bltRoot . "/scripts/simplesamlphp/htaccess-saml.patch", $this->repoRoot . "/patches/htaccess-saml.patch") ->run(); $composer_json = json_decode(file_get_contents($this->getConfigValue('repo.root') . '/composer...
php
{ "resource": "" }
q18676
BltTasks.invokeCommands
train
protected function invokeCommands(array $commands) { foreach ($commands as $key => $value) { if (is_numeric($key)) { $command = $value; $args = []; }
php
{ "resource": "" }
q18677
BltTasks.invokeCommand
train
protected function invokeCommand($command_name, array $args = []) { $this->invokeDepth++; if (!$this->isCommandDisabled($command_name)) { /** @var \Acquia\Blt\Robo\Application $application */ $application = $this->getContainer()->get('application'); $command = $application->find($command_name...
php
{ "resource": "" }
q18678
BltTasks.getDisabledCommands
train
protected function getDisabledCommands() { $disabled_commands_config = $this->getConfigValue('disable-targets'); if ($disabled_commands_config) { $disabled_commands =
php
{ "resource": "" }
q18679
BltTasks.isCommandDisabled
train
protected function isCommandDisabled($command) { $disabled_commands = $this->getDisabledCommands(); if (is_array($disabled_commands) && array_key_exists($command, $disabled_commands) && $disabled_commands[$command]) {
php
{ "resource": "" }
q18680
BltTasks.invokeHook
train
protected function invokeHook($hook) { if ($this->getConfig()->has("command-hooks.$hook.command") && $this->getConfigValue("command-hooks.$hook.command")) { $this->say("Executing $hook target hook..."); $result = $this->taskExecStack() ->exec($this->getConfigValue("command-hooks.$hook.comm...
php
{ "resource": "" }
q18681
BltTasks.installVagrantPlugin
train
protected function installVagrantPlugin($plugin) { if (!$this->getInspector()->isVagrantPluginInstalled($plugin)) {
php
{ "resource": "" }
q18682
BltTasks.executeCommandAgainstFilesets
train
protected function executeCommandAgainstFilesets(array $filesets, $command, $parallel = FALSE) { $passed = TRUE; $failed_filesets = []; foreach ($filesets as $fileset_id => $fileset) { if (!is_null($fileset) && iterator_count($fileset)) { $this->say("Iterating over fileset $fileset_id..."); ...
php
{ "resource": "" }
q18683
BltTasks.executeCommandAgainstFiles
train
protected function executeCommandAgainstFiles($files, $command, $parallel = FALSE) { if ($parallel) { return $this->executeCommandAgainstFilesInParallel($files,
php
{ "resource": "" }
q18684
BltTasks.switchSiteContext
train
public function switchSiteContext($site_name) { $this->logger->debug("Switching site context to <comment>$site_name</comment>."); $config_initializer = new ConfigInitializer($this->getConfigValue('repo.root'), $this->input()); $config_initializer->setSite($site_name);
php
{ "resource": "" }
q18685
ConfigSplitCommand.generateConfigSplits
train
public function generateConfigSplits() { $this->say("This command will generate configuration and directories for the following environment based splits: Local, CI, Dev, Stage, and Prod."); $default_splits = ['Local', 'CI', 'Dev',
php
{ "resource": "" }
q18686
ConfigSplitCommand.createSplitConfig
train
protected function createSplitConfig($name) { $id = strtolower($name); $split_config_file = $this->configSyncDir . "/config_split.config_split.{$id}.yml"; if (file_exists($split_config_file)) { $this->say("The config_split file for $name already exists. Skipping."); } else { $uuid = $thi...
php
{ "resource": "" }
q18687
ConfigSplitCommand.createSplitDir
train
protected function createSplitDir($split) { $split_dir = $this->configSplitDir . '/' . strtolower($split); $result = $this->taskFilesystemStack() ->mkdir($split_dir) ->run(); if (!$result->wasSuccessful()) {
php
{ "resource": "" }
q18688
ConfigSplitCommand.writeSplitConfig
train
protected function writeSplitConfig($file_path, $config) { $result = $this->taskWriteToFile($file_path) ->text($config) ->run();
php
{ "resource": "" }
q18689
DefaultConfig.populateHelperConfig
train
public function populateHelperConfig() { $this->set('drush.alias', $this->get('drush.default_alias')); if (!$this->get('multisites')) { $this->set('multisites', $this->getSiteDirs()); } $multisites = $this->get('multisites');
php
{ "resource": "" }
q18690
DefaultConfig.getSiteDirs
train
protected function getSiteDirs() { $sites_dir = $this->get('docroot') . '/sites'; $sites = []; // If BLT's template has not yet been rsynced into the project root, it is // possible that docroot/sites does not exist. if (!file_exists($sites_dir)) { return $sites; } $finder = new Find...
php
{ "resource": "" }
q18691
ExamplesCommand.init
train
public function init() { $result = $this->taskFilesystemStack() ->copy( $this->getConfigValue('blt.root') . '/scripts/blt/examples/Commands/ExampleCommands.php', $this->getConfigValue('repo.root') . '/blt/src/Blt/Plugin/Commands/ExampleCommands.php', FALSE) ->copy( $this->getConf...
php
{ "resource": "" }
q18692
SimpleSamlPhpCheck.checkSimpleSamlPhp
train
protected function checkSimpleSamlPhp() { if ($this->getConfig()->has('simplesamlphp')) { $lib_root = $this->getConfigValue('repo.root') . '/vendor/simplesamlphp/simplesamlphp'; $config_root = $this->getConfigValue('repo.root') . '/simplesamlphp'; // Check for the configurable files in docroot/si...
php
{ "resource": "" }
q18693
AliasesCommand.generateAliasesAcquia
train
public function generateAliasesAcquia() { $this->cloudConfDir = $_SERVER['HOME'] . '/.acquia'; $this->setAppId(); $this->cloudConfFileName = 'cloud_api.conf'; $this->cloudConfFilePath = $this->cloudConfDir . '/' . $this->cloudConfFileName; $this->siteAliasDir = $this->getConfigValue('drush.alias-dir...
php
{ "resource": "" }
q18694
AliasesCommand.setAppId
train
protected function setAppId() { if ($app_id = $this->getConfigValue('cloud.appId')) { $this->appId = $app_id; } else { $this->say("<info>To generate an alias for the Acquia Cloud, BLT require's your Acquia Cloud application ID.</info>");
php
{ "resource": "" }
q18695
AliasesCommand.writeAppConfig
train
protected function writeAppConfig($app_id) { $project_yml = $this->getConfigValue('blt.config-files.project'); $this->say("Updating ${project_yml}..."); $project_config = YamlMunge::parseFile($project_yml); $project_config['cloud']['appId'] = $app_id; try {
php
{ "resource": "" }
q18696
AliasesCommand.askForCloudApiCredentials
train
protected function askForCloudApiCredentials() { $this->say("You may generate new API tokens at <comment>https://cloud.acquia.com/app/profile/tokens</comment>"); $key = $this->askRequired('Please enter your Acquia cloud API key:');
php
{ "resource": "" }
q18697
AliasesCommand.writeCloudApiConfig
train
protected function writeCloudApiConfig(array $config) { if (!is_dir($this->cloudConfDir)) { mkdir($this->cloudConfDir); }
php
{ "resource": "" }
q18698
AliasesCommand.setCloudApiClient
train
protected function setCloudApiClient($key, $secret) { try { $connector = new Connector(array( 'key' => $key, 'secret' => $secret, )); $cloud_api = Client::factory($connector); // We must call some method on the client to test authentication. $cloud_api->applications(); ...
php
{ "resource": "" }
q18699
AliasesCommand.getAliases
train
protected function getAliases($uri, $envName, $remoteHost, $remoteUser, $siteID) { $alias = array(); // Skip wildcard domains. $skip_site = FALSE; if (strpos($uri, ':*') !== FALSE) { $skip_site = TRUE; } if (!$skip_site) { $docroot = '/var/www/html/' . $remoteUser . '/docroot'; ...
php
{ "resource": "" }