12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- use Symfony\Component\Finder\Finder;
- include ('variables.php');
- // Include the SDK using the Composer autoloader
- date_default_timezone_set('America/Argentina/Buenos_Aires');
- require 'vendor/autoload.php';
- class minioUpdateCest
- {
- public function minioUpdate()
- {
- $cliente=$_GET['CLIENTE'];
- $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',
- ],
- ]);
- # subo últimas screen
- $head = shell_exec('git rev-parse HEAD');
- $head = substr($head,0,-1);
- $directorioA = array('01_login/','02_base/','03_ftth/','04_map/','05_stats/');
- $cantdir= count($directorioA);
- for ($i = 0; $i < $cantdir; $i++)
- {
- $dir = $directorioA[$i];
- $directorio = opendir("./tests/_output/debug/". $cliente. "/" . $head ."/" . $dir);
- while ($archivo = readdir($directorio))
- {
- if (is_dir($archivo))
- {
- }
- else
- {
- $result = $s3->putObject(array(
- 'Bucket' => 'testbucket',
- 'Key' => $cliente . "/" . $head. '/'.$dir . $archivo,
- 'SourceFile' => './tests/_output/debug/'.$cliente . "/" . $head . "/" . $dir . $archivo
- ));
- // We can poll the object until it is accessible
- $s3->waitUntil('ObjectExists', array(
- 'Bucket' => 'testbucket',
- 'Key' => $cliente . "/" . $head. '/'.$dir . $archivo
- ));
- }
- }
- echo "Directorio '" . $dir . "' actualizado. Commit: " . $head . " Cliente: " . $cliente ."\n" ;
- }
- //descargar imagenes Source
- $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',
- ],
- ]);
-
- for ($i = 0; $i < $cantdir; $i++)
- {
- $dir = $directorioA[$i];
- shell_exec('mkdir -p ./tests/screenSRC/'. $cliente . "/" . $dir);
- }
- $iterator = $s3->getIterator('ListObjects', array('Bucket'=> "screen-source",'Prefix'=> $cliente));
- foreach ($iterator as $object)
- {
- // echo $object['Key'];
- $retrive = $s3->getObject([
- 'Bucket' => 'screen-source',
- 'Key' => $object['Key'],
- 'SaveAs' => './tests/screenSRC/' . $object['Key']
- ]);
- echo "Se descargó el archivo " . $object['Key'] . "\n";
- }
- }
- }
|