Download the PHP package zzdjk6/silverstripe-imagelinkupgrade without Composer
On this page you can find all versions of the php package zzdjk6/silverstripe-imagelinkupgrade. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zzdjk6/silverstripe-imagelinkupgrade
More information about zzdjk6/silverstripe-imagelinkupgrade
Files in zzdjk6/silverstripe-imagelinkupgrade
Package silverstripe-imagelinkupgrade
Short Description Upgrade Image Links Used In HTMLText and HTMLVar Fields
License MIT
Homepage https://github.com/zzdjk6/silverstripe-imagelinkupgrade
Informations about the package silverstripe-imagelinkupgrade
silverstripe-imagelinkupgrade
Overview
So, you have already run MigrateFileTask
but find that you still need to do a lot of manual work for updating the broken image links in HTMLText
and HTMLVarchar
fields.
Afraid ignoring some places while manual checking?
Feel frustrated when trying to find the correct image link after upgrading?
Tired of repeating yourself in such a machine-ish task?
Your assistant is here!
Explain
Then, how will this tool help you?
In a nutshell, it will find all the places where a broken image link could be replaced with a correct link in all the HTMLText
and HTMLVarchar
fields of DataObject
.
How it does the job?
Take a look at ImageLinkUpgradeTask.php
, the overall process is:
- Retrieve all
DataObject
classes contains HTMLText or HTMLVarchar field - Retrieve all image records in DB, get the mapping relation of ID, Filename and the accessible URL
- Gather upgrade info by each class: which class, which field, what are the old links and their replacement for that field
- Apply changes to the database
More details could be found in the code.
How to use
Add dependency via composer
:
Then just run it like other tasks: /dev/tasks/ImageLinkUpgradeTask
Caveats
- Make sure you backup your database before using this tool (it will modify your database).
- Currently, some
DataObject
will be updated several times due to class inherit (e.g., subclasses ofSiteTree
). This issue won't affect the final result (just a version jump compare to the original one) - This tool keeps the
Status
of versionedDataObject
in mind, which means if theLive
version is not the same as theStage
version, onlyStage
version will be changed.