Skip to content

Instantly share code, notes, and snippets.

View stamster's full-sized avatar
🎯
Focusing

Jonathan Aaron Steel stamster

🎯
Focusing
View GitHub Profile
@stamster
stamster / magento2_init.sh
Created May 7, 2016 14:06
Magento2 INIT script
#!/bin/bash
MAG=magento #system wide symlink
# or absolute:
#MAG=/usr/share/nginx/mymagentoprojectroot/bin/magento #absolute path
echo "Enabling all modules with clearing static content..."
$MAG module:enable --all --clear-static-content
echo "Running setup upgrade..."
$MAG setup:upgrade
<?php
/*
If you don't want your PHP program to wait XXX seconds before giving up in a case when one of your corporate DC have failed,
and since ldap_connect() does not have a mechanism to timeout on a user specified time,
this is my workaround which shows excellent practical results.
*/
function serviceping($host, $port=389, $timeout=1)
{
$op = fsockopen($host, $port, $errno, $errstr, $timeout);
if (!$op) return 0; //DC is N/A