setData(array('installed' => $installed));
}
return $Response;
}
/**
* Get a list of outdated packages.
*
* @return Response the response object
*/
public static function getOutdated(): Response
{
$Response = new Response();
$Composer = new Composer();
$buffer = $Composer->run('show -oD -f json', true);
$decoded = json_decode($buffer, true);
if ($decoded) {
$Response->setData(array('outdated' => $decoded['installed']));
}
return $Response;
}
/**
* Get the thumbnail for a given package repository.
*
* @return Response the response object
*/
public static function getThumbnail(): Response
{
session_write_close();
ignore_user_abort(true);
$Response = new Response();
$repository = Request::post('repository');
return $Response->setData(array('thumbnail' => Package::getThumbnail($repository)));
}
/**
* Install a package.
*
* @return Response the response object
*/
public static function install(): Response
{
$Response = new Response();
$package = Request::post('package');
if (!$package) {
return $Response;
}
$Composer = new Composer();
if ($error = $Composer->run('require ' . $package)) {
return $Response->setError($error);
}
return $Response->setSuccess(Text::get('packageInstalledSuccess') . '
' . $package);
}
/**
* Pre-fetch all package thumbnails in the background.
*
* @return Response
*/
public static function preFetchThumbnails(): Response
{
$Response = new Response();
// Close session here already in order to prevent blocking other requests.
session_write_close();
ignore_user_abort(true);
set_time_limit(0);
ini_set('memory_limit', '-1');
$packages = json_decode(Fetch::get(AM_PACKAGE_REPO));
$thumbnails = array();
foreach ($packages->results as $package) {
$thumbnails[] = Package::getThumbnail($package->repository);
}
return $Response->setData(array('thumbnails' => $thumbnails));
}
/**
* Remove a package.
*
* @return Response the response object
*/
public static function remove(): Response
{
$Response = new Response();
if ($package = Request::post('package')) {
$Composer = new Composer();
if ($error = $Composer->run('remove ' . $package)) {
$Response->setError($error);
} else {
$Response->setSuccess(Text::get('deteledSuccess') . '
' . $package);
}
}
return $Response;
}
/**
* Update a single package.
*
* @return Response the response object
*/
public static function update(): Response
{
$Response = new Response();
if ($package = Request::post('package')) {
$Composer = new Composer();
if ($error = $Composer->run('update --with-dependencies ' . $package)) {
return $Response->setError($error);
}
Cache::clear();
return $Response->setSuccess(Text::get('packageUpdatedSuccess') . '
' . $package);
}
return $Response;
}
/**
* Update all packages.
*
* @return Response the response object
*/
public static function updateAll(): Response
{
$Response = new Response();
$Composer = new Composer();
if ($error = $Composer->run('update')) {
return $Response->setError($error);
}
Cache::clear();
return $Response->setSuccess(Text::get('packageUpdatedAllSuccess'));
}
}
__halt_compiler();----SIGNATURE:----wQRTml+FMrzqaqWtvf9UcHnsqR4WshUHSvk+JNweScVQKqhGOUxmRNeRpgZP8SfgpXx+5/zjCvVa6ExQ2dA5X0xwrIzLCJ9Tq3X+u8/q0rZfZVhQNuqMJVYDQSsKjbLQ++JdE9mxx1l+1Ev9ila5Xz3g6uZICS6miTjvnETpzncok/Fg6FCVH5+vebObwcQtrY8AeJmH4Vag5G4cfVTVlSAQwebsZbM9AY5leRoQOBSz54lqu2FOaGI3Wb3ZOKj5PiPVKOhl8LtccbcUM6Eq8LQzViics1dxoY1ymxCzSiMAzL+teICfn16JlJbJi0dPNlzj3HCBYronIz4Dl8G9We0tqtPxGnapKK08HSMqekfA6hS+fGLK9jFQ9c8HTNN8vJQvH7sYIE6eWJ4x/uxc0DKoK+X3pvvDByZWpJWZP9ISOguJwjm73dUE864HmA1hp4YGV/TMvCtHirJxBXZx5TpiKI5NpDJDwPdY5Otx2+Jgyw8i8JFXhX9uyCtTNwdWsD9fMEfQWcPG/1fomEmJEJklBV6wuh8jRWP1J1TgOR+KSYkEZvchX6e9OS02oLOTmdVHqPz/2TfSfkST/6FS+pZYl9mZ774MAGyRPy8oSWP2COUfNZu7GMrvUX8XMYuXcJafmxyo4Tlf8a/GpOJskjdD6/7Ok7u+P3u4Ybvx3YM=----ATTACHMENT:----NzcyNzg1NDU4NDY0MzY5IDY0NDQ5MjgxOTAxMDMzOSAzNTM2MzEwMDUyOTU3NDcy