mediaFal changelog
==================

1.0.0-beta2 (2026-11-10)
- Replace file: only with the same file extension (jpg = jpeg, tif = tiff);
  before, an image could be replaced by another image type (a PNG ended up
  in a .jpg file with the wrong MIME type).
- Usage: a resource is scanned at the end of the save request, after all
  plugins; files picked in predefinedBlocks (and other plugins that write in
  OnDocFormSave after mediaFal) were shown as unused until the next scan.

1.0.0-beta1 (2026-10-22)
First beta: features are complete; testing on real sites before 1.0.0-pl.
Fixes from the release review (docs/pregled-2026-10-22.md, B1-B7):
- Security: alt, title and description are stored without HTML and MODX
  tags; falFiles escapes alt, title, description, name and label in its
  templates and in &field (stored XSS / tag injection on the site).
- Security: resource titles and element names in manager error messages
  are escaped (stored XSS in the manager).
- Migration: "Finish" is only possible after "Rewrite references".
- Usage and migration resolve a TV's media source like MODX (link, the TV's
  own source, default_media_source), so files used in TVs without a source
  link are protected; migration binds such TVs to the FAL source.
- Rewriting references keeps JSON intact (empty objects, numeric keys,
  decimals) and never writes an empty value when encoding fails.
- Rewriting references reads rows in batches, renaming only reads rows that
  contain the file name, and a row changed by an editor meanwhile is read
  again instead of being overwritten.
- Plugin events and the falFiles snippet log errors instead of breaking the
  page; source base URLs for the ?v= filter are cached.
- Docs: upgrade notes, migration checklist; missing description of the
  setting mediafal.migrate_skip_dirs.

0.19.0-alpha (2026-10-22)
- Folder of a resource: the upload folder of a resource's Attachments tab
  is linked to the resource. Files uploaded into it (or a subfolder) from
  the library or the core media browser, and files moved into it, are
  attached to the resource (no group). Files that already exist (same
  content) stay in their folder but are attached as well. Uploads from
  editors (RTE, ContentBlocks) do not attach. Moving a file out does not
  detach it. Linked folders have a paperclip icon in the library tree.
  Existing upload folders are linked on upgrade.
- New setting mediafal.content_root (default Content/): the folder of the
  resource folders, shown as a separate node above the trash in the library
  tree. Folders in it are managed by mediaFal: editors cannot create,
  rename, move or delete them (library and core media browser), and files
  can only be uploaded or moved into the folder of a resource. The setting
  mediafal.upload_folder is now the pattern inside the root (default
  {uri}/); on upgrade the old value is split (zavihki/{uri}/ -> root
  zavihki/ + {uri}/), also the source property uploadFolder (new property
  contentRoot).
- Attachments tab: uploads always go to the folder of the resource.
- New setting mediafal.hide_file_tree (default No): hides the core Files
  tab in the left tree of the manager for everyone except sudo users.
- Library: on narrow screens the filter toolbars wrap to more lines
  instead of being cut off.
- Library: the kind filter lists only kinds the selected media source
  accepts (property allowedFileTypes); all sources = all their kinds.
- Library: with "Include subfolders" files from subfolders have a blue
  folder badge (tooltip: the subfolder).
- Library details: "Rename file (URL)" gives the file a new, cleaned name
  in its URL (SEO). The file stays in its day folder; all links in content,
  template variables, ContentBlocks, predefinedBlocks, chunks, templates and
  settings are rewritten, the old URL redirects (301) to the new one and is
  never reused. The window shows the new URL and where links are rewritten.
- Library details: "Name in library" (virtual name, can be changed) and
  "File name (URL)" (never changes) are labelled clearly.

0.18.0-alpha (2026-10-22)
- Library: thumbnails and a preview of images in the trash (the trash is
  outside the web root; the manager connector sends a scaled copy, only to
  users with file_view).
- Library: the trash is a "Trash (N)" node at the bottom of the folder tree
  (files of the selected source; all sources when none is selected); the
  trash icon in the tree toolbar opens it, clicking a folder returns to the
  library. The trash notice and the "In trash" usage filter are removed.
  Deleting and renaming a folder is in the folder's context menu.
