Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 5... Línea 5...
5
use Aws\Multipart\UploadState;
5
use Aws\Multipart\UploadState;
6
use Aws\ResultInterface;
6
use Aws\ResultInterface;
Línea 7... Línea 7...
7
 
7
 
8
trait MultipartUploadingTrait
8
trait MultipartUploadingTrait
-
 
9
{
-
 
10
    private $uploadedBytes = 0;
9
{
11
 
10
    /**
12
    /**
11
     * Creates an UploadState object for a multipart upload by querying the
13
     * Creates an UploadState object for a multipart upload by querying the
12
     * service for the specified upload's information.
14
     * service for the specified upload's information.
13
     *
15
     *
Línea 49... Línea 51...
49
        return $state;
51
        return $state;
50
    }
52
    }
Línea 51... Línea 53...
51
 
53
 
52
    protected function handleResult(CommandInterface $command, ResultInterface $result)
54
    protected function handleResult(CommandInterface $command, ResultInterface $result)
-
 
55
    {
-
 
56
        $partData = [];
-
 
57
        $partData['PartNumber'] = $command['PartNumber'];
-
 
58
        $partData['ETag'] = $this->extractETag($result);
-
 
59
        $commandName = $command->getName();
-
 
60
        $checksumResult = $commandName === 'UploadPart'
-
 
61
            ? $result
-
 
62
            : $result[$commandName . 'Result'];
-
 
63
 
-
 
64
        if (isset($command['ChecksumAlgorithm'])) {
-
 
65
            $checksumMemberName = 'Checksum' . strtoupper($command['ChecksumAlgorithm']);
-
 
66
            $partData[$checksumMemberName] = $checksumResult[$checksumMemberName] ?? null;
-
 
67
        }
53
    {
68
 
-
 
69
        $this->getState()->markPartAsUploaded($command['PartNumber'], $partData);
-
 
70
 
54
        $this->getState()->markPartAsUploaded($command['PartNumber'], [
71
        // Updates counter for uploaded bytes.
-
 
72
        $this->uploadedBytes += $command["ContentLength"];
-
 
73
        // Sends uploaded bytes to progress tracker if getDisplayProgress set
55
            'PartNumber' => $command['PartNumber'],
74
        if ($this->displayProgress) {
56
            'ETag'       => $this->extractETag($result),
75
            $this->getState()->getDisplayProgress($this->uploadedBytes);
57
        ]);
76
        }
Línea 58... Línea 77...
58
    }
77
    }
Línea 59... Línea 78...
59
 
78