Added lazy database object creation.
This commit is contained in:
parent
b89621cb1a
commit
070dc5e782
55 changed files with 772 additions and 817 deletions
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2017-2023, flashwave <me@flash.moe>
|
||||
Copyright (c) 2017-2024, flashwave <me@flash.moe>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
244
composer.lock
generated
244
composer.lock
generated
|
@ -8,16 +8,16 @@
|
|||
"packages": [
|
||||
{
|
||||
"name": "chillerlan/php-qrcode",
|
||||
"version": "4.4.0",
|
||||
"version": "4.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/chillerlan/php-qrcode.git",
|
||||
"reference": "52889cd7ab1b78e6a345edafe24aa74bc5becc08"
|
||||
"reference": "f5e243f3b61a60934780579430a951460f40888d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/chillerlan/php-qrcode/zipball/52889cd7ab1b78e6a345edafe24aa74bc5becc08",
|
||||
"reference": "52889cd7ab1b78e6a345edafe24aa74bc5becc08",
|
||||
"url": "https://api.github.com/repos/chillerlan/php-qrcode/zipball/f5e243f3b61a60934780579430a951460f40888d",
|
||||
"reference": "f5e243f3b61a60934780579430a951460f40888d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -27,10 +27,10 @@
|
|||
},
|
||||
"require-dev": {
|
||||
"phan/phan": "^5.4",
|
||||
"phpmd/phpmd": "^2.13",
|
||||
"phpmd/phpmd": "^2.15",
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"setasign/fpdf": "^1.8.2",
|
||||
"squizlabs/php_codesniffer": "^3.7"
|
||||
"squizlabs/php_codesniffer": "^3.8"
|
||||
},
|
||||
"suggest": {
|
||||
"chillerlan/php-authenticator": "Yet another Google authenticator! Also creates URIs for mobile apps.",
|
||||
|
@ -73,7 +73,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/chillerlan/php-qrcode/issues",
|
||||
"source": "https://github.com/chillerlan/php-qrcode/tree/4.4.0"
|
||||
"source": "https://github.com/chillerlan/php-qrcode/tree/4.4.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -85,20 +85,20 @@
|
|||
"type": "ko_fi"
|
||||
}
|
||||
],
|
||||
"time": "2023-11-23T23:53:20+00:00"
|
||||
"time": "2024-01-06T16:56:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "chillerlan/php-settings-container",
|
||||
"version": "3.1.0",
|
||||
"version": "3.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/chillerlan/php-settings-container.git",
|
||||
"reference": "4d02944424fa1f48abca96353257c93cbac856c1"
|
||||
"reference": "c41e89f8bf963d1e88584a47fb78d1cd204b6e2a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/chillerlan/php-settings-container/zipball/4d02944424fa1f48abca96353257c93cbac856c1",
|
||||
"reference": "4d02944424fa1f48abca96353257c93cbac856c1",
|
||||
"url": "https://api.github.com/repos/chillerlan/php-settings-container/zipball/c41e89f8bf963d1e88584a47fb78d1cd204b6e2a",
|
||||
"reference": "c41e89f8bf963d1e88584a47fb78d1cd204b6e2a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -107,9 +107,9 @@
|
|||
},
|
||||
"require-dev": {
|
||||
"phan/phan": "^5.4",
|
||||
"phpmd/phpmd": "^2.13",
|
||||
"phpunit/phpunit": "^10.2",
|
||||
"squizlabs/php_codesniffer": "^3.7"
|
||||
"phpcsstandards/php_codesniffer": "^3.8",
|
||||
"phpmd/phpmd": "^2.15",
|
||||
"phpunit/phpunit": "^10.5"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
|
@ -150,31 +150,31 @@
|
|||
"type": "ko_fi"
|
||||
}
|
||||
],
|
||||
"time": "2023-07-17T20:46:37+00:00"
|
||||
"time": "2024-01-05T23:55:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/lexer",
|
||||
"version": "3.0.0",
|
||||
"version": "3.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/lexer.git",
|
||||
"reference": "84a527db05647743d50373e0ec53a152f2cde568"
|
||||
"reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/lexer/zipball/84a527db05647743d50373e0ec53a152f2cde568",
|
||||
"reference": "84a527db05647743d50373e0ec53a152f2cde568",
|
||||
"url": "https://api.github.com/repos/doctrine/lexer/zipball/31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd",
|
||||
"reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^10",
|
||||
"phpstan/phpstan": "^1.9",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"doctrine/coding-standard": "^12",
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"phpunit/phpunit": "^10.5",
|
||||
"psalm/plugin-phpunit": "^0.18.3",
|
||||
"vimeo/psalm": "^5.0"
|
||||
"vimeo/psalm": "^5.21"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
|
@ -211,7 +211,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/doctrine/lexer/issues",
|
||||
"source": "https://github.com/doctrine/lexer/tree/3.0.0"
|
||||
"source": "https://github.com/doctrine/lexer/tree/3.0.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -227,7 +227,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-12-15T16:57:16+00:00"
|
||||
"time": "2024-02-05T11:56:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "egulias/email-validator",
|
||||
|
@ -352,7 +352,7 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://patchii.net/flash/index.git",
|
||||
"reference": "e31781c69f0b13fe251771c8e7e529222630a44f"
|
||||
"reference": "73051dc71ee2d0045e5dbe5d846bb665a8b1c39c"
|
||||
},
|
||||
"require": {
|
||||
"ext-mbstring": "*",
|
||||
|
@ -390,7 +390,7 @@
|
|||
],
|
||||
"description": "Composer package for the common library for my projects.",
|
||||
"homepage": "https://railgun.sh/index",
|
||||
"time": "2023-11-20T19:01:19+00:00"
|
||||
"time": "2024-02-06T23:52:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "flashwave/sasae",
|
||||
|
@ -398,7 +398,7 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://patchii.net/flash/sasae.git",
|
||||
"reference": "b56dd222acb8f138729e6258d4a90bbb8401ff52"
|
||||
"reference": "c8a9f2974e6591215b3f898dd5525de1e8367f66"
|
||||
},
|
||||
"require": {
|
||||
"flashwave/index": "dev-master",
|
||||
|
@ -431,7 +431,7 @@
|
|||
],
|
||||
"description": "A wrapper for Twig with added common functionality.",
|
||||
"homepage": "https://railgun.sh/sasae",
|
||||
"time": "2023-11-20T19:09:35+00:00"
|
||||
"time": "2024-01-04T02:13:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "flashwave/syokuhou",
|
||||
|
@ -439,7 +439,7 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://patchii.net/flash/syokuhou.git",
|
||||
"reference": "fdf3c38cc216bf7024af331cbe1758532355c22f"
|
||||
"reference": "c1fe9371ada20fcea51c225cc53b9ceae4642bc4"
|
||||
},
|
||||
"require": {
|
||||
"flashwave/index": "dev-master",
|
||||
|
@ -470,7 +470,7 @@
|
|||
],
|
||||
"description": "Configuration library for PHP.",
|
||||
"homepage": "https://railgun.sh/syokuhou",
|
||||
"time": "2023-11-20T19:10:04+00:00"
|
||||
"time": "2024-01-04T02:12:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/psr7",
|
||||
|
@ -649,16 +649,16 @@
|
|||
},
|
||||
{
|
||||
"name": "matomo/device-detector",
|
||||
"version": "6.2.0",
|
||||
"version": "6.2.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/matomo-org/device-detector.git",
|
||||
"reference": "3577abbfea71eaf88d4cd432274428c39601754f"
|
||||
"reference": "19138b0c4b9ddf4ffd8e423d6af3764b7317cb0b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/matomo-org/device-detector/zipball/3577abbfea71eaf88d4cd432274428c39601754f",
|
||||
"reference": "3577abbfea71eaf88d4cd432274428c39601754f",
|
||||
"url": "https://api.github.com/repos/matomo-org/device-detector/zipball/19138b0c4b9ddf4ffd8e423d6af3764b7317cb0b",
|
||||
"reference": "19138b0c4b9ddf4ffd8e423d6af3764b7317cb0b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -670,8 +670,8 @@
|
|||
},
|
||||
"require-dev": {
|
||||
"matthiasmullie/scrapbook": "^1.4.7",
|
||||
"mayflower/mo4-coding-standard": "^v8.0.0",
|
||||
"phpstan/phpstan": "^0.12.52",
|
||||
"mayflower/mo4-coding-standard": "^v9.0.0",
|
||||
"phpstan/phpstan": "^1.10.44",
|
||||
"phpunit/phpunit": "^8.5.8",
|
||||
"psr/cache": "^1.0.1",
|
||||
"psr/simple-cache": "^1.0.1",
|
||||
|
@ -714,7 +714,7 @@
|
|||
"source": "https://github.com/matomo-org/matomo",
|
||||
"wiki": "https://dev.matomo.org/"
|
||||
},
|
||||
"time": "2023-11-15T09:44:42+00:00"
|
||||
"time": "2024-01-05T09:03:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mustangostang/spyc",
|
||||
|
@ -1128,16 +1128,16 @@
|
|||
},
|
||||
{
|
||||
"name": "sentry/sentry",
|
||||
"version": "4.1.0",
|
||||
"version": "4.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/getsentry/sentry-php.git",
|
||||
"reference": "89666f297891ff937fceb2f3d1fb967a6848cf37"
|
||||
"reference": "a6e06f0b7a17e7f68e11297427da76bfe01a3ca3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/89666f297891ff937fceb2f3d1fb967a6848cf37",
|
||||
"reference": "89666f297891ff937fceb2f3d1fb967a6848cf37",
|
||||
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/a6e06f0b7a17e7f68e11297427da76bfe01a3ca3",
|
||||
"reference": "a6e06f0b7a17e7f68e11297427da76bfe01a3ca3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1161,7 +1161,7 @@
|
|||
"phpbench/phpbench": "^1.0",
|
||||
"phpstan/phpstan": "^1.3",
|
||||
"phpunit/phpunit": "^8.5.14|^9.4",
|
||||
"symfony/phpunit-bridge": "^5.2|^6.0",
|
||||
"symfony/phpunit-bridge": "^5.2|^6.0|^7.0",
|
||||
"vimeo/psalm": "^4.17"
|
||||
},
|
||||
"suggest": {
|
||||
|
@ -1201,7 +1201,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/getsentry/sentry-php/issues",
|
||||
"source": "https://github.com/getsentry/sentry-php/tree/4.1.0"
|
||||
"source": "https://github.com/getsentry/sentry-php/tree/4.5.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1213,7 +1213,7 @@
|
|||
"type": "custom"
|
||||
}
|
||||
],
|
||||
"time": "2023-12-04T12:41:21+00:00"
|
||||
"time": "2024-01-29T16:16:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/deprecation-contracts",
|
||||
|
@ -1284,16 +1284,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v7.0.0",
|
||||
"version": "v7.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/event-dispatcher.git",
|
||||
"reference": "c459b40ffe67c49af6fd392aac374c9edf8a027e"
|
||||
"reference": "834c28d533dd0636f910909d01b9ff45cc094b5e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/c459b40ffe67c49af6fd392aac374c9edf8a027e",
|
||||
"reference": "c459b40ffe67c49af6fd392aac374c9edf8a027e",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/834c28d533dd0636f910909d01b9ff45cc094b5e",
|
||||
"reference": "834c28d533dd0636f910909d01b9ff45cc094b5e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1344,7 +1344,7 @@
|
|||
"description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/event-dispatcher/tree/v7.0.0"
|
||||
"source": "https://github.com/symfony/event-dispatcher/tree/v7.0.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1360,7 +1360,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-07-27T16:29:09+00:00"
|
||||
"time": "2024-01-23T15:02:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher-contracts",
|
||||
|
@ -1440,16 +1440,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/mailer",
|
||||
"version": "v6.4.0",
|
||||
"version": "v6.4.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/mailer.git",
|
||||
"reference": "ca8dcf8892cdc5b4358ecf2528429bb5e706f7ba"
|
||||
"reference": "74412c62f88a85a41b61f0b71ab0afcaad6f03ee"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/mailer/zipball/ca8dcf8892cdc5b4358ecf2528429bb5e706f7ba",
|
||||
"reference": "ca8dcf8892cdc5b4358ecf2528429bb5e706f7ba",
|
||||
"url": "https://api.github.com/repos/symfony/mailer/zipball/74412c62f88a85a41b61f0b71ab0afcaad6f03ee",
|
||||
"reference": "74412c62f88a85a41b61f0b71ab0afcaad6f03ee",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1500,7 +1500,7 @@
|
|||
"description": "Helps sending emails",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/mailer/tree/v6.4.0"
|
||||
"source": "https://github.com/symfony/mailer/tree/v6.4.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1516,20 +1516,20 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-11-12T18:02:22+00:00"
|
||||
"time": "2024-01-29T15:01:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/mime",
|
||||
"version": "v7.0.0",
|
||||
"version": "v7.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/mime.git",
|
||||
"reference": "0a2fff95c1a10df97f571d67e76c7ae0f0d4f535"
|
||||
"reference": "c1ffe24ba6fdc3e3f0f3fcb93519103b326a3716"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/mime/zipball/0a2fff95c1a10df97f571d67e76c7ae0f0d4f535",
|
||||
"reference": "0a2fff95c1a10df97f571d67e76c7ae0f0d4f535",
|
||||
"url": "https://api.github.com/repos/symfony/mime/zipball/c1ffe24ba6fdc3e3f0f3fcb93519103b326a3716",
|
||||
"reference": "c1ffe24ba6fdc3e3f0f3fcb93519103b326a3716",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1583,7 +1583,7 @@
|
|||
"mime-type"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/mime/tree/v7.0.0"
|
||||
"source": "https://github.com/symfony/mime/tree/v7.0.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1599,7 +1599,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-10-19T14:20:43+00:00"
|
||||
"time": "2024-01-30T08:34:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/options-resolver",
|
||||
|
@ -1670,16 +1670,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.28.0",
|
||||
"version": "v1.29.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb"
|
||||
"reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb",
|
||||
"reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4",
|
||||
"reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1693,9 +1693,6 @@
|
|||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.28-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
|
@ -1732,7 +1729,7 @@
|
|||
"portable"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0"
|
||||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1748,20 +1745,20 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-01-26T09:26:14+00:00"
|
||||
"time": "2024-01-29T20:11:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-idn",
|
||||
"version": "v1.28.0",
|
||||
"version": "v1.29.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-intl-idn.git",
|
||||
"reference": "ecaafce9f77234a6a449d29e49267ba10499116d"
|
||||
"reference": "a287ed7475f85bf6f61890146edbc932c0fff919"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/ecaafce9f77234a6a449d29e49267ba10499116d",
|
||||
"reference": "ecaafce9f77234a6a449d29e49267ba10499116d",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a287ed7475f85bf6f61890146edbc932c0fff919",
|
||||
"reference": "a287ed7475f85bf6f61890146edbc932c0fff919",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1774,9 +1771,6 @@
|
|||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.28-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
|
@ -1819,7 +1813,7 @@
|
|||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.28.0"
|
||||
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.29.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1835,20 +1829,20 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-01-26T09:30:37+00:00"
|
||||
"time": "2024-01-29T20:11:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-normalizer",
|
||||
"version": "v1.28.0",
|
||||
"version": "v1.29.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
|
||||
"reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92"
|
||||
"reference": "bc45c394692b948b4d383a08d7753968bed9a83d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92",
|
||||
"reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d",
|
||||
"reference": "bc45c394692b948b4d383a08d7753968bed9a83d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1859,9 +1853,6 @@
|
|||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.28-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
|
@ -1903,7 +1894,7 @@
|
|||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0"
|
||||
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1919,20 +1910,20 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-01-26T09:26:14+00:00"
|
||||
"time": "2024-01-29T20:11:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.28.0",
|
||||
"version": "v1.29.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "42292d99c55abe617799667f454222c54c60e229"
|
||||
"reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229",
|
||||
"reference": "42292d99c55abe617799667f454222c54c60e229",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec",
|
||||
"reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1946,9 +1937,6 @@
|
|||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.28-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
|
@ -1986,7 +1974,7 @@
|
|||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0"
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2002,20 +1990,20 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-07-28T09:04:16+00:00"
|
||||
"time": "2024-01-29T20:11:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php72",
|
||||
"version": "v1.28.0",
|
||||
"version": "v1.29.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php72.git",
|
||||
"reference": "70f4aebd92afca2f865444d30a4d2151c13c3179"
|
||||
"reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/70f4aebd92afca2f865444d30a4d2151c13c3179",
|
||||
"reference": "70f4aebd92afca2f865444d30a4d2151c13c3179",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/861391a8da9a04cbad2d232ddd9e4893220d6e25",
|
||||
"reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2023,9 +2011,6 @@
|
|||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.28-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
|
@ -2062,7 +2047,7 @@
|
|||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php72/tree/v1.28.0"
|
||||
"source": "https://github.com/symfony/polyfill-php72/tree/v1.29.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2078,20 +2063,20 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-01-26T09:26:14+00:00"
|
||||
"time": "2024-01-29T20:11:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php80",
|
||||
"version": "v1.28.0",
|
||||
"version": "v1.29.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php80.git",
|
||||
"reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5"
|
||||
"reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5",
|
||||
"reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b",
|
||||
"reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2099,9 +2084,6 @@
|
|||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.28-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
|
@ -2145,7 +2127,7 @@
|
|||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0"
|
||||
"source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2161,25 +2143,25 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-01-26T09:26:14+00:00"
|
||||
"time": "2024-01-29T20:11:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/service-contracts",
|
||||
"version": "v3.4.0",
|
||||
"version": "v3.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/service-contracts.git",
|
||||
"reference": "b3313c2dbffaf71c8de2934e2ea56ed2291a3838"
|
||||
"reference": "fe07cbc8d837f60caf7018068e350cc5163681a0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/b3313c2dbffaf71c8de2934e2ea56ed2291a3838",
|
||||
"reference": "b3313c2dbffaf71c8de2934e2ea56ed2291a3838",
|
||||
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/fe07cbc8d837f60caf7018068e350cc5163681a0",
|
||||
"reference": "fe07cbc8d837f60caf7018068e350cc5163681a0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"psr/container": "^2.0"
|
||||
"psr/container": "^1.1|^2.0"
|
||||
},
|
||||
"conflict": {
|
||||
"ext-psr": "<1.1|>=2"
|
||||
|
@ -2227,7 +2209,7 @@
|
|||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/service-contracts/tree/v3.4.0"
|
||||
"source": "https://github.com/symfony/service-contracts/tree/v3.4.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2243,7 +2225,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-07-30T20:28:31+00:00"
|
||||
"time": "2023-12-26T14:02:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "twig/html-extra",
|
||||
|
@ -2385,16 +2367,16 @@
|
|||
"packages-dev": [
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "1.10.50",
|
||||
"version": "1.10.57",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "06a98513ac72c03e8366b5a0cb00750b487032e4"
|
||||
"reference": "1627b1d03446904aaa77593f370c5201d2ecc34e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/06a98513ac72c03e8366b5a0cb00750b487032e4",
|
||||
"reference": "06a98513ac72c03e8366b5a0cb00750b487032e4",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e",
|
||||
"reference": "1627b1d03446904aaa77593f370c5201d2ecc34e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2443,7 +2425,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-12-13T10:59:42+00:00"
|
||||
"time": "2024-01-24T11:51:34+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
|
@ -2457,5 +2439,5 @@
|
|||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.3.0"
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ else
|
|||
try {
|
||||
$isNew = false;
|
||||
$emoteInfo = $emotes->getEmote($emoteId);
|
||||
$emoteStrings = $emotes->getEmoteStrings($emoteInfo);
|
||||
$emoteStrings = iterator_to_array($emotes->getEmoteStrings($emoteInfo));
|
||||
} catch(RuntimeException $ex) {
|
||||
Template::throwError(404);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ $pagination = new Pagination($auditLog->countLogs(), 50);
|
|||
if(!$pagination->hasValidOffset())
|
||||
Template::throwError(404);
|
||||
|
||||
$logs = $auditLog->getLogs(pagination: $pagination);
|
||||
$logs = iterator_to_array($auditLog->getLogs(pagination: $pagination));
|
||||
$userInfos = [];
|
||||
$userColours = [];
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ if(CSRF::validateRequest() && $canEdit) {
|
|||
}
|
||||
|
||||
$existingRoles = [];
|
||||
foreach($roles->getRoles(userInfo: $userInfo) as $roleInfo)
|
||||
foreach(iterator_to_array($roles->getRoles(userInfo: $userInfo)) as $roleInfo)
|
||||
$existingRoles[$roleInfo->getId()] = $roleInfo;
|
||||
|
||||
$removeRoles = [];
|
||||
|
@ -226,7 +226,7 @@ if(CSRF::validateRequest() && $canEdit) {
|
|||
return;
|
||||
}
|
||||
|
||||
$rolesAll = $roles->getRoles();
|
||||
$rolesAll = iterator_to_array($roles->getRoles());
|
||||
$userRoleIds = $users->hasRoles($userInfo, $rolesAll);
|
||||
|
||||
Template::render('manage.users.user', [
|
||||
|
|
|
@ -299,7 +299,7 @@ $profileStats->forum_post_count = $forumCtx->countTotalUserPosts($userInfo);
|
|||
$profileStats->comments_count = $msz->getComments()->countPosts(userInfo: $userInfo, deleted: false);
|
||||
|
||||
if(!$viewingAsGuest) {
|
||||
Template::set('profile_warnings', $usersCtx->getWarnings()->getWarningsWithDefaultBacklog($userInfo));
|
||||
Template::set('profile_warnings', iterator_to_array($usersCtx->getWarnings()->getWarningsWithDefaultBacklog($userInfo)));
|
||||
|
||||
if((!$isBanned || $canEdit)) {
|
||||
$unranked = $cfg->getValues([
|
||||
|
|
|
@ -116,7 +116,7 @@ if($isVerifiedRequest && !empty($_POST['current_password'])) {
|
|||
if($_SERVER['REQUEST_METHOD'] === 'POST' && $isVerifiedRequest)
|
||||
$userInfo = $users->getUser($userInfo->getId(), 'id');
|
||||
|
||||
$userRoles = $roles->getRoles(userInfo: $userInfo);
|
||||
$userRoles = iterator_to_array($roles->getRoles(userInfo: $userInfo));
|
||||
|
||||
Template::render('settings.account', [
|
||||
'errors' => $errors,
|
||||
|
|
|
@ -15,8 +15,8 @@ $auditLog = $msz->getAuditLog();
|
|||
$loginHistoryPagination = new Pagination($loginAttempts->countAttempts(userInfo: $currentUser), 5, 'hp');
|
||||
$accountLogPagination = new Pagination($auditLog->countLogs(userInfo: $currentUser), 10, 'ap');
|
||||
|
||||
$loginHistory = $loginAttempts->getAttempts(userInfo: $currentUser, pagination: $loginHistoryPagination);
|
||||
$auditLogs = $auditLog->getLogs(userInfo: $currentUser, pagination: $accountLogPagination);
|
||||
$loginHistory = iterator_to_array($loginAttempts->getAttempts(userInfo: $currentUser, pagination: $loginHistoryPagination));
|
||||
$auditLogs = iterator_to_array($auditLog->getLogs(userInfo: $currentUser, pagination: $accountLogPagination));
|
||||
|
||||
Template::render('settings.logs', [
|
||||
'login_history_list' => $loginHistory,
|
||||
|
|
|
@ -61,7 +61,7 @@ class AuditLog {
|
|||
UserInfo|string|null $userInfo = null,
|
||||
IPAddress|string|null $remoteAddr = null,
|
||||
?Pagination $pagination = null
|
||||
): array {
|
||||
): iterable {
|
||||
if($userInfo instanceof UserInfo)
|
||||
$userInfo = $userInfo->getId();
|
||||
if($remoteAddr instanceof IPAddress)
|
||||
|
@ -98,13 +98,8 @@ class AuditLog {
|
|||
}
|
||||
|
||||
$stmt->execute();
|
||||
$result = $stmt->getResult();
|
||||
$logs = [];
|
||||
|
||||
while($result->next())
|
||||
$logs[] = new AuditLogInfo($result);
|
||||
|
||||
return $logs;
|
||||
return $stmt->getResult()->getIterator(AuditLogInfo::fromResult(...));
|
||||
}
|
||||
|
||||
public function createLog(
|
||||
|
|
|
@ -7,20 +7,24 @@ use Index\Data\IDbResult;
|
|||
use Index\Net\IPAddress;
|
||||
|
||||
class AuditLogInfo {
|
||||
private ?string $userId;
|
||||
private string $action;
|
||||
private array $params;
|
||||
private int $created;
|
||||
private string $address;
|
||||
private string $country;
|
||||
public function __construct(
|
||||
private ?string $userId,
|
||||
private string $action,
|
||||
private array $params,
|
||||
private int $created,
|
||||
private string $address,
|
||||
private string $country,
|
||||
) {}
|
||||
|
||||
public function __construct(IDbResult $result) {
|
||||
$this->userId = $result->isNull(0) ? null : (string)$result->getInteger(0);
|
||||
$this->action = $result->getString(1);
|
||||
$this->params = json_decode($result->getString(2));
|
||||
$this->created = $result->getInteger(3);
|
||||
$this->address = $result->isNull(4) ? '::1' : $result->getString(4); // apparently this being NULL is possible?
|
||||
$this->country = $result->getString(5);
|
||||
public static function fromResult(IDbResult $result): AuditLogInfo {
|
||||
return new AuditLogInfo(
|
||||
userId: $result->getStringOrNull(0),
|
||||
action: $result->getString(1),
|
||||
params: json_decode($result->getString(2)),
|
||||
created: $result->getInteger(3),
|
||||
address: $result->isNull(4) ? '::1' : $result->getString(4), // apparently this being NULL is possible?
|
||||
country: $result->getString(5),
|
||||
);
|
||||
}
|
||||
|
||||
public function hasUserId(): bool {
|
||||
|
|
|
@ -7,22 +7,26 @@ use Index\Net\IPAddress;
|
|||
use Misuzu\ClientInfo;
|
||||
|
||||
class LoginAttemptInfo {
|
||||
private ?string $userId;
|
||||
private bool $success;
|
||||
private string $remoteAddr;
|
||||
private string $countryCode;
|
||||
private int $created;
|
||||
private string $userAgent;
|
||||
private string $clientInfo;
|
||||
public function __construct(
|
||||
private ?string $userId,
|
||||
private bool $success,
|
||||
private string $remoteAddr,
|
||||
private string $countryCode,
|
||||
private int $created,
|
||||
private string $userAgent,
|
||||
private string $clientInfo,
|
||||
) {}
|
||||
|
||||
public function __construct(IDbResult $result) {
|
||||
$this->userId = $result->isNull(0) ? null : (string)$result->getInteger(0);
|
||||
$this->success = $result->getInteger(1) !== 0;
|
||||
$this->remoteAddr = $result->getString(2);
|
||||
$this->countryCode = $result->getString(3);
|
||||
$this->created = $result->getInteger(4);
|
||||
$this->userAgent = $result->getString(5);
|
||||
$this->clientInfo = $result->getString(6);
|
||||
public static function fromResult(IDbResult $result): LoginAttemptInfo {
|
||||
return new LoginAttemptInfo(
|
||||
userId: $result->getStringOrNull(0),
|
||||
success: $result->getBoolean(1),
|
||||
remoteAddr: $result->getString(2),
|
||||
countryCode: $result->getString(3),
|
||||
created: $result->getInteger(4),
|
||||
userAgent: $result->getString(5),
|
||||
clientInfo: $result->getString(6),
|
||||
);
|
||||
}
|
||||
|
||||
public function hasUserId(): bool {
|
||||
|
|
|
@ -83,7 +83,7 @@ class LoginAttempts {
|
|||
IPAddress|string|null $remoteAddr = null,
|
||||
TimeSpan|int|null $timeRange = null,
|
||||
?Pagination $pagination = null
|
||||
): array {
|
||||
): iterable {
|
||||
if($userInfo instanceof UserInfo)
|
||||
$userInfo = $userInfo->getId();
|
||||
if($remoteAddr instanceof IPAddress)
|
||||
|
@ -127,13 +127,7 @@ class LoginAttempts {
|
|||
}
|
||||
$stmt->execute();
|
||||
|
||||
$result = $stmt->getResult();
|
||||
$attempts = [];
|
||||
|
||||
while($result->next())
|
||||
$attempts[] = new LoginAttemptInfo($result);
|
||||
|
||||
return $attempts;
|
||||
return $stmt->getResult()->getIterator(LoginAttemptInfo::fromResult(...));
|
||||
}
|
||||
|
||||
public function recordAttempt(
|
||||
|
|
|
@ -7,32 +7,36 @@ use Index\Net\IPAddress;
|
|||
use Misuzu\ClientInfo;
|
||||
|
||||
class SessionInfo {
|
||||
private string $id;
|
||||
private string $userId;
|
||||
private string $token;
|
||||
private string $firstRemoteAddr;
|
||||
private ?string $lastRemoteAddr;
|
||||
private string $userAgent;
|
||||
private string $clientInfo;
|
||||
private string $countryCode;
|
||||
private int $expires;
|
||||
private bool $bumpExpires;
|
||||
private int $created;
|
||||
private ?int $lastActive;
|
||||
public function __construct(
|
||||
private string $id,
|
||||
private string $userId,
|
||||
private string $token,
|
||||
private string $firstRemoteAddr,
|
||||
private ?string $lastRemoteAddr,
|
||||
private string $userAgent,
|
||||
private string $clientInfo,
|
||||
private string $countryCode,
|
||||
private int $expires,
|
||||
private bool $bumpExpires,
|
||||
private int $created,
|
||||
private ?int $lastActive,
|
||||
) {}
|
||||
|
||||
public function __construct(IDbResult $result) {
|
||||
$this->id = (string)$result->getInteger(0);
|
||||
$this->userId = (string)$result->getInteger(1);
|
||||
$this->token = $result->getString(2);
|
||||
$this->firstRemoteAddr = $result->getString(3);
|
||||
$this->lastRemoteAddr = $result->isNull(4) ? null : $result->getString(4);
|
||||
$this->userAgent = $result->getString(5);
|
||||
$this->clientInfo = $result->getString(6);
|
||||
$this->countryCode = $result->getString(7);
|
||||
$this->expires = $result->getInteger(8);
|
||||
$this->bumpExpires = $result->getInteger(9) !== 0;
|
||||
$this->created = $result->getInteger(10);
|
||||
$this->lastActive = $result->isNull(11) ? null : $result->getInteger(11);
|
||||
public static function fromResult(IDbResult $result): SessionInfo {
|
||||
return new SessionInfo(
|
||||
id: $result->getString(0),
|
||||
userId: $result->getString(1),
|
||||
token: $result->getString(2),
|
||||
firstRemoteAddr: $result->getString(3),
|
||||
lastRemoteAddr: $result->getStringOrNull(4),
|
||||
userAgent: $result->getString(5),
|
||||
clientInfo: $result->getString(6),
|
||||
countryCode: $result->getString(7),
|
||||
expires: $result->getInteger(8),
|
||||
bumpExpires: $result->getBoolean(9),
|
||||
created: $result->getInteger(10),
|
||||
lastActive: $result->getIntegerOrNull(11),
|
||||
);
|
||||
}
|
||||
|
||||
public function getId(): string {
|
||||
|
|
|
@ -58,7 +58,7 @@ class Sessions {
|
|||
public function getSessions(
|
||||
UserInfo|string|null $userInfo = null,
|
||||
?Pagination $pagination = null
|
||||
): array {
|
||||
): iterable {
|
||||
if($userInfo instanceof UserInfo)
|
||||
$userInfo = $userInfo->getId();
|
||||
|
||||
|
@ -85,13 +85,7 @@ class Sessions {
|
|||
}
|
||||
$stmt->execute();
|
||||
|
||||
$result = $stmt->getResult();
|
||||
$sessions = [];
|
||||
|
||||
while($result->next())
|
||||
$sessions[] = new SessionInfo($result);
|
||||
|
||||
return $sessions;
|
||||
return $stmt->getResult()->getIterator(SessionInfo::fromResult(...));
|
||||
}
|
||||
|
||||
public function getSession(
|
||||
|
@ -124,7 +118,7 @@ class Sessions {
|
|||
if(!$result->next())
|
||||
throw new RuntimeException('Session not found.');
|
||||
|
||||
return new SessionInfo($result);
|
||||
return SessionInfo::fromResult($result);
|
||||
}
|
||||
|
||||
public function createSession(
|
||||
|
|
|
@ -5,20 +5,24 @@ use Index\DateTime;
|
|||
use Index\Data\IDbResult;
|
||||
|
||||
class ChangeInfo {
|
||||
private string $id;
|
||||
private ?string $userId;
|
||||
private int $action;
|
||||
private int $created;
|
||||
private string $summary;
|
||||
private string $body;
|
||||
public function __construct(
|
||||
private string $id,
|
||||
private ?string $userId,
|
||||
private int $action,
|
||||
private int $created,
|
||||
private string $summary,
|
||||
private string $body,
|
||||
) {}
|
||||
|
||||
public function __construct(IDbResult $result) {
|
||||
$this->id = (string)$result->getInteger(0);
|
||||
$this->userId = $result->isNull(1) ? null : (string)$result->getInteger(1);
|
||||
$this->action = $result->getInteger(2);
|
||||
$this->created = $result->getInteger(3);
|
||||
$this->summary = $result->getString(4);
|
||||
$this->body = $result->getString(5);
|
||||
public static function fromResult(IDbResult $result): ChangeInfo {
|
||||
return new ChangeInfo(
|
||||
id: $result->getString(0),
|
||||
userId: $result->getStringOrNull(1),
|
||||
action: $result->getInteger(2),
|
||||
created: $result->getInteger(3),
|
||||
summary: $result->getString(4),
|
||||
body: $result->getString(5),
|
||||
);
|
||||
}
|
||||
|
||||
public function getId(): string {
|
||||
|
|
|
@ -121,7 +121,7 @@ class Changelog {
|
|||
DateTime|int|null $dateTime = null,
|
||||
?array $tags = null,
|
||||
?Pagination $pagination = null
|
||||
): array {
|
||||
): iterable {
|
||||
if($userInfo instanceof UserInfo)
|
||||
$userInfo = $userInfo->getId();
|
||||
if($dateTime instanceof DateTime)
|
||||
|
@ -169,13 +169,7 @@ class Changelog {
|
|||
|
||||
$stmt->execute();
|
||||
|
||||
$result = $stmt->getResult();
|
||||
$changes = [];
|
||||
|
||||
while($result->next())
|
||||
$changes[] = new ChangeInfo($result);
|
||||
|
||||
return $changes;
|
||||
return $stmt->getResult()->getIterator(ChangeInfo::fromResult(...));
|
||||
}
|
||||
|
||||
public function getChange(string $changeId): ChangeInfo {
|
||||
|
@ -187,7 +181,7 @@ class Changelog {
|
|||
if(!$result->next())
|
||||
throw new RuntimeException('No tag with that ID exists.');
|
||||
|
||||
return new ChangeInfo($result);
|
||||
return ChangeInfo::fromResult($result);
|
||||
}
|
||||
|
||||
public function createChange(
|
||||
|
|
|
@ -73,15 +73,16 @@ final class ChangelogRoutes extends RouteHandler {
|
|||
if(!$pagination->hasValidOffset())
|
||||
return 404;
|
||||
|
||||
$changeInfos = $this->changelog->getChanges(userInfo: $filterUser, dateTime: $filterDate, tags: $filterTags, pagination: $pagination);
|
||||
if(empty($changeInfos))
|
||||
return 404;
|
||||
|
||||
$changes = [];
|
||||
$changeInfos = $this->changelog->getChanges(userInfo: $filterUser, dateTime: $filterDate, tags: $filterTags, pagination: $pagination);
|
||||
$commentsCategoryName = null;
|
||||
|
||||
foreach($changeInfos as $changeInfo) {
|
||||
$userInfo = $changeInfo->hasUserId() ? $this->usersCtx->getUserInfo($changeInfo->getUserId()) : null;
|
||||
|
||||
if($commentsCategoryName === null)
|
||||
$commentsCategoryName = $changeInfo->getCommentsCategoryName();
|
||||
|
||||
$changes[] = [
|
||||
'change' => $changeInfo,
|
||||
'user' => $userInfo,
|
||||
|
@ -89,13 +90,16 @@ final class ChangelogRoutes extends RouteHandler {
|
|||
];
|
||||
}
|
||||
|
||||
if(empty($changes))
|
||||
return 404;
|
||||
|
||||
return Template::renderRaw('changelog.index', [
|
||||
'changelog_infos' => $changes,
|
||||
'changelog_date' => $filterDate,
|
||||
'changelog_user' => $filterUser,
|
||||
'changelog_tags' => $filterTags,
|
||||
'changelog_pagination' => $pagination,
|
||||
'comments_info' => empty($filterDate) ? null : $this->getCommentsInfo($changeInfos[0]->getCommentsCategoryName()),
|
||||
'comments_info' => empty($filterDate) && $commentsCategoryName !== null ? null : $this->getCommentsInfo($commentsCategoryName),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class Comments {
|
|||
public function getCategories(
|
||||
UserInfo|string|null $owner = null,
|
||||
?Pagination $pagination = null
|
||||
): array {
|
||||
): iterable {
|
||||
if($owner instanceof UserInfo)
|
||||
$owner = $owner->getId();
|
||||
|
||||
|
@ -72,13 +72,7 @@ class Comments {
|
|||
|
||||
$stmt->execute();
|
||||
|
||||
$result = $stmt->getResult();
|
||||
$categories = [];
|
||||
|
||||
while($result->next())
|
||||
$categories[] = new CommentsCategoryInfo($result);
|
||||
|
||||
return $categories;
|
||||
return $stmt->getResult()->getIterator(CommentsCategoryInfo::fromResult(...));
|
||||
}
|
||||
|
||||
public function getCategory(
|
||||
|
@ -124,7 +118,7 @@ class Comments {
|
|||
if(!$result->next())
|
||||
throw new RuntimeException('Comments category not found.');
|
||||
|
||||
return new CommentsCategoryInfo($result);
|
||||
return CommentsCategoryInfo::fromResult($result);
|
||||
}
|
||||
|
||||
public function checkCategoryNameExists(string $name): bool {
|
||||
|
@ -276,7 +270,7 @@ class Comments {
|
|||
?bool $deleted = null,
|
||||
bool $includeRepliesCount = false,
|
||||
bool $includeVotesCount = false
|
||||
): array {
|
||||
): iterable {
|
||||
if($categoryInfo instanceof CommentsCategoryInfo)
|
||||
$categoryInfo = $categoryInfo->getId();
|
||||
if($parentInfo instanceof CommentsPostInfo)
|
||||
|
@ -330,13 +324,7 @@ class Comments {
|
|||
$stmt->addParameter(++$args, $userInfo instanceof UserInfo ? $userInfo->getId() : $userInfo);
|
||||
$stmt->execute();
|
||||
|
||||
$posts = [];
|
||||
$result = $stmt->getResult();
|
||||
|
||||
while($result->next())
|
||||
$posts[] = new CommentsPostInfo($result, $includeRepliesCount, $includeVotesCount);
|
||||
|
||||
return $posts;
|
||||
return $stmt->getResult()->getIterator(fn($result) => CommentsPostInfo::fromResult($result, $includeRepliesCount, $includeVotesCount));
|
||||
}
|
||||
|
||||
public function getPost(
|
||||
|
@ -362,7 +350,7 @@ class Comments {
|
|||
if(!$result->next())
|
||||
throw new RuntimeException('No comment with that ID exists.');
|
||||
|
||||
return new CommentsPostInfo($result, $includeRepliesCount, $includeVotesCount);
|
||||
return CommentsPostInfo::fromResult($result, $includeRepliesCount, $includeVotesCount);
|
||||
}
|
||||
|
||||
public function createPost(
|
||||
|
|
|
@ -6,20 +6,24 @@ use Index\Data\IDbResult;
|
|||
use Misuzu\Users\UserInfo;
|
||||
|
||||
class CommentsCategoryInfo {
|
||||
private string $id;
|
||||
private string $name;
|
||||
private ?string $ownerId;
|
||||
private int $created;
|
||||
private ?int $locked;
|
||||
private int $comments;
|
||||
public function __construct(
|
||||
private string $id,
|
||||
private string $name,
|
||||
private ?string $ownerId,
|
||||
private int $created,
|
||||
private ?int $locked,
|
||||
private int $comments,
|
||||
) {}
|
||||
|
||||
public function __construct(IDbResult $result) {
|
||||
$this->id = (string)$result->getInteger(0);
|
||||
$this->name = $result->getString(1);
|
||||
$this->ownerId = $result->isNull(2) ? null : (string)$result->getInteger(2);
|
||||
$this->created = $result->getInteger(3);
|
||||
$this->locked = $result->isNull(4) ? null : $result->getInteger(4);
|
||||
$this->comments = $result->getInteger(5);
|
||||
public static function fromResult(IDbResult $result): CommentsCategoryInfo {
|
||||
return new CommentsCategoryInfo(
|
||||
id: $result->getString(0),
|
||||
name: $result->getString(1),
|
||||
ownerId: $result->getStringOrNull(2),
|
||||
created: $result->getInteger(3),
|
||||
locked: $result->getIntegerOrNull(4),
|
||||
comments: $result->getInteger(5),
|
||||
);
|
||||
}
|
||||
|
||||
public function getId(): string {
|
||||
|
|
|
@ -5,47 +5,53 @@ use Index\DateTime;
|
|||
use Index\Data\IDbResult;
|
||||
|
||||
class CommentsPostInfo {
|
||||
private string $id;
|
||||
private string $categoryId;
|
||||
private ?string $userId;
|
||||
private ?string $replyingTo;
|
||||
private string $body;
|
||||
private int $created;
|
||||
private ?int $pinned;
|
||||
private ?int $updated;
|
||||
private ?int $deleted;
|
||||
private int $replies;
|
||||
private int $votesTotal;
|
||||
private int $votesPositive;
|
||||
private int $votesNegative;
|
||||
|
||||
public function __construct(
|