Skip to content
Snippets Groups Projects

Issue #3248929: List update that will be applied on the UpdateReady form

Files
5
@@ -4,17 +4,56 @@ namespace Drupal\package_manager_bypass;
use PhpTuf\ComposerStager\Domain\Process\OutputCallbackInterface;
use PhpTuf\ComposerStager\Domain\StagerInterface;
use Symfony\Component\Filesystem\Filesystem;
/**
* Defines an update stager which doesn't actually do anything.
*/
class Stager extends InvocationRecorderBase implements StagerInterface {
/**
* The fixtures state key.
*
* @var string
*/
protected const FIXTURES_STATE_KEY = 'package_manager_bypass_stager_fixtures_path';
/**
* The fixtures state key.
*
* @var string
*/
protected const DIRECTORIES_CREATED_STATE_KEY = 'package_manager_bypass_stager_directories_created';
/**
* {@inheritdoc}
*/
public function stage(array $composerCommand, string $stagingDir, ?OutputCallbackInterface $callback = NULL, ?int $timeout = 120): void {
$fixturesDirectoryPath = \Drupal::state()->get(static::FIXTURES_STATE_KEY);
if ($fixturesDirectoryPath) {
if (!file_exists($stagingDir)) {
mkdir($stagingDir);
$directories_created = \Drupal::state()->get(static::DIRECTORIES_CREATED_STATE_KEY, []);
$directories_created[] = $stagingDir;
\Drupal::state()->set(static::DIRECTORIES_CREATED_STATE_KEY, $directories_created);
}
$fileSystem = new Filesystem();
$fileSystem->mirror($fixturesDirectoryPath, $stagingDir);
}
$this->saveInvocationArguments($composerCommand, $stagingDir);
}
/**
* @param string $activeDir
* @param string $stagingDir
*/
public function setTestFixtureDirectory(string $fixturesDirectoryPath):void {
\Drupal::state()->set(static::FIXTURES_STATE_KEY, $fixturesDirectoryPath);
}
public function deleteStagedDirectories():void {
$directories_created = \Drupal::state()->get(static::DIRECTORIES_CREATED_STATE_KEY);
$fileSystem = new Filesystem();
$fileSystem->remove($directories_created);
}
}
Loading