@@ -80,6 +80,7 @@ public function __construct(
80
80
private StatsDClient $ statsd ,
81
81
private readonly FallbackGitHubAuthProvider $ fallbackGitHubAuthProvider ,
82
82
CacheItemPoolInterface $ cache ,
83
+ private readonly string $ updaterWorkerCacheDir ,
83
84
) {
84
85
$ this ->cache = new Psr16Cache ($ cache );
85
86
$ this ->logger = $ logger ;
@@ -130,6 +131,14 @@ public function process(Job $job, SignalHandler $signal): array
130
131
$ io = new BufferIO ('' , OutputInterface::VERBOSITY_VERY_VERBOSE , new HtmlOutputFormatter (Factory::createAdditionalStyles ()));
131
132
$ io ->loadConfiguration ($ config );
132
133
134
+ // sandbox into a unique cache dir per package id to avoid potential cache reuse issues
135
+ if (trim ($ this ->updaterWorkerCacheDir ) !== '' && is_dir ($ this ->updaterWorkerCacheDir )) {
136
+ $ subDir = str_pad ((string )$ package ->getId (), 9 , '0 ' , STR_PAD_LEFT );
137
+ $ subDir = substr ($ subDir , 0 , 6 ).'/ ' .$ package ->getId ();
138
+ $ config ->merge (['config ' => ['cache-dir ' => $ this ->updaterWorkerCacheDir .'/ ' .$ subDir ]]);
139
+ unset($ subDir );
140
+ }
141
+
133
142
$ usesPackagistToken = false ;
134
143
if (Preg::isMatch ('{^https://github\.com/(?P<repo>[^/]+/[^/]+?)(?:\.git)?$}i ' , $ package ->getRepository (), $ matches )) {
135
144
$ usesPackagistToken = true ;
0 commit comments