opened 06:41AM - 07 Feb 23 UTC
Potential Bug
To Triage
I use to define my own PIWIK_USER_PATH in /bootstrap.php to alter the path of th…e config.ini.php-file. But when calling /misc/cron/archive.php PIWIK_USER_PATH is already set BEFORE /bootstrap.php is called.
## Expected Behavior
/bootstrap.php should be called before PIWIK_USER_PATH is set in /misc/cron/archive.php
## Current Behavior
/bootstrap.php is called AFTER PIWIK_USER_PATH is already set in /misc/cron/archive.php
## Possible Solution
/misc/cron/archive.php
```
if (!defined('PIWIK_DOCUMENT_ROOT')) {
define('PIWIK_DOCUMENT_ROOT', realpath(dirname(__FILE__) . "/../.."));
}
// Added
if (file_exists(PIWIK_DOCUMENT_ROOT . '/bootstrap.php')) {
require_once PIWIK_DOCUMENT_ROOT . '/bootstrap.php';
}
// /Added
if (!defined('PIWIK_INCLUDE_PATH')) {
define('PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT);
}
if (!defined('PIWIK_USER_PATH')) {
define('PIWIK_USER_PATH', PIWIK_INCLUDE_PATH);
}
```
## Steps to Reproduce (for Bugs)
Create a /bootstrap.php-file with this content:
`define('PIWIK_USER_PATH', $_SERVER['DOCUMENT_ROOT'].'/my-new-path-to-matomo-config/');`
Move config.ini.php to $_SERVER['DOCUMENT_ROOT'].'/my-new-path-to-matomo-config/'
call /misc/cron/archive.php
=> Warning: Constant PIWIK_USER_PATH already defined in ...\matomo\bootstrap.php on line 1
=> cron-job is not working, instead the installation-page is shown
## Context
I'm moving the config-file to another location, because I want to use matomo on different servers and don't want to override the config.ini.php on updates.