Skip to content

Instantly share code, notes, and snippets.

View h3nn3s's full-sized avatar

Henrik Ziegenhain h3nn3s

View GitHub Profile
@h3nn3s
h3nn3s / auto_prepend_file.php
Created January 18, 2017 07:28
Small PHP script to set TYPO3_CONTEXT environment variable via php.ini setting for auto_prepend_file. Sets context depending on current subdomain (dev. or www.)
<?php
$host = getenv('SERVER_NAME');
$patternDev = '/^dev\./';
$patternProduction = '/^www\./';
if (preg_match($patternDev, $host)) {
putenv('TYPO3_CONTEXT=Development');
}
if (preg_match($patternProduction, $host)) {
putenv('TYPO3_CONTEXT=Production');
@h3nn3s
h3nn3s / FindActiveCheckboxesViewHelper.php
Created January 30, 2018 10:04
TYPO3: Check which checkbox items got checked by bitwise shifting
<?php
namespace HenrikZiegenhain\MyExt\ViewHelpers;
/***************************************************************
* Copyright notice
*
* (c) 2018 Henrik Ziegenhain <[email protected]>
*
* All rights reserved
*
@h3nn3s
h3nn3s / ConvertApplicationAreaValuesToBinaryDataProcessor.php
Created January 30, 2018 11:00
TYPO3 powermail DataProcessor: Convert checkbox positions to there decimal represenation
<?php
namespace HenrikZiegenhain\MyExt\DataProcessor;
/***************************************************************
* Copyright notice
*
* (c) 2018 Henrik Ziegenhain <[email protected]>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
@h3nn3s
h3nn3s / PznValidator.php
Created January 30, 2018 14:01
TYPO3 Powermail Validator Class
<?php
namespace HenrikZiegenhain\MyExt\Domain\Validator;
/***************************************************************
* Copyright notice
*
* (c) 2018 Henrik Ziegenhain <[email protected]>
*
* All rights reserved
*
@h3nn3s
h3nn3s / dump_typo3_without_userdata_caches.sh
Created February 27, 2019 06:55
Dump TYPO3 Database without Caches and Userdata
#!/bin/bash
# This script dumps all neccessary tables for LOCAL Development
# Be aware, that it excludes all userdata, caches and environment
# specific tables!
PASSWORD=
HOST=
USER=
DATABASE=
@h3nn3s
h3nn3s / DataHandler.php
Created April 3, 2023 04:21
Hook into Tcemain to clear custom cachetags
<?php
namespace Vendor\Extension\Hooks;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Cache\Exception\NoSuchCacheGroupException;
use TYPO3\CMS\Core\Database\ReferenceIndex;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;