- Library: the search text is cleared when another folder is opened.
- Library: dates (uploaded, in trash since, permanent deletion) use the
  manager date and time format (manager_date_format, manager_time_format).
- Attachments tab: "Gather into folder" moves the resource's own
  attachments to its upload folder (each media source into its own); a
  window first lists what moves from where, what cannot move because it is
  also attached to another resource, and which emptied folders are deleted.
  Folders are virtual, paths and URLs stay the same.
- Library and picker: "Resource" filter (title or ID) shows all files of a
  resource (usage and attachments) from all folders; in the file details,
  "show its files" next to each resource in the usage list.
- Attachments tab: the upload folder is shown as information on one line
  (no longer a button to change it; the folder comes from the upload
  folder pattern of the system setting or the media source).
- Library, picker, attachments: keyboard like a file explorer (arrows select,
  Shift extends, Ctrl moves only the focus, Space toggles).

0.17.1-alpha (2026-10-21)
Fixes from an external test of 0.16.3:
- Usage: absolute links to the site's own domain count as usage also with
  or without "www."; new setting mediafal.site_hosts (other hosts of the
  site, e.g. the production domain on a development copy).
- Usage: an incomplete scan (TV query error, extra reporting
  $usage->fail()) keeps the previous usage rows instead of deleting them.
- Trash: a file is not deleted permanently while content still points to
  it; the full scan purges the trash after refreshing usage.
- "Scan usage" (menu, library link) requires file_remove as well, because
  the scan empties the trash and moves unused files to it.
- Upload: two simultaneous uploads with the same name no longer overwrite
  each other (path lock per source).
- Images too large for GD (memory_limit) are stored unprocessed and get no
  srcset/crop variants instead of a fatal error.
- Attachments and file info check media source access and the resource
  being linked (view).
- Thumbnails of absolute paths only for images under the site root, never
  from core/ or hidden folders.
- Migration: links to other hosts are not rewritten; links and 301
  redirects work with a different letter case when unambiguous; failed
  copies are retried by a new run; empty files (0 bytes) are not migrated
  (they would become one file) and are listed under "Check manually".
- Manager: server errors are shown, file and folder names are escaped,
  file lists, attachment groups and the crop window work with the keyboard,
  icon buttons have accessible names, file paths with "%" are kept.

0.17.0-alpha (2026-10-21)
- Upload folder of the Attachments tab follows the resource: new default
  Content/{uri}/ (aliases of parents and resource), new placeholders
  {alias}, {parentAlias}, {uri}, {pagetitle}, {parentTitle}, {template},
  {year}, {month}; an empty alias/title becomes the ID. Existing installs
  keep their setting.
- A FAL media source can override the folder (property uploadFolder).
- When a resource's alias, title or parent changes (save or drag in the
  tree), its folder and the folders of its children are renamed/moved,
  unless an editor moved them or the new folder already exists.
- Plugin: OnTVOutputRenderList returns the path only for TVs with falfile
  output (a nested event printed it in the manager, e.g. with Redactor).

0.16.3-alpha (2026-10-20)
- Migration: URLs with parentheses or commas in the file name
  (logo-(9).png, a,-b.png) are found and rewritten; CSS url() and srcset
  still work.
- Usage scan and ?v= filter: URLs with ../ (Redactor in a context with its
  own base URL, e.g. /en/) are recognised.
- Contexts with their own base_url (Babel /en/): file URLs and ?v= use the
  source folder from the site root (/assets/media/...), not /en/assets/....

0.16.2-alpha (2026-10-20)
- Library: the folder tree loads fast on large sources (file counts per
  folder use the index; 16 s -> 0.2 s with 5000 folders).

0.16.1-alpha (2026-10-19)
- Migration: relative TV values (image, file, MIGX) are resolved through the
  TV's media source for each resource, also dynamic per-resource paths
  (migxResourceMediaPath) and sources that cover the same folder.
