This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) === | |
# | |
# by Fotis Evangelou, developer of Engintron (engintron.com) | |
# | |
# ~ Updated December 2021 ~ | |
# | |
# | |
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores. | |
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change to the project directory | |
cd $FORGE_SITE_PATH | |
# Turn on maintenance mode | |
$FORGE_PHP artisan down || true | |
# Pull the latest changes from the git repository | |
# git reset --hard | |
# git clean -df | |
git pull origin $FORGE_SITE_BRANCH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\\ Change to inno-db | |
class ChangeDbTableEngine extends Migration | |
{ | |
public function up() | |
{ | |
$items = Schema::getAllTables(); | |
foreach ($items as $item) { | |
$dbName = config('database.connections.mysql.database'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// this is to get table related information from a different table | |
/* | |
'mysql-information-schema' => array( | |
'driver' => 'mysql', | |
'host' => '127.0.0.1', | |
'database' => 'information_schema', | |
'username' => 'root', | |
'password' => '', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function insertLog($log_module, $log_event, $log_affected_table_name, $log_affected_table_primary_key_field, $log_affected_table_primary_key_value, $log_sql_query_string, $log_event_user_id, $log_information) { | |
$sql = " | |
INSERT INTO log( | |
log_module, | |
log_event, | |
log_affected_table_name, | |
log_affected_table_primary_key_field, | |
log_affected_table_primary_key_value, | |
log_sql_query_string, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$exp_date = "2006-01-16"; | |
$todays_date = date("Y-m-d"); | |
$today = strtotime($todays_date); | |
$expiration_date = strtotime($exp_date); | |
if ($expiration_date > $today) { | |
$valid = "yes"; | |
} else { | |
$valid = "no"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* fetch multiple rows of data and return in a single array | |
*/ | |
function mysql_fetch_rowsarr($result, $numass=MYSQL_BOTH) { | |
$i=0; | |
@$keys=array_keys(mysql_fetch_array($result, $numass)); | |
@mysql_data_seek($result, 0); | |
while ($row = mysql_fetch_array($result, $numass)) { | |
foreach ($keys as $speckey) { |