-
-
Notifications
You must be signed in to change notification settings - Fork 834
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The new implementation generates a subquery of IDs instead of sending big arrays of data to/from the database. This massively speeds up performance.
- Loading branch information
1 parent
5235dda
commit 7122861
Showing
19 changed files
with
988 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php: [7.3, 7.4, '8.0'] | ||
service: ['mysql:5.7', mariadb] | ||
prefix: ['', flarum_] | ||
|
||
include: | ||
- service: 'mysql:5.7' | ||
db: MySQL | ||
- service: mariadb | ||
db: MariaDB | ||
- prefix: flarum_ | ||
prefixStr: (prefix) | ||
|
||
exclude: | ||
- php: 7.3 | ||
service: 'mysql:5.7' | ||
prefix: flarum_ | ||
- php: 7.3 | ||
service: mariadb | ||
prefix: flarum_ | ||
- php: 8.0 | ||
service: 'mysql:5.7' | ||
prefix: flarum_ | ||
- php: 8.0 | ||
service: mariadb | ||
prefix: flarum_ | ||
|
||
services: | ||
mysql: | ||
image: ${{ matrix.service }} | ||
ports: | ||
- 13306:3306 | ||
|
||
name: 'PHP ${{ matrix.php }} / ${{ matrix.db }} ${{ matrix.prefixStr }}' | ||
|
||
steps: | ||
- uses: actions/checkout@master | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: xdebug | ||
extensions: curl, dom, gd, json, mbstring, openssl, pdo_mysql, tokenizer, zip | ||
tools: phpunit, composer:v2 | ||
|
||
# The authentication alter is necessary because newer mysql versions use the `caching_sha2_password` driver, | ||
# which isn't supported prior to PHP7.4 | ||
# When we drop support for PHP7.3, we should remove this from the setup. | ||
- name: Create MySQL Database | ||
run: | | ||
sudo systemctl start mysql | ||
mysql -uroot -proot -e 'CREATE DATABASE flarum_test;' --port 13306 | ||
mysql -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';" --port 13306 | ||
- name: Install Composer dependencies | ||
run: composer install | ||
|
||
- name: Setup Composer tests | ||
run: composer test:setup | ||
env: | ||
DB_PORT: 13306 | ||
DB_PASSWORD: root | ||
DB_PREFIX: ${{ matrix.prefix }} | ||
|
||
- name: Run Composer tests | ||
run: composer test | ||
env: | ||
COMPOSER_PROCESS_TIMEOUT: 600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
30 changes: 30 additions & 0 deletions
30
extensions/tags/tests/integration/RetrievesRepresentativeTags.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Flarum. | ||
* | ||
* For detailed copyright and license information, please view the | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Flarum\Tags\Tests\integration; | ||
|
||
trait RetrievesRepresentativeTags | ||
{ | ||
protected function tags() | ||
{ | ||
return [ | ||
['id' => 1, 'name' => 'Primary 1', 'slug' => 'primary-1', 'position' => 0, 'parent_id' => null], | ||
['id' => 2, 'name' => 'Primary 2', 'slug' => 'primary-2', 'position' => 1, 'parent_id' => null], | ||
['id' => 3, 'name' => 'Primary 2 Child 1', 'slug' => 'primary-2-child-1', 'position' => 2, 'parent_id' => 2], | ||
['id' => 4, 'name' => 'Primary 2 Child 2', 'slug' => 'primary-2-child-2', 'position' => 3, 'parent_id' => 2], | ||
['id' => 5, 'name' => 'Primary 2 Child Restricted', 'slug' => 'primary-2-child-restricted', 'position' => 4, 'parent_id' => 2, 'is_restricted' => true], | ||
['id' => 6, 'name' => 'Primary Restricted', 'slug' => 'primary-restricted', 'position' => 5, 'parent_id' => null, 'is_restricted' => true], | ||
['id' => 7, 'name' => 'Primary Restricted Child 1', 'slug' => 'primary-restricted-child-1', 'position' => 6, 'parent_id' => 6], | ||
['id' => 8, 'name' => 'Primary Restricted Child Restricted', 'slug' => 'primary-restricted-child-restricted', 'position' => 7, 'parent_id' => 6, 'is_restricted' => true], | ||
['id' => 9, 'name' => 'Secondary 1', 'slug' => 'secondary-1', 'position' => null, 'parent_id' => null], | ||
['id' => 10, 'name' => 'Secondary 2', 'slug' => 'secondary-2', 'position' => null, 'parent_id' => null], | ||
['id' => 11, 'name' => 'Secondary Restricted', 'slug' => 'secondary-restricted', 'position' => null, 'parent_id' => null, 'is_restricted' => true], | ||
]; | ||
} | ||
} |
Oops, something went wrong.