Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Filesystem.php

function Filesystem::touch

Same name in this branch
  1. 11.1.x vendor/php-tuf/composer-stager/src/Internal/Filesystem/Service/Filesystem.php \PhpTuf\ComposerStager\Internal\Filesystem\Service\Filesystem::touch()

Sets access and modification time of file.

Parameters

int|null $time The touch time as a Unix timestamp, if not supplied the current system time is used:

int|null $atime The access time as a Unix timestamp, if not supplied the current system time is used:

Throws

IOException When touch fails

File

vendor/symfony/filesystem/Filesystem.php, line 131

Class

Filesystem
Provides basic utility to manipulate the file system.

Namespace

Symfony\Component\Filesystem

Code

public function touch(string|iterable $files, ?int $time = null, ?int $atime = null) : void {
    foreach ($this->toIterable($files) as $file) {
        if (!($time ? self::box('touch', $file, $time, $atime) : self::box('touch', $file))) {
            throw new IOException(\sprintf('Failed to touch "%s": ', $file) . self::$lastError, 0, null, $file);
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal