parent
53934e9d4b
commit
f8976d8915
|
@ -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.13
|
Version: 1.4.14
|
||||||
Author: 沈唁
|
Author: 沈唁
|
||||||
Author URI: https://qq52o.me
|
Author URI: https://qq52o.me
|
||||||
License: Apache2.0
|
License: Apache2.0
|
||||||
|
@ -19,7 +19,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.13');
|
define('OSS_VERSION', '1.4.14');
|
||||||
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')) {
|
||||||
|
@ -237,7 +237,7 @@ function oss_delete_oss_files(array $files)
|
||||||
*/
|
*/
|
||||||
function oss_upload_attachments($metadata)
|
function oss_upload_attachments($metadata)
|
||||||
{
|
{
|
||||||
$mime_types = get_allowed_mime_types();
|
$mime_types = wp_get_mime_types();
|
||||||
$image_mime_types = [
|
$image_mime_types = [
|
||||||
$mime_types['jpg|jpeg|jpe'],
|
$mime_types['jpg|jpeg|jpe'],
|
||||||
$mime_types['gif'],
|
$mime_types['gif'],
|
||||||
|
@ -246,7 +246,6 @@ function oss_upload_attachments($metadata)
|
||||||
$mime_types['tiff|tif'],
|
$mime_types['tiff|tif'],
|
||||||
$mime_types['webp'],
|
$mime_types['webp'],
|
||||||
$mime_types['ico'],
|
$mime_types['ico'],
|
||||||
$mime_types['heic'],
|
|
||||||
];
|
];
|
||||||
// 例如mp4等格式 上传后根据配置选择是否删除 删除后媒体库会显示默认图片 点开内容是正常的
|
// 例如mp4等格式 上传后根据配置选择是否删除 删除后媒体库会显示默认图片 点开内容是正常的
|
||||||
// 图片在缩略图处理
|
// 图片在缩略图处理
|
||||||
|
|
|
@ -96,6 +96,29 @@ class OSS_CLI_Commands
|
||||||
WP_CLI::error("Failed: {$path}");
|
WP_CLI::error("Failed: {$path}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除 OSS 中的文件
|
||||||
|
*
|
||||||
|
* ## OPTIONS
|
||||||
|
*
|
||||||
|
* <key>
|
||||||
|
* : 需要删除 OSS 中的文件 key
|
||||||
|
*
|
||||||
|
* ## EXAMPLES
|
||||||
|
*
|
||||||
|
* wp oss delete-file 2021/01/1.jpg
|
||||||
|
*
|
||||||
|
* @when after_wp_load
|
||||||
|
* @subcommand delete-file
|
||||||
|
*/
|
||||||
|
public function delete_file($args, $assoc_args)
|
||||||
|
{
|
||||||
|
[$key] = $args;
|
||||||
|
WP_CLI::line("Deleting file [{$key}] from OSS...");
|
||||||
|
|
||||||
|
oss_delete_oss_file($key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WP_CLI::add_command('oss', 'OSS_CLI_Commands', ['shortdesc' => 'Commands used to operate OSS.']);
|
WP_CLI::add_command('oss', 'OSS_CLI_Commands', ['shortdesc' => 'Commands used to operate OSS.']);
|
||||||
|
|
|
@ -5,7 +5,7 @@ Tags: oss, 阿里云, 对象存储, aliyun
|
||||||
Requires at least: 4.6
|
Requires at least: 4.6
|
||||||
Tested up to: 6.5
|
Tested up to: 6.5
|
||||||
Requires PHP: 7.1
|
Requires PHP: 7.1
|
||||||
Stable tag: 1.4.13
|
Stable tag: 1.4.14
|
||||||
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
|
||||||
|
|
||||||
|
@ -76,6 +76,12 @@ License URI: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 1.4.14 =
|
||||||
|
|
||||||
|
- 支持 `wp-cli` 命令删除文件
|
||||||
|
- Use wp_get_mime_types instead of get_allowed_mime_types
|
||||||
|
- 修复 heic 格式图片上传失败问题
|
||||||
|
|
||||||
= 1.4.13 =
|
= 1.4.13 =
|
||||||
|
|
||||||
- 支持 `wp-cli` 命令上传文件
|
- 支持 `wp-cli` 命令上传文件
|
||||||
|
|
Loading…
Reference in New Issue