idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
5,200
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 ; } else { $ this -> l...
Checks a URL for a non - 50x response .
5,201
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...
Checks that Dev Desktop is configured correctly .
5,202
public function registerFilesets ( ) { $ classes = [ \ Acquia \ Blt \ Robo \ Filesets \ Filesets :: class , \ Acquia \ Blt \ Custom \ Filesets :: class , ] ; $ fileset_annotations = $ this -> getAllFilesetAnnotations ( $ classes ) ; $ filesets = $ this -> getFilesetsFromAnnotations ( $ fileset_annotations ) ; $ this ->...
Registers filesets .
5,203
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 ...
Gets an array of instantiated filesets given an array of annotations .
5,204
protected function yell ( $ text , $ length = 40 , $ color = 'green' ) { $ format = "<fg=white;bg=$color;options=bold>%s</fg=white;bg=$color;options=bold>" ; $ this -> formattedOutput ( $ text , $ length , $ format ) ; }
Writes text to screen with big loud decoration .
5,205
protected function askChoice ( $ question , $ options , $ default = NULL ) { return $ this -> doAsk ( new ChoiceQuestion ( $ this -> formatQuestion ( $ question ) , $ options , $ default ) ) ; }
Asks the user a multiple - choice question .
5,206
protected function askRequired ( $ message ) { $ question = new Question ( $ this -> formatQuestion ( $ message ) ) ; $ question -> setValidator ( function ( $ answer ) { if ( empty ( $ answer ) ) { throw new \ RuntimeException ( 'You must enter a value!' ) ; } return $ answer ; } ) ; return $ this -> doAsk ( $ questio...
Asks a required question .
5,207
protected function printArrayAsTable ( array $ array , array $ headers = [ 'Property' , 'Value' ] ) { $ table = new Table ( $ this -> output ) ; $ table -> setHeaders ( $ headers ) -> setRows ( ArrayManipulator :: convertArrayToFlatTextArray ( $ array ) ) -> render ( ) ; }
Writes an array to the screen as a formatted table .
5,208
protected function logConfig ( array $ array , $ prefix = '' , $ verbosity = OutputInterface :: VERBOSITY_VERY_VERBOSE ) { if ( $ this -> output ( ) -> getVerbosity ( ) >= $ verbosity ) { if ( $ prefix ) { $ this -> output ( ) -> writeln ( "<comment>Configuration for $prefix:</comment>" ) ; foreach ( $ array as $ key =...
Writes a particular configuration key s value to the log .
5,209
private function addBuiltInCommandsAndHooks ( ) { $ commands = $ this -> getCommands ( [ 'path' => __DIR__ . '/Commands' , 'namespace' => 'Acquia\Blt\Robo\Commands' , ] ) ; $ hooks = $ this -> getHooks ( [ 'path' => __DIR__ . '/Hooks' , 'namespace' => 'Acquia\Blt\Robo\Hooks' , ] ) ; $ this -> commands = array_merge ( $...
Add the commands and hooks which are shipped with core BLT .
5,210
private function getCommands ( array $ options = [ 'path' => NULL , 'namespace' => NULL ] ) { $ discovery = new CommandFileDiscovery ( ) ; $ discovery -> setSearchPattern ( '*Command.php' ) -> setSearchLocations ( [ ] ) -> addExclude ( 'Internal' ) ; return $ discovery -> discover ( $ options [ 'path' ] , $ options [ '...
Discovers command classes using CommandFileDiscovery .
5,211
private function getHooks ( array $ options = [ 'path' => NULL , 'namespace' => NULL ] ) { $ discovery = new CommandFileDiscovery ( ) ; $ discovery -> setSearchPattern ( '*Hook.php' ) -> setSearchLocations ( [ ] ) ; return $ discovery -> discover ( $ options [ 'path' ] , $ options [ 'namespace' ] ) ; }
Discovers hooks using CommandFileDiscovery .
5,212
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 InputOptio...
Add any global arguments or options that apply to all commands .
5,213
public function configureContainer ( $ container ) { $ container -> share ( 'logStyler' , BltLogStyle :: class ) ; $ blt_tasks = new BltTasks ( ) ; $ builder = new CollectionBuilder ( $ blt_tasks ) ; $ blt_tasks -> setBuilder ( $ builder ) ; $ container -> add ( 'builder' , $ builder ) ; $ container -> add ( 'executor'...
Register the necessary classes for BLT .
5,214
public function run ( InputInterface $ input , OutputInterface $ output ) { $ application = $ this -> getContainer ( ) -> get ( 'application' ) ; $ status_code = $ this -> runner -> run ( $ input , $ output , $ application , $ this -> commands ) ; return $ status_code ; }
Runs the instantiated BLT application .
5,215
public function expandFileProperties ( $ filename ) { $ expanded_contents = Expander :: expandArrayProperties ( file ( $ filename ) , $ this -> export ( ) ) ; file_put_contents ( $ filename , implode ( "" , $ expanded_contents ) ) ; }
Expands YAML placeholders in a given file using config object .
5,216
public function set ( $ key , $ value ) { if ( $ value === 'false' ) { $ value = FALSE ; } elseif ( $ value === 'true' ) { $ value = TRUE ; } if ( is_string ( $ value ) && strstr ( $ value , '$' ) ) { $ expanded = Expander :: expandArrayProperties ( [ $ value ] , $ this -> export ( ) ) ; $ value = $ expanded [ 0 ] ; } ...
Set a config value .
5,217
public function get ( $ key , $ defaultOverride = NULL ) { $ value = parent :: get ( $ key , $ defaultOverride ) ; if ( is_string ( $ value ) && strstr ( $ value , '$' ) ) { $ expanded = Expander :: expandArrayProperties ( [ $ value ] , $ this -> export ( ) ) ; $ value = $ expanded [ 0 ] ; } return $ value ; }
Fetch a configuration value .
5,218
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 -> warning ...
Builds separate artifact and pushes to git . remotes defined blt . yml .
5,219
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 a valid commit mess...
Gets the commit message to be used for committing deployment artifact .
5,220
protected function getBranchName ( $ options ) { if ( $ options [ 'branch' ] ) { $ this -> say ( "Branch is set to <comment>{$options['branch']}</comment>." ) ; return $ options [ 'branch' ] ; } else { return $ this -> askDefault ( 'Enter the branch name for the deployment artifact' , $ this -> getDefaultBranchName ( )...
Gets the branch name for the deployment artifact .
5,221
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 ) ) { throw new BltException ( "You must enter a valid tag name." ) ; } el...
Gets the name of the tag to cut .
5,222
protected function getDefaultBranchName ( ) { chdir ( $ this -> getConfigValue ( 'repo.root' ) ) ; $ git_current_branch = trim ( shell_exec ( "git rev-parse --abbrev-ref HEAD" ) ) ; $ default_branch = $ git_current_branch . '-build' ; return $ default_branch ; }
Gets the default branch name for the deployment artifact .
5,223
protected function deployToTag ( $ options ) { $ this -> tagName = $ this -> getTagName ( $ options ) ; $ this -> branchName = $ this -> getDefaultBranchName ( ) . '-temp' ; $ this -> prepareDir ( ) ; $ this -> addGitRemotes ( ) ; $ this -> checkoutLocalDeployBranch ( ) ; $ this -> build ( ) ; $ this -> commit ( ) ; $ ...
Creates artifact cuts new tag and pushes .
5,224
protected function deployToBranch ( $ options ) { $ this -> branchName = $ this -> getBranchName ( $ options ) ; $ this -> prepareDir ( ) ; $ this -> addGitRemotes ( ) ; $ this -> checkoutLocalDeployBranch ( ) ; $ this -> mergeUpstreamChanges ( ) ; $ this -> build ( ) ; $ this -> commit ( ) ; $ this -> push ( $ this ->...
Creates artifact on branch and pushes .
5,225
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 -> deploy...
Deletes the existing deploy directory and initializes git repo .
5,226
protected function checkoutLocalDeployBranch ( ) { $ this -> taskExecStack ( ) -> dir ( $ this -> deployDir ) -> stopOnFail ( FALSE ) -> setVerbosityThreshold ( VerbosityThresholdInterface :: VERBOSITY_VERBOSE ) -> exec ( "git checkout -b {$this->branchName}" ) -> run ( ) ; }
Checks out a new local branch for artifact .
5,227
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 ) -> s...
Merges upstream changes into deploy branch .
5,228
public function build ( ) { $ this -> say ( "Generating build artifact..." ) ; $ this -> say ( "For more detailed output, use the -v flag." ) ; $ commands = [ 'source:build:frontend' , 'drupal:hash-salt:init' , ] ; if ( ! empty ( $ this -> tagName ) ) { $ commands [ 'drupal:deployment-identifier:init' ] = [ '--id' => $...
Builds deployment artifact .
5,229
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 -> tas...
Copies files from source repo into artifact .
5,230
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 de...
Installs composer dependencies for artifact .
5,231
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 ( 'F...
Removes sensitive files from the deploy dir .
5,232
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 a...
Gets the file that lists the excludes for the artifact .
5,233
protected function mungeExcludeLists ( $ file1 , $ file2 ) { $ file1_contents = file ( $ file1 ) ; $ file2_contents = file ( $ file2 ) ; $ merged = array_merge ( $ file1_contents , $ file2_contents ) ; $ merged_without_dups = array_unique ( $ merged ) ; file_put_contents ( $ this -> excludeFileTemp , $ merged_without_d...
Combines deploy . exclude_file with deploy . exclude_additions_file .
5,234
protected function setMultisiteFilePermissions ( $ perms ) { $ taskFilesystemStack = $ this -> taskFilesystemStack ( ) ; $ multisites = $ this -> getConfigValue ( 'multisites' ) ; foreach ( $ multisites as $ multisite ) { $ multisite_dir = $ this -> getConfigValue ( 'docroot' ) . '/sites/' . $ multisite ; $ taskFilesys...
Sets permissions for all multisite directories .
5,235
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' ) -> setVerbo...
Creates a commit on the artifact .
5,236
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 ( ) -> dir (...
Pushes the artifact to git . remotes .
5,237
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 = $...
Creates a tag on the build repository .
5,238
public function updateAll ( ) { $ this -> config -> set ( 'drush.alias' , '' ) ; foreach ( $ this -> getConfigValue ( 'multisites' ) as $ multisite ) { $ this -> updateSite ( $ multisite ) ; } }
Update the database to reflect the state of the Drupal file system .
5,239
public function syncRefresh ( ) { $ this -> config -> set ( 'drush.alias' , '' ) ; $ this -> config -> set ( 'sync.files' , TRUE ) ; foreach ( $ this -> getConfigValue ( 'multisites' ) as $ multisite ) { $ this -> say ( "Syncing $multisite..." ) ; if ( ! $ this -> config -> get ( 'drush.uri' ) ) { $ this -> config -> s...
Syncs database and files and runs updates .
5,240
public function update_8006000 ( ) { $ 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' , TRUE ) ; $ this -> up...
8 . 6 . 0 .
5,241
public function update_8006002 ( ) { $ composer_json = $ this -> updater -> getComposerJson ( ) ; $ composer_json = DoPackagistConverter :: convertComposerJson ( $ composer_json ) ; unset ( $ composer_json [ 'require' ] [ 'drupal-composer/drupal-security-advisories' ] ) ; $ this -> updater -> writeComposerJson ( $ comp...
8 . 6 . 2 .
5,242
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-browserkit-driver' , ] ; foreach (...
8 . 5 . 4 .
5,243
public function update_8006006 ( ) { $ composer_json = $ this -> updater -> getComposerJson ( ) ; unset ( $ composer_json [ 'require-dev' ] [ 'drush/drush' ] ) ; $ this -> updater -> writeComposerJson ( $ composer_json ) ; }
8 . 6 . 6 .
5,244
public function update_8006007 ( ) { $ composer_json = $ this -> updater -> getComposerJson ( ) ; if ( ! empty ( $ composer_json [ 'extra' ] [ 'drupal-scaffold' ] [ 'excludes' ] ) ) { $ composer_json [ 'extra' ] [ 'drupal-scaffold' ] [ 'excludes' ] = array_unique ( array_values ( $ composer_json [ 'extra' ] [ 'drupal-s...
8 . 6 . 7 .
5,245
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-dri...
8 . 9 . 0 .
5,246
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' ] ) ; unset ( $ project_yml [ 'phpcs' ] [ 'filesets' ] [ 'files.p...
8 . 9 . 1 .
5,247
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}' ...
8 . 9 . 3 .
5,248
public function update_8009007 ( ) { $ this -> updater -> deleteFile ( 'drush.wrapper' ) ; $ this -> updater -> deleteFile ( '.drush-use' ) ; $ messages = [ "You should replace your local global installation of drush with drush launcher:" , "https://github.com/drush-ops/drush-launcher" , ] ; $ formattedBlock = $ this -...
8 . 9 . 7 .
5,249
public function update_8009011 ( ) { $ project_yml = $ this -> updater -> getProjectYml ( ) ; if ( isset ( $ project_yml [ 'vm' ] [ 'enable' ] ) ) { $ project_local_yml = $ this -> updater -> getProjectLocalYml ( ) ; $ project_local_yml [ 'vm' ] [ 'enable' ] = $ project_yml [ 'vm' ] [ 'enable' ] ; $ this -> updater -> ...
8 . 9 . 11 .
5,250
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 ...
9 . 1 . 0 - alpha1 .
5,251
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' ] [ '...
9 . 1 . 0 .
5,252
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." , ] ; $ this -> updater...
9 . 2 . 0 .
5,253
public function lintFileSets ( ) { $ this -> say ( "Validating yaml syntax for all custom modules and exported config..." ) ; $ fileset_manager = $ this -> getContainer ( ) -> get ( 'filesetManager' ) ; $ fileset_ids = $ this -> getConfigValue ( 'validate.yaml.filesets' ) ; $ filesets = $ fileset_manager -> getFilesets...
Executes YAML validator against all validate . yaml . filesets files .
5,254
public function lintFileList ( $ file_list ) { $ this -> say ( "Linting YAML files..." ) ; $ files = explode ( "\n" , $ file_list ) ; $ fileset_manager = $ this -> getContainer ( ) -> get ( 'filesetManager' ) ; $ fileset_ids = $ this -> getConfigValue ( 'validate.yaml.filesets' ) ; $ filesets = $ fileset_manager -> get...
Executes YAML validator against files if in validate . yaml . filesets .
5,255
public function initializeSimpleSamlPhp ( ) { $ this -> requireModule ( ) ; $ this -> initializeConfig ( ) ; $ this -> setSimpleSamlPhpInstalled ( ) ; $ this -> symlinkDocrootToLibDir ( ) ; $ this -> addHtaccessPatch ( ) ; $ this -> outputCompleteSetupInstructions ( ) ; }
Initializes SimpleSAMLphp for project .
5,256
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...
Copies configuration templates from SimpleSamlPHP to the repo root .
5,257
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 { YamlMunge :: writeFile ( $ proje...
Sets value in blt . yml to let targets know simplesamlphp is installed .
5,258
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/si...
Creates a symlink from the docroot to the web accessible library dir .
5,259
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 ) -> setVerbosityThresho...
Copies customized config files into vendored SimpleSamlPHP .
5,260
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}/simplesamlphp/metadata/saml2...
Outputs a message to edit the new config files .
5,261
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' ) . '/com...
Add a patch to . htaccess .
5,262
protected function invokeCommands ( array $ commands ) { foreach ( $ commands as $ key => $ value ) { if ( is_numeric ( $ key ) ) { $ command = $ value ; $ args = [ ] ; } else { $ command = $ key ; $ args = $ value ; } $ this -> invokeCommand ( $ command , $ args ) ; } }
Invokes an array of Symfony commands .
5,263
protected function invokeCommand ( $ command_name , array $ args = [ ] ) { $ this -> invokeDepth ++ ; if ( ! $ this -> isCommandDisabled ( $ command_name ) ) { $ application = $ this -> getContainer ( ) -> get ( 'application' ) ; $ command = $ application -> find ( $ command_name ) ; $ input = new ArrayInput ( $ args )...
Invokes a single Symfony command .
5,264
protected function getDisabledCommands ( ) { $ disabled_commands_config = $ this -> getConfigValue ( 'disable-targets' ) ; if ( $ disabled_commands_config ) { $ disabled_commands = ArrayManipulator :: flattenMultidimensionalArray ( $ disabled_commands_config , ':' ) ; return $ disabled_commands ; } return [ ] ; }
Gets an array of commands that have been configured to be disabled .
5,265
protected function isCommandDisabled ( $ command ) { $ disabled_commands = $ this -> getDisabledCommands ( ) ; if ( is_array ( $ disabled_commands ) && array_key_exists ( $ command , $ disabled_commands ) && $ disabled_commands [ $ command ] ) { $ this -> logger -> warning ( "The $command command is disabled." ) ; retu...
Determines if a command has been disabled via disable - targets .
5,266
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-hoo...
Invokes a given command - hooks hook typically defined in blt . yml .
5,267
protected function installVagrantPlugin ( $ plugin ) { if ( ! $ this -> getInspector ( ) -> isVagrantPluginInstalled ( $ plugin ) ) { $ this -> logger -> warning ( "The $plugin plugin is not installed! Attempting to install it..." ) ; $ this -> taskExec ( "vagrant plugin install $plugin" ) -> run ( ) ; } }
Installs a vagrant plugin if it is not already installed .
5,268
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....
Executes a given command against multiple filesets .
5,269
protected function executeCommandAgainstFiles ( $ files , $ command , $ parallel = FALSE ) { if ( $ parallel ) { return $ this -> executeCommandAgainstFilesInParallel ( $ files , $ command ) ; } else { return $ this -> executeCommandAgainstFilesProcedurally ( $ files , $ command ) ; } }
Executes a given command against an array of files .
5,270
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 ) ; $ new_config ...
Sets multisite context by settings site - specific config values .
5,271
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' , 'Stage' , 'Prod' ] ; foreach ( $ default_splits as $ split ) { $ this -> cr...
Generates empty config_split splits for the selected environments .
5,272
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 = $ this ...
Create a config_split configuration and directory for the given split .
5,273
protected function createSplitDir ( $ split ) { $ split_dir = $ this -> configSplitDir . '/' . strtolower ( $ split ) ; $ result = $ this -> taskFilesystemStack ( ) -> mkdir ( $ split_dir ) -> run ( ) ; if ( ! $ result -> wasSuccessful ( ) ) { throw new BltException ( "Unable to create $split_dir." ) ; } if ( ! file_ex...
Creates the config directory for the given config_split .
5,274
protected function writeSplitConfig ( $ file_path , $ config ) { $ result = $ this -> taskWriteToFile ( $ file_path ) -> text ( $ config ) -> run ( ) ; if ( ! $ result ) { throw new BltException ( "Unable to write $file_path." ) ; } }
Write the config_split configuration YAML file in the given directory .
5,275
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' ) ; $ first_multisite = reset ( $ multisites ) ; $ s...
Populates configuration settings not available during construction .
5,276
protected function getSiteDirs ( ) { $ sites_dir = $ this -> get ( 'docroot' ) . '/sites' ; $ sites = [ ] ; if ( ! file_exists ( $ sites_dir ) ) { return $ sites ; } $ finder = new Finder ( ) ; $ dirs = $ finder -> in ( $ sites_dir ) -> directories ( ) -> depth ( '< 1' ) -> exclude ( [ 'g' , 'settings' ] ) -> sortByNam...
Gets an array of sites for the Drupal application .
5,277
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 -> getConfigValue ( ...
Generates example files for writing custom commands and hooks .
5,278
protected function checkSimpleSamlPhp ( ) { if ( $ this -> getConfig ( ) -> has ( 'simplesamlphp' ) ) { $ lib_root = $ this -> getConfigValue ( 'repo.root' ) . '/vendor/simplesamlphp/simplesamlphp' ; $ config_root = $ this -> getConfigValue ( 'repo.root' ) . '/simplesamlphp' ; if ( ! file_exists ( $ config_root ) ) { $...
Performs a high level check of SimpleSAMLphp installation .
5,279
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 ...
Generates new Acquia site aliases for Drush .
5,280
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>" ) ; $ this -> say ( "<info>See https://docs.acquia.com/acquia-c...
Sets the Acquia application ID from config and prompt .
5,281
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 { YamlMunge :: writeFile ( $...
Sets appId value in blt . yml to disable interative prompt .
5,282
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:' ) ; $ secret = $ this -> askRequired ( 'Please enter your Acquia cloud API ...
Interactive prompt to get Cloud API credentials .
5,283
protected function writeCloudApiConfig ( array $ config ) { if ( ! is_dir ( $ this -> cloudConfDir ) ) { mkdir ( $ this -> cloudConfDir ) ; } file_put_contents ( $ this -> cloudConfFilePath , json_encode ( $ config ) ) ; $ this -> say ( "Credentials were written to {$this->cloudConfFilePath}." ) ; }
Writes configuration to local file .
5,284
protected function setCloudApiClient ( $ key , $ secret ) { try { $ connector = new Connector ( array ( 'key' => $ key , 'secret' => $ secret , ) ) ; $ cloud_api = Client :: factory ( $ connector ) ; $ cloud_api -> applications ( ) ; $ this -> cloudApiClient = $ cloud_api ; return $ cloud_api ; } catch ( \ Exception $ ...
Tests CloudAPI client authentication credentials .
5,285
protected function getAliases ( $ uri , $ envName , $ remoteHost , $ remoteUser , $ siteID ) { $ alias = array ( ) ; $ skip_site = FALSE ; if ( strpos ( $ uri , ':*' ) !== FALSE ) { $ skip_site = TRUE ; } if ( ! $ skip_site ) { $ docroot = '/var/www/html/' . $ remoteUser . '/docroot' ; $ alias [ $ envName ] [ 'uri' ] =...
Generates a site alias for valid domains .
5,286
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 -...
Gets ACSF sites info without secondary API calls or Drupal bootstrap .
5,287
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 exists and ...
Writes site aliases to disk .
5,288
public function copy ( ) { $ destination = $ this -> getConfigValue ( 'repo.root' ) . '/hooks' ; $ this -> say ( "Copying default Acquia cloud hooks into $destination..." ) ; $ result = $ this -> taskCopyDir ( [ $ this -> getConfigValue ( 'blt.root' ) . '/scripts/cloud-hooks/hooks' => $ destination , ] ) -> run ( ) ; $...
Installs Acquia cloud hooks .
5,289
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...
Checks Drupal VM configuration .
5,290
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 -> taskFilesystemSta...
Create a new project via symlink from current checkout of BLT .
5,291
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_branch ...
Generates release notes and cuts a new tag on GitHub .
5,292
public function releaseNotes ( $ tag , $ github_token , $ options = [ 'prev-tag' => NULL , ] ) { $ current_branch = $ this -> getCurrentBranch ( ) ; $ prev_tag = $ this -> getPrevTag ( $ options , $ current_branch ) ; $ changes = $ this -> generateReleaseNotes ( $ tag , $ prev_tag , $ github_token ) ; $ this -> updateC...
Update CHANGELOG . md with notes for new release .
5,293
public function fixCode ( ) { $ command = "'{$this->bin}/phpcbf'" ; $ task = $ this -> taskExecStack ( ) -> dir ( $ this -> bltRoot ) -> exec ( $ command ) ; $ result = $ task -> run ( ) ; return $ result -> getExitCode ( ) ; }
Fixes BLT internal code via PHPCBF .
5,294
public function sniffCode ( ) { $ task = $ this -> taskExecStack ( ) -> dir ( $ this -> bltRoot ) -> exec ( "{$this->bin}/phpcs" ) -> exec ( "composer validate" ) ; $ result = $ task -> run ( ) ; return $ result -> getExitCode ( ) ; }
Sniffs BLT internal code via PHPCS .
5,295
protected function updateBltVersionConstant ( $ tag ) { $ this -> taskReplaceInFile ( $ this -> bltRoot . '/src/Robo/Blt.php' ) -> regex ( '/(const VERSION = \')[0-9]{1,2}\.[0-9x]{1,2}(\.[0-9x](-(alpha|beta|rc|dev)[0-9]{0,2})?|-dev?)(\';)/' ) -> to ( '${1}' . $ tag . '${5}' ) -> run ( ) ; }
Updates the version constant in Blt . php .
5,296
protected function sortChanges ( $ log_entries , $ github_token ) { $ client = new Client ( ) ; $ client -> authenticate ( $ github_token , NULL , Client :: AUTH_URL_TOKEN ) ; $ issue_api = $ client -> api ( 'issue' ) ; $ changes = [ 'breaking' => [ ] , 'enhancements' => [ ] , 'bugs' => [ ] , 'misc' => [ ] , ] ; foreac...
Sorts an array of log changes based on GitHub issue labels .
5,297
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 ( $ label...
Sorts log entry according to GitHub label .
5,298
public function allSites ( ) { $ multisites = $ this -> getConfigValue ( 'multisites' ) ; $ this -> printSyncMap ( $ multisites ) ; $ continue = $ this -> confirm ( "Continue?" , TRUE ) ; if ( ! $ continue ) { return 0 ; } foreach ( $ multisites as $ multisite ) { $ this -> say ( "Refreshing site <comment>$multisite</c...
Synchronize each multisite .
5,299
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' ) -...
Copies remote files to local machine .