action install to ms

This commit is contained in:
2024-11-08 14:48:52 +03:00
parent e4c3655d92
commit bff1cb798f
2 changed files with 17 additions and 0 deletions

View File

@ -97,4 +97,20 @@ class ModuleShopRestController extends RestController
$this->renderApi($res);
}
public function actionInstall(int $id): void
{
$model = $this->model->where("id", $id)->first();
header('Content-type: application/zip');
header('Content-Disposition: attachment; filename="' . $model->slug . '.igm"');
header('Content-Length: ' . filesize(ROOT_DIR . $model->path_to_archive));
// Debug::dd(filesize(ROOT_DIR . $model->path_to_archive));
readfile(ROOT_DIR . $model->path_to_archive);
$model->installations++;
$model->save();
}
}