|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* |
|
4
|
|
|
* Advanced BBCode Box |
|
5
|
|
|
* |
|
6
|
|
|
* @copyright (c) 2023 Matt Friedman |
|
7
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0) |
|
8
|
|
|
* |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace vse\abbc3\migrations; |
|
12
|
|
|
|
|
13
|
|
|
class v336_m17_unparse extends \phpbb\db\migration\container_aware_migration |
|
|
|
|
|
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* {@inheritdoc} |
|
17
|
|
|
*/ |
|
18
|
|
|
public static function depends_on() |
|
19
|
|
|
{ |
|
20
|
|
|
return [ |
|
21
|
|
|
'\vse\abbc3\migrations\v322_m11_reparse', |
|
22
|
|
|
]; |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* We don't need to reparse posts if this is a completely fresh install, so |
|
27
|
|
|
* this migration will check for that and if it is totally fresh, it will undo |
|
28
|
|
|
* the changes from v322_m11_reparse. |
|
29
|
|
|
* |
|
30
|
|
|
* {@inheritdoc} |
|
31
|
|
|
*/ |
|
32
|
|
|
public function effectively_installed() |
|
33
|
|
|
{ |
|
34
|
|
|
// Check if very first migration was skipped (proves we're not updating ABBC3 3.0) |
|
35
|
|
|
$sql = 'SELECT 1 as no_30 |
|
36
|
|
|
FROM ' . $this->table_prefix . "migrations |
|
37
|
|
|
WHERE migration_name = '\\\\vse\\\\abbc3\\\\migrations\\\\v310_m1_remove_data' |
|
38
|
|
|
AND migration_start_time = 0 |
|
39
|
|
|
AND migration_end_time = 0"; |
|
40
|
|
|
$result = $this->db->sql_query_limit($sql, 1); |
|
41
|
|
|
$no_30 = (bool) $this->db->sql_fetchfield('no_30'); |
|
42
|
|
|
$this->db->sql_freeresult($result); |
|
43
|
|
|
|
|
44
|
|
|
// Check if any ABBC3 v310 migrations were installed less than a minute ago (proves we're not updating ABBC3 3.1) |
|
45
|
|
|
$sql = 'SELECT 1 as fresh_install |
|
46
|
|
|
FROM ' . $this->table_prefix . 'migrations |
|
47
|
|
|
WHERE migration_name ' . $this->db->sql_like_expression('\\\\vse\\\\abbc3\\\\migrations\\\\v310' . $this->db->get_any_char()) . ' |
|
48
|
|
|
AND migration_start_time >= ' . (time() - 60); |
|
49
|
|
|
$result = $this->db->sql_query_limit($sql, 1); |
|
50
|
|
|
$fresh_install = (bool) $this->db->sql_fetchfield('fresh_install'); |
|
51
|
|
|
$this->db->sql_freeresult($result); |
|
52
|
|
|
|
|
53
|
|
|
return !($no_30 && $fresh_install); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* {@inheritdoc} |
|
58
|
|
|
*/ |
|
59
|
|
|
public function update_data() |
|
60
|
|
|
{ |
|
61
|
|
|
return [ |
|
62
|
|
|
['config.remove', ['abbc3_reparse']], |
|
63
|
|
|
['if', [ |
|
64
|
|
|
$this->config->offsetExists('text_reparser.pm_text_last_cron') && $this->config->offsetGet('text_reparser.pm_text_last_cron') == 0, |
|
65
|
|
|
['config.remove', ['text_reparser.pm_text_last_cron']], |
|
66
|
|
|
]], |
|
67
|
|
|
['if', [ |
|
68
|
|
|
$this->config->offsetExists('text_reparser.post_text_last_cron') && $this->config->offsetGet('text_reparser.post_text_last_cron') == 0, |
|
69
|
|
|
['config.remove', ['text_reparser.post_text_last_cron']], |
|
70
|
|
|
]], |
|
71
|
|
|
['if', [ |
|
72
|
|
|
!$this->config->offsetExists('text_reparser.pm_text_last_cron'), |
|
73
|
|
|
['config.remove', ['text_reparser.pm_text_cron_interval']], |
|
74
|
|
|
]], |
|
75
|
|
|
['if', [ |
|
76
|
|
|
!$this->config->offsetExists('text_reparser.post_text_last_cron'), |
|
77
|
|
|
['config.remove', ['text_reparser.post_text_cron_interval']], |
|
78
|
|
|
]], |
|
79
|
|
|
['custom', [[$this, 'clear_reparsers']]], |
|
80
|
|
|
]; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Prevent CLI command from wanting to run post and pm re-parsers |
|
85
|
|
|
* after ABBC3 installation. |
|
86
|
|
|
* |
|
87
|
|
|
* @return void |
|
88
|
|
|
*/ |
|
89
|
|
|
public function clear_reparsers() |
|
90
|
|
|
{ |
|
91
|
|
|
/** @var \phpbb\textreparser\manager $reparser_manager */ |
|
92
|
|
|
$reparser_manager = $this->container->get('text_reparser.manager'); |
|
93
|
|
|
|
|
94
|
|
|
/** @var \phpbb\di\service_collection $reparsers */ |
|
95
|
|
|
$reparsers = $this->container->get('text_reparser_collection'); |
|
96
|
|
|
|
|
97
|
|
|
foreach ($reparsers as $name => $reparser) |
|
98
|
|
|
{ |
|
99
|
|
|
if (in_array($name, ['text_reparser.post_text', 'text_reparser.pm_text'])) |
|
100
|
|
|
{ |
|
101
|
|
|
$resume_data = $reparser_manager->get_resume_data($name); |
|
102
|
|
|
|
|
103
|
|
|
if (!empty($resume_data['range-max'])) |
|
104
|
|
|
{ |
|
105
|
|
|
$reparser_manager->update_resume_data($name, 1, 0, 100); |
|
106
|
|
|
} |
|
107
|
|
|
} |
|
108
|
|
|
} |
|
109
|
|
|
} |
|
110
|
|
|
} |
|
111
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths