Skip to content

Commit

Permalink
Use file streaming for output to prevent large files from exhausting …
Browse files Browse the repository at this point in the history
…PHP memory limit (#203)

* [TASK] Use file streaming for output to prevent large files from exhausting PHP memory limit [TER-194] [TER-195]

* [TASK] Raise upper PHP requirement in ext_emconf.php [TER-194] [TER-195]

* [TASK] Update php-cs-fixer configuration [TER-194] [TER-195]

* [TASK] Run php-cs-fixer [TER-194] [TER-195]

* [BUGFIX] Add missing use statement [TER-194] [TER-195]

* [BUGFIX] Add missing use statement [TER-194] [TER-195]

* [TASK] Remove old comments and run php-cs-fixer [TER-194] [TER-195]

* [TASK] Prepare release of version 6.0.3 [TER-194] [TER-195]
  • Loading branch information
bmgrieger committed Apr 5, 2024
1 parent aff5928 commit d35a29e
Show file tree
Hide file tree
Showing 44 changed files with 338 additions and 339 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
/Tests/ export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php_cs export-ignore
/.php-cs-fixer.php export-ignore
/Resources/Private/Examples/ export-ignore
34 changes: 34 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

use TYPO3\CodingStandards\CsFixerConfig;

if (PHP_SAPI !== 'cli') {
die('This script supports command line usage only. Please check your command.');
}

$headerComment = <<<COMMENT
This file is part of the "Secure Downloads" Extension for TYPO3 CMS.
For the full copyright and license information, please read the
LICENSE.txt file that was distributed with this source code.
(c) Dev <[email protected]>, Leuchtfeuer Digital Marketing
COMMENT;

$config = CsFixerConfig::create();
$config
->setHeader($headerComment, true)
->getFinder()
->name('*.php')
->exclude('Configuration')
->exclude('Libraries')
->exclude('Resources')
->exclude('Migrations')
->notName('ext_emconf.php')
->notName('ext_tables.php')
->notName('ext_localconf.php')
->in(dirname(__DIR__));

return $config;
61 changes: 0 additions & 61 deletions .php_cs

This file was deleted.

11 changes: 5 additions & 6 deletions Classes/Cache/AbstractCache.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<?php

declare(strict_types=1);
namespace Leuchtfeuer\SecureDownloads\Cache;

/***
*
/*
* This file is part of the "Secure Downloads" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dev <[email protected]>, Leuchtfeuer Digital Marketing
*
***/
* (c) Dev <[email protected]>, Leuchtfeuer Digital Marketing
*/

namespace Leuchtfeuer\SecureDownloads\Cache;

use TYPO3\CMS\Core\SingletonInterface;

Expand Down
15 changes: 7 additions & 8 deletions Classes/Cache/DecodeCache.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
<?php

declare(strict_types=1);
namespace Leuchtfeuer\SecureDownloads\Cache;

use Leuchtfeuer\SecureDownloads\Domain\Transfer\Token\AbstractToken;

/***
*
/*
* This file is part of the "Secure Downloads" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dev <[email protected]>, Leuchtfeuer Digital Marketing
*
***/
* (c) Dev <[email protected]>, Leuchtfeuer Digital Marketing
*/

namespace Leuchtfeuer\SecureDownloads\Cache;

use Leuchtfeuer\SecureDownloads\Domain\Transfer\Token\AbstractToken;

/**
* Stores decoded JSON web token data.
Expand Down
11 changes: 5 additions & 6 deletions Classes/Cache/EncodeCache.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<?php

declare(strict_types=1);
namespace Leuchtfeuer\SecureDownloads\Cache;

/***
*
/*
* This file is part of the "Secure Downloads" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dev <[email protected]>, Leuchtfeuer Digital Marketing
*
***/
* (c) Dev <[email protected]>, Leuchtfeuer Digital Marketing
*/

namespace Leuchtfeuer\SecureDownloads\Cache;

/**
* Stores encoded JSON web token data.
Expand Down
14 changes: 6 additions & 8 deletions Classes/Controller/LogController.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<?php

declare(strict_types=1);
namespace Leuchtfeuer\SecureDownloads\Controller;

/***
*
/*
* This file is part of the "Secure Downloads" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dev <[email protected]>, Leuchtfeuer Digital Marketing
*
***/
* (c) Dev <[email protected]>, Leuchtfeuer Digital Marketing
*/

namespace Leuchtfeuer\SecureDownloads\Controller;

use Doctrine\DBAL\Exception;
use Leuchtfeuer\SecureDownloads\Domain\Repository\LogRepository;
Expand All @@ -33,8 +32,7 @@ class LogController extends ActionController
public function __construct(
protected ModuleTemplateFactory $moduleTemplateFactory,
protected LogRepository $logRepository,
) {
}
) {}

