| @@ -104,9 +104,11 @@ | ||
| 104 | 104 | 'count' => \FluentCommunity\App\Models\Comment::count() |
| 105 | 105 | ], |
| 106 | 106 | [ |
| 107 | 107 | 'key' => 'Total Reactions', |
| 108 | - 'count' => \FluentCommunity\App\Models\Reaction::count() | |
| 108 | + 'count' => \FluentCommunity\App\Models\Reaction::whereIn('object_type', ['feed', 'comment']) | |
| 109 | + ->where('type', 'like') | |
| 110 | + ->count() | |
| 109 | 111 | ] |
| 110 | 112 | ]; |
| 111 | 113 | |
| 112 | 114 | \WP_CLI\Utils\format_items('table', $fluentStats, ['key', 'count']); |
| @@ -166,8 +168,13 @@ | ||
| 166 | 168 | $baseUrl = 'https://community.buddyboss.com/wp-json/wp/v2/users/?per_page=50&page='; |
| 167 | 169 | |
| 168 | 170 | $page = 590; |
| 169 | 171 | |
| 172 | + $dumpDir = wp_upload_dir()['basedir'] . '/fcom-dump'; | |
| 173 | + if (!is_dir($dumpDir)) { | |
| 174 | + wp_mkdir_p($dumpDir); | |
| 175 | + } | |
| 176 | + | |
| 170 | 177 | while (true) { |
| 171 | 178 | $response = wp_remote_get($baseUrl . $page, [ |
| 172 | 179 | 'timeout' => 60, |
| 173 | 180 | ]); |
| @@ -184,9 +191,9 @@ | ||
| 184 | 191 | break; // No more users to fetch, exit the loop |
| 185 | 192 | } |
| 186 | 193 | |
| 187 | 194 | // save the json to a file |
| 188 | - file_put_contents(ABSPATH . '/dump/' . $page . '.json', $json); | |
| 195 | + file_put_contents($dumpDir . '/' . $page . '.json', $json); | |
| 189 | 196 | |
| 190 | 197 | \WP_CLI::line('Downloaded page ' . $page); |
| 191 | 198 | |
| 192 | 199 | |