Пример #1
0
				if (preg_match('#^([0-9]+)_(.+)$#', $ID, $regs))
				{
					$BUCKET_ID = $regs[1];
					$item = $regs[2];

					if ($BUCKET_ID)
					{
						if (CModule::IncludeModule('clouds'))
						{
							$obBucket = new CCloudStorageBucket($BUCKET_ID);
							if ($obBucket->Init())
							{
								$name = $path.'/'.$item;
								while($obBucket->FileExists($name))
								{
									$file_size = $obBucket->GetFileSize($name);
									if ($obBucket->DeleteFile($name))
										$obBucket->DecFileCounter($file_size);
									$name = CTar::getNextName($name);
								}

								$e = $APPLICATION->GetException();
								if(is_object($e))
									$lAdmin->AddGroupError($e->GetString(), $ID);
							}
							else
								$lAdmin->AddGroupError(GetMessage("MAIN_DUMP_ERR_INIT_CLOUD"), $ID);
						}
					}
					else
					{
Пример #2
0
$message = null;
$path = (string) $_GET["path"];
$sTableID = "tbl_clouds_file_list";
$lAdmin = new CAdminList($sTableID);
$arID = $lAdmin->GroupAction();
$action = isset($_REQUEST["action"]) && is_string($_REQUEST["action"]) ? "{$_REQUEST['action']}" : "";
if ($USER->CanDoOperation("clouds_upload") && is_array($arID)) {
    foreach ($arID as $ID) {
        if (strlen($ID) <= 0) {
            continue;
        }
        $ID = urldecode($ID);
        switch ($action) {
            case "delete":
                if (substr($ID, 0, 1) === "F") {
                    $file_size = $obBucket->GetFileSize($path . substr($ID, 1));
                    if (!$obBucket->DeleteFile($path . substr($ID, 1))) {
                        $e = $APPLICATION->GetException();
                        if (is_object($e)) {
                            $lAdmin->AddUpdateError($e->GetString(), $ID);
                        } else {
                            $lAdmin->AddUpdateError(GetMessage("CLO_STORAGE_FILE_UNKNOWN_ERROR", array("#CODE#" => "D01")), $ID);
                        }
                    } else {
                        $obBucket->DecFileCounter($file_size);
                    }
                } elseif (substr($ID, 0, 1) === "D") {
                    $arFiles = $obBucket->ListFiles($path . substr($ID, 1), true);
                    foreach ($arFiles["file"] as $i => $file) {
                        if (!$obBucket->DeleteFile($path . substr($ID, 1) . "/" . $file)) {
                            $e = $APPLICATION->GetException();