/**
* @return ResponseInterface
Expand Down
11 changes: 5 additions & 6 deletions Classes/Domain/Model/Log.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<?php

declare(strict_types=1);
namespace Leuchtfeuer\SecureDownloads\Domain\Model;

/***
*
/*
* This file is part of the "Secure Downloads" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dev <[email protected]>, Leuchtfeuer Digital Marketing
*
***/
* (c) Dev <[email protected]>, Leuchtfeuer Digital Marketing
*/

namespace Leuchtfeuer\SecureDownloads\Domain\Model;

use Doctrine\DBAL\Exception;
use TYPO3\CMS\Core\Database\ConnectionPool;
Expand Down
16 changes: 7 additions & 9 deletions Classes/Domain/Repository/LogRepository.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<?php

declare(strict_types=1);
namespace Leuchtfeuer\SecureDownloads\Domain\Repository;

/***
*
/*
* This file is part of the "Secure Downloads" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dev <[email protected]>, Leuchtfeuer Digital Marketing
*
***/
* (c) Dev <[email protected]>, Leuchtfeuer Digital Marketing
*/

namespace Leuchtfeuer\SecureDownloads\Domain\Repository;

use Leuchtfeuer\SecureDownloads\Domain\Model\Log;
use Leuchtfeuer\SecureDownloads\Domain\Transfer\Filter;
Expand All @@ -29,13 +28,12 @@

class LogRepository extends Repository
{
const TABLENAME = 'tx_securedownloads_domain_model_log';
public const TABLENAME = 'tx_securedownloads_domain_model_log';

public function __construct(
private readonly ConnectionPool $connectionPool,
private readonly DataMapper $dataMapper
) {
}
) {}

public function createQueryBuilder(): QueryBuilder
{
Expand Down
11 changes: 5 additions & 6 deletions Classes/Domain/Repository/StorageRepository.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<?php

declare(strict_types=1);
namespace Leuchtfeuer\SecureDownloads\Domain\Repository;

/***
*
/*
* This file is part of the "Secure Downloads" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2020 Dev <[email protected]>, Leuchtfeuer Digital Marketing
*
***/
* (c) Dev <[email protected]>, Leuchtfeuer Digital Marketing
*/

namespace Leuchtfeuer\SecureDownloads\Domain\Repository;

use Doctrine\DBAL\Exception;
use Leuchtfeuer\SecureDownloads\Resource\Driver\SecureDownloadsDriver;
Expand Down
17 changes: 8 additions & 9 deletions Classes/Domain/Transfer/ExtensionConfiguration.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<?php

declare(strict_types=1);
namespace Leuchtfeuer\SecureDownloads\Domain\Transfer;

/***
*
/*
* This file is part of the "Secure Downloads" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dev <[email protected]>, Leuchtfeuer Digital Marketing
*
***/
* (c) Dev <[email protected]>, Leuchtfeuer Digital Marketing
*/

namespace Leuchtfeuer\SecureDownloads\Domain\Transfer;

use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException;
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException;
Expand All @@ -24,11 +23,11 @@
*/
class ExtensionConfiguration implements SingletonInterface
{
const FILE_TYPES_WILDCARD = '*';
public const FILE_TYPES_WILDCARD = '*';

const OUTPUT_STREAM = 'stream';
public const OUTPUT_STREAM = 'stream';

const OUTPUT_NGINX = 'x-accel-redirect';
public const OUTPUT_NGINX = 'x-accel-redirect';

/**
* The value will be added to configured cache lifetime of the page, where the resource is embedded in.
Expand Down
17 changes: 8 additions & 9 deletions Classes/Domain/Transfer/Filter.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
<?php

declare(strict_types=1);
namespace Leuchtfeuer\SecureDownloads\Domain\Transfer;

/***
*
/*
* This file is part of the "Secure Downloads" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dev <[email protected]>, Leuchtfeuer Digital Marketing
*
***/
* (c) Dev <[email protected]>, Leuchtfeuer Digital Marketing
*/

namespace Leuchtfeuer\SecureDownloads\Domain\Transfer;

class Filter
{
const USER_TYPE_ALL = 0;
const USER_TYPE_LOGGED_ON = -1;
const USER_TYPE_LOGGED_OFF = -2;
public const USER_TYPE_ALL = 0;
public const USER_TYPE_LOGGED_ON = -1;
public const USER_TYPE_LOGGED_OFF = -2;

/**
* @var string The file type.
Expand Down
Loading

0 comments on commit d35a29e

Please sign in to comment.