Skip to content

Commit 204af99

Browse files
authored
Merge pull request #392 from iMattPro/fix-cli-commands
fix: various updates/fixes for failing Tool commands
2 parents 4764541 + 75a02bc commit 204af99

File tree

8 files changed

+28
-27
lines changed

8 files changed

+28
-27
lines changed

console/command/composer/rebuild_repo.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use phpbb\titania\manage\tool\composer\rebuild_repo as rebuild_tool;
1717
use phpbb\user;
18+
use Symfony\Component\Console\Helper\ProgressBar;
1819
use Symfony\Component\Console\Input\InputArgument;
1920
use Symfony\Component\Console\Input\InputInterface;
2021
use Symfony\Component\Console\Input\InputOption;
@@ -74,8 +75,8 @@ protected function configure()
7475
*/
7576
protected function execute(InputInterface $input, OutputInterface $output)
7677
{
77-
$progress = $this->getHelper('progress');
78-
$progress->start($output, $this->tool->get_total());
78+
$progress = new ProgressBar($output, $this->tool->get_total());
79+
$progress->start();
7980

8081
$result = $this->tool
8182
->set_start(0)

manage/tool/composer/rebuild_repo.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
use phpbb\titania\entity\package;
2323
use phpbb\titania\ext;
2424
use phpbb\titania\manage\tool\base;
25-
use Symfony\Component\Console\Helper\ProgressHelper;
25+
use Symfony\Component\Console\Helper\ProgressBar;
2626
use Symfony\Component\Finder\SplFileInfo;
2727

2828
class rebuild_repo extends base
@@ -175,7 +175,7 @@ protected function get_batch($fetch_attach_data)
175175
* from the revision zip files
176176
* @param bool|false $force Force tool to run if a build is already
177177
* in progress
178-
* @param ProgressHelper|null $progress
178+
* @param ProgressBar|null $progress
179179
* @return array
180180
*/
181181
public function run($from_file = false, $force = false, $progress = null)
@@ -268,7 +268,7 @@ public function run($from_file = false, $force = false, $progress = null)
268268
$this->dump_include($last_type, $group, $packages);
269269
}
270270

271-
$next_batch = $this->start + $this->limit;
271+
$next_batch = $this->limit ? $this->start + $this->limit : $this->get_total();
272272

273273
if ($next_batch >= $this->get_total())
274274
{

manage/tool/contribution/resync_count.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use phpbb\titania\ext;
2020
use phpbb\titania\manage\tool\base;
2121
use phpbb\user;
22-
use Symfony\Component\Console\Helper\ProgressHelper;
22+
use Symfony\Component\Console\Helper\ProgressBar;
2323

2424
class resync_count extends base
2525
{
@@ -74,7 +74,7 @@ public function __construct(db_driver_interface $db, type_collection $types, use
7474
* Run the tool
7575
*
7676
* @param int $prev_contrib Previous contrib that was resynced
77-
* @param ProgressHelper|null $progress
77+
* @param ProgressBar|null $progress
7878
* @return array
7979
*/
8080
public function run($prev_contrib = 0, $progress = null)
@@ -208,7 +208,7 @@ public function get_total()
208208
);
209209
$sql = $this->db->sql_build_query('SELECT', $sql_ary);
210210
$result = $this->db->sql_query($sql);
211-
$this->total = (int) $this->db->sql_fetchfield('cnt', $result);
211+
$this->total = (int) $this->db->sql_fetchfield('cnt');
212212
$this->db->sql_freeresult($result);
213213
}
214214

manage/tool/contribution/update_release_topics.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use phpbb\titania\manage\tool\base;
2121
use phpbb\titania\versions;
2222
use phpbb\user;
23-
use Symfony\Component\Console\Helper\ProgressHelper;
23+
use Symfony\Component\Console\Helper\ProgressBar;
2424

2525
class update_release_topics extends base
2626
{
@@ -93,7 +93,7 @@ public function get_total()
9393
)) . '
9494
AND ' . $this->db->sql_in_set('contrib_type', $types);
9595
$result = $this->db->sql_query($sql);
96-
$this->total = (int) $this->db->sql_fetchfield('cnt', $result);
96+
$this->total = (int) $this->db->sql_fetchfield('cnt');
9797
$this->db->sql_freeresult($result);
9898
}
9999
else
@@ -194,7 +194,7 @@ protected function get_applicable_types()
194194
/**
195195
* Run the tool
196196
*
197-
* @param ProgressHelper|null $progress
197+
* @param ProgressBar|null $progress
198198
* @return array
199199
*/
200200
public function run($progress = null)

manage/tool/search/reindex.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use phpbb\titania\search\manager as search_manager;
2020
use phpbb\titania\sync;
2121
use phpbb\user;
22-
use Symfony\Component\Console\Helper\ProgressHelper;
22+
use Symfony\Component\Console\Helper\ProgressBar;
2323