- Migration: such TVs are rebound to the FAL source also in a partial
  (subfolder) migration; unmigrated and missing files get an absolute path
  (/assets/...), which the FAL source outputs and thumbnails unchanged.
- Migration report: "Check manually" warnings (non image/file TVs,
  per-resource sources); no log noise from dynamic sources.

0.16.0-alpha (2026-10-14)
- Template tab "Attachment groups": default source of the Files tab for the
  template (before default_media_source).

0.15.0-alpha (2026-10-14)
- Files tab: the default media source (default_media_source of the system,
  context, user group or user) is selected first when it is visible.
- Library notice (administrators): default_media_source settings or TVs that
  point to a media source that no longer exists.
- "Permission ... required": the missing permission is named instead of
  "- unknown -".

0.14.1-alpha (2026-10-14)
- falFiles: @FILE templates (&tpl, &tplImage, &tplFile, wrappers), path
  relative to pdotools_elements_path or the site root; rendered by pdoTools
  when installed (Fenom), otherwise as a MODX chunk.

0.14.0-alpha (2026-10-14)
- falFiles: &sortby (rank, random, name, title, created, size) and &sortdir;
  sorting before &offset/&limit. &group=`0` / `-` / `none` = attachments
  without a group. Placeholder [[+created]].

0.13.1-alpha (2026-10-14)
- Not allowed type: own translated message with the file, the source and the
  allowed types (the core message is English only in most languages).

0.13.0-alpha (2026-10-14)
- The source property allowedFileTypes of a FAL source now also applies to
  uploads, "Replace file" and migration (MODX core only filters the list).
  Migration lists types the target does not allow and leaves them in place.
- Install: "Images" allows jpg, jpeg, png, gif, webp, avif; "Files" allows the
  types from mediafal.kind_document/archive/audio/video.

0.12.3-alpha (2026-10-14)
- Deleting a migration backup is written to the manager log; finished runs
  show "backup of originals deleted" instead of the old path.

0.12.2-alpha (2026-10-14)
- Migration and template groups grids: no gear icon next to the action icons
  (it opened the same actions); right-click menu stays.

0.12.1-alpha (2026-10-14)
- Migration turns JPEG photos with an EXIF orientation upright (no resizing);
  cli/orient.php fixes files migrated earlier (dry run, --apply).

0.12.0-alpha (2026-10-14)
- Library: rotate images 90° left/right or 180° in the details (path and
  URL stay, ?v= changes; focal point adjusted; crops at places of use reset).
- Library: previews of image types the server's GD cannot read (e.g. WebP
  without support) are shown from the original file; TIFF/HEIC without preview.
- Library details: no horizontal overflow when the panel scrolls; secondary
  buttons with a visible border, "Delete" in red.

0.11.3-alpha (2026-10-14)
- Library: clicking the "Include subfolders" box no longer toggles
  "Show only unused" (overlapping checkbox inputs in the toolbar).
- Warning in the error log when GD cannot read an image type (e.g. WebP
  without support): the upload is stored unprocessed, no srcset/crop variants.

0.11.2-alpha (2026-10-14)
- Migration "Finish" also removes source folders left empty (never the
  source base path, the site root, assets/, core, manager, connectors).

0.11.1-alpha (2026-10-14)
- Library: "Duplicates" option removed from the toolbar (duplicates cannot
  normally arise); the "2x" badge and the list in the details stay.

0.11.0-alpha (2026-10-14)
- No more "Unused/" folder: files stay in their own folder; unused files show
  the red "!" badge and the new library option "Show only unused". The
  upgrade moves files from the old folder back to their previous folder,
  removes the empty folder and the setting mediafal.unused_folder.
  "Days unused" (unused_days) counts from the moment a file lost its last use.
- Migration: unused files stay in the target folder.
- Library tree: the top node is the root of the source (count = all files);
  "Include subfolders" is on by default; "Files in root" node removed.
- Install: no FAL source is created on a folder already used by a regular
  media source (warning in the console).
- Migration: target folder without a trailing slash no longer merges with
  the source subfolder.

