yiichou / aliyun-oss-support

基于阿里云OSS的WordPress远程附件支持插件
Other
353 stars 80 forks source link

服务器缺少curl扩展导致的问题不正常 #82

Closed Anricx closed 5 years ago

Anricx commented 5 years ago

安装了没任何反应😄;

我觉得可以在插件设置页面添加一个依赖检测 阅读源码才知道这里出问题了:

try {
    Config::$ossClient = new OSS\OssClient(Config::$accessKeyId, Config::$accessKeySecret, Config::$endpoint);
    new OSS\WP\Upload();
    new OSS\WP\Delete();
    new OSS\WP\UrlHelper();
} catch (OSS\Core\OssException $e) {
   // 异常了就走默认了
    register_activation_hook(__FILE__, function () {
        add_option('oss_options', Config::$originOptions, '', 'yes');
    });
}

尝试打印了异常后输出

Message: Extension {curl} is not installed or not enabled, please check your php env.<br />

希望梳理下依赖,然后在setting页面自动检测。  

yiichou commented 5 years ago

关联 #69 不过没有 curl 会被 OssException 捕获这种情况确实是之前没考虑到的 Thx