Change of a console command

Some time ago and with the great support of my server provider, I have created two cron jobs in order to import my server log files into Matomo. It worked fine until today, the data was regularly imported twice a day, and I received email reports about it. But now the import has stopped.

I suppose that the reason for that could be seen in a warning message that appeared in some of the last email reports:

“force-date-last-n” is deprecated. Please use the “process_new_segments_from” INI configuration option instead.

Unfortunately I only know how to use the “force-date-last-n” in a cron job syntax. But how can I use the “process_new_segments_from” in this syntax?

This is the INI file of Matomo: "config/config.ini.php" file

And how can I use the content of this INI file in oder to change my cron job syntax?:

.../Piwik/console core:archive --force-all-websites --force-date-last-n=1000 --url='https://piwik.mydomain....'

you have to update the ini file of your Matomo installation!

How can I do that?

By the way, at the moment I have also an empty view in my Matomo installation:

Open the file with a text editor, update it and save it!

Could you please explain more in detail, what do you mean with “update it”?

Is there a certain update routine or process or instruction available for updating the "config/config.ini.php" file of Matomo?

Just change the value of process_new_segments_from param in the configuration file…

There is no process_new_segments_from param in the “config/config.ini.php” of my Matomo.

I have found it only in the “global.ini.php” file:

process_new_segments_from = "beginning_of_time"

Should I override this value in the "config/config.ini.php" file?

And how could I do that in detail?

In the section General, you can add this param I think.
Probably you should also remove any reference to force-date-last-n in this file…

The description for process_new_segments_from parameter is:

When archiving segments for the first time, this determines the oldest date that will be archived. This option can be used to avoid archiving (for instance) the lastN years for every new segment. Valid option values include: beginning_of_time (start date of archiving will not be changed) segment_last_edit_time (start date of archiving will be the earliest last edit date found, if none is found, the created date is used) segment_creation_time (start date of archiving will be the creation date of the segment) editLastN where N is an integer (eg editLast10 to archive for 10 days before the segment last edit date) lastN where N is an integer (eg last10 to archive for 10 days before the segment creation date)

In the section [General] of the config.ini.php i have added this line:

process_new_segments_from = "beginning_of_time"

I have changed the cron job to this syntax:

/console core:archive --force-all-websites --process_new_segments_from --url='https://piwik.mydomain'

But the cron job still delivers this error message:

/usr/bin/env: php: No such file or directory

The same error appears when I change the cron job to this syntax:

/console core:archive --force-all-websites --process_new_segments_from=beginning_of_time --url='https://piwik.mydomain

According to my server provider, /usr/bin/env php is working and delivers a PHP version:

[root@host01 ~]# /usr/bin/env php -v
PHP 7.3.33 (cli) (built: Nov 22 2021 11:56:49) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies
    with the ionCube PHP Loader + ionCube24 v10.4.5, Copyright (c) 2002-2020, by ionCube Ltd.
    with Zend OPcache v7.3.33, Copyright (c) 1999-2018, by Zend Technologies

What is wrong with the changed parameter process_new_segments_from in my cron job syntax?

Or is it possible that the parameter force-all-websites became also outdated?

Before 24 April, both parameters and the whole cron job syntax were working perfectly.

If ./console doesn’t work, you can also run php console directly and that way make it unambigous which PHP binary to use.

Would the cron job syntax then be like this:

/php console core:archive --force-all-websites --process_new_segments_from=beginning_of_time --url='https://piwik.mydomain

– or somehow different?

There is no --process_new_segments_from command line option to console as the script displays when you try to run it.

So I’d recommend you to first run the process once manually, see if the command works and if it does put it in your crontab

This is really surprising.

Until 24 April I had a perfectly working cron job with this syntax:

/console core:archive --force-all-websites --force-date-last-n=1000 --url=https://piwik.mydomain

Some days before 24 April this cron job gave already a warning message:

"force-date-last-n" is deprecated. Please use the "process_new_segments_from" INI configuration option instead.

Since 24 April this cron job gives only an error message:

/usr/bin/env: php: No such file or directory

According to my server provider, php in this directory is intact, but there could be something with the cron job parameters.

If I consider the cron job warning messages before 24 April, I supposed that I should replace the parameter "force-date-last-n" by the parameter "process_new_segments_from".

But now I have to see, that this recommended parameter "process_new_segments_from" even doesn’t exist.

Unfortunately I have no direct acccess to a server console. I can only try to change my existing cron job and replace the outdated parameter “--force-date-last-n=1000” by a working parameter.

But if I read your screenshot correctly, the allegedly deprecated parameter “--force-date-last-n” is still listed among the valid Matomo archive parameters.

So I am wondering why Matomo or my server gave warning messages before 24 April that “force-date-last-n” is deprecated.

If it is not deprecated, my old cron job syntax should be working on your system. Do you have the time to try a command like this on your server?:

... php console core:archive --force-all-websites --force-date-last-n=1000 ...

Update: Now I have tried again to use my old cron job syntax:

/console core:archive --force-all-websites --force-date-last-n=1000 --url='https://piwik.mydomain

Surprise: It worked again!

Nevertheless, the cron job sends again this warning message:

“force-date-last-n” is deprecated. Please use the “process_new_segments_from” INI configuration option instead.

Is it a message from Matomo?

According to my server provider, the warning message

“force-date-last-n” is deprecated. Please use the “process_new_segments_from” INI configuration option instead.

comes directly from Matomo: /plugins/CoreConsole/Commands/CoreArchiver.php

 if($input->getOption('force-date-last-n')) {
            $message = '"force-date-last-n" is deprecated. Please use the "process_new_segments_from" INI configuration option instead.';
            $output->writeln('<comment>' . $message .'</comment>');
        }

This warning message was misleading for me when I tried to find the reason why my cron job didn’t work from 24 April.

From my point of view, this warning message is wrong. In order to avoid further misunderstandings, it should not be produced anymore.