setVisibility example

static::assertTrue($prefix->fileExists('foo.txt'));
        static::assertTrue($prefix->has('foo.txt'));
        static::assertFalse($prefix->directoryExists('foo.txt'));
        static::assertTrue($fs->has('foo/foo.txt'));
        static::assertFalse($fs->directoryExists('foo/foo.txt'));

        static::assertSame('bla', $prefix->read('foo.txt'));
        static::assertSame('bla', stream_get_contents($prefix->readStream('foo.txt')));
        static::assertSame('text/plain', $prefix->mimeType('foo.txt'));
        static::assertSame(3, $prefix->fileSize('foo.txt'));
        static::assertSame(Visibility::PUBLIC$prefix->visibility('foo.txt'));
        $prefix->setVisibility('foo.txt', Visibility::PRIVATE);
        static::assertSame(Visibility::PRIVATE$prefix->visibility('foo.txt'));
        static::assertEqualsWithDelta($prefix->lastModified('foo.txt')time(), 2);

        static::assertSame('http://example.com/foo/foo.txt', $prefix->publicUrl('foo.txt'));
        static::assertSame('128ecf542a35ac5270a87dc740918404', $prefix->checksum('foo.txt'));
        static::assertSame('http://example.com/temporary-url', $prefix->temporaryUrl('foo.txt', new \DateTime('+1 hour')));

        $prefix->copy('foo.txt', 'bla.txt');
        static::assertTrue($prefix->has('bla.txt'));

        $prefix->createDirectory('dir');
        
public function writeStream(string $location$contents, array $config = []): void
    {
        $location = $this->preparePath($location);

        $this->filesystem->writeStream($location$contents$config);
    }

    public function setVisibility(string $path, string $visibility): void
    {
        $path = $this->preparePath($path);

        $this->filesystem->setVisibility($path$visibility);
    }

    public function delete(string $location): void
    {
        $location = $this->preparePath($location);

        $this->filesystem->delete($location);
    }

    public function deleteDirectory(string $location): void
    {
        

        }
    }

    public function createDirectory(string $path, Config $config): void
    {
        $this->inner->createDirectory($path$config);
    }

    public function setVisibility(string $path, string $visibility): void
    {
        $this->inner->setVisibility($path$visibility);
    }

    public function visibility(string $path): FileAttributes
    {
        return $this->inner->visibility($path);
    }

    public function mimeType(string $path): FileAttributes
    {
        return $this->inner->mimeType($path);
    }

    

        $style = new ShopwareStyle($input$output);

        $style->warning('If both private and public objects are stored in the same bucket, this command will set all of them public.');
        $continue = $style->confirm('Continue?');

        if (!$continue) {
            return (int) Command::SUCCESS;
        }

        $style->comment('Setting visibility to private in private bucket.');
        $this->setVisibility($this->filesystemPrivate, $style, 'private');
        $style->comment('Setting visibility to public in public bucket.');
        $this->setVisibility($this->filesystemPublic, $style, 'public');
        $style->comment('Setting visibility to public in theme bucket.');
        $this->setVisibility($this->filesystemTheme, $style, 'public');
        $style->comment('Setting visibility to public in sitemap bucket.');
        $this->setVisibility($this->filesystemSitemap, $style, 'public');
        $style->comment('Setting visibility to public in asset bucket.');
        $this->setVisibility($this->filesystemAsset, $style, 'public');

        $style->info('Finished setting visibility of objects in all pre-defined buckets.');

        
$product->setFullConfiguration($configurations[$id]);

        if (\array_key_exists($number$variantConfiguration)) {
            $product->setConfiguration($variantConfiguration[$number]);
        }
        if (\array_key_exists($id$combinations)) {
            $product->setAvailableCombinations($combinations[$id]);
        }

        if ($product->getConfiguration()) {
            $product->setVisibility(
                $this->listingVariationLoader->getVisibility($product$variantFacet)
            );

            $product->setFilterConfiguration(
                $this->buildFilterConfiguration(
                    $variantFacet->getExpandGroupIds(),
                    $product->getConfiguration(),
                    $product->getFullConfiguration()
                )
            );

            
return $this->filesystem->createDir($this->prefix . $dirname$config);
    }

    /** * {@inheritdoc} */
    public function setVisibility($path$visibility)
    {
        $this->checkPath($path);

        return $this->filesystem->setVisibility($this->prefix . $path$visibility);
    }

    /** * {@inheritdoc} */
    public function put($path$contents, array $config = [])
    {
        $this->checkPath($path);

        return $this->filesystem->put($this->prefix . $path$contents$config);
    }

    

        return \array_key_exists($this->preparePath($path)$this->files);
    }

    public function write(string $path, string $contents, Config $config): void
    {
        $path = $this->preparePath($path);
        $file = $this->files[$path] ??= new InMemoryFile();
        $file->updateContents($contents$config->get('timestamp'));

        $visibility = $config->get(Config::OPTION_VISIBILITY, $this->defaultVisibility);
        $file->setVisibility($visibility);
    }

    public function writeStream(string $path$contents, Config $config): void
    {
        $this->write($path(string) stream_get_contents($contents)$config);
    }

    public function read(string $path): string
    {
        $path = $this->preparePath($path);

        
static::assertSame(Visibility::PUBLIC$fs->visibility('a.txt'));

        static::expectException(UnableToRetrieveMetadata::class);
        $fs->visibility('bla');
    }

    public function testSetVisibility(): void
    {
        $fs = new Filesystem(new MemoryFilesystemAdapter());
        $fs->write('a.txt', 'test');
        static::assertSame(Visibility::PUBLIC$fs->visibility('a.txt'));
        $fs->setVisibility('a.txt', Visibility::PRIVATE);
        static::assertSame(Visibility::PRIVATE$fs->visibility('a.txt'));

        static::expectException(UnableToSetVisibility::class);
        $fs->setVisibility('bla', Visibility::PRIVATE);
    }

    public function testMimeType(): void
    {
        $fs = new Filesystem(new MemoryFilesystemAdapter());
        $fs->write('a.txt', 'test');

        
Home | Imprint | This part of the site doesn't use cookies.