Skip to content

Commit

Permalink
Add suggested PHP changes in drush and composer files
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Simonsen committed Dec 9, 2024
1 parent 7b93a67 commit 423ed7e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions drush/Commands/PolicyCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ public function rsyncValidate(CommandData $commandData) {
throw new \Exception(dt('Per !file, you may never rsync to the production site.', ['!file' => __FILE__]));
}
}

}
25 changes: 14 additions & 11 deletions scripts/composer/ScriptHandler.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

/**
* @file
* Contains \DrupalProject\composer\ScriptHandler.
*/

namespace DrupalProject\composer;

use Composer\Script\Event;
Expand All @@ -14,8 +9,16 @@
use DrupalFinder\DrupalFinderComposerRuntime;
use Symfony\Component\Filesystem\Filesystem;

/**
*
*/
class ScriptHandler {

/**
* @param \Composer\Script\Event $event
*
* @return void
*/
public static function createRequiredFiles(Event $event) {
$fs = new Filesystem();
$drupalFinder = new DrupalFinderComposerRuntime();
Expand All @@ -32,15 +35,15 @@ public static function createRequiredFiles(Event $event) {
'themes',
];

// Required for unit testing
// Required for unit testing.
foreach ($dirs as $dir) {
if (!$fs->exists($drupalRoot . '/'. $dir)) {
$fs->mkdir($drupalRoot . '/'. $dir);
$fs->touch($drupalRoot . '/'. $dir . '/.gitkeep');
if (!$fs->exists($drupalRoot . '/' . $dir)) {
$fs->mkdir($drupalRoot . '/' . $dir);
$fs->touch($drupalRoot . '/' . $dir . '/.gitkeep');
}
}

// Prepare the settings file for installation
// Prepare the settings file for installation.
if (!$fs->exists($drupalRoot . '/sites/default/settings.php') && $fs->exists($drupalRoot . '/sites/default/default.settings.php')) {
$fs->copy($drupalRoot . '/sites/default/default.settings.php', $drupalRoot . '/sites/default/settings.php');
require_once $drupalRoot . '/core/includes/bootstrap.inc';
Expand All @@ -55,7 +58,7 @@ public static function createRequiredFiles(Event $event) {
$event->getIO()->write("Created a sites/default/settings.php file with chmod 0666");
}

// Create the files directory with chmod 0777
// Create the files directory with chmod 0777.
if (!$fs->exists($drupalRoot . '/sites/default/files') && !is_link($drupalRoot . '/sites/default/files')) {
$oldmask = umask(0);
$fs->mkdir($drupalRoot . '/sites/default/files', 0777);
Expand Down

0 comments on commit 423ed7e

Please sign in to comment.