class prune_shadow_topics extends base implements parametrized

Prune one forum of its shadow topics cron task.

It is intended to be used when cron is invoked via web. This task can decide whether it should be run using data obtained by viewforum code, without making additional database queries.

Properties

protected $phpbb_root_path
protected $php_ext
protected $config
protected $db
protected $log
protected $user
protected $forum_data

If $forum_data is given, it is assumed to contain necessary information about a single forum that is to be pruned.

Methods

string
get_name()

Returns the name of the task.

from  base
set_name(string $name)

Sets the name of the task.

from  base
bool
is_runnable()

Returns whether this cron task can run, given current board configuration.

bool
should_run()

Returns whether this cron task should run now, because enough time has passed since it was last run.

__construct(string $phpbb_root_path, string $php_ext, config $config, driver_interface $db, log $log, user $user)

Constructor.

set_forum_data(array $forum_data)

Manually set forum data.

null
run()

Runs this cron task.

array
get_parameters()

Returns parameters of this cron task as an array.

null
parse_parameters(request_interface $request)

Parses parameters found in $request, which is an instance of \phpbb\request\request_interface.

null
auto_prune_shadow_topics(int $forum_id, string $prune_mode, int $prune_flags, int $prune_days, int $prune_freq)

Automatically prune shadow topics Based on fuunction auto_prune()

Details

in base at line 34
string get_name()

Returns the name of the task.

Return Value

string

Name of wrapped task.

in base at line 44
set_name(string $name)

Sets the name of the task.

Parameters

string $name

The task name

at line 101
bool is_runnable()

Returns whether this cron task can run, given current board configuration.

This cron task will not run when system cron is utilised, as in such cases prune_all_forums task would run instead.

Additionally, this task must be given the forum data, either via the constructor or parse_parameters method.

Return Value

bool

at line 114
bool should_run()

Returns whether this cron task should run now, because enough time has passed since it was last run.

Forum pruning interval is specified in the forum data.

Return Value

bool

at line 52
__construct(string $phpbb_root_path, string $php_ext, config $config, driver_interface $db, log $log, user $user)

Constructor.

Parameters

string $phpbb_root_path

The root path

string $php_ext

PHP file extension

config $config

The config

driver_interface $db

The db connection

log $log

The phpBB log system

user $user

The phpBB user object

at line 67
set_forum_data(array $forum_data)

Manually set forum data.

Parameters

array $forum_data

Information about a forum to be pruned.

at line 77
null run()

Runs this cron task.

Return Value

null

at line 125
array get_parameters()

Returns parameters of this cron task as an array.

The array has one key, f, whose value is id of the forum to be pruned.

Return Value

array

at line 140
null parse_parameters(request_interface $request)

Parses parameters found in $request, which is an instance of \phpbb\request\request_interface.

It is expected to have a key f whose value is id of the forum to be pruned.

Parameters

request_interface $request

Request object.

Return Value

null

at line 171
protected null auto_prune_shadow_topics(int $forum_id, string $prune_mode, int $prune_flags, int $prune_days, int $prune_freq)

Automatically prune shadow topics Based on fuunction auto_prune()

Parameters

int $forum_id

Forum ID of forum that should be pruned

string $prune_mode

Prune mode

int $prune_flags

Prune flags

int $prune_days

Prune date in days

int $prune_freq

Prune frequency

Return Value

null