add deleting invalid textures automatically

This commit is contained in:
printempw 2016-08-17 18:08:51 +08:00
parent 6fbaf4175b
commit 89acfaff8f
2 changed files with 7 additions and 2 deletions

View File

@ -98,6 +98,10 @@ class SkinlibController extends BaseController
$texture = Texture::find($_GET['tid']);
if (!$texture || $texture && !\Storage::exist(BASE_DIR."/textures/".$texture->hash)) {
if (Option::get('auto_del_invalid_texture') == "1") {
if ($texture) $texture->delete();
Http::abort(404, '请求的材质文件已经被删除');
}
Http::abort(404, '请求的材质文件已经被删除,请联系管理员删除该条目');
}

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-07-29 11:53:11
* @Last Modified by: printempw
* @Last Modified time: 2016-08-15 22:09:17
* @Last Modified time: 2016-08-17 18:06:10
*/
return [
@ -32,5 +32,6 @@ return [
'version' => '',
'check_update' => '1',
'update_source' => 'github',
'copyright_text' => '<strong>Copyright &copy; 2016 <a href="{site_url}">{site_name}</a>.</strong> All rights reserved.'
'copyright_text' => '<strong>Copyright &copy; 2016 <a href="{site_url}">{site_name}</a>.</strong> All rights reserved.',
'auto_del_invalid_texture' => '1'
];