2323use phpbb \titania \ext ;
2424use phpbb \titania \manage \tool \base ;
2525use Symfony \Component \Console \Helper \ProgressBar ;
26- use Symfony \Component \Finder \SplFileInfo ;
2726
2827class rebuild_repo extends base
2928{
@@ -57,6 +56,9 @@ class rebuild_repo extends base
5756 /** @var string */
5857 protected $ revisions_table ;
5958
59+ /** @var string */
60+ protected $ revisions_phpbb_table ;
61+
6062 /** @var int */
6163 protected $ total ;
6264
@@ -84,6 +86,7 @@ public function __construct(db_driver_interface $db, ext_config $ext_config, typ
8486 $ this ->attachments_table = $ table_prefix . 'attachments ' ;
8587 $ this ->contribs_table = $ table_prefix . 'contribs ' ;
8688 $ this ->revisions_table = $ table_prefix . 'revisions ' ;
89+ $ this ->revisions_phpbb_table = $ table_prefix . 'revisions_phpbb ' ;
8790 }
8891
8992 /**
@@ -105,10 +108,13 @@ public function get_total()
105108
106109 $ sql = 'SELECT COUNT(r.revision_id) AS cnt
107110 FROM ' . $ this ->contribs_table . ' c, ' .
108- $ this ->revisions_table . ' r
111+ $ this ->revisions_table . ' r, ' .
112+ $ this ->revisions_phpbb_table . ' rp
109113 WHERE c.contrib_id = r.contrib_id
114+ AND r.revision_id = rp.revision_id
110115 AND c.contrib_status = ' . ext::TITANIA_CONTRIB_APPROVED . '
111116 AND r.revision_status = ' . ext::TITANIA_REVISION_APPROVED . '
117+ AND rp.phpbb_version_branch >= ' . ext::TITANIA_REPOSITORY_MIN_PHPBB_BRANCH . '
112118 AND ' . $ this ->db ->sql_in_set ('c.contrib_type ' , $ types );
113119 $ this ->db ->sql_query ($ sql );
114120 $ this ->total = (int ) $ this ->db ->sql_fetchfield ('cnt ' );
@@ -142,12 +148,15 @@ protected function get_batch($fetch_attach_data)
142148 $ sql = 'SELECT c.contrib_id, c.contrib_name_clean, c.contrib_type, r.revision_id,
143149 r.attachment_id, r.revision_composer_json ' . $ attach_fields . '
144150 FROM ' . $ this ->contribs_table . ' c, ' .
145- $ this ->revisions_table . ' r ' .
151+ $ this ->revisions_table . ' r, ' .
152+ $ this ->revisions_phpbb_table . ' rp ' .
146153 $ attach_table . '
147- WHERE c.contrib_id = r.contrib_id ' .
154+ WHERE c.contrib_id = r.contrib_id
155+ AND r.revision_id = rp.revision_id ' .
148156 $ attach_where . '
149157 AND c.contrib_status = ' . ext::TITANIA_CONTRIB_APPROVED . '
150158 AND r.revision_status = ' . ext::TITANIA_REVISION_APPROVED . '
159+ AND rp.phpbb_version_branch >= ' . ext::TITANIA_REPOSITORY_MIN_PHPBB_BRANCH . '
151160 AND ' . $ this ->db ->sql_in_set ('c.contrib_type ' , $ types ) . '
152161 ORDER BY c.contrib_id ASC, r.revision_id ASC ' ;
153162 $ result = $ this ->db ->sql_query_limit ($ sql , $ this ->limit , $ this ->start );
0 commit comments