A big piece of functionality that people have been asking for in Known (and that I actually needed to start building out for some client work), was the ability to add a “draft” published status on a post, which was separate from “PRIVATE” in an ACL context.
To start building this out I introduced the concept of
publish_status (defaulting to “published”) on an Entity. Originally I implemented this as a piece of metadata, however since this had issues with filtering queries by “NOT ‘draft'” owing to this bug, I’m proposing a new pull request which implements the same functionality as a collection level schema change.
This obviously requires some DB patches to be applied, but it is both more efficient and more flexible.
Sessions are, in many bits of web software, used to store the details of the currently logged in user, and to provide the concept of a user being logged in and logged out. Known is no exception in this.
These sessions need to be stored, in some way, on the server. Usually this is either stored in files, or in a database.
Known currently has the ability to store sessions in the currently enabled database engine (Mysql, mongo etc), or in files. However, for various reasons (e.g. you want to use a different database engine to store sessions, or you want to implement a fancy session store), it would be useful to decouple the sessions from the database.
This pull request adds the ability to specify, in your
config.ini, a handler class implementing the
This new class can then implement a session handler which uses a different storage engine, other than just files and the current database.
Before migrating over to MySQL as the officially “blessed” database engine, Known previously used MongoDB.
The support for this was provided by the PECL extension ‘mongo’, which while supported in PHP5.4, was later deprecated and completely removed in PHP 7. This left early adopters, like myself, no upgrade path to PHP 7.
The end goal I believe, is to build a bullet proof import/export function into Known and get everyone over onto MySql, however in order to give us a little more runway, I took the opportunity to rewrite the mongo database driver to use the newer (and supported) MongoDB driver.
This pull request completely replaces the existing mongo code with a backwards compatible version built on the newer MongoDB driver, handling both database and GridFS.
Of course, while it does pass unit tests, this is a big change, so I encourage existing mongo users to kick it about for a bit, and also be sure to take a full backup of your existing stuff before rolling out this change.
Let me know your thoughts!