1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* Advanced BBCode Box |
5
|
|
|
* |
6
|
|
|
* @copyright (c) 2018 Matt Friedman |
7
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0) |
8
|
|
|
* |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace vse\abbc3\migrations; |
12
|
|
|
|
13
|
|
|
use phpbb\db\migration\container_aware_migration; |
14
|
|
|
|
15
|
|
|
class v320_m10_reparse extends container_aware_migration |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* {@inheritdoc} |
19
|
|
|
*/ |
20
|
|
|
public static function depends_on() |
21
|
|
|
{ |
22
|
|
|
return array( |
23
|
|
|
'\vse\abbc3\migrations\v320_m9_delete_bbcodes', |
24
|
|
|
'\phpbb\db\migration\data\v320\text_reparser', |
25
|
|
|
); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* {@inheritdoc} |
30
|
|
|
*/ |
31
|
|
|
public function effectively_installed() |
32
|
|
|
{ |
33
|
|
|
return $this->config->offsetExists('abbc3_reparse'); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* {@inheritdoc} |
38
|
|
|
*/ |
39
|
|
|
public function update_data() |
40
|
|
|
{ |
41
|
|
|
return array( |
42
|
|
|
array('config.add', array('abbc3_reparse', time())), |
43
|
|
|
array('if', array( |
44
|
|
|
$this->config->offsetExists('reparse_lock'), |
45
|
|
|
array('config.remove', array('reparse_lock', 0)), |
46
|
|
|
)), |
47
|
|
|
array('if', array( |
48
|
|
|
!$this->config->offsetExists('text_reparser.pm_text_last_cron'), |
49
|
|
|
array('config.add', array('text_reparser.pm_text_last_cron', 0)), |
50
|
|
|
)), |
51
|
|
|
array('if', array( |
52
|
|
|
!$this->config->offsetExists('text_reparser.pm_text_cron_interval'), |
53
|
|
|
array('config.add', array('text_reparser.pm_text_cron_interval', 10)), |
54
|
|
|
)), |
55
|
|
|
array('if', array( |
56
|
|
|
!$this->config->offsetExists('text_reparser.post_text_last_cron'), |
57
|
|
|
array('config.add', array('text_reparser.post_text_last_cron', 0)), |
58
|
|
|
)), |
59
|
|
|
array('if', array( |
60
|
|
|
!$this->config->offsetExists('text_reparser.post_text_cron_interval'), |
61
|
|
|
array('config.add', array('text_reparser.post_text_cron_interval', 10)), |
62
|
|
|
)), |
63
|
|
|
array('custom', array(array($this, 'reset_reparsers'))), |
64
|
|
|
); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Initialize post/pm reparsers |
69
|
|
|
*/ |
70
|
|
|
public function reset_reparsers() |
71
|
|
|
{ |
72
|
|
|
/** @var \phpbb\textreparser\manager $reparser_manager */ |
73
|
|
|
$reparser_manager = $this->container->get('text_reparser.manager'); |
74
|
|
|
|
75
|
|
|
/** @var \phpbb\di\service_collection $reparsers */ |
76
|
|
|
$reparsers = $this->container->get('text_reparser_collection'); |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @var string $name |
80
|
|
|
* @var \phpbb\textreparser\reparser_interface $reparser |
81
|
|
|
*/ |
82
|
|
|
foreach ($reparsers as $name => $reparser) |
83
|
|
|
{ |
84
|
|
|
if (in_array($name, ['text_reparser.post_text', 'text_reparser.pm_text'])) |
85
|
|
|
{ |
86
|
|
|
$reparser_manager->update_resume_data($name, 1, $reparser->get_max_id(), 100); |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|