Skip to content
Shish edited this page Feb 27, 2024 · 7 revisions

Get the new code

From Git

If you got shimmie from git, then git pull should fetch the latest code (git checkout main then git pull if you're on an old non-main branch).

Once the new Shimmie code is ready, you'll need to make sure all the dependencies are in place and up-to-date via composer install.

From .zip

If you got shimmie from one of the .zip downloads, you'll need to download new code, extract it, then copy across the data folder from the old install into the new one.

Update database schema

This should be automatic - next time the site is loaded, it'll see that the current schema is out of date, and will update it.

Check for any breaking changes

Release notes on https://github.com/shish/shimmie2/releases should include notes on any major changes

Upcoming breaking changes in 2.11

PageRequestEvent Args

PageRequestEvent->page_matches() changed from prefix-matching to exact-matching, and changed from numbered args to named args, eg if you want to handle the page "foo/bar/baz", then

if($event->page_matches("foo/bar")) {
    $action = $event->get_arg(0);
}

becomes

if($event->page_matches("foo/bar/{action}")) {
    $action = $event->get_arg('action');
}

PageRequestEvent method & permissions

global $user;

if($event->page_matches("foo/bar")) {
    if($_SERVER["REQUEST_METHOD"] == "GET") {
        if($user->can(Permissions::DO_THING)) {
            // do the thing
        } else {
            throw new PermissionDenied("You do not have access to the thing");
        }
    }
}

becomes

if($event->page_matches("foo/bar". method: "GET", permission: Permissions::DO_THING)) {
    // do the thing
}

Docker Settings

Previously we had one special docker environment variable to control php.ini settings - UPLOAD_MAX_FILESIZE, now all php.ini settings can be changed by setting any PHP_INI_XXX variable, eg PHP_INI_UPLOAD_MAX_FILESIZE

ImageAdditionEvent / ImageInfoSetEvent deduplication

Instead of setting metadata at upload time in one way, and setting metadata on update in a different way, we now always use ImageInfoSetEvent. Also, ImageInfoSet can handle multiple posts at the same time, using a POST payload like

[
    // two images are being uploaded at the same time
    "data0" => [... puppy.jpg ...],
    "data1" => [... kitten.jpg ...],
    // "tags" has special behaviour where the common + file-specific fields
    // get merged, so the first file will be tagged "cute puppy" and the second
    // file will be tagged "cute kitten"
    "tags" => "cute",
    "tags0" => "puppy",
    "tags1" => "kitten",
    // most other metadata fields have the standard behaviour of using a
    // file-specific field if it is non-empty, falling back to the common one
    "source" => "http://pets.com",
    "source0" => "",
    "source1" => "http://catcatcat.com",
]
Clone this wiki locally