Skip to content

Instantly share code, notes, and snippets.

@alex-vlasov
alex-vlasov / ubuntu13_10_downgrade_php_5_3.sh
Last active December 27, 2015 11:39 — forked from intel352/php5_4_downgrade_5_3.sh
Downgrade php to 5.3 on ubuntu 13.10
#!/bin/bash
#
# Original for 5.3 by Ruben Barkow (rubo77) http://www.entikey.z11.de/
# release 1 PHP5.4 to 5.3 by Emil Terziev ( foxy ) Bulgaria
# Originally Posted by Bachstelze http://ubuntuforums.org/showthread.php?p=9080474#post9080474
# OK, here's how to do the Apt magic to get PHP packages from the precise repositories:
echo "Am I root? "
if [ "$(whoami &2>/dev/null)" != "root" ] && [ "$(id -un &2>/dev/null)" != "root" ] ; then
@alex-vlasov
alex-vlasov / box-net-backup.sh
Last active January 1, 2016 22:09
box.net WebDAV backup-manager backup
#!/bin/bash
if [ -n "`mount | grep box.net`" ]
then
echo "box.net mounted, continue" ;
else
echo "box.net not mounted, trying to mount" ;
modprobe fuse
@alex-vlasov
alex-vlasov / rebuild-stage.sh
Created March 4, 2014 12:21
Sugar build for changed files
#!/bin/bash
SOURCE_DIR="/var/www/sugar/Mango" ;
BUILD_DIR="/var/www/sugar/Mango/build/rome" ;
VERSION="6.7.0" ;
git status --porcelain | grep -v '^?' | cut -c 4- | xargs -I{} -n1 sh -c "cd $BUILD_DIR && sudo php -n build.php --dir={} --file={} --flav=ult --cleanCache=1 --base_dir=$SOURCE_DIR --ver=$VERSION"
@alex-vlasov
alex-vlasov / gist:434ddc41847450f01406
Created July 9, 2014 08:42
Add codeCoverageIgnore to all PHPUnit tests (existing comments)
find . -name '*.php' | xargs perl -0777 -i -pe 's#([ \t]+\/\*\*\s*?\n)(([ \t]+\*[ \t]+(?!@codeCoverageIgnore)[^\n]*?\n)*)\s+\*\/\s*([ \t]+(?:public|protected) function (?:setUp(?:BeforeClass)?|tearDown(?:AfterClass)?)\(\))# /**\n * \@codeCoverageIgnore\n$2 */\n $4#gis'
@alex-vlasov
alex-vlasov / gist:399e4d0987bc5b815d64
Created July 9, 2014 09:11
Add codeCoverageIgnore to all PHPUnit setup/teardown methods
find . -name '*.php' | xargs perl -0777 -i -pe 's#([;{}]\s*)([ \t]+(?:static )?(?:public|protected) (?:static )?function (?:setUp(?:BeforeClass)?|tearDown(?:AfterClass)?)\(\))#$1 /**\n * \@codeCoverageIgnore\n */\n $2#gis'
@alex-vlasov
alex-vlasov / phpunit-junit-log-to-phpunit-xml
Created October 13, 2016 08:30
Populate phpunit configuration xml with files list based on run suite junit log
grep 'file=' phpunit-junit.log | sed 's/.*file="//' - | sed 's/" .*//' - | uniq | sed 's/^/<file>/' - | sed 's/$/<\/file>/' - > /var/www/sugar/Mango/tests.xml
@alex-vlasov
alex-vlasov / test.php
Created October 25, 2016 15:29
BR-4692 opcache test
<?php
if(!defined('sugarEntry'))define('sugarEntry', true);
require_once('include/entryPoint.php');
$logger = new Sugarcrm\Sugarcrm\Dbal\Logging\SugarLogger($GLOBALS['log']);