feat: switch from MySQL to SQLite for zero-dependency deployment
- Rewrite db.php to use SQLite via PDO (no external DB server needed) - Rewrite schema.sql for SQLite (AUTOINCREMENT, CHECK constraints, triggers for updated_at, ON CONFLICT instead of ON DUPLICATE KEY) - Fix config.php upsert to use ON CONFLICT syntax - Fix index.php: tag filter via json_each, vote upsert via ON CONFLICT, and fix protocol create route (was returning 405 for POST /api/protocols) - Fix yaml.php seed import: replace invalid false callbacks with fn() => null, fix yaml_parse pos argument (-1 -> 0) - Update Dockerfile: drop pdo_mysql/mysqli (pdo_sqlite is built in) - Update CloudronManifest.json: remove mysql addon, bump to v0.3.0 - Update README for SQLite deployment
This commit is contained in:
Executable → Regular
+6
-4
@@ -83,10 +83,12 @@ function yaml_array(array $arr): string {
|
||||
*/
|
||||
function parse_protocol_yaml(string $yaml_text): ?array {
|
||||
if (function_exists('yaml_parse')) {
|
||||
// Harden against PHP object injection via !php/object tags
|
||||
$data = yaml_parse($yaml_text, -1, $ndocs, [
|
||||
'!php/object' => false,
|
||||
'!php/const' => false,
|
||||
// Harden against PHP object injection via !php/object and !php/const tags.
|
||||
// The callbacks must be valid callables; null them out to neutralize deserialization.
|
||||
$neutralize = fn() => null;
|
||||
$data = yaml_parse($yaml_text, 0, $ndocs, [
|
||||
'!php/object' => $neutralize,
|
||||
'!php/const' => $neutralize,
|
||||
]);
|
||||
if (!is_array($data)) return null;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user