0.10.3-alpha (2026-10-14)
- Install form: two FAL sources, "Images" (assets/media/images/) and "Files"
  (assets/media/files/, file language = resource language); the images
  source becomes the default media source; hiding assets/media/ in the
  "Filesystem" source is marked as recommended, with a clearer label.
- Overlap warning: "media" in skipFiles also covers FAL sources in
  subfolders (assets/media/images/).

0.10.2-alpha (2026-10-14)
- Migration: sources rooted at the site root (e.g. Filesystem) are no longer
  offered as a source; create a media source for the folder to migrate
  (e.g. assets/images/) and migrate from it.

0.10.1-alpha (2026-10-14)
- Migration: the site root, core, manager and connectors (or a folder
  containing them) cannot be chosen as the source (e.g. Filesystem without a
  subfolder); assets/components and folders of FAL sources are always
  skipped when scanning (their files would be moved to the backup on finish).

0.10.0-alpha (2026-10-14)
- One snippet falFiles (D63); falImg removed (merged; it is deleted on
  upgrade – replace [[falImg? ...]] with [[falFiles? ... &limit=`1`
  &tpl=`falFilesImg`]]).
- &filter: images, documents, videos, audio, archives, other, files (all but
  images), extensions (.pdf,.md), combinations, exclusion with !.
- Extensions per kind in system settings mediafal.kind_* (new formats
  without code); kind of indexed files is synced on install and full scan.
- Default output with installed, editable chunks: images as thumbnails
  (&thumbWidth, cached) linked to the full image, other files as a list with
  extension and size; &tpl, &tplImage, &tplFile, &tplImages, &tplFiles.
- &source by ID or name for every source of files; &id accepts several IDs;
  &index, &field, &path from falImg.

0.9.15-alpha (2026-10-14)
- Attachments tab upload: a file whose content already exists in another
  FAL source is not uploaded again, but the existing file is attached to
  the resource (shown under that source) – D62.
- Upload message in the tab: new / already existing / attached / already
  attached counted separately.
- FAL source keeps all upload errors (core addError kept only the last one
  per field, so with several rejected files only one message was shown).

0.9.14-alpha (2026-10-14)
- Attachments tab: groups always stacked below each other (a new group was
  floating next to the thumbnails of the previous one).
- Attachments tab: group actions (upload, library, rename, delete) as icons
  on the right of the group header; click on the header collapses the group
  (Ext header tools had no icons in the MODX theme, double collapse arrow).
- Attachments tab: selected FAL source button highlighted.

0.9.12-alpha (2026-10-14)
- Library tree: top node labelled "<source> – all files (N)" so it is not
  mistaken for the root folder ("Files in root").
- Language filter: "Language: all" / "No language (all)" (shorter, clearer).

0.9.11-alpha (2026-10-14)
- Library: details column no longer wider than its panel (fields reached
  past the right edge, horizontal scrollbar).
- Library: folder context menu "Upload to this folder".
- All manager UIs use own lexicon keys instead of core ones (save, rename,
  name, cancel, remove, error, …): core Slovenian lexicon is mostly
  untranslated, so buttons were in English.

0.9.10-alpha (2026-10-14)
- Library upload: when some files already existed in other folders (reuse),
  the message lists them by folder and the list shows all uploaded files
  (new and existing) selected; "Uploaded files (N)" button clears the view.

0.9.9-alpha (2026-10-14)
- Library: drag & drop of folders in the tree (into another folder, or onto
  the source root / "Files in root" to move to the top level; not into
  itself or a subfolder).
- Library: drop target folder clearly highlighted (background, frame, bold).
- Library: collapsing notifications no longer leaves an empty gap.
- Library: successful upload shown as a MODX status message instead of a
  modal dialog; errors still in a dialog.
- Library: overlap check (D50) no longer computed for the library.

0.9.8-alpha (2026-10-14)
- Library: notifications collapsed into one "Notifications (N)" line that
  expands on click (state remembered).
- Library: no warning about other media sources covering a FAL folder
  (e.g. core "Filesystem", usually admin only); still shown on the
  migration page.
