Completed
Pull Request — master (#155)
by
unknown
01:29
created

DownloadsController::homeAction()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
cc 2
nc 2
nop 2
1
<?php
2
/**
3
 *
4
 * @copyright (c) 2014 phpBB Group
5
 * @license http://opensource.org/licenses/gpl-3.0.php GNU General Public License v3
6
 * @author MichaelC
7
 *
8
 */
9
10
namespace AppBundle\Controller;
11
12
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
13
use AppBundle\Utilities\DownloadManager;
14
use Symfony\Component\HttpFoundation\Request;
15
use AppBundle\Entity\Download;
16
17
class DownloadsController extends Controller
18
{
19
	public function homeAction(Request $request, $branch = 'latest')
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
20
	{
21
		$templateVariables = array(
22
			'U_UPDATE_INSTRUCTIONS'	=> '/support/documents.php?mode=install&version=3.2',
23
		);
24
25
		switch ($branch)
26
		{
27
			case 'latest':
28
				$view = 'AppBundle:Downloads:home.html.twig';
29
				break;
30
31
			default:
32
				$view = 'AppBundle:Downloads:previous-version.html.twig';
33
				break;
34
		}
35
36
		return $this->render($view, $templateVariables);
37
	}
38
39
	// public function downloadHandlerAction(Request $request, $package)
40
	// {
41
	// 	$download = new Download();
42
	// 	$download->setConfigurableOptions($package, $request->getClientIp());
43
	// 	$em = $this->getDoctrine()->getManager();
44
	// 	$em->persist($download);
45
	// 	$em->flush();
46
47
	// 	return $this->redirect(('https://download.phpbb.com/pub/release/' . $package), 301);
48
	// }
49
50
	// public function downloadRedirectHandlerAction(Request $request, $branch = 'latest')
51
	// {
52
	// 	$downloadManager = $this->get('phpbb.downloadManager');
53
	// 	$branch = ($branch == 'latest') ? '3.1' : $branch;
54
	// 	$downloadManager->setBranch($branch);
55
	// 	return $this->downloadHandlerAction($request, $downloadManager->getMainPackageName);
56
	// }
57
}
58