123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?php
- use Symfony\Component\Finder\Finder;
- // Include the SDK using the Composer autoloader
- date_default_timezone_set('America/Argentina/Buenos_Aires');
- require 'vendor/autoload.php';
- $s3 = new Aws\S3\S3Client([
- 'version' => 'latest',
- 'region' => 'sa-east-1',
- 'endpoint' => 'https://s3.infra.flowdat.com/minio/login',
- 'use_path_style_endpoint' => true,
- 'credentials' => [
- 'key' => 'iksop',
- 'secret' => '8htoiwn44g204th',
- ],
- ]);
- /* Send a PutObject request and get the result object.
- $insert = $s3->putObject([
- 'Bucket' => 'testbucket',
- 'Key' => 'testFer',
- 'Body' => 'Hello Fer!!'."\n"
- ]);
- // Download the contents of the object.
- $retrive = $s3->getObject([
- 'Bucket' => 'testbucket',
- 'Key' => 'testFer',
- 'SaveAs' => 'testkey_local'
- ]);
- */
- $head = shell_exec('git rev-parse HEAD');
- $head = substr($head,0,-1);
- $directorioA = array('01_login/','02_base/','03_ftth/','04_map/');
- for ($i = 0; $i < 4; $i++)
- {
- $dir = $directorioA[$i];
- $directorio = opendir("tests/_output/debug/" . $dir);
- while ($archivo = readdir($directorio))
- {
- if (is_dir($archivo))
- {
- }
- else
- {
- $result = $s3->putObject(array(
- 'Bucket' => 'testbucket',
- 'Key' => $head.'/'.$dir . $archivo,
- 'SourceFile' => './tests/_output/debug/' . $dir . $archivo
- ));
- // We can poll the object until it is accessible
- $s3->waitUntil('ObjectExists', array(
- 'Bucket' => 'testbucket',
- 'Key' => $head.'/'.$dir . $archivo
- ));
- }
- }
- echo "Directorio '" . $dir . "' actualizado. Commit: " . $head . "\n" ;
- }
- //descargar HEAD~1
- $s3 = new Aws\S3\S3Client([
- 'version' => 'latest',
- 'region' => 'sa-east-1',
- 'endpoint' => 'https://s3.infra.flowdat.com/minio/login',
- 'use_path_style_endpoint' => true,
- 'credentials' => [
- 'key' => 'iksop',
- 'secret' => '8htoiwn44g204th',
- ],
- ]);
- $head = shell_exec('git rev-parse HEAD~1');
- $head = substr($head,0,-1);
- for ($i = 0; $i < 4; $i++)
- {
- $dir = $directorioA[$i];
- shell_exec('mkdir -p ./tests/to_compare/' . $head . "/" . $dir);
- }
- $iterator = $s3->getIterator('ListObjects', array('Bucket'=> "testbucket",'Prefix'=> $head));
- foreach ($iterator as $object) {
- // echo "Objeto cargado: " . $object['Key'];
-
- $retrive = $s3->getObject([
- 'Bucket' => 'testbucket',
- 'Key' => $object['Key'],
- 'SaveAs' => './tests/to_compare/' . $object['Key']
- ]);
- echo "Se descargó el archivo " . $object['Key'] . "\n";
- }
-
- // Print the body of the result by indexing into the result object.
- //echo $retrive['Body'];
|