parent
48df76994b
commit
6c09f4057e
|
@ -3,7 +3,7 @@
|
||||||
Plugin Name: OSS Aliyun
|
Plugin Name: OSS Aliyun
|
||||||
Plugin URI: https://github.com/sy-records/aliyun-oss-wordpress
|
Plugin URI: https://github.com/sy-records/aliyun-oss-wordpress
|
||||||
Description: 使用阿里云对象存储 OSS 作为附件存储空间。(This is a plugin that uses Aliyun Object Storage Service for attachments remote saving.)
|
Description: 使用阿里云对象存储 OSS 作为附件存储空间。(This is a plugin that uses Aliyun Object Storage Service for attachments remote saving.)
|
||||||
Version: 1.4.4
|
Version: 1.4.6
|
||||||
Author: 沈唁
|
Author: 沈唁
|
||||||
Author URI: https://qq52o.me
|
Author URI: https://qq52o.me
|
||||||
License: Apache2.0
|
License: Apache2.0
|
||||||
|
@ -20,7 +20,7 @@ use OSS\Credentials\CredentialsProvider;
|
||||||
use AlibabaCloud\Credentials\Credential;
|
use AlibabaCloud\Credentials\Credential;
|
||||||
use OSS\Credentials\StaticCredentialsProvider;
|
use OSS\Credentials\StaticCredentialsProvider;
|
||||||
|
|
||||||
define('OSS_VERSION', '1.4.4');
|
define('OSS_VERSION', '1.4.6');
|
||||||
define('OSS_BASEFOLDER', plugin_basename(dirname(__FILE__)));
|
define('OSS_BASEFOLDER', plugin_basename(dirname(__FILE__)));
|
||||||
|
|
||||||
if (!function_exists('get_home_path')) {
|
if (!function_exists('get_home_path')) {
|
||||||
|
@ -251,6 +251,10 @@ function oss_upload_attachments($metadata)
|
||||||
*/
|
*/
|
||||||
function oss_upload_thumbs($metadata)
|
function oss_upload_thumbs($metadata)
|
||||||
{
|
{
|
||||||
|
if (empty($metadata['file'])) {
|
||||||
|
return $metadata;
|
||||||
|
}
|
||||||
|
|
||||||
//获取上传路径
|
//获取上传路径
|
||||||
$wp_uploads = wp_upload_dir();
|
$wp_uploads = wp_upload_dir();
|
||||||
$basedir = $wp_uploads['basedir'];
|
$basedir = $wp_uploads['basedir'];
|
||||||
|
@ -261,22 +265,20 @@ function oss_upload_thumbs($metadata)
|
||||||
$no_local_file = esc_attr($oss_options['nolocalsaving']) == 'true';
|
$no_local_file = esc_attr($oss_options['nolocalsaving']) == 'true';
|
||||||
$no_thumb = esc_attr($oss_options['nothumb']) == 'true';
|
$no_thumb = esc_attr($oss_options['nothumb']) == 'true';
|
||||||
|
|
||||||
if (!empty($metadata['file'])) {
|
// Maybe there is a problem with the old version
|
||||||
// Maybe there is a problem with the old version
|
$file = $basedir . '/' . $metadata['file'];
|
||||||
$file = $basedir . '/' . $metadata['file'];
|
if ($upload_path != '.') {
|
||||||
if ($upload_path != '.') {
|
$path_array = explode($upload_path, $file);
|
||||||
$path_array = explode($upload_path, $file);
|
if (count($path_array) >= 2) {
|
||||||
if (count($path_array) >= 2) {
|
$object = '/' . $upload_path . end($path_array);
|
||||||
$object = '/' . $upload_path . end($path_array);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$object = '/' . $metadata['file'];
|
|
||||||
$file = str_replace('./', '', $file);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
oss_file_upload($object, $file, $no_local_file);
|
$object = '/' . $metadata['file'];
|
||||||
|
$file = str_replace('./', '', $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
oss_file_upload($object, $file, $no_local_file);
|
||||||
|
|
||||||
//得到本地文件夹和远端文件夹
|
//得到本地文件夹和远端文件夹
|
||||||
$dirname = dirname($metadata['file']);
|
$dirname = dirname($metadata['file']);
|
||||||
$file_path = $dirname != '.' ? "{$basedir}/{$dirname}/" : "{$basedir}/";
|
$file_path = $dirname != '.' ? "{$basedir}/{$dirname}/" : "{$basedir}/";
|
||||||
|
|
|
@ -5,7 +5,7 @@ Tags: oss, 阿里云, 对象存储, aliyun
|
||||||
Requires at least: 4.2
|
Requires at least: 4.2
|
||||||
Tested up to: 6.3
|
Tested up to: 6.3
|
||||||
Requires PHP: 7.0
|
Requires PHP: 7.0
|
||||||
Stable tag: 1.4.5
|
Stable tag: 1.4.6
|
||||||
License: Apache2.0
|
License: Apache2.0
|
||||||
License URI: http://www.apache.org/licenses/LICENSE-2.0.html
|
License URI: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
|
@ -73,6 +73,10 @@ License URI: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 1.4.6 =
|
||||||
|
|
||||||
|
- 修复 pdf 等文件格式上传时报错
|
||||||
|
|
||||||
= 1.4.5 =
|
= 1.4.5 =
|
||||||
|
|
||||||
- 兼容 PHP 7.0
|
- 兼容 PHP 7.0
|
||||||
|
|
Loading…
Reference in New Issue