Skip to content

Commit

Permalink
[FEATURE] Downgrade to TYPO3 6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
IchHabRecht committed Sep 13, 2018
1 parent cbc9758 commit ad38e5f
Show file tree
Hide file tree
Showing 18 changed files with 77 additions and 184 deletions.
3 changes: 1 addition & 2 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'array_syntax' => [
'syntax' => 'short',
'syntax' => 'long',
],
'binary_operator_spaces' => true,
'blank_line_before_return' => true,
'concat_space' => [
'spacing' => 'one',
],
'declare_strict_types' => true,
'function_typehint_space' => true,
'hash_to_slash_comment' => true,
'linebreak_after_opening_tag' => true,
Expand Down
2 changes: 1 addition & 1 deletion .styleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ enabled:
- function_typehint_space
- hash_to_slash_comment
- linebreak_after_opening_tag
- long_array_syntax
- lowercase_cast
- method_separation
- native_function_casing
Expand Down Expand Up @@ -52,7 +53,6 @@ enabled:
- phpdoc_var_without_name
- return_type_declaration
- self_accessor
- short_array_syntax
- short_scalar_cast
- single_quote
- standardize_not_equals
Expand Down
109 changes: 10 additions & 99 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ install:
composer config prefer-stable true;
composer require typo3/cms-core:"@dev" --no-update;
fi
- composer require nimut/typo3-complete:"$TYPO3"
- composer require typo3/cms:"$TYPO3"
- mkdir -p .Build/public/typo3conf/ext/
- if [ ! -L .Build/public/typo3conf/ext/filefill ]; then ln -snvf ../../../../. .Build/public/typo3conf/ext/filefill; fi
- export TYPO3_PATH_ROOT=$PWD/.Build/public
Expand Down Expand Up @@ -68,105 +68,16 @@ script:
jobs:
fast_finish: true
include:
- stage: test
php: 7.2
env: TYPO3=^8.7
- stage: test
php: 7.1
env: TYPO3=^8.7
- stage: test
php: 7.0
env: TYPO3=^8.7
- stage: test
php: 5.6
env: TYPO3=^7.6
env: TYPO3=^6.2
- stage: test
php: 5.5
env: TYPO3=^7.6

- stage: 🚢 to ter
if: tag IS present AND env(TYPO3_ORG_USERNAME) IS present AND env(TYPO3_ORG_PASSWORD) IS present
php: 7.0
env: TYPO3=^8.7
before_install: skip
install: skip
before_script: skip
script:
- >
echo;
echo "Preparing upload of release ${TRAVIS_TAG} to TER";
echo;
echo;
composer global require helhum/ter-client;
- >
TAG_MESSAGE=`git tag -n10 -l $TRAVIS_TAG | sed 's/^[0-9.]*[ ]*//g'`;
echo;
echo "Uploading release ${TRAVIS_TAG} to TER";
echo;
echo;
$HOME/.composer/vendor/bin/ter-client upload filefill . -u "$TYPO3_ORG_USERNAME" -p "$TYPO3_ORG_PASSWORD" -m "$TAG_MESSAGE";
- stage: ✔ with sonarqube scanner
if: type = push AND branch IN (master, pre-merge) AND env(SONAR_TOKEN) IS present AND fork = false
php: 7.2
before_install: skip
install:
- mkdir -p .Log/coverage/ .Log/junit/
- export TYPO3_PATH_WEB=$PWD/.Build/public
- export typo3DatabaseName=typo3
- export typo3DatabaseHost=localhost
- export typo3DatabaseUsername=root
- export typo3DatabasePassword=
before_script:
script:
- >
if [ -d "Tests" ]; then
for TYPO3 in "^7.6" "^8.7"; do
echo;
echo "Running TYPO3 version $TYPO3";
echo;
echo;
git clean -Xdf;
composer require --dev nimut/typo3-complete:"$TYPO3";
git checkout composer.json;
VERSION=${TYPO3//[!0-9]/};
mkdir -p .Build/public/typo3conf/ext/
if [ ! -L .Build/public/typo3conf/ext/filefill ]; then ln -snvf ../../../../. .Build/public/typo3conf/ext/filefill; fi
if [ -d "Tests/Unit" ]; then
echo;
echo "Running unit tests";
echo;
echo;
.Build/bin/phpunit --bootstrap .Build/vendor/nimut/testing-framework/res/Configuration/UnitTestsBootstrap.php --log-junit .Log/junit/unit_$VERSION.xml --coverage-php .Log/coverage/unit_$VERSION.cov Tests/Unit/;
fi
if [ -d "Tests/Functional" ]; then
echo;
echo "Running functional tests";
echo;
echo;
.Build/bin/phpunit --bootstrap .Build/vendor/nimut/testing-framework/res/Configuration/FunctionalTestsBootstrap.php --log-junit .Log/junit/functional_$VERSION.xml --coverage-php .Log/coverage/functional_$VERSION.cov Tests/Functional/;
fi
done
echo;
echo "Merging log and coverage files";
echo;
echo;
composer require --update-with-all-dependencies nimut/phpunit-merger;
.Build/bin/phpunit-merger coverage .Log/coverage/ .Log/coverage.xml;
.Build/bin/phpunit-merger log .Log/junit/ .Log/junit.xml;
fi
- git fetch --unshallow || true

- >
echo;
echo "Running SonarQube Scanner";
echo;
echo;
sonar-scanner;
env: TYPO3=^6.2
- stage: test
php: 5.4
env: TYPO3=^6.2
- stage: test
php: 5.3
env: TYPO3=^6.2
dist: precise
8 changes: 4 additions & 4 deletions Classes/Hooks/ResetMissingFiles.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);
namespace IchHabRecht\Filefill\Hooks;

