mirror of
https://github.com/yunluo/gdk.git
synced 2024-05-04 23:43:23 +02:00
优化更新的问题
This commit is contained in:
parent
07042529eb
commit
c55cf1aa6c
|
@ -44,7 +44,7 @@ add_action('wp_ajax_get_new_version', 'gdk_ajax_get_update');
|
|||
//Ajax安装插件更新
|
||||
function gdk_ajax_install_update()
|
||||
{
|
||||
$url = 'http://a.gitcafe.net/gdk.zip?v=' . date("His");
|
||||
$url = 'http://dl.gitcafe.net/gdk.zip';
|
||||
unzip_url($url, GDK_ROOT_PATH);
|
||||
exit(1);
|
||||
|
||||
|
@ -65,7 +65,7 @@ function gdk_pasteup_imag()
|
|||
$wp_upload_dir = wp_upload_dir();
|
||||
$file = $_FILES['imageFile'];
|
||||
$result = array('success' => false, 'message' => 'Null');
|
||||
if (in_array($file['type'], array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/png'))) {
|
||||
if (in_array($file['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/png'))) {
|
||||
if ($file['error'] > 0) {
|
||||
$result['message'] = 'error';
|
||||
} else {
|
||||
|
|
|
@ -1358,14 +1358,16 @@ function getQrcode($url)
|
|||
|
||||
function unzip_url($url, $where)
|
||||
{
|
||||
$zippath = $where . '/' . (basename($url)) . '.zip';
|
||||
wp_remote_get($url,
|
||||
[
|
||||
'timeout' => 300,
|
||||
'stream' => true,
|
||||
'filename' => $zippath,
|
||||
]
|
||||
);
|
||||
$zippath = $where . '/' . (basename($url));
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL,$url);
|
||||
curl_setopt($curl, CURLOPT_HEADER,0);
|
||||
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
|
||||
curl_setopt($curl,CURLOPT_TIMEOUT,300);
|
||||
$downfile = fopen($zippath,'wb');
|
||||
curl_setopt($curl,CURLOPT_FILE,$downfile);
|
||||
curl_exec($curl);
|
||||
curl_close($curl);
|
||||
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||
\WP_Filesystem();
|
||||
\unzip_file($zippath, $where);
|
||||
|
|
Loading…
Reference in a new issue