public static function delete($file) { if (empty($file)) { return false; } if (function_exists('option')) { $bucket = option('config.attachment_up_bucket'); $user = option('config.attachment_up_username'); $pwd = option('config.attachment_up_password'); $unlink = option('config.attachment_upload_unlink'); } else { $bucket = C('config.attachment_up_bucket'); $user = C('config.attachment_up_username'); $pwd = C('config.attachment_up_password'); $unlink = C('config.attachment_upload_unlink'); } if (empty($bucket) || empty($user) || empty($pwd)) { return false; } if (empty($unlink)) { return false; } $upyun = new UpYun($bucket, $user, $pwd); try { error_log('upyunUser::delete:' . $file); $upyun->delete($file); } catch (Exception $e) { print_r($e); } }
public function show() { $sql = 'SELECT * FROM ' . DB_PREFIX . 'delete_file '; $orderby = ' ORDER BY create_time ASC'; $limit = ' limit 0, 1'; $data = $this->db->query_first($sql . $orderby . $limit); if ($data['bucket_name'] && $data['file_path']) { $upyun = new UpYun($data['bucket_name'], SPACEOPERATORS, SPACEOPERATORSPASSWORD); if ($upyun->delete($data['file_path']) === true) { $this->db->query('DELETE FROM ' . DB_PREFIX . 'delete_file WHERE id = ' . $data['id']); } else { $this->db->query('UPDATE ' . DB_PREFIX . 'delete_file SET times=times-1,create_time=' . TIMENOW . ' WHERE id = ' . $data['id']); } } $this->db->query('DELETE FROM ' . DB_PREFIX . 'delete_file where times<=0'); }
public function delete() { $id = $_POST['value']; $section = $this->section_model->get_section_by_id($id); if ($section['section_path']) { $path = strstr($section['section_path'], '/img'); $UpYun = new UpYun('code32', 'rxs', 'rxs84217621'); $result = $UpYun->delete($path); } $value = $this->section_model->delete($id); if ($result == 1 && $value == 1) { echo '1'; } else { echo '-1'; } }
public function deleteYunImg($url = '') { $upConf = C('upload'); T('image/upyun'); try { $upyun = new UpYun($upConf['yun']['bucket'], $upConf['yun']['user'], $upConf['yun']['pwd']); return $upyun->delete('/' . $url); } catch (Exception $e) { // echo $e->getCode().$e->getMessage(); } return false; }
function ftp_delete($path) { $upyun = new UpYun($this->upyun_config['bucket_name'], $this->upyun_config['operator_name'], $this->upyun_config['operator_pwd']); $path = discuz_ftp::clear($path); try { $rsp = $upyun->delete($this->upyun_dir . ltrim($path, '/')); return $rsp; } catch (Exception $e) { return 0; } }
function delete() { $UpYun = new UpYun('code32', 'rxs', 'rxs84217621'); echo $UpYun->delete('/video/875cbbbc8ec551845f0ff360df11376f.mp4'); }
function upyundel($file_path) { require_once CSCMSPATH . 'uploads/upyun/upyun.class.php'; $upyun = new UpYun(CS_Upy_Bucket, CS_Upy_Name, CS_Upy_Pwd); $response = $upyun->delete($file_path); if ($response) { return true; } else { return false; } }
$accessKeySecret = $sk; $endExplode = explode(".", $serverUrl); $endpoint = "http://" . $endExplode[1] . "." . $endExplode[2] . "." . $endExplode[3]; try { $ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false); } catch (OssException $e) { print "bad.无法连接至存储服务器"; } $object = $ming; try { $ossClient->deleteObject($bucketName, $object); } catch (OssException $e) { echo "bad.删除失败,但上传记录将被删除"; deleteShare($key1, $con); return; } echo "ok.删除成功"; deleteShare($key1, $con); break; case 'upyun': $upyun = new UpYun($bucketName, $operator_name, $operator_pwd); try { $upyun->delete('/' . $ming); } catch (Exception $e) { echo "bad.删除失败,但上传记录将被删除"; deleteShare($key1, $con); } echo "ok.删除成功"; deleteShare($key1, $con); break; }