function frs_file_restore_process($request, $group_id) { $fileId = $request->getValidated('id', 'uint', 0); if ($fileId > 0) { $fileFactory = new FRSFileFactory(); $file = $fileFactory->getFRSFileFromDb($fileId); $file_name = $file->getFileName(); $basename = basename($file_name); $release_id = $file->getReleaseID(); if (!$fileFactory->isSameFileMarkedToBeRestored($basename, $release_id, $group_id)) { if (!$fileFactory->isFileNameExist($file_name, $group_id)) { if ($fileFactory->markFileToBeRestored($file)) { $GLOBALS['Response']->addFeedback('info', 'File marked to be restored'); } else { $GLOBALS['Response']->addFeedback('error', 'File not restored'); } } else { $GLOBALS['Response']->addFeedback('error', 'There is already a file with this filename having an active status'); } } else { $GLOBALS['Response']->addFeedback('error', 'A file with a same name is marked to be restored'); } } else { $GLOBALS['Response']->addFeedback('error', 'Bad file id'); } $GLOBALS['Response']->redirect('?group_id=' . $group_id); }