contao / core

Contao 3 → see contao/contao for Contao 4
GNU Lesser General Public License v3.0
490 stars 214 forks source link

Contao 3 - News: Teaser images get lost after update from 2.11.x #4873

Closed Mediazept closed 12 years ago

Mediazept commented 12 years ago

One of my customers called me because all his teaser images are lost after upgrading from 2.11.5 to 3RC1 (latest nightly). Contao 2.x.x stores the file path of teaser images is stored in tl_news "singleSRC". I was watching the table before and after each step of the upgrade procedure. In step 3 there are a lot of changes on existing tables. Despite I couldn't find any reference for tl_new "singleSRC", after the last update step the column was emptied. It's a bit weird because singleSRC is still varchar(255), not INT. Since at this point of the update process table tl_files is already created, the script could replace any path reference with the appropriate file id.

leofeyer commented 12 years ago

Is this somehow reproducible with the example website?

Mediazept commented 12 years ago

Hallo Leo, ich kann auch nochmals mit der Music Academy testen. Werde vermutlich erst heute Abend dazu kommen. Das Ergebnis werde ich wieder im Bugtracker posten. Ich hatte auch noch keine Zeit in den Code des Installers reinzusehen. Meine Aussage bezüglich "keine Referenz auf die Spalte gefunden" bezog sich nur auf die Änderungsliste die der Installer ausgibt. Gruß Steffen

Mediazept commented 12 years ago

I repeated the test with a standard "Music Academy" installation. I started with 2.11.5 and added a news item with an image. Afterwards I did a clean install of the latest C3 RC2 build, just using localconf and my 2.11 database. "tl_files" was renamed to "files". As described above, in step 3 of the database update singleSRC gets deleted. A new entry for the image is created in tl_content (type "text"): I can see my caption text, "addImage" is set to "1", but the image does not appear on the front page and in the backend there's no image reference. If I add another news item with an image, I can see that "tl_news" should in fact contain the file id from tl_files in "singleSRC" . There's no entry in tl_content for the new added image, so I assume that there's a table mix up when running the install tool.

leofeyer commented 12 years ago

When exactly did you rename tl_files to files? Before or after the version 3 update?

Mediazept commented 12 years ago

Before runnung the update.

leofeyer commented 12 years ago

That's wrong. There should be an error message in the install tool if you do this. Did you not see it or did it not show up?

Mediazept commented 12 years ago

I didn't show up. I will repeat the update test and try to reproduce the problem with the default install within the next days and will report back on this issue.

Paratron commented 12 years ago

Well, no error message for me, too and I get the same behaviour (missing images in ALL types of content elements) weither I rename the tl_files folder during/before/after the update process, or leave it with the old name.

If I leave it with the old name, I am NOT able to rename it after the update process, since contao automagically looks into "tl_files" for the file-manager hdd<>db sync. When I rename the folder after the update, contao tells me that there are no files in my files folder.

When I rename tl_files to files BEFORE the update, contao file-manager seems to be bound to the files folder and not tl_files.

Anyways: all images from all content elements are gone in all cases. The only place where images remain is inside of ce_text elements when they are applied through tinyMCE (but only when I keep the tl_files folder).

leofeyer commented 12 years ago

I think you have a wrong idea of what it takes to rename the upload folder. You cannot just rename it, neither before nor after the update, because your database data and style sheets will still point to the old location and all your images will not be found. So generally, if you update from Contao 2, the folder name must rename the same!

@tristanlins has written a script to adjust the database data: https://gist.github.com/3304014

I have changed the code of the install tool in 9fec1e66d449da05f9967939ff6cf826b8c18040 to stop if the folder has been renamed and to point to the gist. There is also a (german) article about the contao.org update, which provides more information: http://contao.org/de/news/update-auf-contao-3.html

Paratron commented 12 years ago

I am completely aware of what it means to rename that folder. I assumed that one of your click-the-update-button-three-times update process would rewrite/patch the old filenames in the database, since you are now just holding reference numbers instead of whole file paths in the content elements. I assumed this also because you communicated that tl_files will become just files in your blog.

leofeyer commented 12 years ago

The blog article clearly states that renaming the folder is optional and requires to run an external script! Please read the "Fleißaufgabe" section.