_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q18700 | AliasesCommand.getSitesJson | train | protected function getSitesJson($sshFull, $remoteUser) {
$this->say('Getting ACSF sites.json information...');
$result = $this->taskRsync()
->fromPath('/mnt/files/' . $remoteUser . '/files-private/sites.json')
->fromHost($sshFull)
->toPath($this->cloudConfDir)
->remoteShell('ssh -A -p ... | php | {
"resource": ""
} |
q18701 | AliasesCommand.writeSiteAliases | train | protected function writeSiteAliases($site_id, array $aliases) {
if (!is_dir($this->siteAliasDir)) {
mkdir($this->siteAliasDir);
}
$filePath = $this->siteAliasDir . '/' . $site_id . '.site.yml';
if (file_exists($filePath)) {
if (!$this->confirm("File $filePath already | php | {
"resource": ""
} |
q18702 | CloudHooksCommand.copy | train | public function copy() {
$destination = $this->getConfigValue('repo.root') . '/hooks';
$this->say("Copying default Acquia cloud hooks into $destination...");
// This WILL overwrite files is source files are newer.
$result = $this->taskCopyDir([
| php | {
"resource": ""
} |
q18703 | DrupalVmCheck.checkDrupalVm | train | protected function checkDrupalVm() {
$drupal_vm_config_file = $this->getConfigValue('vm.config');
if (!file_exists($drupal_vm_config_file)) {
$this->logProblem(__FUNCTION__ . ':init', "You have DrupalVM initialized, but $drupal_vm_config_file is missing.", 'error');
return FALSE;
}
$drupal_v... | php | {
"resource": ""
} |
q18704 | RoboFile.createFromSymlink | train | public function createFromSymlink($options = [
'project-dir' => self::BLT_PROJECT_DIR,
'vm' => TRUE,
]) {
$test_project_dir = $this->bltRoot . "/" . $options['project-dir'];
$bin = $test_project_dir . "/vendor/bin";
$this->prepareTestProjectDir($test_project_dir);
$this->taskFilesystemStack()
... | php | {
"resource": ""
} |
q18705 | RoboFile.bltRelease | train | public function bltRelease(
$tag,
$github_token,
$options = [
'prev-tag' => NULL,
]
) {
$this->stopOnFail();
$current_branch = $this->getCurrentBranch();
$this->checkDirty();
$this->printReleasePreamble($tag, $current_branch);
$this->assertBranchMatchesUpstream($current_branc... | php | {
"resource": ""
} |
q18706 | RoboFile.releaseNotes | train | public function releaseNotes(
$tag,
$github_token,
$options = [
'prev-tag' => NULL,
]
) {
$current_branch = $this->getCurrentBranch();
$prev_tag = $this->getPrevTag($options, $current_branch);
// @todo Check git version. | php | {
"resource": ""
} |
q18707 | RoboFile.fixCode | train | public function fixCode() {
$command = "'{$this->bin}/phpcbf'";
$task = $this->taskExecStack()
| php | {
"resource": ""
} |
q18708 | RoboFile.sniffCode | train | public function sniffCode() {
$task = $this->taskExecStack()
->dir($this->bltRoot)
->exec("{$this->bin}/phpcs")
| php | {
"resource": ""
} |
q18709 | RoboFile.updateBltVersionConstant | train | protected function updateBltVersionConstant($tag) {
// Change version constant in Blt.php.
$this->taskReplaceInFile($this->bltRoot . '/src/Robo/Blt.php')
// Test group:
// @codingStandardsIgnoreStart
// const VERSION = '9.x-dev';
// const VERSION = '9.0.x-dev';
// const VERSION = '... | php | {
"resource": ""
} |
q18710 | RoboFile.sortChanges | train | protected function sortChanges($log_entries, $github_token) {
$client = new Client();
$client->authenticate($github_token, NULL, Client::AUTH_URL_TOKEN);
/** @var \Github\Api\Issue $issue_api */
$issue_api = $client->api('issue');
$changes = [
'breaking' => [],
'enhancements' => [],
| php | {
"resource": ""
} |
q18711 | RoboFile.sortLogEntry | train | protected function sortLogEntry($log_entry, $issue_api, $changes) {
$sorted = FALSE;
$github_issue_number = $this->parseGitHubIssueNumber($log_entry);
if ($github_issue_number) {
$labels = $this->getGitHubIssueLabels($issue_api, $github_issue_number);
if ($labels) {
foreach ($labels as $... | php | {
"resource": ""
} |
q18712 | SyncCommand.allSites | train | public function allSites() {
$multisites = $this->getConfigValue('multisites');
$this->printSyncMap($multisites);
$continue = $this->confirm("Continue?", TRUE);
if (!$continue) {
return 0;
}
foreach ($multisites as $multisite) {
| php | {
"resource": ""
} |
q18713 | SyncCommand.syncFiles | train | public function syncFiles() {
$local_alias = '@' . $this->getConfigValue('drush.aliases.local');
$remote_alias = '@' . $this->getConfigValue('drush.aliases.remote');
$site_dir = $this->getConfigValue('site');
$task = $this->taskDrush()
->alias('')
->uri('')
->drush('rsync')
->ar... | php | {
"resource": ""
} |
q18714 | SyncCommand.syncDbAllSites | train | public function syncDbAllSites() {
$exit_code = 0;
$multisites = $this->getConfigValue('multisites');
$this->printSyncMap($multisites);
$continue = $this->confirm("Continue?");
if (!$continue) {
return $exit_code;
}
foreach ($multisites as $multisite) | php | {
"resource": ""
} |
q18715 | SyncCommand.syncDb | train | public function syncDb() {
$local_alias = '@' . $this->getConfigValue('drush.aliases.local');
$remote_alias = '@' . $this->getConfigValue('drush.aliases.remote');
$task = $this->taskDrush()
->alias('')
->drush('cache-clear drush')
->drush('sql-sync')
->arg($remote_alias)
->arg... | php | {
"resource": ""
} |
q18716 | ToggleModulesCommand.toggleModules | train | public function toggleModules() {
if ($this->input()->hasArgument('environment')) {
$environment = $this->input()->getArgument('environment');
}
elseif ($this->getConfig()->has('environment')) {
$environment = $this->getConfigValue('environment');
}
elseif (!empty($_ENV['environment'])) ... | php | {
"resource": ""
} |
q18717 | ToggleModulesCommand.doToggleModules | train | protected function doToggleModules($command, $config_key) {
if ($this->getConfig()->has($config_key)) {
$this->say("Executing <comment>drush $command</comment> for modules defined in <comment>$config_key</comment>...");
$modules = (array) $this->getConfigValue($config_key);
$modules_list = implode... | php | {
"resource": ""
} |
q18718 | DrupalVmHook.interactExecuteOnHost | train | public function interactExecuteOnHost() {
if (!$this->getInspector()->isVmCli() && $this->getInspector()->isDrupalVmLocallyInitialized() && $this->getConfigValue('vm.blt-in-vm')) {
$this->logger->warning("Drupal VM is locally initialized, but you are not inside the VM.");
$this->logger->warning("You sho... | php | {
"resource": ""
} |
q18719 | CiCommand.travisInit | train | public function travisInit() {
$result = $this->taskFilesystemStack()
->copy($this->getConfigValue('blt.root') . '/scripts/travis/.travis.yml', $this->getConfigValue('repo.root') . '/.travis.yml', TRUE)
->stopOnFail()
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->... | php | {
"resource": ""
} |
q18720 | CiCommand.gitlabInit | train | public function gitlabInit() {
$result = $this->taskFilesystemStack()
->copy($this->getConfigValue('blt.root') . '/scripts/gitlab/gitlab-ci.yml', $this->getConfigValue('repo.root') . '/.gitlab-ci.yml', TRUE)
->stopOnFail()
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
... | php | {
"resource": ""
} |
q18721 | ComposerMunge.mungeFiles | train | public static function mungeFiles($file1, $file2) {
$default_contents = [];
$file1_contents = (array) json_decode(file_get_contents($file1), TRUE) + $default_contents;
$file2_contents = (array) json_decode(file_get_contents($file2), TRUE) + $default_contents;
$output = self::mergeKeyed($file1_contents,... | php | {
"resource": ""
} |
q18722 | ComposerMunge.mergeKeyed | train | protected static function mergeKeyed($file1_contents, $file2_contents, $exclude_keys = []) {
// Merge keyed arrays objects.
$merge_keys = [
'config',
'extra',
];
$output = $file1_contents;
foreach ($merge_keys as $key) {
// Set empty keys to empty placeholder arrays.
if (!arr... | php | {
"resource": ""
} |
q18723 | TwigCommand.lintFileSets | train | public function lintFileSets() {
$this->say("Validating twig syntax for all custom modules and themes...");
/** @var \Acquia\Blt\Robo\Filesets\FilesetManager $fileset_manager */
$fileset_manager = $this->getContainer()->get('filesetManager');
| php | {
"resource": ""
} |
q18724 | TwigCommand.lintFileList | train | public function lintFileList($file_list) {
$this->say("Linting twig 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": ""
} |
q18725 | TwigCommand.executeTwigLintCommandAgainstFilesets | train | protected function executeTwigLintCommandAgainstFilesets(array $filesets) {
$command = $this->createTwigLintCommand();
/** @var \Acquia\Blt\Robo\Application $application */
$application = $this->getContainer()->get('application');
$application->add($command);
$passed = TRUE;
$failed_filesets =... | php | {
"resource": ""
} |
q18726 | TwigCommand.createTwigLintCommand | train | protected function createTwigLintCommand() {
$twig = new Environment(new FilesystemLoader());
$repo_root = $this->getConfigValue('repo.root');
$extension_file_contents = file_get_contents($repo_root . '/docroot/core/lib/Drupal/Core/Template/TwigExtension.php');
// Get any custom defined Twig filters t... | php | {
"resource": ""
} |
q18727 | SetupWizard.wizardGenerateSettingsFiles | train | public function wizardGenerateSettingsFiles() {
$missing = FALSE;
if (!$this->getInspector()->isDrupalLocalSettingsFilePresent()) {
$this->logger->warning("<comment>{$this->getConfigValue('drupal.local_settings_file')}</comment> is missing.");
$missing = TRUE;
}
elseif (!$this->getInspector(... | php | {
"resource": ""
} |
q18728 | SetupWizard.wizardInstallDrupal | train | public function wizardInstallDrupal() {
if (!$this->getInspector()->isMySqlAvailable()) {
return FALSE;
}
if (!$this->getInspector()->isDrupalInstalled()) {
$this->logger->warning('Drupal is not installed.');
$confirm = $this->confirm("Do you want to install Drupal?");
if ($confirm) ... | php | {
"resource": ""
} |
q18729 | Inspector.isDrupalInstalled | train | public function isDrupalInstalled() {
$this->logger->debug("Verifying that Drupal is installed...");
$result = $this->executor->drush("sqlq \"SHOW TABLES LIKE 'config'\"")->run();
$output | php | {
"resource": ""
} |
q18730 | Inspector.getDrushStatus | train | public function getDrushStatus() {
$status_info = (array) json_decode($this->executor->drush('status | php | {
"resource": ""
} |
q18731 | Inspector.isDrushAliasValid | train | public function isDrushAliasValid($alias) {
$bin = $this->getConfigValue('composer.bin');
$command = "'$bin/drush' site:alias @$alias --format=json";
return $this->executor->execute($command)
| php | {
"resource": ""
} |
q18732 | Inspector.getDrushMajorVersion | train | public function getDrushMajorVersion() {
$version_info = json_decode($this->executor->drush('version --format=json')->run()->getMessage(), TRUE);
if (!empty($version_info['drush-version'])) {
$version = $version_info['drush-version'];
}
| php | {
"resource": ""
} |
q18733 | Inspector.isMySqlAvailable | train | public function isMySqlAvailable() {
if (is_null($this->isMySqlAvailable)) {
$this->isMySqlAvailable = | php | {
"resource": ""
} |
q18734 | Inspector.getMySqlAvailable | train | public function getMySqlAvailable() {
$this->logger->debug("Verifying that MySQL is available...");
/** @var \Robo\Result $result */
| php | {
"resource": ""
} |
q18735 | Inspector.isDrupalVmLocallyInitialized | train | public function isDrupalVmLocallyInitialized() {
if (is_null($this->isDrupalVmLocallyInitialized)) {
$this->isDrupalVmLocallyInitialized = $this->isVmCli() || $this->getConfigValue('vm.enable');
$statement = $this->isDrupalVmLocallyInitialized ? "is" : "is not";
| php | {
"resource": ""
} |
q18736 | Inspector.isDrupalVmConfigValid | train | public function isDrupalVmConfigValid() {
$valid = TRUE;
$status = $this->getDrupalVmStatus();
$machine_name = $this->getConfigValue('project.machine_name');
if (empty($status[$machine_name]['state'])) {
$this->logger->error("Could not find VM. Please ensure that the VM machine name matches projec... | php | {
"resource": ""
} |
q18737 | Inspector.isDrupalVmBooted | train | public function isDrupalVmBooted() {
if (!$this->commandExists('vagrant')) {
$this->isDrupalVmBooted = FALSE;
}
if (is_null($this->isDrupalVmBooted)) {
$status = $this->getDrupalVmStatus();
$machine_name = $this->getConfigValue('project.machine_name');
$this->isDrupalVmBooted = !emp... | php | {
"resource": ""
} |
q18738 | Inspector.isVagrantPluginInstalled | train | public function isVagrantPluginInstalled($plugin) {
$installed = (bool) $this->executor->execute("vagrant plugin list | grep '$plugin'")
->interactive(FALSE)
| php | {
"resource": ""
} |
q18739 | Inspector.getComposerVersion | train | public function getComposerVersion() {
$version = $this->executor->execute("composer --version")
->interactive(FALSE)
| php | {
"resource": ""
} |
q18740 | Inspector.isBltAliasInstalled | train | public function isBltAliasInstalled() {
$cli_config_file = $this->getCliConfigFile();
if (!is_null($cli_config_file) && file_exists($cli_config_file)) { | php | {
"resource": ""
} |
q18741 | Inspector.getCliConfigFile | train | public function getCliConfigFile() {
$file = NULL;
if (DIRECTORY_SEPARATOR == '\\') {
$user = $_SERVER['USERNAME'];
$home_dir = $_SERVER['USERPROFILE'];
}
else {
$user = posix_getpwuid(posix_getuid());
$home_dir = $user['dir'];
}
if (strstr(getenv('SHELL'), 'zsh')) {
... | php | {
"resource": ""
} |
q18742 | Inspector.isGitMinimumVersionSatisfied | train | public function isGitMinimumVersionSatisfied($minimum_version) {
exec("git --version | cut -d' ' -f3", $output, $exit_code);
if | php | {
"resource": ""
} |
q18743 | Inspector.getLocalBehatConfig | train | public function getLocalBehatConfig() {
$behat_local_config_file = $this->getConfigValue('repo.root') . '/tests/behat/local.yml';
$behat_local_config = new BltConfig();
$loader = new YamlConfigLoader();
| php | {
"resource": ""
} |
q18744 | Inspector.filesExist | train | public function filesExist($files) {
foreach ($files as $file) {
if (!file_exists($file)) {
| php | {
"resource": ""
} |
q18745 | Inspector.isBehatConfigured | train | public function isBehatConfigured() {
// Verify that URIs required for Drupal and Behat are configured correctly.
$local_behat_config = $this->getLocalBehatConfig();
if ($this->getConfigValue('project.local.uri') != $local_behat_config->get('local.extensions.Behat\MinkExtension.base_url')) {
$this->l... | php | {
"resource": ""
} |
q18746 | Inspector.getCurrentSchemaVersion | train | public function getCurrentSchemaVersion() {
if (file_exists($this->getConfigValue('blt.config-files.schema-version'))) {
$version = trim(file_get_contents($this->getConfigValue('blt.config-files.schema-version')));
| php | {
"resource": ""
} |
q18747 | Inspector.warnIfDrupalVmNotRunning | train | protected function warnIfDrupalVmNotRunning() {
if (!$this->isVmCli() && $this->isDrupalVmLocallyInitialized() && !$this->isDrupalVmBooted()) {
| php | {
"resource": ""
} |
q18748 | Inspector.isActiveConfigIdentical | train | public function isActiveConfigIdentical() {
$uri = $this->getConfigValue('drush.uri');
$result = $this->executor->drush("config:status --uri=$uri | php | {
"resource": ""
} |
q18749 | DrushTask.drush | train | public function drush($command) {
// Clear out options associated with previous drush command.
$this->setOptionsForLastCommand();
if (!$this->defaultsInitialized) {
$this->init();
}
| php | {
"resource": ""
} |
q18750 | DrushTask.init | train | protected function init() {
if ($this->getConfig()->get('drush.bin')) {
$this->executable = str_replace(' ', '\\ ', $this->getConfig()->get('drush.bin'));
}
else {
$this->executable = 'drush';
}
if (!isset($this->dir)) {
$this->dir($this->getConfig()->get('drush.dir'));
}
... | php | {
"resource": ""
} |
q18751 | DrushTask.mixedToBool | train | protected function mixedToBool($mixedVar) {
if (is_string($mixedVar)) {
$boolVar = ($mixedVar === 'yes' || $mixedVar === 'true');
}
else | php | {
"resource": ""
} |
q18752 | DrushTask.setOptionsForLastCommand | train | protected function setOptionsForLastCommand() {
if (isset($this->commands)) {
$numberOfCommands = count($this->commands);
$correspondingCommand = $numberOfCommands - 1;
$this->options[$correspondingCommand] = $this->arguments;
$this->arguments = '';
}
| php | {
"resource": ""
} |
q18753 | DrushTask.setGlobalOptions | train | protected function setGlobalOptions() {
if (isset($this->uri) && !empty($this->uri)) {
$this->option('uri', $this->uri);
}
if (!$this->interactive) {
$this->option('no-interaction');
}
if ($this->verbose !== FALSE) {
$verbosity_threshold = $this->verbosityThreshold();
switc... | php | {
"resource": ""
} |
q18754 | DrushTask.setupExecution | train | protected function setupExecution() {
$this->setOptionsForLastCommand();
$this->setGlobalOptions();
$globalOptions = $this->arguments;
foreach ($this->commands as $commandNumber => $command) {
if ($this->alias) {
$command = "@{$this->alias} {$command}";
}
$options = isset($t... | php | {
"resource": ""
} |
q18755 | FileSystemCheck.checkFileSystem | train | protected function checkFileSystem() {
$paths = [
'%files' => 'Public files directory',
'%private' => 'Private files directory',
'%temp' => 'Temporary files directory',
];
foreach ($paths as $key => $title) {
if (empty($this->drushStatus['%paths'][$key])) {
$this->logProblem... | php | {
"resource": ""
} |
q18756 | PhpCbfCommand.phpcbfFileSet | train | public function phpcbfFileSet() {
$this->say('Fixing and beautifying code...');
$bin = $this->getConfigValue('composer.bin');
$result = $this->taskExec("$bin/phpcbf")
->dir($this->getConfigValue('repo.root'))
->run();
$exit_code = $result->getExitCode();
// - 0 indicates that no fixabl... | php | {
"resource": ""
} |
q18757 | FileStore.get | train | public function get($key) {
$out = NULL;
// Read the json encoded value from disk if it exists.
$path = | php | {
"resource": ""
} |
q18758 | FileStore.set | train | public function set($key, $data) {
$path = $this->getFileName($key, TRUE);
| php | {
"resource": ""
} |
q18759 | FileStore.remove | train | public function remove($key) {
$path = $this->getFileName($key, TRUE);
| php | {
"resource": ""
} |
q18760 | FileStore.keys | train | public function keys() {
$root = $this->directory;
if (file_exists($root) && is_readable($root)) {
| php | {
"resource": ""
} |
q18761 | FileStore.getFileName | train | protected function getFileName($key, $writable = FALSE) {
$key = $this->cleanKey($key);
if ($writable) {
$this->ensureDirectoryWritable();
}
if (!$key) {
| php | {
"resource": ""
} |
q18762 | FileStore.ensureDirectoryWritable | train | protected function ensureDirectoryWritable() {
// Reality check to prevent stomping on the local filesystem if there is
// something wrong with the config.
if (!$this->directory) {
throw new BltException('Could not save data to a file because the path setting is mis-configured.');
}
$writable... | php | {
"resource": ""
} |
q18763 | AliasCommand.installBltAlias | train | public function installBltAlias() {
if (isset($_SERVER['ComSpec'])) {
$bltRoot = $this->getConfigValue('blt.root') . '\\vendor\\bin';
$this->logger->error("Setting a blt alias is not supported in cmd.exe");
$this->say("<info>Please use Windows to add <comment>$bltRoot</comment> to your Environment... | php | {
"resource": ""
} |
q18764 | AliasCommand.createNewAlias | train | protected function createNewAlias() {
$this->say("Installing <comment>blt</comment> alias...");
$config_file = $this->getInspector()->getCliConfigFile();
if (is_null($config_file)) {
$this->logger->error("Could not install blt alias. No profile found. Tried ~/.zshrc, ~/.bashrc, ~/.bash_profile, ~/.pro... | php | {
"resource": ""
} |
q18765 | AliasCommand.getAliasInfo | train | protected function getAliasInfo() {
$alias_length = NULL;
$alias = NULL;
$config_file = $this->getInspector()->getCliConfigFile();
$contents = file_get_contents($config_file);
$needle = 'function blt() {';
$begin_alias_pos = strpos($contents, $needle);
$end_alias_pos = $this->getClosingBrack... | php | {
"resource": ""
} |
q18766 | AliasCommand.updateAlias | train | protected function updateAlias() {
$alias_info = $this->getAliasInfo();
$new_contents = str_replace($alias_info['alias'], $alias_info['canonical_alias'], $alias_info['contents']);
$bytes = file_put_contents($alias_info['config_file'], $new_contents);
if (!$bytes) {
| php | {
"resource": ""
} |
q18767 | AliasCommand.getClosingBracketPosition | train | protected function getClosingBracketPosition($contents, $start_pos) {
$brackets = ['{'];
for ($pos = $start_pos; $pos < strlen($contents); $pos++) {
$char = substr($contents, $pos, 1);
if ($char == '{') {
array_push($brackets, $char);
}
| php | {
"resource": ""
} |
q18768 | CommandEventHook.skipDisabledCommands | train | public function skipDisabledCommands(ConsoleCommandEvent $event) {
$command = $event->getCommand();
if ($this->isCommandDisabled($command->getName())) {
$event->disableCommand();
| php | {
"resource": ""
} |
q18769 | PhpcsCommand.sniffFileSets | train | public function sniffFileSets() {
$bin = $this->getConfigValue('composer.bin');
$result = $this->taskExecStack()
->dir($this->getConfigValue('repo.root'))
->exec("$bin/phpcs")
->run();
$exit_code = $result->getExitCode();
if ($exit_code) {
if ($this->input()->isInteractive()) {
... | php | {
"resource": ""
} |
q18770 | PhpcsCommand.sniffFileList | train | public function sniffFileList($file_list) {
$this->say("Sniffing directories containing changed files...");
$files = explode("\n", $file_list);
$files = array_filter($files);
if ($files) {
$temp_path = $this->getConfigValue('repo.root') | php | {
"resource": ""
} |
q18771 | AcsfCommand.printPreamble | train | public function printPreamble() {
$this->logger->notice("This command will initialize support for Acquia Cloud Site Factory by performing the following tasks:");
$this->logger->notice(" * Adding drupal/acsf and acquia/acsf-tools the require array in your composer.json file.");
$this->logger->notice(" * Ex... | php | {
"resource": ""
} |
q18772 | AcsfCommand.acsfInitialize | train | public function acsfInitialize($options = ['acsf-version' => '^2.47.0']) {
$this->printPreamble();
$this->acsfHooksInitialize();
$this->say('Adding acsf module as a dependency...');
$package_options = [
'package_name' => 'drupal/acsf',
'package_version' => $options['acsf-version'],
];
... | php | {
"resource": ""
} |
q18773 | AcsfCommand.acsfDrushInitialize | train | public function acsfDrushInitialize() {
$this->say('Executing initialization command provided acsf module...');
$acsf_include = $this->getConfigValue('docroot') . '/modules/contrib/acsf/acsf_init';
$result = $this->taskExecStack()
->exec($this->getConfigValue('repo.root') . | php | {
"resource": ""
} |
q18774 | AcsfCommand.downloadDrush8 | train | protected function downloadDrush8($destination) {
$file = fopen($destination, 'w');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
'https://github.com/drush-ops/drush/releases/download/8.1.15/drush.phar');
curl_setopt($ch, CURLOPT_FAILONERROR, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, ... | php | {
"resource": ""
} |
q18775 | BuildCommand.composerInstall | train | public function composerInstall() {
$result = $this->taskExec(
(DIRECTORY_SEPARATOR == "\\") ? 'set' : 'export' .
" COMPOSER_EXIT_ON_PATCH_FAILURE=1 && composer install --ansi --no-interaction --optimize-autoloader --apcu-autoloader"
)
->dir($this->getConfigValue('repo.root'))
| php | {
"resource": ""
} |
q18776 | ArrayManipulator.expandFromDotNotatedKeys | train | public static function expandFromDotNotatedKeys(array $array) {
$data = new Data();
// @todo Make | php | {
"resource": ""
} |
q18777 | ArrayManipulator.flattenMultidimensionalArray | train | public static function flattenMultidimensionalArray(array $array, $glue) {
$iterator = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($array));
$result = array();
foreach ($iterator as $leafValue) {
$keys = array();
foreach (range(0, $iterator->getDepth()) as $depth) {
| php | {
"resource": ""
} |
q18778 | ArrayManipulator.convertArrayToFlatTextArray | train | public static function convertArrayToFlatTextArray(array $array) {
$rows = [];
$max_line_length = 60;
foreach ($array as $key => $value) {
if (is_array($value)) {
$flattened_array = self::flattenToDotNotatedKeys($value);
foreach ($flattened_array as $sub_key => $sub_value) {
... | php | {
"resource": ""
} |
q18779 | ConfigCommand.getValue | train | public function getValue($key) {
if (!$this->getConfig()->has($key)) {
throw new | php | {
"resource": ""
} |
q18780 | ConfigCommand.dump | train | public function dump() {
$config = $this->getConfig()->export(); | php | {
"resource": ""
} |
q18781 | YamlMunge.mungeFiles | train | public static function mungeFiles($file1, $file2) {
$file1_contents = (array) self::parseFile($file1);
$file2_contents = (array) self::parseFile($file2);
| php | {
"resource": ""
} |
q18782 | YamlMunge.arrayMergeRecursiveExceptEmpty | train | public static function arrayMergeRecursiveExceptEmpty(array &$array1, array &$array2) {
$merged = $array1;
foreach ($array2 as $key => &$value) {
if (is_array($value) && | php | {
"resource": ""
} |
q18783 | AcsfCommand.validateAcsf | train | public function validateAcsf() {
$this->say("Validating ACSF settings...");
$task = $this->taskDrush()
->stopOnFail()
->drush("--include=modules/contrib/acsf/acsf_init acsf-init-verify");
$result = $task->run();
| php | {
"resource": ""
} |
q18784 | SettingsCommand.installGitHook | train | protected function installGitHook($hook) {
$fs = new Filesystem();
$project_hook_directory = $this->getConfigValue('repo.root') . "/.git/hooks";
$project_hook = $project_hook_directory . "/$hook";
if ($this->getConfigValue('git.hooks.' . $hook)) {
$this->say("Installing $hook git hook...");
... | php | {
"resource": ""
} |
q18785 | ConfigCommand.update | train | public function update() {
$task = $this->taskDrush()
->stopOnFail()
// Execute db updates.
// This must happen before features are imported or configuration is
// imported. For instance, if you add a dependency on a new extension to
// an existing configuration file, you must enable t... | php | {
"resource": ""
} |
q18786 | ConfigCommand.import | train | public function import() {
$strategy = $this->getConfigValue('cm.strategy');
if ($strategy != 'none') {
$cm_core_key = $this->getConfigValue('cm.core.key');
$this->logConfig($this->getConfigValue('cm'), 'cm');
$task = $this->taskDrush();
$this->invokeHook('pre-config-import');
/... | php | {
"resource": ""
} |
q18787 | ConfigCommand.importConfigSplit | train | protected function importConfigSplit($task, $cm_core_key) {
$task->drush("pm-enable")->arg('config_split');
$task->drush("config-import")->arg($cm_core_key);
// Runs a second import | php | {
"resource": ""
} |
q18788 | ConfigCommand.importFeatures | train | protected function importFeatures($task, $cm_core_key) {
$task->drush("config-import")->arg($cm_core_key)->option('partial');
$task->drush("pm-enable")->arg('features');
$task->drush("cc")->arg('drush');
if ($this->getConfig()->has('cm.features.bundle')) {
| php | {
"resource": ""
} |
q18789 | ConfigCommand.checkFeaturesOverrides | train | protected function checkFeaturesOverrides() {
if ($this->getConfigValue('cm.features.no-overrides')) {
// @codingStandardsIgnoreStart
$this->say("Checking for features overrides...");
if ($this->getConfig()->has('cm.features.bundle')) {
$task = $this->taskDrush()->stopOnFail();
for... | php | {
"resource": ""
} |
q18790 | ConfigCommand.getExportedSiteUuid | train | protected function getExportedSiteUuid($cm_core_key) {
$site_config_file = $this->getConfigValue('docroot') . '/' . $this->getConfigValue("cm.core.dirs.$cm_core_key.path") . | php | {
"resource": ""
} |
q18791 | DevCommand.linkComposer | train | public function linkComposer($options = ['blt-path' => InputOption::VALUE_REQUIRED]) {
$composer_json_filepath = $this->getConfigValue('repo.root') . '/composer.json';
$composer_json = json_decode(file_get_contents($composer_json_filepath));
$composer_json->repositories->blt = [
'type' => 'path',
... | php | {
"resource": ""
} |
q18792 | ValidateHook.validateSettingsFileIsValid | train | public function validateSettingsFileIsValid(CommandData $commandData) {
if (!$this->getInspector()->isDrupalSettingsFilePresent()) {
throw new BltException("Could not find settings.php for this site.");
}
if | php | {
"resource": ""
} |
q18793 | ValidateHook.validateVmConfig | train | public function validateVmConfig() {
if ($this->getInspector()->isDrupalVmLocallyInitialized() && $this->getInspector()->isDrupalVmBooted() | php | {
"resource": ""
} |
q18794 | ValidateHook.validateGitConfig | train | public function validateGitConfig() {
if (!$this->getInspector()->isGitMinimumVersionSatisfied('2.0')) {
throw new BltException("Your system does not meet BLT's requirements. Please update git to 2.0 or newer.");
}
if (!$this->getInspector()->isGitUserSet()) {
| php | {
"resource": ""
} |
q18795 | GitCommand.commitMsgHook | train | public function commitMsgHook($message) {
$this->say('Validating commit message syntax...');
$pattern = $this->getConfigValue('git.commit-msg.pattern');
$help_description = $this->getConfigValue('git.commit-msg.help_description');
$example = $this->getConfigValue('git.commit-msg.example');
$this->lo... | php | {
"resource": ""
} |
q18796 | GitCommand.preCommitHook | train | public function preCommitHook($changed_files) {
$collection = $this->collectionBuilder();
$collection->setProgressIndicator(NULL);
$collection->addCode(
function () use ($changed_files) {
return $this->invokeCommands([
'tests:phpcs:sniff:files' => ['file_list' => $changed_files],
... | php | {
"resource": ""
} |
q18797 | DrushHook.validateDrushConfig | train | public function validateDrushConfig(CommandData $commandData) {
$alias = $this->getConfigValue('drush.alias');
if ($alias && !$this->getInspector()->isDrushAliasValid("$alias")) {
$this->logger->error("Invalid drush alias '@$alias'.");
$this->logger->info('Troubleshooting suggestions:');
| php | {
"resource": ""
} |
q18798 | TextMunge.munge | train | public static function munge($file1, $file2) {
$file1_contents = file($file1);
$file2_contents = file($file2);
$munged_contents = | php | {
"resource": ""
} |
q18799 | TextMunge.arrayMergeNoDuplicates | train | public static function arrayMergeNoDuplicates(array &$array1, array &$array2) {
$merged = array_merge($array1, $array2);
$merged_without_dups = array_unique($merged);
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.