Repository navigation
feat: add the database-backed session handler and persistence - #4
Merged
Merged
Conversation
Moves the PhpDb session handler, the mezzio session persistence and their upsert Insert out of the IMS copy of php-db/phpdb-mezzio-session into this bridge, under the PhpDb\Session namespace it presents. Nothing is deleted from IMS. The code is brought up to the stack standards rather than copied verbatim: the table name comes from one SessionTable enum, settings resolve through IniDefaults, payload encoding is SessionPayload, exceptions are declared, and every finding is fixed at source with no baseline entry. session:init-db creates the table. Its columns come from the IMS session schema (id, payload, modified_at, expires_at; primary key id; index on expires_at), less the database-side timestamp defaults because every write supplies both timestamps. SessionProvider is a second config provider and aliases SessionPersistenceInterface to the database persistence. mezzio-session and webware-console are dev dependencies and suggestions, not requirements. Signed-off-by: Joey Smith <jsmith@webinertia.net>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves the session handler and persistence from the IMS copy of
php-db/phpdb-mezzio-sessioninto this bridge, underPhpDb\Session(the namespace that package presents). IMS is only read.DbSessionHandler(ext-session handler),PhpDbSessionPersistence(mezzio persistence, async-safe) and the upsertSql\Insert.session:init-dbcreates the table. Columns are taken from the IMS schema (data/schema/015_session.sql):id VARCHAR(64)PK,payload MEDIUMTEXT,modified_at,expires_at(indexed). The database-side timestamp defaults are not carried over: every write supplies both.SessionProvideris a secondextra.laminas.config-providerand aliasesSessionPersistenceInterfaceto the database persistence.mezzio/mezzio-sessionandwebware/webware-consolearerequire-devplussuggest, not requirements.Changed from the source rather than copied: table name from one
SessionTableenum, settings throughIniDefaults, payload encoding inSessionPayload, declared exceptions, named arguments,fromConfigArray()folded into the constructor. No baseline entries added.Known limits, unchanged from the source:
Sql\Inserthardcodes MySQLON DUPLICATE KEY UPDATE(the source has the same@todo); the integration tests run on MySQL only.gc()keeps$maxLifetime; the interface names it$max_lifetime, which the camel-case lint rule rejects, so the analyzer warns.Verification: format, lint, analyze and guard clean. 58 unit tests. Integration on a throwaway MySQL 9.7: handler, persistence, factory wiring, and the created table compared column by column with the IMS definition. Coverage 100% lines. Infection on
src/Session: 138 mutants, 0 escaped.Not from this PR:
SchemaFactoryIntegrationTest::itCreatesPrefixedTableOnMysqlalready fails on1.0.x(calls the now-privateWebwareProvider::getDependencies()), which also stops Infection from starting its initial run. I excluded it locally and did not touch it.WebwareProviderWiringTestis updated becauseconfig-provideris now a list.A release of webware-phpdb is needed before hosts can use this without a path repo.