Skip to content

cron-eu/t3x-cron-context

Folders and files

NameName
Last commit message
Last commit date

Latest commit

377974e · Feb 28, 2024
Feb 28, 2024
Aug 25, 2023
Aug 23, 2019
Apr 1, 2021
Aug 25, 2023
Feb 28, 2024
Feb 28, 2024
Aug 25, 2023
Oct 28, 2015

Repository files navigation

Cron TYPO3_CONTEXT Configuration

Installation

Install extension via composer and add config/system/additional.php (or use symlinks):

<?php
defined('TYPO3') || die('Access denied.');

require_once \TYPO3\CMS\Core\Core\Environment::getProjectPath() . '/vendor/cron-eu/cron-context/Default.php';

Copy EXT:cron_context/Examples/additional/ to config/system/additional/

Hint: You don't need to install this extension inside TYPO3 CMS.

Configuration

When using EXT:cron_context/Default.php following configuration directories are used (in this order):

  • EXT:cron_context/Configuration/
  • config/system/additional/

Context examples

TYPO3_CONTEXT=Production (default):

  • config/system/additional/Production.php

TYPO3_CONTEXT=Testing (eg. for Unit tests):

  • config/system/additional/Testing.php

TYPO3_CONTEXT=Development (for development):

  • config/system/additional/Development.php

TYPO3_CONTEXT=Development/Docker (for development inside docker boilerplate):

  • config/system/additional/Development.php
  • config/system/additional/Development/Docker.php

TYPO3_CONTEXT=Production/Preview (for preview):

  • config/system/additional/Development.php
  • config/system/additional/Development/Preview.php

TYPO3_CONTEXT=Production/Live/Server4711 (specific live server configuration):

  • config/system/additional/Development.php
  • config/system/additional/Development/Live.php
  • config/system/additional/Development/Live/Server4711.php

Environment variables

cron_context will read the TYPO3 DB credentials from the following environment variables if present:

  • MYSQL_DB or DB_NAME
  • MYSQL_HOST or DB_HOST
  • MYSQL_PORT or DB_PORT
  • MYSQL_USER or DB_USER
  • MYSQL_PASS or DB_PASS
  • DB_DRIVER (defaults to "mysqli" if not set and a DB_NAME is set)

Advanced usage

If you don't want to use EXT:cron_context/Configuration/ you can customize your own loading in config/system/additional.php

<?php
defined('TYPO3') || die('Access denied.');

// Prevent double loading
if (defined('CRON_TYPO3_ADDITIONALCONFIGURATION')) {
    return;
}

require_once __DIR__ . '/ContextLoader.php';

$confLoader = new \Cron\CronContext\ContextLoader();
$confLoader
        // Add project context configuration
    ->addContextConfiguration(\TYPO3\CMS\Core\Core\Environment::getConfigPath() . '/system/additional')
        // Add local configuration
    ->addConfiguration(\TYPO3\CMS\Core\Core\Environment::getConfigPath() . '/system/additional/local.php')
        // Load configuration files (maybe cached)
    ->loadConfiguration()
        // Add context name to sitename (if in development context)
    ->appendContextNameToSitename();
unset($confLoader);