- Library: "Show trash" resets source, folder and other filters, so the
  trashed files from the notice are always listed.
- Library toolbar in two rows, wider combos, aligned labels and checkboxes.
- Unused files marked with a red "!" badge instead of the word "unused".

0.9.7-alpha (2026-10-14)
- Migration page in the standard MODX extra layout: header, tabs (New run,
  Runs, Backups), description, Ext form, report, MODX grids with action icons
  and context menu, progress dialog while copying.
- Template tab "Attachment groups": fieldset per FAL source with a
  "visible" checkbox, editable MODX grid of groups (name, crop ratios,
  order).
- Resource tab "Attachments": Ext toolbar, link bar, groups as panels with
  the media browser tiles, Ext editor; drag & drop and uploads as before.
- Fix: the migration form sent the field hint (emptyText) as the subfolder.

0.9.6-alpha (2026-10-14)
- Library rebuilt with ExtJS in the look of the core Media page: folder tree
  (with context menu and toolbar), DataView with the media browser grid and
  list templates, filter toolbar, paging toolbar, details panel with Ext
  forms; the left manager bar is hidden like on the Media page. The picker
  window (Attachments tab, falfile TV) uses the same view.

0.9.5-alpha (2026-10-14)
- Library actions check the core permissions like the media browser
  (file_update, file_remove, file_upload, directory_create/update/remove),
  not only the media source access policy.
- Readme: permissions.

0.9.4-alpha (2026-10-14)
- Default folder for files that lost their last usage is "Unused/"
  (mediafal.unused_folder; existing installations keep their value).

0.9.3-alpha (2026-10-14)
- Install options on the first install: create the FAL source "Media"
  (assets/media/), make it default_media_source, add "media" to skipFiles of
  the "Filesystem" source.
- Library warns when the full usage scan has not run for more than 7 days
  (setting mediafal.last_scan), with "Scan usage now".
- data: URIs in templates, chunks, TV defaults and settings are no longer
  reported as usage issues (only in resources, e.g. pasted images).
- Readme rewritten: installation, cron, editors, output, migration,
  settings, developers, uninstall.

0.9.2-alpha (2026-10-14)
- Fresh install: file state ENUM is created in lower case (xPDO wrote 'ACTIVE',
  so no file counted as active).
- New FAL media source defaults to assets/media/ and creates its folder if
  it does not exist yet.
- Uninstall removes the plugin, snippets, menus and event even though the
  package files are already gone; leftover elements no longer break the site.

0.9.1-alpha (2026-10-14)
- Library: trash notice refreshes after delete/restore/purge; the delete
  confirmation says files go to the trash and until when they can be restored.

0.9.0-alpha (2026-10-14)
- Crop at the place of use (falfile TV, attachments): ratios per TV (ratios)
  or per template attachment group (mediafal.crop_ratios as fallback),
  crops stored with the usage, generated on output in the cache.
- Focal point per file (library: click the preview); without a manual crop
  images are cropped around it (falImg/falFiles &ratio, &crop=0).
- Replace file content rejects duplicates of other files.
- Files in "Unused" longer than mediafal.unused_days (0 = off) move to the
  trash during the full scan.

0.8.0-alpha (2026-10-13)
- Images on upload: EXIF orientation applied, downscaled to mediafal.image_max,
  metadata (EXIF/GPS, XMP, IPTC, PNG text) removed; unchanged when not needed.
- srcset variants on demand (falImg/falFiles &srcset, &sizes; WebP <picture>
  when the server supports it), cached in assets/cache/mediafal/.
- Trash: deleted files move outside the web root, can be restored or deleted
  permanently, automatic deletion after mediafal.trash_days; visible in the
  library (notice, "In trash" filter with who/when/until).

0.7.1-alpha (2026-10-13)
- Migration can take over unindexed files lying under a FAL source (written
  past the source): new path by our scheme, virtual folders = old location.
- After rewriting predefinedBlocks data the affected pages are re-rendered.
- Finishing a FileMan migration reminds that FileMan can be uninstalled.
- Warning when another media source covers the folder of a FAL source.

