Updated Index library.

This commit is contained in:
Pachira 2024-10-21 20:50:01 +00:00
parent 4af67cc422
commit fd085514e5
23 changed files with 183 additions and 320 deletions

View file

@ -1,8 +1,6 @@
{
"require": {
"flashwave/index": "^0.2408.40014",
"flashwave/sasae": "^1.1",
"flashwave/syokuhou": "^1.2",
"flashwave/index": "^0.2410",
"erusev/parsedown": "~1.6",
"sentry/sdk": "^4.0",
"nesbot/carbon": "^3.7"

337
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "2b09221cee42b366070c9da9bec346b6",
"content-hash": "95007e8e6950a46ba5ccde993824d8ca",
"packages": [
{
"name": "carbonphp/carbon-doctrine-types",
@ -127,26 +127,39 @@
},
{
"name": "flashwave/index",
"version": "v0.2408.182001",
"version": "v0.2410.191603",
"source": {
"type": "git",
"url": "https://patchii.net/flash/index.git",
"reference": "5a1fdcccedf818897a3468d5457875fabfb2ce28"
"reference": "17cdb4d1c239241200d7e30968122a8cd8b26509"
},
"require": {
"ext-mbstring": "*",
"php": ">=8.3"
"php": ">=8.3",
"twig/html-extra": "^3.13",
"twig/twig": "^3.14"
},
"require-dev": {
"phpstan/phpstan": "^1.11",
"phpunit/phpunit": "^11.2"
},
"suggest": {
"ext-mysqli": "Support for the Index\\Data\\MariaDB namespace (both mysqlnd and libmysql are supported).",
"ext-sqlite3": "Support for the Index\\Data\\SQLite namespace."
"ext-memcache": "Support for the Index\\Cache\\Memcached namespace (only if you can't use ext-memcached for some reason).",
"ext-memcached": "Support for the Index\\Cache\\Memcached namespace (you should use this instead of ext-memcache).",
"ext-mysqli": "Support for the Index\\Db\\MariaDb namespace (both mysqlnd and libmysql are supported).",
"ext-redis": "Support for the Index\\Cache\\Valkey namespace.",
"ext-sqlite3": "Support for the Index\\Db\\Sqlite namespace."
},
"type": "library",
"autoload": {
"files": [
"src/Cache/ArrayCache/_ndx.php",
"src/Cache/Memcached/_ndx.php",
"src/Cache/Valkey/_ndx.php",
"src/Db/MariaDb/_ndx.php",
"src/Db/NullDb/_ndx.php",
"src/Db/Sqlite/_ndx.php"
],
"psr-4": {
"Index\\": "src"
}
@ -165,85 +178,7 @@
],
"description": "Composer package for the common library for my projects.",
"homepage": "https://railgun.sh/index",
"time": "2024-08-18T20:01:21+00:00"
},
{
"name": "flashwave/sasae",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://patchii.net/flash/sasae.git",
"reference": "897a28e56926ad465bf0daf587caf3d92a311383"
},
"require": {
"flashwave/index": "^0.2408.40014",
"php": ">=8.3",
"twig/html-extra": "^3.12",
"twig/twig": "^3.12"
},
"require-dev": {
"phpstan/phpstan": "^1.11",
"phpunit/phpunit": "^11.2"
},
"type": "library",
"autoload": {
"psr-4": {
"Sasae\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"bsd-3-clause-clear"
],
"authors": [
{
"name": "flashwave",
"email": "packagist@flash.moe",
"homepage": "https://flash.moe",
"role": "mom"
}
],
"description": "A wrapper for Twig with added common functionality.",
"homepage": "https://railgun.sh/sasae",
"time": "2024-09-01T20:38:47+00:00"
},
{
"name": "flashwave/syokuhou",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://patchii.net/flash/syokuhou.git",
"reference": "129a46c0d917382f9bc195cce278be51984eb87d"
},
"require": {
"flashwave/index": "^0.2408.40014",
"php": ">=8.3"
},
"require-dev": {
"phpstan/phpstan": "^1.11",
"phpunit/phpunit": "^11.2"
},
"type": "library",
"autoload": {
"psr-4": {
"Syokuhou\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"bsd-3-clause-clear"
],
"authors": [
{
"name": "flashwave",
"email": "packagist@flash.moe",
"homepage": "https://flash.moe",
"role": "mom"
}
],
"description": "Configuration library for PHP.",
"homepage": "https://railgun.sh/syokuhou",
"time": "2024-08-04T01:07:23+00:00"
"time": "2024-10-19T16:04:17+00:00"
},
{
"name": "guzzlehttp/psr7",
@ -684,16 +619,16 @@
},
{
"name": "psr/log",
"version": "3.0.1",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "79dff0b268932c640297f5208d6298f71855c03e"
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/79dff0b268932c640297f5208d6298f71855c03e",
"reference": "79dff0b268932c640297f5208d6298f71855c03e",
"url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"shasum": ""
},
"require": {
@ -728,9 +663,9 @@
"psr-3"
],
"support": {
"source": "https://github.com/php-fig/log/tree/3.0.1"
"source": "https://github.com/php-fig/log/tree/3.0.2"
},
"time": "2024-08-21T13:31:24+00:00"
"time": "2024-09-11T13:17:53+00:00"
},
{
"name": "ralouphie/getallheaders",
@ -1063,16 +998,16 @@
},
{
"name": "symfony/mime",
"version": "v7.1.4",
"version": "v7.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
"reference": "ccaa6c2503db867f472a587291e764d6a1e58758"
"reference": "711d2e167e8ce65b05aea6b258c449671cdd38ff"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/mime/zipball/ccaa6c2503db867f472a587291e764d6a1e58758",
"reference": "ccaa6c2503db867f472a587291e764d6a1e58758",
"url": "https://api.github.com/repos/symfony/mime/zipball/711d2e167e8ce65b05aea6b258c449671cdd38ff",
"reference": "711d2e167e8ce65b05aea6b258c449671cdd38ff",
"shasum": ""
},
"require": {
@ -1127,7 +1062,7 @@
"mime-type"
],
"support": {
"source": "https://github.com/symfony/mime/tree/v7.1.4"
"source": "https://github.com/symfony/mime/tree/v7.1.5"
},
"funding": [
{
@ -1143,7 +1078,7 @@
"type": "tidelift"
}
],
"time": "2024-08-13T14:28:19+00:00"
"time": "2024-09-20T08:28:38+00:00"
},
{
"name": "symfony/options-resolver",
@ -1214,20 +1149,20 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.30.0",
"version": "v1.31.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "0424dff1c58f028c451efff2045f5d92410bd540"
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540",
"reference": "0424dff1c58f028c451efff2045f5d92410bd540",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638",
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638",
"shasum": ""
},
"require": {
"php": ">=7.1"
"php": ">=7.2"
},
"provide": {
"ext-ctype": "*"
@ -1273,7 +1208,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0"
},
"funding": [
{
@ -1289,26 +1224,25 @@
"type": "tidelift"
}
],
"time": "2024-05-31T15:07:36+00:00"
"time": "2024-09-09T11:45:10+00:00"
},
{
"name": "symfony/polyfill-intl-idn",
"version": "v1.30.0",
"version": "v1.31.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
"reference": "a6e83bdeb3c84391d1dfe16f42e40727ce524a5c"
"reference": "c36586dcf89a12315939e00ec9b4474adcb1d773"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a6e83bdeb3c84391d1dfe16f42e40727ce524a5c",
"reference": "a6e83bdeb3c84391d1dfe16f42e40727ce524a5c",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/c36586dcf89a12315939e00ec9b4474adcb1d773",
"reference": "c36586dcf89a12315939e00ec9b4474adcb1d773",
"shasum": ""
},
"require": {
"php": ">=7.1",
"symfony/polyfill-intl-normalizer": "^1.10",
"symfony/polyfill-php72": "^1.10"
"php": ">=7.2",
"symfony/polyfill-intl-normalizer": "^1.10"
},
"suggest": {
"ext-intl": "For best performance"
@ -1357,7 +1291,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.30.0"
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.31.0"
},
"funding": [
{
@ -1373,24 +1307,24 @@
"type": "tidelift"
}
],
"time": "2024-05-31T15:07:36+00:00"
"time": "2024-09-09T11:45:10+00:00"
},
{
"name": "symfony/polyfill-intl-normalizer",
"version": "v1.30.0",
"version": "v1.31.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
"reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb"
"reference": "3833d7255cc303546435cb650316bff708a1c75c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/a95281b0be0d9ab48050ebd988b967875cdb9fdb",
"reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb",
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c",
"reference": "3833d7255cc303546435cb650316bff708a1c75c",
"shasum": ""
},
"require": {
"php": ">=7.1"
"php": ">=7.2"
},
"suggest": {
"ext-intl": "For best performance"
@ -1438,7 +1372,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.30.0"
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0"
},
"funding": [
{
@ -1454,24 +1388,24 @@
"type": "tidelift"
}
],
"time": "2024-05-31T15:07:36+00:00"
"time": "2024-09-09T11:45:10+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.30.0",
"version": "v1.31.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c"
"reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c",
"reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341",
"reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341",
"shasum": ""
},
"require": {
"php": ">=7.1"
"php": ">=7.2"
},
"provide": {
"ext-mbstring": "*"
@ -1518,7 +1452,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0"
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0"
},
"funding": [
{
@ -1534,97 +1468,24 @@
"type": "tidelift"
}
],
"time": "2024-06-19T12:30:46+00:00"
},
{
"name": "symfony/polyfill-php72",
"version": "v1.30.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
"reference": "10112722600777e02d2745716b70c5db4ca70442"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/10112722600777e02d2745716b70c5db4ca70442",
"reference": "10112722600777e02d2745716b70c5db4ca70442",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"type": "library",
"extra": {
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Php72\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php72/tree/v1.30.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-06-19T12:30:46+00:00"
"time": "2024-09-09T11:45:10+00:00"
},
{
"name": "symfony/polyfill-php81",
"version": "v1.30.0",
"version": "v1.31.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php81.git",
"reference": "3fb075789fb91f9ad9af537c4012d523085bd5af"
"reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/3fb075789fb91f9ad9af537c4012d523085bd5af",
"reference": "3fb075789fb91f9ad9af537c4012d523085bd5af",
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
"reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
"shasum": ""
},
"require": {
"php": ">=7.1"
"php": ">=7.2"
},
"type": "library",
"extra": {
@ -1667,7 +1528,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php81/tree/v1.30.0"
"source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0"
},
"funding": [
{
@ -1683,24 +1544,24 @@
"type": "tidelift"
}
],
"time": "2024-06-19T12:30:46+00:00"
"time": "2024-09-09T11:45:10+00:00"
},
{
"name": "symfony/polyfill-php83",
"version": "v1.30.0",
"version": "v1.31.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php83.git",
"reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9"
"reference": "2fb86d65e2d424369ad2905e83b236a8805ba491"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9",
"reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9",
"url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/2fb86d65e2d424369ad2905e83b236a8805ba491",
"reference": "2fb86d65e2d424369ad2905e83b236a8805ba491",
"shasum": ""
},
"require": {
"php": ">=7.1"
"php": ">=7.2"
},
"type": "library",
"extra": {
@ -1743,7 +1604,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php83/tree/v1.30.0"
"source": "https://github.com/symfony/polyfill-php83/tree/v1.31.0"
},
"funding": [
{
@ -1759,20 +1620,20 @@
"type": "tidelift"
}
],
"time": "2024-06-19T12:35:24+00:00"
"time": "2024-09-09T11:45:10+00:00"
},
{
"name": "symfony/translation",
"version": "v7.1.3",
"version": "v7.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "8d5e50c813ba2859a6dfc99a0765c550507934a1"
"reference": "235535e3f84f3dfbdbde0208ede6ca75c3a489ea"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/8d5e50c813ba2859a6dfc99a0765c550507934a1",
"reference": "8d5e50c813ba2859a6dfc99a0765c550507934a1",
"url": "https://api.github.com/repos/symfony/translation/zipball/235535e3f84f3dfbdbde0208ede6ca75c3a489ea",
"reference": "235535e3f84f3dfbdbde0208ede6ca75c3a489ea",
"shasum": ""
},
"require": {
@ -1837,7 +1698,7 @@
"description": "Provides tools to internationalize your application",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/translation/tree/v7.1.3"
"source": "https://github.com/symfony/translation/tree/v7.1.5"
},
"funding": [
{
@ -1853,7 +1714,7 @@
"type": "tidelift"
}
],
"time": "2024-07-26T12:41:01+00:00"
"time": "2024-09-16T06:30:38+00:00"
},
{
"name": "symfony/translation-contracts",
@ -1935,23 +1796,23 @@
},
{
"name": "twig/html-extra",
"version": "v3.12.0",
"version": "v3.13.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/html-extra.git",
"reference": "4cdfc6f419910ad6ef9c4c9fafbcd1d5793b4f4c"
"reference": "8229e750091171c1f11801a525927811c7ac5a7e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/html-extra/zipball/4cdfc6f419910ad6ef9c4c9fafbcd1d5793b4f4c",
"reference": "4cdfc6f419910ad6ef9c4c9fafbcd1d5793b4f4c",
"url": "https://api.github.com/repos/twigphp/html-extra/zipball/8229e750091171c1f11801a525927811c7ac5a7e",
"reference": "8229e750091171c1f11801a525927811c7ac5a7e",
"shasum": ""
},
"require": {
"php": ">=8.0.2",
"symfony/deprecation-contracts": "^2.5|^3",
"symfony/mime": "^5.4|^6.4|^7.0",
"twig/twig": "^3.0"
"twig/twig": "^3.13|^4.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^6.4|^7.0"
@ -1987,7 +1848,7 @@
"twig"
],
"support": {
"source": "https://github.com/twigphp/html-extra/tree/v3.12.0"
"source": "https://github.com/twigphp/html-extra/tree/v3.13.0"
},
"funding": [
{
@ -1999,20 +1860,20 @@
"type": "tidelift"
}
],
"time": "2024-08-18T17:25:19+00:00"
"time": "2024-09-03T13:08:40+00:00"
},
{
"name": "twig/twig",
"version": "v3.12.0",
"version": "v3.14.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "4d19472d4ac1838e0b1f0e029ce1fa4040eb34ea"
"reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/4d19472d4ac1838e0b1f0e029ce1fa4040eb34ea",
"reference": "4d19472d4ac1838e0b1f0e029ce1fa4040eb34ea",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/126b2c97818dbff0cdf3fbfc881aedb3d40aae72",
"reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72",
"shasum": ""
},
"require": {
@ -2066,7 +1927,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.12.0"
"source": "https://github.com/twigphp/Twig/tree/v3.14.0"
},
"funding": [
{
@ -2078,22 +1939,22 @@
"type": "tidelift"
}
],
"time": "2024-08-29T09:51:12+00:00"
"time": "2024-09-09T17:55:12+00:00"
}
],
"packages-dev": [
{
"name": "phpstan/phpstan",
"version": "1.12.0",
"version": "1.12.7",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "384af967d35b2162f69526c7276acadce534d0e1"
"reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/384af967d35b2162f69526c7276acadce534d0e1",
"reference": "384af967d35b2162f69526c7276acadce534d0e1",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc2b9976bd8b0f84ec9b0e50cc35378551de7af0",
"reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0",
"shasum": ""
},
"require": {
@ -2138,7 +1999,7 @@
"type": "github"
}
],
"time": "2024-08-27T09:18:05+00:00"
"time": "2024-10-18T11:12:07+00:00"
}
],
"aliases": [],

