@@ -38,10 +38,9 @@ public function getDescription(): string
38
38
return 'Masi - Migrate RealUrl pages.tx_realurl_exclude field to Masi pages.exclude_slug_for_subpages ' ;
39
39
}
40
40
41
- public function executeUpdate (): bool
41
+ protected function getExistingExcludedPages (): array
42
42
{
43
43
$ conn = GeneralUtility::makeInstance (ConnectionPool::class)->getConnectionForTable ('pages ' );
44
-
45
44
$ queryBuilder = $ conn ->createQueryBuilder ();
46
45
$ queryBuilder ->getRestrictions ()->removeAll ();
47
46
$ existingRows = $ queryBuilder
@@ -55,8 +54,18 @@ public function executeUpdate(): bool
55
54
)
56
55
->execute ()
57
56
->fetchAll ();
57
+
58
+ return array_column ($ existingRows , 'uid ' );
59
+
60
+ }
61
+
62
+ public function executeUpdate (): bool
63
+ {
64
+ $ conn = GeneralUtility::makeInstance (ConnectionPool::class)->getConnectionForTable ('pages ' );
65
+ $ queryBuilder = $ conn ->createQueryBuilder ();
66
+ $ queryBuilder ->getRestrictions ()->removeAll ();
58
67
59
- $ existingPages = array_column ( $ existingRows , ' uid ' );
68
+ $ existingPages = $ this -> getExistingExcludedPages ( );
60
69
61
70
$ conn ->createQueryBuilder ()
62
71
->update ('pages ' )
@@ -77,7 +86,7 @@ public function executeUpdate(): bool
77
86
return true ;
78
87
}
79
88
80
- public function updateNecessary (): bool
89
+ protected function doesRealurlFieldExist (): bool
81
90
{
82
91
$ conn = GeneralUtility::makeInstance (ConnectionPool::class)->getConnectionForTable ('pages ' );
83
92
$ columns = $ conn ->getSchemaManager ()->listTableColumns ('pages ' );
@@ -89,6 +98,15 @@ public function updateNecessary(): bool
89
98
return false ;
90
99
}
91
100
101
+ /**
102
+ * Upgrade is necessary if the environment has the "tx_realurl_exclude" column and
103
+ * there is at least one page having this field set to "1", else skip the wizard
104
+ */
105
+ public function updateNecessary (): bool
106
+ {
107
+ return $ this ->doesRealurlFieldExist () && count ($ this ->getExistingExcludedPages ()) > 0 ;
108
+ }
109
+
92
110
public function getPrerequisites (): array
93
111
{
94
112
return [
0 commit comments