reids preparation

This commit is contained in:
Chris
2025-05-18 12:31:50 +02:00
parent b7f5b09011
commit 54b237a522
4 changed files with 16 additions and 1 deletions

View File

@@ -5,6 +5,8 @@ RUN apk add --no-cache bash socat file ffmpeg
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
WORKDIR /app/public
RUN install-php-extensions redis
# Add php.ini
ADD configs/php.ini /usr/local/etc/php/php.ini

View File

@@ -25,6 +25,7 @@ _buildConfig() {
echo "<?php"
echo "define('URL', '${URL:-}');"
echo "define('TITLE', '${TITLE:-PictShare}');"
echo "define('REDIS_CACHING', '${REDIS_CACHING:-true}');"
echo "define('ALLOWED_SUBNET', '${ALLOWED_SUBNET:-}');"
echo "define('CONTENTCONTROLLERS', '${CONTENTCONTROLLERS:-}');"
echo "define('MASTER_DELETE_CODE', '${MASTER_DELETE_CODE:-}');"
@@ -56,6 +57,9 @@ _buildConfig() {
echo "define('ALLOWED_DOMAINS', '${ALLOWED_DOMAINS:-}');"
echo "define('SPLIT_DATA_DIR', ${SPLIT_DATA_DIR:-false});"
echo "define('LOG_VIEWS', ${LOG_VIEWS:-false});"
echo "define('REDIS_CACHING', ${REDIS_CACHING:-true});"
echo "define('REDIS_SERVER', '${REDIS_SERVER:-localhost}');"
echo "define('REDIS_PORT', ${REDIS_PORT:-6379});"
}

View File

@@ -24,6 +24,8 @@ In this file you can set the following options. For a simple working example con
| UPLOAD_QUOTA (NOT IMPLEMENTED) | int | Size in MB. If set, will only allow uploads if combined size of uploads on Server is smaller than this value. Does not account for ALT_FOLDER data and resized versions of original uploads won't be added to calculation |
| MAX_RESIZED_IMAGES (NOT IMPLEMENTED ) | string | If set, limits count of resized images/videos per file on server |
| LOG_VIEWS | bool | If set, will log all views into the ./logs/app.log. Pretty resource heavy, only use for debugging purposes |
| REDIS_CACHING | bool | true by default, Used to cache URL to file mapping. If set to false, PictShare will not use Redis for caching. This is not recommended as it will slow down the server significantly |
| REDIS_SERVER | string | IP address of the Redis server. If set, PictShare will use this server for caching. If not set, PictShare will use the default Redis server on localhost |
# Content controllers

View File

@@ -17,7 +17,14 @@ loadAllContentControllers();
//load external things if existing
if(file_exists(ROOT.'/src/lib/vendor/autoload.php'))
require ROOT.'/src/lib/vendor/autoload.php';
require_once(ROOT.'/src/lib/vendor/autoload.php');
// redis
if(!defined('REDIS_CACHING') || REDIS_CACHING == true)
{
$GLOBALS['redis'] = new Redis();
$GLOBALS['redis']->connect((!defined('REDIS_SERVER'))?'localhost':REDIS_SERVER, (!defined('REDIS_PORT'))?6379:REDIS_PORT);
}
//parse the URL to an array and filter it