Skip to content

Instantly share code, notes, and snippets.

View fchaussin's full-sized avatar

François CHAUSSIN fchaussin

  • François Chaussin
  • Lyon
View GitHub Profile
@fchaussin
fchaussin / unzip.php
Last active May 16, 2019 10:24
Script PHP d'extraction ZIP
<?php
$zipfiles = glob('*.{zip}', GLOB_BRACE);
$options = "";
foreach($zipfiles as $file){
$options .= "<option value='{$file}'>{$file}</option>";
}
?>
<style>
body{font-family:sans-serif;font-size:20px;width:100%;max-width:900px;margin:0 auto;}
.text{background:rgba(0,0,0,.05);padding:2em; text-align: center;}
@fchaussin
fchaussin / mysql dump php
Created September 23, 2019 05:40
Export MySql/MariaDb dump
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$database = 'dbname';
$user = 'user';
$pass = '***';
$host = 'localhost';
$now = date('Ymdhis');
$dir = dirname(__FILE__) . "/dump{$now}.sql";
@fchaussin
fchaussin / MyController.php
Last active September 27, 2019 14:04
TYPO3 : adding a FlexForm to an Extbase Extension
class MyController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
...
private function _getFlexFormOptions()
{
$this->contentObj = $this->configurationManager->getContentObject();
$piFlexForm = $this->contentObj->data['pi_flexform'];
$options = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($piFlexForm);
return $options;
}
@fchaussin
fchaussin / Repository.php
Created February 11, 2020 09:49
[TYPO3 Extbase] Find By Uid including Hidden and Deleted records
/**
* Find a record by uid even if it is hidden or deleted
*
* @param int $uid
* @param int|array $pid
* @return object
*/
public function findByUidInAllRecordsByUid($uid, $pid=false)
{
@fchaussin
fchaussin / Extbase Query Debug
Created March 18, 2020 14:19
Display SQL debug for TYPO3 Extbase query builder
$query = $this->createQuery();
$query->equals('mm.uid_foreign', $uid);
$return = $query->count();
$queryParser = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::class);
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($queryParser->convertQueryToDoctrineQueryBuilder($query)->getSQL());
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($queryParser->convertQueryToDoctrineQueryBuilder($query)->getParameters());
return $return;
@fchaussin
fchaussin / XDebugIpUpdate.sh
Last active October 2, 2020 07:21
Update php.ini local IP for Xdebug with PHP-FPM
#!/bin/bash
# 2020 - @fchaussin [FCN]
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
echo -e "Please exec this bash as superuser, with -E to keep your user environnement variables:
\e[32msudo -E ./xDebugIp.sh\e[39m"
exit
fi
php_version="7.2"
1. Install « from scratch » avec ddev. typo3/cms-base-distribution
2. Petit tour du propriétaire du backend (mode page : creation de la root page, ajout de content elements classiques (fournis dans l’install de typo par defaut), mode liste, formulaires, gabarits, install tools)
3. Puis paramétrage multilingues (ajout des langues dans le mode liste, paramétrage multisites dans le mode sites, ajout du français en back : mode maintenance/languages pack, puis réglage du langage dans la config utilisateur en haut à droite)
4. Installation de Bootstrap Package (theme et config typoscripts par defaut) via composer https://packagist.org/packages/bk2k/bootstrap-package
5. Explications sur cette extension https://docs.typo3.org/p/bk2k/bootstrap-package/master/en-us/
6. Installation de l’extension DCE via composer https://packagist.org/packages/t3/dce
7. Création de contents element avec DCE, afin de comprendre les concepts de TCA (champs formulaires backend) et de Fluid template engine
8. Installation de Extension
@fchaussin
fchaussin / SSH files mount on windows10
Created May 27, 2020 13:47
Some utils to access ssh content in windows explorer
Install the latest version of WinFsp. https://github.com/billziss-gh/winfsp/releases/tag/v1.2POST1
Install the latest version of SSHFS-Win. Choose the x64 or x86 installer according to your computer’s architecture. https://github.com/billziss-gh/sshfs-win/releases/latest
Map Windows Drive using this URL: \\sshfs\username@machine_ip\..\..
@fchaussin
fchaussin / tca_upgrade_62-76.md
Last active June 16, 2020 09:49
TYPO3 TCA upgrades 6.2 => 7.6

WIZARDS

browse_links.php

'script' => 'browse_links.php?mode=wizard&act=file' ,

// becomes

@fchaussin
fchaussin / flexform_upgrade_62-76.md
Created June 16, 2020 07:33
Typo3 Upgrade 6.2 => 7.6 Flexforms

WIZARDS

browse_links.php

<script>browse_links.php?mode=wizard&act=file</script>

//becomes