View file

@ -1,9 +1,9 @@
<?php
use Index\Data\IDbConnection;
use Index\Data\Migration\IDbMigration;
use Index\Db\DbConnection;
use Index\Db\Migration\DbMigration;
final class ExistingTables_20231013_215920 implements IDbMigration {
public function migrate(IDbConnection $conn): void {
final class ExistingTables_20231013_215920 implements DbMigration {
public function migrate(DbConnection $conn): void {
$existingTables = [];
$result = $conn->query('SHOW TABLES');
while($result->next())

View file

@ -1,8 +1,8 @@
<?php
namespace Makai;
use Index\Data\DbTools;
use Syokuhou\SharpConfig;
use Index\Config\Fs\FsConfig;
use Index\Db\DbBackends;
define('MKI_STARTUP', microtime(true));
define('MKI_ROOT', __DIR__);
@ -19,7 +19,7 @@ error_reporting(MKI_DEBUG ? -1 : 0);
mb_internal_encoding('UTF-8');
date_default_timezone_set('GMT');
$cfg = SharpConfig::fromFile(MKI_ROOT . '/makai.cfg');
$cfg = FsConfig::fromFile(MKI_ROOT . '/makai.cfg');
if($cfg->hasValues('sentry:dsn'))
(function($cfg) {
@ -34,7 +34,7 @@ if($cfg->hasValues('sentry:dsn'))
});
})($cfg->scopeTo('sentry'));
$db = DbTools::create($cfg->getString('database:dsn', 'null:'));
$db = DbBackends::create($cfg->getString('database:dsn', 'null:'));
$db->execute('SET SESSION time_zone = \'+00:00\', sql_mode = \'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION\'');
$makai = new MakaiContext($db);

View file

@ -1,9 +1,11 @@
<?php
namespace Makai;
use Index\Http\Routing\{HttpGet,RouteHandler};
use Index\Http\Routing\{HttpGet,RouteHandler,RouteHandlerTrait};
class AssetsRoutes implements RouteHandler {
use RouteHandlerTrait;
class AssetsRoutes extends RouteHandler {
public function __construct(
private SiteInfo $siteInfo
) {}

View file

@ -1,10 +1,10 @@
<?php
namespace Makai;
use Index\CSRFP;
use Index\CsrfToken;
final class CSRFPContainer {
private ?CSRFP $instance = null;
private ?CsrfToken $instance = null;
private string $secretKey = '';
private string $identity = '';
@ -25,9 +25,9 @@ final class CSRFPContainer {
|| ($this->secretKey !== '' && $this->identity !== '');
}
public function getInstance(): ?CSRFP {
public function getInstance(): ?CsrfToken {
if($this->instance === null)
$this->instance = new CSRFP($this->secretKey, $this->identity);
$this->instance = new CsrfToken($this->secretKey, $this->identity);
return $this->instance;
}

View file

@ -1,9 +1,8 @@
<?php
namespace Makai\Contacts;
use Index\Colour\Colour;
use Index\Colour\ColourRGB;
use Index\Data\IDbResult;
use Index\Colour\{Colour,ColourRgb};
use Index\Db\DbResult;
class ContactInfo {
private string $name;
@ -15,7 +14,7 @@ class ContactInfo {
private string $display;
private ?string $link;
public function __construct(IDbResult $result) {
public function __construct(DbResult $result) {
$this->name = $result->getString(0);
$this->homePage = $result->getInteger(1) !== 0;
$this->order = $result->getInteger(2);
@ -59,7 +58,7 @@ class ContactInfo {
}
public function getColour(): Colour {
return ColourRGB::fromRawRGB($this->colour);
return ColourRgb::fromRawRgb($this->colour);
}
public function getColourRaw(): int {

View file

@ -1,13 +1,12 @@
<?php
namespace Makai\Contacts;
use Index\Data\DbStatementCache;
use Index\Data\IDbConnection;
use Index\Db\{DbConnection,DbStatementCache};
class Contacts {
private DbStatementCache $cache;
public function __construct(IDbConnection $dbConn) {
public function __construct(DbConnection $dbConn) {
$this->cache = new DbStatementCache($dbConn);
}

View file

@ -1,14 +1,16 @@
<?php
namespace Makai;
use Index\Http\Routing\{HttpGet,RouteHandler};
use Sasae\SasaeEnvironment;
use Index\Http\Routing\{HttpGet,RouteHandler,RouteHandlerTrait};
use Index\Templating\TplEnvironment;
use Makai\Contacts\Contacts;
use Makai\Projects\Projects;
class DeveloperRoutes extends RouteHandler {
class DeveloperRoutes implements RouteHandler {
use RouteHandlerTrait;
public function __construct(
private SasaeEnvironment $templating,
private TplEnvironment $templating,
private Contacts $contacts,
private Projects $projects
) {}

View file

@ -1,13 +1,13 @@
<?php
namespace Makai;
use Index\Data\IDbConnection;
use Index\Data\Migration\{IDbMigrationRepo,DbMigrationManager,FsDbMigrationRepo};
use Sasae\SasaeEnvironment;
use Index\Db\DbConnection;
use Index\Db\Migration\{DbMigrationRepo,DbMigrationManager,FsDbMigrationRepo};
use Index\Templating\TplEnvironment;
final class MakaiContext {
private IDbConnection $dbConn;
private SasaeEnvironment $templating;
private DbConnection $dbConn;
private TplEnvironment $templating;
private CSRFPContainer $csrfp;
private SiteInfo $siteInfo;
@ -16,7 +16,7 @@ final class MakaiContext {
private Projects\Projects $projects;
private SSHKeys\SSHKeys $sshKeys;
public function __construct(IDbConnection $dbConn) {
public function __construct(DbConnection $dbConn) {
$this->dbConn = $dbConn;
$this->siteInfo = new SiteInfo;
@ -44,7 +44,7 @@ final class MakaiContext {
return $this->sshKeys;
}
public function getDbConn(): IDbConnection {
public function getDbConn(): DbConnection {
return $this->dbConn;
}
@ -57,16 +57,16 @@ final class MakaiContext {
return new DbMigrationManager($this->dbConn, 'fm_' . DbMigrationManager::DEFAULT_TABLE);
}
public function createMigrationRepo(): IDbMigrationRepo {
public function createMigrationRepo(): DbMigrationRepo {
return new FsDbMigrationRepo(MKI_DIR_MIGRATIONS);
}
public function getTemplating(): SasaeEnvironment {
public function getTemplating(): TplEnvironment {
return $this->templating;
}
public function startTemplating(): void {
$this->templating = new SasaeEnvironment(
$this->templating = new TplEnvironment(
MKI_DIR_TEMPLATES,
cache: MKI_DEBUG ? null : ['Makai', GitInfo::hash(true)],
debug: MKI_DEBUG,

View file

@ -1,16 +1,15 @@
<?php
namespace Makai\Projects;
use Index\Colour\Colour;
use Index\Colour\ColourRGB;
use Index\Data\IDbResult;
use Index\Colour\{Colour,ColourRgb};
use Index\Db\DbResult;
class LanguageInfo {
private string $id;
private string $name;
private ?int $colour;
public function __construct(IDbResult $result) {
public function __construct(DbResult $result) {
$this->id = $result->getString(0);
$this->name = $result->getString(1);
$this->colour = $result->isNull(2) ? null : $result->getInteger(2);
@ -29,7 +28,7 @@ class LanguageInfo {
}
public function getColour(): Colour {
return $this->colour === null ? Colour::none() : ColourRGB::fromRawRGB($this->colour);
return $this->colour === null ? Colour::none() : ColourRgb::fromRawRGB($this->colour);
}
public function getColourRaw(): ?int {

View file

@ -2,8 +2,8 @@
namespace Makai\Projects;
use Carbon\CarbonImmutable;
use Index\Colour\{Colour,ColourRGB};
use Index\Data\IDbResult;
use Index\Colour\{Colour,ColourRgb};
use Index\Db\DbResult;
class ProjectInfo {
private string $id;
@ -22,7 +22,7 @@ class ProjectInfo {
private ?int $archivedAt;
private ?int $deletedAt;
public function __construct(IDbResult $result) {
public function __construct(DbResult $result) {
$this->id = $result->getString(0);
$this->name = $result->getString(1);
$this->nameClean = $result->getString(2);
@ -81,7 +81,7 @@ class ProjectInfo {
}
public function getColour(): Colour {
return $this->colour === null ? Colour::none() : ColourRGB::fromRawRGB($this->colour);
return $this->colour === null ? Colour::none() : ColourRgb::fromRawRGB($this->colour);
}
public function getColourRaw(): ?int {

View file

@ -1,15 +1,13 @@
<?php
namespace Makai\Projects;
use Index\Colour\Colour;
use Index\Colour\ColourRGB;
use Index\Data\DbStatementCache;
use Index\Data\IDbConnection;
use Index\Colour\{Colour,ColourRgb};
use Index\Db\{DbConnection,DbStatementCache};
class Projects {
private DbStatementCache $cache;
public function __construct(IDbConnection $dbConn) {
public function __construct(DbConnection $dbConn) {
$this->cache = new DbStatementCache($dbConn);
}
@ -82,6 +80,6 @@ class Projects {
if(!$result->next() || $result->isNull(0))
return Colour::none();
return ColourRGB::fromRawRGB($result->getInteger(0));
return ColourRgb::fromRawRGB($result->getInteger(0));
}
}

View file

@ -1,8 +1,7 @@
<?php
namespace Makai;
use Index\Http\Routing\{HttpRouter,IRouter,IRouteHandler};
use Sasae\SasaeEnvironment;
use Index\Http\Routing\{HttpRouter,Router,RouteHandler};
class RoutingContext {
private HttpRouter $router;
@ -12,11 +11,11 @@ class RoutingContext {
$this->router->use('/', fn($resp) => $resp->setPoweredBy('Makai'));
}
public function getRouter(): IRouter {
public function getRouter(): Router {
return $this->router;
}
public function register(IRouteHandler $handler): void {
public function register(RouteHandler $handler): void {
$this->router->register($handler);
}

View file

@ -1,10 +1,9 @@
<?php
namespace Makai;
use Index\Http\{HttpResponseBuilder,HttpRequest};
use Index\Http\ErrorHandling\HtmlErrorHandler;
use Index\Http\{HtmlHttpErrorHandler,HttpResponseBuilder,HttpRequest};
class RoutingErrorHandler extends HtmlErrorHandler {
class RoutingErrorHandler extends HtmlHttpErrorHandler {
public function handle(HttpResponseBuilder $response, HttpRequest $request, int $code, string $message): void {
if($code === 401 || $code === 403 || $code === 404 || $code === 500 || $code === 503) {
$response->setTypeHTML();

View file

@ -2,7 +2,7 @@
namespace Makai\SSHKeys;
use Carbon\CarbonImmutable;
use Index\Data\IDbResult;
use Index\Db\DbResult;
class SSHKeyInfo {
private string $id;
@ -13,7 +13,7 @@ class SSHKeyInfo {
private int $createdAt;
private ?int $deprecatedAt;
public function __construct(IDbResult $result) {
public function __construct(DbResult $result) {
$this->id = $result->getString(0);
$this->level = $result->getInteger(1);
$this->algo = $result->getString(2);

View file

@ -1,13 +1,12 @@
<?php
namespace Makai\SSHKeys;
use Index\Data\DbStatementCache;
use Index\Data\IDbConnection;
use Index\Db\{DbConnection,DbStatementCache};
class SSHKeys {
private DbStatementCache $cache;
public function __construct(IDbConnection $dbConn) {
public function __construct(DbConnection $dbConn) {
$this->cache = new DbStatementCache($dbConn);
}

View file

@ -2,9 +2,11 @@
namespace Makai\SSHKeys;
use DateTimeInterface;
use Index\Http\Routing\{HttpGet,RouteHandler};
use Index\Http\Routing\{HttpGet,RouteHandler,RouteHandlerTrait};
class SSHKeysRoutes implements RouteHandler {
use RouteHandlerTrait;
class SSHKeysRoutes extends RouteHandler {
public function __construct(
private SSHKeys $sshKeys
) {}

View file

@ -1,12 +1,14 @@
<?php
namespace Makai\Tools\Ascii;
use Index\Http\Routing\{HttpGet,RouteHandler};
use Sasae\SasaeEnvironment;
use Index\Http\Routing\{HttpGet,RouteHandler,RouteHandlerTrait};
use Index\Templating\TplEnvironment;
class AsciiRoutes implements RouteHandler {
use RouteHandlerTrait;
class AsciiRoutes extends RouteHandler {
public function __construct(
private SasaeEnvironment $templating
private TplEnvironment $templating
) {}
#[HttpGet('/tools/ascii')]

View file

@ -2,9 +2,11 @@
namespace Makai\Tools;
use Index\XString;
use Index\Http\Routing\{HttpGet,RouteHandler};
use Index\Http\Routing\{HttpGet,RouteHandler,RouteHandlerTrait};
class ToolsRoutes implements RouteHandler {
use RouteHandlerTrait;
class ToolsRoutes extends RouteHandler {
#[HttpGet('/tools/random')]
public function getRandomString($response, $request): string {
$response->setTypePlain();

View file

@ -3,14 +3,16 @@ namespace Makai\Tools\Whois;
use Exception;
use Memcached;
use Index\Cache\CacheTools;
use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler};
use Sasae\SasaeEnvironment;
use Index\Cache\CacheBackends;
use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler,RouteHandlerTrait};
use Index\Templating\TplEnvironment;
use Makai\CSRFPContainer;
class WhoisRoutes extends RouteHandler {
class WhoisRoutes implements RouteHandler {
use RouteHandlerTrait;
public function __construct(
private SasaeEnvironment $templating,
private TplEnvironment $templating,
private CSRFPContainer $csrfp,
) {}
@ -51,7 +53,7 @@ class WhoisRoutes extends RouteHandler {
$source = '';
try {
$cache = CacheTools::create('memcached://localhost');
$cache = CacheBackends::create('memcached://localhost');
$result = $cache->get($prefix . $hash);
if($result === null) {

View file

@ -1,6 +1,6 @@
#!/usr/bin/env php
<?php
use Index\Data\Migration\FsDbMigrationRepo;
use Index\Db\Migration\FsDbMigrationRepo;
require_once __DIR__ . '/../makai.php';

View file

@ -1,6 +1,6 @@
#!/usr/bin/env php
<?php
use Index\Data\Migration\FsDbMigrationRepo;
use Index\Db\Migration\FsDbMigrationRepo;
require_once __DIR__ . '/../makai.php';