PhilGale.co.uk - Portfolio


Note: I will not be releasing any commercial code here.

DOCX PARSER

Ok so I wrote the original version in ~2012, for a client request of their existing workflow being .docx file based, and wishing each piece of content to only need one copy with no additional work to get them working in a browser format.

I found some basic tools online for pulling content (plaintext) from word files so realised I could too. Basically each .docx file is a ZIP archive of misc. other data. Inside are numerous XML files, but two relevant ones are "structure.xml", and "document.xml.rels", they both generally following OpenDocument XML format.

I then wrote a fully featured .docx -> PHP Data set -> Html parser, which at least at that time had no (free) equivalent. A few years later I opensourced what I could. In 2019 I then rewrote all the code as a personal project to improve usability & code quality

VIEW SOURCE


System: Automatic database upgrades

One of the most annoying parts of managing a CMS, although it doesn't happen much now days, is having an SQL schema change. This used to need a developer to perform the update on every database in turn.

I performed the following, after planning out the procedure on my notepad:

  • Added a new class for tracking installed DB upgrades on each website, and DB upgrades pending installation
  • Added functionality in the API CMS for creating a `db upgrade`, which takes your inserted SQL, and runs all the last set of unit tests, using the last dev- code base known to have passed.
  • Ensure if the code passes, the SQL is provided in a secondary payload to all API requests, where the pending install version is lower
  • Ensure the individual websites install said upgrades at their next background task slot.
  • Add an initial DB version constant, so future website builds know they're upgrades are already included.

This was a fun system as I piggybacked of both the internal API, and the Automatic testing systems which I developed several months before, and everything just worked! Ideal!