0.7.0-alpha (2026-10-13)
- Migration of existing files into FAL (Media menu, admins; CLI cli/migrate.php):
  dry run with report (used/unused, duplicates, blocked types, references per
  table, broken references), copy in batches (physical path by file date, old
  folders become virtual folders, unused files go to the unused folder),
  rewrite of references (content, TVs incl. relative values and source
  rebinding, ContentBlocks/MIGX/predefinedBlocks JSON, chunks, templates,
  settings), finish (originals moved to core/export/mediafal-backup/, visible
  with a delete button), 301 from old paths. Idempotent: re-runs skip
  migrated files and rewrite new references.
- FileMan files become attachments (group, order, title, description);
  private FileMan files are not moved.

0.6.0-alpha (2026-10-13)
- Library page (Media menu): all FAL files with search (name, path, alt,
  title, description), filters (source, folder with subfolders, kind,
  language, used/unused, duplicates), grid/list, paging, details with
  metadata per language, usage and duplicates, bulk move/language/delete,
  folder create/rename/delete, upload of several files (button or drop),
  drag files into folders, replace file content (same kind, same URL).
- Picker window with multi select used by the Files tab and the falfile TV.

0.5.0-alpha (2026-10-13)
- Resource tab "Files" (attachments): files per FAL source, template and own
  groups, upload of several files with progress (also drag & drop into a
  group), add from library, drag to reorder / move between groups, multi
  select, hide, alt/title/description per resource, link to another resource
  (its attachments are shown, filtered by language; unlink keeps a copy or
  starts empty). Duplicate copies attachments; emptying the trash removes them.
- Template tab "Attachment groups": show the Files tab, visible FAL sources,
  predefined groups per source.
- FAL source property uploadCulture (language of files uploaded from the tab).
- falFiles without &tv lists the resource attachments (&group, &source).
- Attachments count as usage (cannot delete an attached file).

0.4.0-alpha (2026-10-13)
- TV type falfile: one or more files (setting max), allowed kinds, alt/title
  override per usage with the language default as hint, ordering; value is a
  JSON list. Output format url (default) / img / list / json.
- Snippets falImg and falFiles (chunk or @INLINE templates).
- ?v=<hash> on FAL file URLs (snippets, TV, output filter for content and
  other TVs); setting mediafal.cache_bust.
- Media browser respects allowedFileTypes on FAL sources.

0.3.1-alpha (2026-10-13)
- Emptying the trash moves files that were used only on the purged resources
  into the virtual folder mediafal.unused_folder (URL unchanged); when used
  again they return to their previous folder. Nothing is deleted physically.
- Extras menu "mediaFal: scan usage" runs the full usage scan without cron.

0.3.0-alpha (2026-10-13)
- Usage tracking: scanner on resource/template/chunk/TV save finds every URL
  under a FAL source (HTML, srcset, CSS, JSON of ContentBlocks, MIGX, falfile)
  and relative paths in values bound to a FAL source; table mediafal_usage.
- Full scan for cron: core/components/mediafal/cli/scan.php (--issues, --orphans).
- Used files cannot be deleted (setting mediafal.protect_used); usage list in
  the metadata window of the media browser.
- Event OnMediaFalCollectUsage for plugins with own data (e.g. predefinedBlocks).

0.2.0-alpha (2026-10-13)
- FAL media source core: virtual folders addressed by virtual path, upload
  to YYYY/MM/DD/ with readable file names and overflow folders, duplicate
  detection across FAL sources (setting mediafal.duplicates: reuse/reject),
  blocked extensions, virtual rename/move, delete keeps the path reserved.
- Default/per-language metadata (alt, title, description) and file language
  edited from the media browser context menu.
- Works with the core browser, image/file TVs, ContentBlocks, Redactor,
  TinyMCE RTE and CKEditor (file picker).

0.1.0-alpha (2026-10-13)
- Package skeleton: namespace, xPDO schema (virtual folders, file index,
  metadata per language), installer with table upgrade, plugin, system
  settings, en/sl lexicons, transport build.