2424
class reindex extends base
2525
{
@@ -114,7 +114,7 @@ protected function get_contrib_count()
114114
$sql = 'SELECT COUNT(contrib_id) AS cnt
115115
FROM ' . $this->contribs_table;
116116
$result = $this->db->sql_query($sql);
117-
$total = (int) $this->db->sql_fetchfield('cnt', $result);
117+
$total = (int) $this->db->sql_fetchfield('cnt');
118118
$this->db->sql_freeresult($result);
119119

120120
return $total;
@@ -130,7 +130,7 @@ protected function get_faq_count()
130130
$sql = 'SELECT COUNT(faq_id) AS cnt
131131
FROM ' . $this->contrib_faq_table;
132132
$result = $this->db->sql_query($sql);
133-
$total = (int) $this->db->sql_fetchfield('cnt', $result);
133+
$total = (int) $this->db->sql_fetchfield('cnt');
134134
$this->db->sql_freeresult($result);
135135

136136
return $total;
@@ -146,7 +146,7 @@ protected function get_post_count()
146146
$sql = 'SELECT COUNT(post_id) AS cnt
147147
FROM ' . $this->posts_table;
148148
$result = $this->db->sql_query($sql);
149-
$total = (int) $this->db->sql_fetchfield('cnt', $result);
149+
$total = (int) $this->db->sql_fetchfield('cnt');
150150
$this->db->sql_freeresult($result);
151151

152152
return $total;
@@ -155,7 +155,7 @@ protected function get_post_count()
155155
/**
156156
* Run tool
157157
*
158-
* @param ProgressHelper|null $progress
158+
* @param ProgressBar|null $progress
159159
* @return array
160160
*/
161161
public function run($progress = null)

manage/tool/topic/rebuild_urls.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use phpbb\titania\ext;
2121
use phpbb\titania\manage\tool\base;
2222
use phpbb\user;
23-
use Symfony\Component\Console\Helper\ProgressHelper;
23+
use Symfony\Component\Console\Helper\ProgressBar;
2424

2525
class rebuild_urls extends base
2626
{
@@ -75,7 +75,7 @@ public function __construct(db_driver_interface $db, user $user, type_collection
7575
/**
7676
* Run tool.
7777
*
78-
* @param ProgressHelper|null $progress
78+
* @param ProgressBar|null $progress
7979
* @return array
8080
*/
8181
public function run($progress = null)

manage/tool/topic/resync_dots.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use phpbb\titania\config\config as ext_config;
1919
use phpbb\titania\manage\tool\base;
2020
use phpbb\user;
21-
use Symfony\Component\Console\Helper\ProgressHelper;
21+
use Symfony\Component\Console\Helper\ProgressBar;
2222

2323
class resync_dots extends base
2424
{
@@ -68,7 +68,7 @@ public function get_total()
6868
WHERE post_approved = 1
6969
AND post_deleted = 0';
7070
$result = $this->db->sql_query($sql);
71-
$this->total = (int) $this->db->sql_fetchfield('cnt', $result);
71+
$this->total = (int) $this->db->sql_fetchfield('cnt');
7272
$this->db->sql_freeresult($result);
7373
}
7474

@@ -96,7 +96,7 @@ protected function get_batch()
9696
/**
9797
* Run the tool
9898
*
99-
* @param ProgressHelper|null $progress
99+
* @param ProgressBar|null $progress
100100
* @return array
101101
*/
102102
public function run($progress = null)

sync.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public function contribs($mode, $contrib_id = false, $start = false, $limit = fa
252252
WHERE contrib_id = ' . $row['contrib_id'] . '
253253
AND revision_status = ' . ext::TITANIA_REVISION_APPROVED;
254254
$result1 = $this->db->sql_query($sql);
255-
$cnt = $this->db->sql_fetchfield('cnt', $result1);
255+
$cnt = $this->db->sql_fetchfield('cnt', false, $result1);
256256
$this->db->sql_freeresult($result1);
257257

258258
if (($cnt > 0 && $row['contrib_status'] == ext::TITANIA_CONTRIB_NEW) || ($cnt == 0 && $row['contrib_status'] == ext::TITANIA_CONTRIB_APPROVED))
@@ -631,7 +631,7 @@ public function _get_post_count($topic_id)
631631
AND post_deleted = 0
632632
AND post_approved = 1';
633633
$result = $this->db->sql_query($sql);
634-
$teams = $this->db->sql_fetchfield('cnt', $result);
634+
$teams = $this->db->sql_fetchfield('cnt', false, $result);
635635
$this->db->sql_freeresult($result);
636636

637637
$sql = 'SELECT COUNT(post_id) AS cnt
@@ -641,7 +641,7 @@ public function _get_post_count($topic_id)
641641
AND post_deleted = 0
642642
AND post_approved = 1';
643643
$result = $this->db->sql_query($sql);
644-
$authors = $this->db->sql_fetchfield('cnt', $result);
644+
$authors = $this->db->sql_fetchfield('cnt', false, $result);
645645
$this->db->sql_freeresult($result);
646646

647647
$sql = 'SELECT COUNT(post_id) AS cnt
@@ -651,15 +651,15 @@ public function _get_post_count($topic_id)
651651
AND post_deleted = 0
652652
AND post_approved = 1';
653653
$result = $this->db->sql_query($sql);
654-
$public = $this->db->sql_fetchfield('cnt', $result);
654+
$public = $this->db->sql_fetchfield('cnt', false, $result);
655655
$this->db->sql_freeresult($result);
656656

657657
$sql = 'SELECT COUNT(post_id) AS cnt
658658
FROM ' . $this->posts_table . '
659659
WHERE topic_id = ' . (int) $topic_id . '
660660
AND post_deleted <> 0';
661661
$result = $this->db->sql_query($sql);
662-
$deleted = $this->db->sql_fetchfield('cnt', $result);
662+
$deleted = $this->db->sql_fetchfield('cnt', false, $result);
663663
$this->db->sql_freeresult($result);
664664

665665
$sql = 'SELECT COUNT(post_id) AS cnt
@@ -668,7 +668,7 @@ public function _get_post_count($topic_id)
668668
AND post_deleted = 0
669669
AND post_approved = 0';
670670
$result = $this->db->sql_query($sql);
671-
$unapproved = $this->db->sql_fetchfield('cnt', $result);
671+
$unapproved = $this->db->sql_fetchfield('cnt', false, $result);
672672
$this->db->sql_freeresult($result);
673673

674674
return count::to_db(array(

0 commit comments

Comments
 (0)