admin 发表于 2020-7-8 10:09:42

修复Discuz开启远程附件后,DIY缩略图路径错误的BUG

当Discuz开启FTP远程附件(或者其他插件远程附件后),DIY的缩略图被上传到远程空间后,Discuz没有把缩略图同步标记为远程状态,仍然调用本地连接,导致缩略图无法显示,手动更新DIY缓存可正常,但每次都手动去更新不现实,1314学习网给出修复此BUG的解决办法:
打开:source\function\function_block.php
1.找到
if($blockitem['picflag'] == '1') {$replacevalue = $_G['setting']['attachurl'].$replacevalue; } elseif ($blockitem['picflag'] == '2') {$replacevalue = $_G['setting']['ftp']['attachurl'].$replacevalue;}修改为
if ($blockitem['picflag'] == '2') {      $replacevalue = (preg_match('/^https?:\/\//is', $replacevalue) ? '' : $_G['setting']['ftp']['attachurl']).$replacevalue;} else {      if(file_exists($_G['setting']['attachdir'].$replacevalue)) {                $replacevalue = $_G['setting']['attachurl'].$replacevalue;      }else{                $replacevalue = (preg_match('/^https?:\/\//is', $replacevalue) ? '' : $_G['setting']['ftp']['attachurl']).$replacevalue;      }}
2.找到if($blockitem['picflag'] == '1') {      $replacevalue = $_G['setting']['attachurl'].$blockitem['thumbpath'];} elseif ($blockitem['picflag'] == '2') {      $replacevalue = $_G['setting']['ftp']['attachurl'].$blockitem['thumbpath'];}修改为if ($blockitem['picflag'] == '2') {      $replacevalue = (preg_match('/^https?:\/\//is', $blockitem['thumbpath']) ? '' : $_G['setting']['ftp']['attachurl']).$blockitem['thumbpath'];}else{      if(file_exists($_G['setting']['attachdir'].$blockitem['thumbpath'])) {                $replacevalue = $_G['setting']['attachurl'].$blockitem['thumbpath'];      }else{                $replacevalue = (preg_match('/^https?:\/\//is', $blockitem['thumbpath']) ? '' : $_G['setting']['ftp']['attachurl']).$blockitem['thumbpath'];      }}
3.找到
@unlink($_G['setting']['attachdir'].'./'.$thumbpath);在下边添加:C::t('common_block_item')->update($itemid, array('picflag' => 2));$replacevalue = (preg_match('/^https?:\/\//is', $thumbpath) ? '' : $_G['setting']['ftp']['attachurl']).$thumbpath;修改后更新下对应的页面的DIY缓存,以便实时生效


X3.4已改好文件下载
function_block.zip(9.72 KB, 下载次数: 0)<div class="tip tip_4" id="attach_31970_menu" style="position: absolute; display: none" disautofocus="true"><div class="tip_c xs0">2020-6-24 22:05 上传
点击文件名下载附件
页: [1]
查看完整版本: 修复Discuz开启远程附件后,DIY缩略图路径错误的BUG

创宇盾启航版免费网站防御网站加速服务