mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #47743
[Bug 1760970] Re: Upgraded site doesn't rotate images
Turns out the problem has nothing to do with the postgres install vs
upgrade db settings as there is already code to handle that.
The problem comes from this chain of events:
1) Install an older site (I practised with an old 16.10 site) and add some files including images via Content -> Files then check database table:
SELECT * FROM artefact_file_image;
You should see the width/height values for the files
2) Upgrade to master and log in so you are on dashboard page then check database table:
SELECT * FROM artefact_file_image;
You should see new column added with orientation 0 for the files + the
width/height
3) Go to the Content -> Files page then check database table:
SELECT * FROM artefact_file_image;
You should see all image files that exist in the home folder now have
their width/height/orientation removed
The problem stems from the fact the files on upgrade are missing their
artefact_file_files contenthash value and there is a bit of code in the
ArtefactTypeFile class that checks to see if the value exists and if not
generates it and commits the artefact.
And the problem comes in when we create a new ArtefactTypeImage instance
we call the parent ArtefactTypeFile and commit it before we have full
constructed the ArtefactTypeImage and so data is lost.
Because the parent Artefact class has a destructor we shouldn't need to
explicitly call the commit() during construction of ArtefactTypeFile on
line 1115 of artefact/file/lib.php because the it will be committed on
destruction as long as we set the $this->dirty = true;
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1760970
Title:
Upgraded site doesn't rotate images
Status in Mahara:
Confirmed
Status in Mahara 18.04 series:
Confirmed
Status in Mahara 18.10 series:
Confirmed
Bug description:
When you upgrade from 17.10 to 18.04RC2 / master, images that had been
uploaded prior to the upgrade cannot be rotated.
Robert tracked it down to the database in the table
"artefact_file_image". There it says:
orientation character varying(10) DEFAULT '0'::character varying,
and
CONSTRAINT artefileimag_ori_ck CHECK (orientation::text = ANY
(ARRAY['0'::character varying
when on a fresh install it says "bigint" instead of "character
varying".
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1760970/+subscriptions
References