mirror of
https://github.com/composer/composer
synced 2025-05-11 01:22:54 +00:00
Store dev mode in installed.json, fixes #3008
This commit is contained in:
parent
8fe2b9ec69
commit
60df892517
7 changed files with 21 additions and 13 deletions
|
@ -49,7 +49,12 @@ class FilesystemRepository extends WritableArrayRepository
|
|||
}
|
||||
|
||||
try {
|
||||
$packages = $this->file->read();
|
||||
$data = $this->file->read();
|
||||
if (isset($data['packages'])) {
|
||||
$packages = $data['packages'];
|
||||
} else {
|
||||
$packages = $data;
|
||||
}
|
||||
|
||||
if (!is_array($packages)) {
|
||||
throw new \UnexpectedValueException('Could not parse package list from the repository');
|
||||
|
@ -74,16 +79,16 @@ class FilesystemRepository extends WritableArrayRepository
|
|||
/**
|
||||
* Writes writable repository.
|
||||
*/
|
||||
public function write()
|
||||
public function write($devMode)
|
||||
{
|
||||
$data = array();
|
||||
$data = array('packages' => array(), 'dev' => $devMode);
|
||||
$dumper = new ArrayDumper();
|
||||
|
||||
foreach ($this->getCanonicalPackages() as $package) {
|
||||
$data[] = $dumper->dump($package);
|
||||
$data['packages'][] = $dumper->dump($package);
|
||||
}
|
||||
|
||||
usort($data, function ($a, $b) {
|
||||
usort($data['packages'], function ($a, $b) {
|
||||
return strcmp($a['name'], $b['name']);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue