Repository navigation
Conversation
waldoj
commented
Aug 5, 2026
Member
- Accelerate exporting static files—it's now much faster
- Move to MySQL's fulltext search, delivering much better results
- Replace Typekit with Google Fonts
- Add timestamps to log messages
- Display a public "last updated" link on every page
- Add a tally badge to the Pinned Laws menu item
- Add a generator meta tag
list_laws() is slow because of running structure_contents() for every law within it, so we memoize per structure, setting up a tiny, one-slot cache. This collapses N calls into just 1. We also simplify the per-sibling $law->get_metadata() loop by using a query that obviates the loop. Note that caching is within the PHP process, not within Memcached or whatever. Toward #622.
Dictionary::term_list() fetches the whole global dictionary for every law, and then Law::render() fetches additional terms that are in scope. So we replace term_list()'s big OR query into two queries, meaning that we can use a one-slot memo cache for the non-structure-scoped bit. Also, we skip the section-scoped part for a global-scope query. Then we unique the two to avoid any duplicates. Toward #622.
Instead of running a single query for each word, combine all of them into a series of smaller ones, capped at 500 per PCRE. We also move this into a function, allowing us to add a one-slot cache, for when this is run repeatedly on laws in the same chapter. Toward #622.
Adds: <meta name="generator" content="State Decoded v1.1"> (or whatever the version number is) to each page's output. Closes #729.
Without this index, this part of the import is really slow.
Validate that an edition was imported properly.
We were catching it and discarding it, which makes failures a mystery. This fixes that.
Annoyingly, is_writable() returns false for a file that doesn't yet exist, so we're getting inaccurate results around confirming that sitemap.xml can be written to, whether or not it yet exists. So instead we use this new wrapper.
Just rip it out. It's not worth the trouble. #606
I could have sworn that we added this custom function in ~2014, but apparently not, somehow?
Only the web interfaces was running migrations! This led to badness. Here, that badness is eliminated.
We've got some inefficient queries that make it way too slow (and memory-intensive) to record cross-references for an entire code. Here, we optimize these queries.
We had no test coverage for this. Now we do.
This wasn't catching a PHP error, a result of an undefined constant.
glob() wasn't doing it, so now we have a method that will recurse.
EDITION_ID is only defined when importing into the current edition, but not for new editions, resulting in an import failure. This addresses that bug.
Both with and without =, because that's what it's supposed to do.
Skip when laws_references.edition_id is absent.
These give PDO the sadness.
The order of operations before didn't work for a new install, only for upgrades.
After a couple of problems, it seems that a test is needed.
"Done" displayed no matter what, so it wasn't an indicator of success. Now we track how long it takes, and how many laws are imported, reporting that. Also, if the import fails, that's reported, too.
This is slow, and it's difficult to measure progress. This fixes that.
This was only being handled at the time of export, which meant that simply updating which edition is current wouldn't update the symlink. So we now support updating that symlink when updating the edition, too.
Our checkup function complains if any laws don't have text. But the fact is that some laws sometimes don't have any text! We set a real low threshold here.
Otherwise there's a stale sitemap.
We were blindly assuming that everything exported fine, even as the log racked up tens of thousands of errors. So now we check.
Instead of letting them stream past, let's actually catch them and deal with them.
It was nested within two if statements, which meant that we didn't have an edition name until the database was set up. In this way we ensure that it's always present.
They were all pretty out of date.
This both adds a tally as a badge to the menu item and changes the JavaScript variable that we use to identify a given law. (That was using the Disqus identifier, which was fine as long as Disqus was a thing anybody used.)
It was only 150 pixels wide, far too small. But, also, the size was specified inline, so now it's specified in CSS.
We were using jquery.min.js as a proxy for "have we downloaded front-end assets," which isn't enough anymore. Iterate through a longer list, to ensure we have what we need.
These tests only work for full-text MySQL search, not for our old search setup.
This wasn't possible when we first wrote The State Decoded, but it's possible now! #606
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.