Shimmie 2.11.0
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",
]