Skip to content

Instantly share code, notes, and snippets.

@tigusigalpa
tigusigalpa / database.php
Last active March 11, 2024 17:43
Laravel PostgreSQL SSL encryption connection config
<?php
/**
* 1. You have to store your client SSL certificates on your Laravel server, in my case this is /var/certs/mydomain.com/...
* 2. You have to right select SSL mode for PostgreSQL (see https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-SSLMODE-STATEMENTS), verify-full means your server CA is signed for real domain name for the PostgreSQL server (recommended)
* 3. Go to Laravel config/database.php to the section 'pgsql' and extend it to the following:
*/
return [
/*...*/
'connections' => [
/*'mysql' etc*/
@tigusigalpa
tigusigalpa / check_moodle_version.php
Last active January 9, 2024 06:46
Check the current Moodle version function by given params
/**
* Function to check the current Moodle version pass your params
*
* @param string $version Number of version or release['3.5' or '4.1'] (depends on @param $checkfor)
* @param string $checkfor ['all' or 'release' ($version like '3.1.3')] or 'version' ($version like '2016052303')
* @param string $compare http://php.net/manual/function.version-compare.php#refsect1-function.version-compare-parameters
* @return bool
* @author Igor Sazonov <sovletig@gmail.com>
* @example $check = checkMoodleVersion('3.9'); //if current Moodle version is 4.2 - returns true because $compare is >=
*/