Skip to content

Instantly share code, notes, and snippets.

@lorenzulrich
lorenzulrich / Settings.yaml
Created June 7, 2016 17:36
Re-using TYPO3 CMS (salted MD5) passwords in Flow
TYPO3:
Flow:
security:
cryptography:
hashingStrategies:
typo3md5salted: Vendor\Package\Security\Cryptography\Typo3Md5SaltedHashingStrategy
@lorenzulrich
lorenzulrich / dropAllTablesFromDatabase.sh
Created June 22, 2016 22:37
Drop all tables from MySQL database without root privileges
#!/bin/bash
MUSER="$1"
MPASS="$2"
MDB="$3"
# Detect paths
MYSQL=$(which mysql)
AWK=$(which awk)
GREP=$(which grep)
@lorenzulrich
lorenzulrich / config.ts
Last active August 12, 2017 07:39
TYPO3: One domain per language with RealURL
[globalVar = GP:L=1]
config {
sys_language_uid = 1
language = en
locale_all = en_CH.utf8
htmlTag_langKey = en
baseURL = http://default.domain.tld/
}
[global]
@lorenzulrich
lorenzulrich / MediaContentMigrationCommandController.php
Last active November 24, 2017 18:49
Command controller for TYPO3 7 LTS+ to migrate CType Media containing YouTube and Vimeo videos to CType textmedia using file references
<?php
namespace Visol\Foobar\Command;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\Resource\File;
use TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\OnlineMediaHelperRegistry;
use TYPO3\CMS\Core\Resource\ResourceFactory;
@lorenzulrich
lorenzulrich / Example.fusion
Last active January 20, 2018 21:18
Neos CMS Eel Helper to get configuration of NodeTypes
# In this example, I want to render the same <select> box as a filter in the frontend I use to categorize a Node in the backend
@context.offerTypeSettings = ${Visol.NodeTypeConfigurationHelper.setting('My.FoobarCom:Document.Offer', 'properties.offerType.ui.inspector.editorOptions.values')}
offerTypes = Neos.Fusion:Collection {
collection = ${offerTypeSettings}
itemRenderer = ${'<option value="' + itemKey + '">' + item.label + '</option>'}
}
@lorenzulrich
lorenzulrich / ContainsReferenceToNodeOperation.php
Last active January 23, 2018 18:25
Neos CMS FlowQuery operation to filter a collection of Nodes having a reference to a given Node
<?php
namespace Visol\FoobarCom\FlowQuery\Operation;
use Neos\ContentRepository\Domain\Model\NodeInterface;
use Neos\Eel\FlowQuery\FlowQuery;
use Neos\Eel\FlowQuery\Operations\AbstractOperation;
class ContainsReferenceToNodeOperation extends AbstractOperation
{
@lorenzulrich
lorenzulrich / AbstractApiController.php
Created April 23, 2018 15:07
TraceableJob for Flow Framework
<?php
namespace Visol\Foo\Controller;
/*
* This file is part of the Visol.Foo package.
*/
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Mvc\Controller\ActionController;
use TYPO3\Flow\Mvc\View\JsonView;
@lorenzulrich
lorenzulrich / typo3-cms-linkhandler-record-and language-link-migration.patch
Created June 25, 2018 18:08
TYPO3 8.7: Core patch to migrate links from EXT:linkhandler to built-in link handling functionality
@lorenzulrich
lorenzulrich / BgSetUsage.html
Last active November 14, 2018 21:00
ResponsiveImageViewHelper and SrcSetViewHelper for Responsive Images using lazysizes/bgset
<div class="lazyload" data-bgset="{v:srcSet(image: media.1, ratio: 1, maxWidth: 1920)}">
Foo
</div>
{namespace v=Visol\Foobar\ViewHelpers}
@lorenzulrich
lorenzulrich / realurl_conf.php
Last active January 28, 2019 14:44
TYPO3 RealURL: Two sites in an installation, both with one domain per language
<?php
$realUrlSiteConfigurations = [
'site1' => [
'rootPageUid' => 1,
'schema' => 'https',
'languageDomainMap' => [
0 => 'www.site1.ch',
1 => 'www.site1.fr',
2 => 'www.site1.it',
]