/*
Expand Down Expand Up @@ -28,7 +27,8 @@ class ResetMissingFiles
public function processDatamap_afterDatabaseOperations($status, $table, $id)
{
if ($table !== 'sys_file_storage'
|| empty($_POST['_save_tx_filefill_missing'])
|| empty($_POST['_savedok_x'])
|| $_POST['_savedok_x'] !== 'filefill'
|| !MathUtility::canBeInterpretedAsInteger($id)
) {
return;
Expand All @@ -37,9 +37,9 @@ public function processDatamap_afterDatabaseOperations($status, $table, $id)
$databaseConnection->exec_UPDATEquery(
'sys_file',
'storage=' . (int)$id . ' AND missing=1',
[
array(
'missing' => 0,
]
)
);
}

Expand Down
5 changes: 2 additions & 3 deletions Classes/Resource/Domain/DomainResource.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);
namespace IchHabRecht\Filefill\Resource\Domain;

/*
Expand Down Expand Up @@ -40,10 +39,10 @@ public function __construct($url)
*/
public function hasFile($fileIdentifier, $filePath)
{
$report = [];
$report = array();
GeneralUtility::getUrl($this->url . ltrim($filePath, '/'), 2, false, $report);

$isCurlResponse = in_array($report['lib'], ['cURL', 'GuzzleHttp'], true)
$isCurlResponse = in_array($report['lib'], array('cURL', 'GuzzleHttp'), true)
&& (
(empty($report['http_code']) && (int)$report['error'] === 200)
|| (int)$report['http_code'] === 200
Expand Down
5 changes: 2 additions & 3 deletions Classes/Resource/Domain/DomainResourceRepository.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);
namespace IchHabRecht\Filefill\Resource\Domain;

/*
Expand All @@ -26,7 +25,7 @@ class DomainResourceRepository
*/
public function findAll()
{
$domainResources = [];
$domainResources = array();

$databaseConnection = $this->getDatabaseConnection();

Expand All @@ -49,7 +48,7 @@ public function findAll()

while ($row = $result->fetch_assoc()) {
$url = 'http://' . $row['domainName'];
$domainResources[] = GeneralUtility::makeInstance(DomainResource::class, $url);
$domainResources[] = GeneralUtility::makeInstance('IchHabRecht\\Filefill\\Resource\\Domain\\DomainResource', $url);
}

return $domainResources;
Expand Down
1 change: 0 additions & 1 deletion Classes/Resource/Driver/FileFillDriver.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);
namespace IchHabRecht\Filefill\Resource\Driver;

/*
Expand Down
14 changes: 6 additions & 8 deletions Classes/Resource/Placeholder/PlaceholderResource.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);
namespace IchHabRecht\Filefill\Resource\Placeholder;

/*
Expand All @@ -18,7 +17,6 @@
use IchHabRecht\Filefill\Resource\RemoteResourceInterface;
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Core\Resource\FileInterface;
use TYPO3\CMS\Core\Resource\ProcessedFile;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;

Expand All @@ -27,12 +25,12 @@ class PlaceholderResource implements RemoteResourceInterface
/**
* @var array
*/
protected $allowedFileExtensions = [
protected $allowedFileExtensions = array(
'gif',
'jpeg',
'jpg',
'png',
];
);

/**
* @var string
Expand All @@ -42,7 +40,7 @@ class PlaceholderResource implements RemoteResourceInterface
/**
* @var FileInterface[]
*/
protected static $fileIdentifierCache = [];
protected static $fileIdentifierCache = array();

/**
* @param string $fileIdentifier
Expand All @@ -59,7 +57,7 @@ public function hasFile($fileIdentifier, $filePath)
if (!isset(static::$fileIdentifierCache[$fileIdentifier])) {
$resourceFactory = ResourceFactory::getInstance();
$localPath = $filePath;
$storage = $resourceFactory->getStorageObject(0, [], $localPath);
$storage = $resourceFactory->getStorageObject(0, array(), $localPath);
if ($storage->getUid() === 0) {
static::$fileIdentifierCache[$fileIdentifier] = false;

Expand Down Expand Up @@ -89,10 +87,10 @@ public function hasFile($fileIdentifier, $filePath)

$originalFile = $resourceFactory->getFileObject((int)$databaseRow['original']);
$taskType = $databaseRow['task_type'];
$configuration = unserialize($databaseRow['configuration'], ['allowed_classes' => false]);
$configuration = unserialize($databaseRow['configuration']);

$fileObject = GeneralUtility::makeInstance(
ProcessedFile::class,
'TYPO3\\CMS\\Core\\Resource\\ProcessedFile',
$originalFile,
$taskType,
$configuration,
Expand Down
1 change: 0 additions & 1 deletion Classes/Resource/RemoteResourceCollection.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);
namespace IchHabRecht\Filefill\Resource;

/*
Expand Down
20 changes: 8 additions & 12 deletions Classes/Resource/RemoteResourceCollectionFactory.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);
namespace IchHabRecht\Filefill\Resource;

/*
Expand All @@ -15,9 +14,6 @@
* LICENSE file that was distributed with this source code.
*/

use IchHabRecht\Filefill\Resource\Domain\DomainResource;
use IchHabRecht\Filefill\Resource\Domain\DomainResourceRepository;
use IchHabRecht\Filefill\Resource\Placeholder\PlaceholderResource;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class RemoteResourceCollectionFactory
Expand All @@ -29,7 +25,7 @@ class RemoteResourceCollectionFactory
*/
public static function createRemoteResourceCollectionFromConfiguration(array $configuration)
{
$remoteResources = [];
$remoteResources = array();

foreach ($configuration as $key => $resource) {
if (empty($resource)) {
Expand All @@ -39,22 +35,22 @@ public static function createRemoteResourceCollectionFromConfiguration(array $co
switch ($key) {
case 'domain':
foreach ($resource as $domain) {
$remoteResources[] = GeneralUtility::makeInstance(DomainResource::class, $domain);
$remoteResources[] = GeneralUtility::makeInstance('IchHabRecht\\Filefill\\Resource\\Domain\\DomainResource', $domain);
}
break;
case 'sys_domain':
$domainResourceRepository = GeneralUtility::makeInstance(DomainResourceRepository::class);
$domainResourceRepository = GeneralUtility::makeInstance('IchHabRecht\\Filefill\\Resource\\Domain\\DomainResourceRepository');
$remoteResources = array_merge($remoteResources, $domainResourceRepository->findAll());
break;
case 'placeholder':
$remoteResources[] = GeneralUtility::makeInstance(PlaceholderResource::class);
$remoteResources[] = GeneralUtility::makeInstance('IchHabRecht\\Filefill\\Resource\\Placeholder\\PlaceholderResource');
break;
default:
throw new \RuntimeException('Unexpected File Fill Resource configuration "' . $key . '"', 1519788775);
}
}

return GeneralUtility::makeInstance(RemoteResourceCollection::class, $remoteResources);
return GeneralUtility::makeInstance('IchHabRecht\\Filefill\\Resource\\RemoteResourceCollection', $remoteResources);
}

/**
Expand All @@ -64,7 +60,7 @@ public static function createRemoteResourceCollectionFromConfiguration(array $co
*/
public static function createRemoteResourceCollectionFromFlexForm($flexForm)
{
$configuration = [];
$configuration = array();

$resourcesConfiguration = GeneralUtility::xml2array($flexForm);

Expand All @@ -78,11 +74,11 @@ public static function createRemoteResourceCollectionFromFlexForm($flexForm)
switch ($key) {
case 'domain':
if (empty($configuration[$key])) {
$configuration[$key] = [];
$configuration[$key] = array();
}
$configuration[$key] = array_merge(
$configuration[$key],
[$resource['domain']['el']['domain']['vDEF']]
array($resource['domain']['el']['domain']['vDEF'])
);
break;
case 'sys_domain':
Expand Down
1 change: 0 additions & 1 deletion Classes/Resource/RemoteResourceInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);
namespace IchHabRecht\Filefill\Resource;

/*
Expand Down
1 change: 0 additions & 1 deletion Classes/Slot/FileProcessingServiceSlot.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);
namespace IchHabRecht\Filefill\Slot;

/*
Expand Down
Loading

0 comments on commit ad38e5f

Please sign in to comment.