mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-07-15 21:31:36 +03:00
Maintenance: Fixed type and CI issues
- Fixed issues picked up by PHPStan updates.
- Not sure why it was flagging the BookSorter issue, but swapping if
statements made it go away.
- Updated BookSortMapItem with modern syntax.
- Attempted to fix CI issues by adding DOM extension.
- Attempted to make migration CI more efficient via tmpfs
This commit is contained in:
@@ -22,7 +22,7 @@ jobs:
|
|||||||
uses: https://github.com/shivammathur/setup-php@v2
|
uses: https://github.com/shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: 8.5
|
php-version: 8.5
|
||||||
extensions: gd, mbstring, json, curl, xml, mysql, ldap
|
extensions: gd, mbstring, json, curl, xml, dom, mysql, ldap
|
||||||
|
|
||||||
- name: Get Composer Cache Directory
|
- name: Get Composer Cache Directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
|
|||||||
@@ -23,6 +23,14 @@ jobs:
|
|||||||
services:
|
services:
|
||||||
mysql:
|
mysql:
|
||||||
image: docker.io/library/mariadb:12.2.2-noble
|
image: docker.io/library/mariadb:12.2.2-noble
|
||||||
|
options: --tmpfs /var/lib/mysql:rw
|
||||||
|
cmd:
|
||||||
|
- --innodb-flush-log-at-trx-commit=0
|
||||||
|
- --innodb-flush-method=O_DIRECT
|
||||||
|
- --innodb-doublewrite=0
|
||||||
|
- --innodb-buffer-pool-size=256M
|
||||||
|
- --skip-log-bin
|
||||||
|
- --sync-binlog=0
|
||||||
env:
|
env:
|
||||||
MARIADB_USER: bookstack-test
|
MARIADB_USER: bookstack-test
|
||||||
MARIADB_PASSWORD: bookstack-test
|
MARIADB_PASSWORD: bookstack-test
|
||||||
@@ -35,7 +43,7 @@ jobs:
|
|||||||
uses: https://github.com/shivammathur/setup-php@v2
|
uses: https://github.com/shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php }}
|
php-version: ${{ matrix.php }}
|
||||||
extensions: gd, mbstring, json, curl, xml, mysql, ldap
|
extensions: gd, mbstring, json, curl, xml, dom, mysql, ldap
|
||||||
|
|
||||||
- name: Get Composer Cache Directory
|
- name: Get Composer Cache Directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
php: ['8.2', '8.3', '8.4', '8.5']
|
php: ['8.2', '8.3', '8.4', '8.5']
|
||||||
env:
|
env:
|
||||||
phpextensions: gd, mbstring, json, curl, xml, mysql, ldap, gmp
|
phpextensions: gd, mbstring, json, curl, xml, dom, mysql, ldap, gmp
|
||||||
phpextensioncachekey: cache-v1
|
phpextensioncachekey: cache-v1
|
||||||
steps:
|
steps:
|
||||||
- uses: https://code.forgejo.org/actions/checkout@v6
|
- uses: https://code.forgejo.org/actions/checkout@v6
|
||||||
|
|||||||
@@ -4,37 +4,12 @@ namespace BookStack\Sorting;
|
|||||||
|
|
||||||
class BookSortMapItem
|
class BookSortMapItem
|
||||||
{
|
{
|
||||||
/**
|
public function __construct(
|
||||||
* @var int
|
public int $id,
|
||||||
*/
|
public int $sort,
|
||||||
public $id;
|
public int|null $parentChapterId,
|
||||||
|
public string $type,
|
||||||
/**
|
public int $parentBookId,
|
||||||
* @var int
|
) {
|
||||||
*/
|
|
||||||
public $sort;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var ?int
|
|
||||||
*/
|
|
||||||
public $parentChapterId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
public $parentBookId;
|
|
||||||
|
|
||||||
public function __construct(int $id, int $sort, ?int $parentChapterId, string $type, int $parentBookId)
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
$this->sort = $sort;
|
|
||||||
$this->parentChapterId = $parentChapterId;
|
|
||||||
$this->type = $type;
|
|
||||||
$this->parentBookId = $parentBookId;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ class BookSorter
|
|||||||
$model->priority = $sortMapItem->sort;
|
$model->priority = $sortMapItem->sort;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($chapterChanged || $priorityChanged) {
|
if ($priorityChanged || $chapterChanged) {
|
||||||
$model::withoutTimestamps(fn () => $model->save());
|
$model::withoutTimestamps(fn () => $model->save());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ class ConfiguredHtmlPurifier
|
|||||||
$this->configureHtmlDefinition($htmlDef);
|
$this->configureHtmlDefinition($htmlDef);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var \HTMLPurifier_URIDefinition $uriDef */
|
|
||||||
$uriDef = $config->getDefinition('URI', true, true);
|
$uriDef = $config->getDefinition('URI', true, true);
|
||||||
if ($uriDef instanceof HTMLPurifier_URIDefinition) {
|
if ($uriDef instanceof HTMLPurifier_URIDefinition) {
|
||||||
$this->configureUriDefinition($uriDef);
|
$this->configureUriDefinition($uriDef);
|
||||||
|
|||||||
Reference in New Issue
Block a user