Jake B.
Well-known member
- Affected version
- 2.2.9
Currently if the daily stats need to be rebuilt for some reason (such as importing from another software) it cannot be done through the CLI, and you are required to sit with your browser open while it runs which can take quite some time on sites that have been around for more than a few years and have a lot of content. The following CLI command definition resolves this issue:
PHP:
<?php
namespace XF\Cli\Command\Rebuild;
use Symfony\Component\Console\Input\InputOption;
class RebuildStats extends AbstractRebuildCommand
{
protected function getRebuildName()
{
return 'stats';
}
protected function getRebuildDescription()
{
return 'Rebuilds daily statistics.';
}
protected function getRebuildClass()
{
return 'XF:Stats';
}
protected function configureOptions()
{
$this
->addOption(
'delete',
null,
InputOption::VALUE_NONE,
'Delete existing cached data. Default: false'
);
}
}