@@ -108,13 +108,10 @@ public function get_total()
108108
109109 $ sql = 'SELECT COUNT(r.revision_id) AS cnt
110110 FROM ' . $ this ->contribs_table . ' c, ' .
111- $ this ->revisions_table . ' r, ' .
112- $ this ->revisions_phpbb_table . ' rp
111+ $ this ->revisions_table . ' r
113112 WHERE c.contrib_id = r.contrib_id
114- AND r.revision_id = rp.revision_id
115113 AND c.contrib_status = ' . ext::TITANIA_CONTRIB_APPROVED . '
116114 AND r.revision_status = ' . ext::TITANIA_REVISION_APPROVED . '
117- AND rp.phpbb_version_branch >= ' . ext::TITANIA_REPOSITORY_MIN_PHPBB_BRANCH . '
118115 AND ' . $ this ->db ->sql_in_set ('c.contrib_type ' , $ types );
119116 $ this ->db ->sql_query ($ sql );
120117 $ this ->total = (int ) $ this ->db ->sql_fetchfield ('cnt ' );
@@ -146,7 +143,7 @@ protected function get_batch($fetch_attach_data)
146143 }
147144
148145 $ sql = 'SELECT c.contrib_id, c.contrib_name_clean, c.contrib_type, r.revision_id,
149- r.attachment_id, r.revision_composer_json ' . $ attach_fields . '
146+ r.attachment_id, r.revision_composer_json, rp.phpbb_version_branch ' . $ attach_fields . '
150147 FROM ' . $ this ->contribs_table . ' c, ' .
151148 $ this ->revisions_table . ' r, ' .
152149 $ this ->revisions_phpbb_table . ' rp ' .
@@ -156,7 +153,6 @@ protected function get_batch($fetch_attach_data)
156153 $ attach_where . '
157154 AND c.contrib_status = ' . ext::TITANIA_CONTRIB_APPROVED . '
158155 AND r.revision_status = ' . ext::TITANIA_REVISION_APPROVED . '
159- AND rp.phpbb_version_branch >= ' . ext::TITANIA_REPOSITORY_MIN_PHPBB_BRANCH . '
160156 AND ' . $ this ->db ->sql_in_set ('c.contrib_type ' , $ types ) . '
161157 ORDER BY c.contrib_id ASC, r.revision_id ASC ' ;
162158 $ result = $ this ->db ->sql_query_limit ($ sql , $ this ->limit , $ this ->start );
@@ -201,6 +197,7 @@ public function run($from_file = false, $force = false, $progress = null)
201197
202198 $ last_type = $ last_contrib = '' ;
203199 $ packages = array ();
200+ $ packages_phpbb4_only = array ();
204201
205202 foreach ($ batch as $ contrib_id => $ revisions )
206203 {
@@ -255,6 +252,17 @@ public function run($from_file = false, $force = false, $progress = null)
255252 $ download_url ,
256253 $ contrib_url
257254 );
255+
256+ if ($ revision ['phpbb_version_branch ' ] >= ext::TITANIA_REPOSITORY_MIN_PHPBB_BRANCH )
257+ {
258+ $ packages_phpbb4_only = $ this ->repo ->set_release (
259+ $ packages_phpbb4_only ,
260+ $ revision ['revision_composer_json ' ],
261+ $ download_url ,
262+ $ contrib_url
263+ );
264+ }
265+
258266 unset($ batch [$ contrib_id ][$ index ]);
259267 }
260268
@@ -266,15 +274,18 @@ public function run($from_file = false, $force = false, $progress = null)
266274 if (($ group_count % 50 ) === 0 )
267275 {
268276 $ this ->dump_include ($ last_type , $ group , $ packages );
277+ $ this ->dump_include ($ last_type , $ group , $ packages_phpbb4_only , ext::TITANIA_REPOSITORY_MIN_PHPBB_BRANCH );
269278 $ group_count = 0 ;
270279 $ group ++;
271280 $ packages = array ();
281+ $ packages_phpbb4_only = array ();
272282 }
273283 $ group_count ++;
274284 }
275285 if (!empty ($ packages ))
276286 {
277287 $ this ->dump_include ($ last_type , $ group , $ packages );
288+ $ this ->dump_include ($ last_type , $ group , $ packages_phpbb4_only , ext::TITANIA_REPOSITORY_MIN_PHPBB_BRANCH );
278289 }
279290
280291 $ next_batch = $ this ->limit ? $ this ->start + $ this ->limit : $ this ->get_total ();
@@ -297,11 +308,13 @@ public function run($from_file = false, $force = false, $progress = null)
297308 * @param string $type Contrib type name
298309 * @param int $group Group id
299310 * @param array $packages Packages
311+ * @param string $suffix Optional suffix for filename
300312 */
301- protected function dump_include ($ type , $ group , array $ packages )
313+ protected function dump_include ($ type , $ group , array $ packages, $ prefix = '' )
302314 {
303315 $ type_name = $ this ->types ->get ($ type )->name ;
304- $ this ->repo ->dump_include ("packages- $ type_name- $ group.json " , $ packages );
316+ $ filename = $ prefix ? "packages- $ prefix- $ type_name- $ group.json " : "packages- $ type_name- $ group.json " ;
317+ $ this ->repo ->dump_include ($ filename , $ packages );
305318 }
306319
307320 /**
0 commit comments