Skip to content

Instantly share code, notes, and snippets.

View brgmn's full-sized avatar

Martin Brüggemann brgmn

View GitHub Profile
@brgmn
brgmn / config.inc.php
Created August 31, 2012 07:10
Use Oxid eShop with nginx
if (@$_SERVER['SERVER_NAME'] == 'katzentest-ssl.local'){
$this->_blIsSsl = true;
}
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
$_SERVER['REMOTE_ADDR'] = $list[0];
$_SERVER['HTTP_HOST'] = 'katzentest.com';
$_SERVER['SERVER_NAME'] = 'katzentest.com';
}
@brgmn
brgmn / katzenet-production.php
Created October 11, 2012 07:19
TYPO3 Surf sample configuration (github, TYPO3 Flow, ubuntu server) -> place this at /Build/Surf/ and deploy with ./flow surf:deploy katzenet-production
<?php
use \TYPO3\Surf\Domain\Model\Workflow;
use \TYPO3\Surf\Domain\Model\Node;
use \TYPO3\Surf\Domain\Model\SimpleWorkflow;
$application = new \TYPO3\Surf\Application\FLOW3();
$application->setOption('repositoryUrl', '[email protected]:katzeag/Katzenet.git');
$application->setDeploymentPath('/var/www/katzenet-app');
$application->setOption('keepReleases', 20);
$application->setOption('composerCommandPath', '/usr/bin/composer');
@brgmn
brgmn / .gitconfig
Created October 29, 2012 15:40
Git alias ("git release") for preparing a TYPO3 Flow Surf deployment (updating all packages and pushing the distribution package)
[alias]
release = "!git stash; git pull origin master;composer update --dev;git commit -am '[RELEASE] Update composer.lock';git push origin master;echo '### GURU RELEASE ACTION DONE ###';"
@brgmn
brgmn / syncRemoteFTP.sh
Created January 27, 2013 20:56
Sync remote ftp-webspace with curlftpfs and rsync.
#!/bin/sh
curlftpfs -s ftp://user:[email protected] /mnt/ftpverz
rsync -rltDvz --force --exclude-from=rsync_exclude.txt /var/www/webprojekt/ /mnt/ftpverz/
umount /mnt/ftpverz
@brgmn
brgmn / JobsCommandController.php
Created June 22, 2014 19:43
Catch database exception (if timed out) and rebuild the connection in long running TYPO3 Flow commands
<?php
//...
class JobsCommandController extends CommandController {
public function workCommand($queue, $verbose = FALSE) {
do {
try {
$job = $this->jobManager->waitAndExecute($queueName);
if ($job !== NULL) {
$this->printLineIf('Processed job "%s"', $verbose, array($job->getLabel()));
$this->persistenceManager->clearState();
@brgmn
brgmn / TestCommandController.php
Created February 23, 2015 06:38
MySQL wait_timeout test command for TYPO3 Flow (assuming wait_timeout in MySQL is set to 10 seconds).
<?php
namespace Brgmn\Test\Command;
/* *
* This script belongs to the TYPO3 Flow package "Brgmn.Test". *
* *
* */
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Persistence\Doctrine\PersistenceManager;
@brgmn
brgmn / mysql-wait-time-out-exception.txt
Created February 23, 2015 07:24
If a MySQL wait_timeout occures the following exception is logged in TYPO3 Flow
Uncaught exception #1: Warning: Error while sending QUERY packet. PID=27496 in /Users/bernd/Sites/neos2/Packages/Libraries/doctrine/dbal/lib/Doctrine/DBAL/Connection.php line 959
22 TYPO3\Flow\Error\ErrorHandler::handleError(2, "Error while sending QUERY packet. PID=27496", "/Users/bernd/Sites/neos2/Packages/Libraries/doctrine/dbal/lib/Doctrine/DBAL/Connection.php", 959, array|1|)
21 PDO::beginTransaction()
20 Doctrine\DBAL\Connection::beginTransaction()
19 Doctrine\ORM\UnitOfWork::commit(NULL)
18 Doctrine\ORM\EntityManager::flush()
17 TYPO3\Flow\Persistence\Doctrine\PersistenceManager_Original::persistAll()
16 Brgmn\Test\Command\TestCommandController_Original::testCommand()
15 call_user_func_array(array|2|, array|0|)
@brgmn
brgmn / fake_wait_timeout.php
Created February 24, 2015 09:10
Fake a low MySQL wait_timeout setting and force a exception
public function testCommand() {
$site = $this->siteRepository->findAll()->getFirst();
/** @var Connection $connection */
$connection = $this->entityManager->getConnection();
$connection->exec('SET SESSION wait_timeout=1;');
$this->outputLine('Set wait_timeout for mysql session to one second and wait two seconds now');
sleep(2);
$domain = new Domain();
$domain->setSite($site);
$domain->setHostPattern('katze2.de');
@brgmn
brgmn / proxytop
Created February 1, 2023 07:48
Proxytop Python 3 version
#!/usr/bin/env python
import curses
import argparse
import npyscreen
import MySQLdb
import sys
import time
### Option parser