Deleting a file that is used as a file attribute somewhere messes up site

Permalink 0 0 Browser Info Environment
If you delete a file that is used in a file attribute that file gets only partially deleted.

All file versions from the database and the physical files on the harddrive are removed. The entry in the Files table cannot be removed because the atFile table has a foreign key that is set to restrict on delete instead of set to null.

In the end the file is still displayed in the file manager but is corrupt, because it has no file versions. This can lead to the whole site not being able to be displayed because it tries to reindex the file on every page load which results in an exception.


Status: New

concrete5 Environment Information

# concrete5 Version
Core Version - 8.1.0
Version Installed - 8.1.0
Database Version - 20170123000000

# concrete5 Packages
Dung-Package für Webseiten (2.0)

# concrete5 Overrides
blocks/page_list/templates/press.php, blocks/page_list/templates, blocks/page_list, blocks/press_filter/controller.php, blocks/press_filter/view.php, blocks/press_filter, blocks/teasers/edit.php, blocks/teasers/db.xml, blocks/teasers/add.php, blocks/teasers/controller.php, blocks/teasers/view.php, blocks/teasers, blocks/gallery/form.php, blocks/gallery/edit.php, blocks/gallery/db.xml, blocks/gallery/templates/gross.php, blocks/gallery/templates, blocks/gallery/add.php, blocks/gallery/icon.png, blocks/gallery/controller.php, blocks/gallery/view.js, blocks/gallery/composer.php, blocks/gallery/image_template.php, blocks/gallery/view.php, blocks/gallery, blocks/highlights/edit.php, blocks/highlights/db.xml, blocks/highlights/add.php, blocks/highlights/controller.php, blocks/highlights/view.php, blocks/highlights, blocks/image_slider/edit.php, blocks/image_slider/db.xml, blocks/image_slider/view_bak.css, blocks/image_slider/LICENSE.TXT, blocks/image_slider/add.php, blocks/image_slider/icon.png, blocks/image_slider/form_setup_html.php, blocks/image_slider/controller.php, blocks/image_slider/composer.php, blocks/image_slider/view.php, blocks/image_slider, blocks/press/controller.php, blocks/press/view.php, blocks/press, languages/it_IT/LC_MESSAGES/messages.mo, languages/it_IT/LC_MESSAGES, languages/it_IT, languages/fi_FI/LC_MESSAGES/messages.mo, languages/fi_FI/LC_MESSAGES, languages/fi_FI, languages/es_PY/LC_MESSAGES/messages.mo, languages/es_PY/LC_MESSAGES, languages/es_PY, languages/pl_PL/LC_MESSAGES/messages.mo, languages/pl_PL/LC_MESSAGES, languages/pl_PL, languages/da_DK/LC_MESSAGES/messages.mo, languages/da_DK/LC_MESSAGES, languages/da_DK, languages/pt_BR/LC_MESSAGES/messages.mo, languages/pt_BR/LC_MESSAGES, languages/pt_BR, languages/el_GR/LC_MESSAGES/messages.mo, languages/el_GR/LC_MESSAGES, languages/el_GR, languages/nb_NO/LC_MESSAGES/messages.mo, languages/nb_NO/LC_MESSAGES, languages/nb_NO, languages/nl_NL/LC_MESSAGES/messages.mo, languages/nl_NL/LC_MESSAGES, languages/nl_NL, languages/ja_JP/LC_MESSAGES/messages.mo, languages/ja_JP/LC_MESSAGES, languages/ja_JP, languages/ru_RU/LC_MESSAGES/messages.mo, languages/ru_RU/LC_MESSAGES, languages/ru_RU, languages/de_DE/LC_MESSAGES/messages.mo, languages/de_DE/LC_MESSAGES, languages/de_DE, languages/sv_SE/LC_MESSAGES/messages.mo, languages/sv_SE/LC_MESSAGES, languages/sv_SE, languages/fr_FR/LC_MESSAGES/messages.mo, languages/fr_FR/LC_MESSAGES, languages/fr_FR, languages/tr_TR/LC_MESSAGES/messages.mo, languages/tr_TR/LC_MESSAGES, languages/tr_TR, themes/gfp/description.txt, themes/gfp/js/jquery.cookiesdirective.min.js, themes/gfp/js/foundation.min.js, themes/gfp/js/modernizr.js, themes/gfp/js/main.js, themes/gfp/js/placeholder.js, themes/gfp/js/modernizr.custom.js, themes/gfp/js/jquery.cookiesdirective.js, themes/gfp/js/app.js, themes/gfp/js/css3-multi-column.min.js, themes/gfp/js/main.min.js, themes/gfp/js/jquery.highlight-4.js, themes/gfp/js/jquery.scrollTo-1.4.3.1-min.js, themes/gfp/js, themes/gfp/images/gpev_logo.png, themes/gfp/images/gfp-logo.png, themes/gfp/images, themes/gfp/page_theme.php, themes/gfp/full.php, themes/gfp/default.php, themes/gfp/elements/footer_bottom.php, themes/gfp/elements/header.php, themes/gfp/elements/footer.php, themes/gfp/elements/header_top.php, themes/gfp/elements, themes/gfp/css/_app.scss, themes/gfp/css/_base.scss, themes/gfp/css/foundation.scss, themes/gfp/css/skola.css, themes/gfp/css/main.css, themes/gfp/css/foundation.css, themes/gfp/css/build/_offcanvas_menu.scss, themes/gfp/css/build/_general.scss, themes/gfp/css/build/_mainmenu.scss, themes/gfp/css/build/_footer.scss, themes/gfp/css/build/_press.scss, themes/gfp/css/build/_pageteaser.scss, themes/gfp/css/build/_highlights.scss, themes/gfp/css/build/_pagination.scss, themes/gfp/css/build/_slider.scss, themes/gfp/css/build/_header.scss, themes/gfp/css/build, themes/gfp/css/foundation.css.map, themes/gfp/css/foundationBase.css, themes/gfp/css/main.css.map, themes/gfp/css/_concrete5-ui.scss, themes/gfp/css/_print.scss, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-BoldItalic.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-Black.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-LightItalic.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-MediumItalic.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-RegularItalic.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-Regular.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-Light.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-BlackItalic.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-Medium.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-Bold.woff, themes/gfp/css/fonts/SkolaSansCn, themes/gfp/css/fonts, themes/gfp/css/main.scss, themes/gfp/css, themes/gfp/sidebar_right.php, themes/gfp/view.php, themes/gfp, tools/test.php, blocks/page_list/templates/press.php, blocks/page_list/templates, blocks/page_list, blocks/press_filter/controller.php, blocks/press_filter/view.php, blocks/press_filter, blocks/teasers/edit.php, blocks/teasers/db.xml, blocks/teasers/add.php, blocks/teasers/controller.php, blocks/teasers/view.php, blocks/teasers, blocks/gallery/form.php, blocks/gallery/edit.php, blocks/gallery/db.xml, blocks/gallery/templates/gross.php, blocks/gallery/templates, blocks/gallery/add.php, blocks/gallery/icon.png, blocks/gallery/controller.php, blocks/gallery/view.js, blocks/gallery/composer.php, blocks/gallery/image_template.php, blocks/gallery/view.php, blocks/gallery, blocks/highlights/edit.php, blocks/highlights/db.xml, blocks/highlights/add.php, blocks/highlights/controller.php, blocks/highlights/view.php, blocks/highlights, blocks/image_slider/edit.php, blocks/image_slider/db.xml, blocks/image_slider/view_bak.css, blocks/image_slider/LICENSE.TXT, blocks/image_slider/add.php, blocks/image_slider/icon.png, blocks/image_slider/form_setup_html.php, blocks/image_slider/controller.php, blocks/image_slider/composer.php, blocks/image_slider/view.php, blocks/image_slider, blocks/autonav/templates/footer.php, blocks/autonav/templates, blocks/autonav, blocks/press/controller.php, blocks/press/view.php, blocks/press, languages/it_IT/LC_MESSAGES/messages.mo, languages/it_IT/LC_MESSAGES, languages/it_IT, languages/fi_FI/LC_MESSAGES/messages.mo, languages/fi_FI/LC_MESSAGES, languages/fi_FI, languages/es_PY/LC_MESSAGES/messages.mo, languages/es_PY/LC_MESSAGES, languages/es_PY, languages/pl_PL/LC_MESSAGES/messages.mo, languages/pl_PL/LC_MESSAGES, languages/pl_PL, languages/da_DK/LC_MESSAGES/messages.mo, languages/da_DK/LC_MESSAGES, languages/da_DK, languages/pt_BR/LC_MESSAGES/messages.mo, languages/pt_BR/LC_MESSAGES, languages/pt_BR, languages/el_GR/LC_MESSAGES/messages.mo, languages/el_GR/LC_MESSAGES, languages/el_GR, languages/nb_NO/LC_MESSAGES/messages.mo, languages/nb_NO/LC_MESSAGES, languages/nb_NO, languages/nl_NL/LC_MESSAGES/messages.mo, languages/nl_NL/LC_MESSAGES, languages/nl_NL, languages/ja_JP/LC_MESSAGES/messages.mo, languages/ja_JP/LC_MESSAGES, languages/ja_JP, languages/ru_RU/LC_MESSAGES/messages.mo, languages/ru_RU/LC_MESSAGES, languages/ru_RU, languages/de_DE/LC_MESSAGES/messages.mo, languages/de_DE/LC_MESSAGES, languages/de_DE, languages/sv_SE/LC_MESSAGES/messages.mo, languages/sv_SE/LC_MESSAGES, languages/sv_SE, languages/fr_FR/LC_MESSAGES/messages.mo, languages/fr_FR/LC_MESSAGES, languages/fr_FR, languages/tr_TR/LC_MESSAGES/messages.mo, languages/tr_TR/LC_MESSAGES, languages/tr_TR, themes/gfp/description.txt, themes/gfp/js/jquery.cookiesdirective.min.js, themes/gfp/js/foundation.min.js, themes/gfp/js/modernizr.js, themes/gfp/js/main.js, themes/gfp/js/placeholder.js, themes/gfp/js/modernizr.custom.js, themes/gfp/js/jquery.cookiesdirective.js, themes/gfp/js/app.js, themes/gfp/js/css3-multi-column.min.js, themes/gfp/js/main.min.js, themes/gfp/js/jquery.highlight-4.js, themes/gfp/js/jquery.scrollTo-1.4.3.1-min.js, themes/gfp/js, themes/gfp/images/gpev_logo.png, themes/gfp/images/gfp-logo.png, themes/gfp/images, themes/gfp/page_theme.php, themes/gfp/full.php, themes/gfp/default.php, themes/gfp/elements/footer_bottom.php, themes/gfp/elements/header.php, themes/gfp/elements/footer.php, themes/gfp/elements/header_top.php, themes/gfp/elements, themes/gfp/css/_app.scss, themes/gfp/css/_base.scss, themes/gfp/css/foundation.scss, themes/gfp/css/skola.css, themes/gfp/css/main.css, themes/gfp/css/foundation.css, themes/gfp/css/build/_offcanvas_menu.scss, themes/gfp/css/build/_general.scss, themes/gfp/css/build/_mainmenu.scss, themes/gfp/css/build/_footer.scss, themes/gfp/css/build/_press.scss, themes/gfp/css/build/_pageteaser.scss, themes/gfp/css/build/_highlights.scss, themes/gfp/css/build/_pagination.scss, themes/gfp/css/build/_slider.scss, themes/gfp/css/build/_header.scss, themes/gfp/css/build, themes/gfp/css/foundation.css.map, themes/gfp/css/foundationBase.css, themes/gfp/css/main.css.map, themes/gfp/css/_concrete5-ui.scss, themes/gfp/css/_print.scss, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-BoldItalic.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-Black.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-LightItalic.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-MediumItalic.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-RegularItalic.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-Regular.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-Light.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-BlackItalic.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-Medium.woff, themes/gfp/css/fonts/SkolaSansCn/SkolaSansCn-Bold.woff, themes/gfp/css/fonts/SkolaSansCn, themes/gfp/css/fonts, themes/gfp/css/main.scss, themes/gfp/css, themes/gfp/sidebar_right.php, themes/gfp/view.php, themes/gfp, tools/test.php

# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache

# Server API
apache2handler

# PHP Version
5.6.30-1+deb.sury.org~trusty+1

# PHP Extensions
apache2handler, calendar, Core, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, imagick, intl, json, libxml, mbstring, mcrypt, mhash, mysql, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, Phar, posix, readline, Reflection, session, shmop, SimpleXML, soap, sockets, SPL, standard, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, Zend OPcache, zip, zlib

# PHP Settings
max_execution_time - 90
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 300
max_input_vars - 1000
memory_limit - 256M
post_max_size - 150M
sql.safe_mode - Off
upload_max_filesize - 150M
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
opcache.max_accelerated_files - 30000
opcache.max_file_size - 0
opcache.max_wasted_percentage - 5

Browser User-Agent String

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0