Skip to content

Instantly share code, notes, and snippets.

uraku lf-uraku-yuki

Block or report user

Report or block lf-uraku-yuki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lf-uraku-yuki
lf-uraku-yuki / mysql_all_create_tables_for_php.php
Last active Oct 27, 2018
mysql_all_create_tables_for_php
View mysql_all_create_tables_for_php.php
<?php
$con = new mysqli('localhost', 'root', 'pw', 'dbname');
$mysqli_result = $con->query('show tables');
$table_name_array = $mysqli_result->fetch_all(MYSQLI_BOTH);
$mysqli_result = null;
foreach ($table_name_array as $row) {
$mysqli_result = $con->query('show create table ' . $row[0]);
$create_table = $mysqli_result->fetch_array();
echo $create_table[1] . "\r\n\r\n";
@lf-uraku-yuki
lf-uraku-yuki / ci3_exlog_helper.php
Last active Dec 14, 2017
CodeIgniter 3.x Logging Back Trace Helper
View ci3_exlog_helper.php
<?php
if (! function_exist('logDebug')) {
function logDebug($message)
{
$trace = debug_backtrace();
$output = 'UserLog: ' . $trace[1]["class"] . '::' . $trace[1]['function'] . ' - ';
if (is_array($message)) {
$message = print_r($message, true);
}
@lf-uraku-yuki
lf-uraku-yuki / ci3-db-connect-retry.php
Created Nov 7, 2017
Codeigniter 3.x Database Connect Retry Sample
View ci3-db-connect-retry.php
<?php
function reconnectDb()
{
if ($this->db->conn_id !== false) {
return;
}
log_message('error', 'DB接続失敗。再接続開始');
// スクリプト実行可能時間を延ばしておく
ini_set('max_execution_time', '180');
for ($retry_count = 0; $retry_count < 8; $retry_count ++) {
@lf-uraku-yuki
lf-uraku-yuki / userparameter_mysql_ping.conf
Created Nov 7, 2017
zabbix-user parameter mysql.ping fixed
View userparameter_mysql_ping.conf
UserParameter=mysql.ping,HOME=/var/lib/zabbix mysqladmin ping 2>&1 | grep -c alive
You can’t perform that action at this time.