Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Renames a file or directory
<?php rename(string $from, string $to, ?resource $context = null): bool
<?php file_put_contents($tempPath, $content);
rename($tempPath, $path);
}
<?php public function move($path, $target)
{
return rename($path, $target);
}
<?php return false;
}
return @rename($from, $to) === true;
}
<?php function move_uploaded_file($from, $to)
{
return \is_file($from) && \rename($from, $to);
}
<?php $this->warn("Your RoadRunner binary version (<fg=red>$version</>) may be incompatible with Octane.");
if ($this->confirm('Should Octane download the latest RoadRunner binary version for your operating system?', true)) {
rename($roadRunnerBinary, "$roadRunnerBinary.backup");
try {
$this->downloadRoadRunnerBinary();
<?php } catch (Throwable $e) {
report($e);
rename("$roadRunnerBinary.backup", $roadRunnerBinary);
return $this->warn('Unable to download RoadRunner binary. The HTTP request exception has been logged.');
}
<?php $this->resolveDirectoryVisibility($config->get(Config::OPTION_DIRECTORY_VISIBILITY))
);
if ( ! @rename($sourcePath, $destinationPath)) {
throw UnableToMoveFile::fromLocationTo($sourcePath, $destinationPath);
}
}
<?php $tempFileName = $this->root . $file . uniqid('.', true) . '.tmp';
try {
return file_put_contents($tempFileName, $contents) !== false && rename($tempFileName, $this->root . $file);
} catch (\ErrorException $e) {
$this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
if (Preg::isMatch('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
<?php copy($newFilename, $localFilename);
@unlink($newFilename);
} else {
rename($newFilename, $localFilename);
}
return true;
<?php $tmpFile = tempnam(sys_get_temp_dir(), '');
$script = $tmpFile.'.vbs';
rename($tmpFile, $script);
$checksum = hash_file('sha256', $newFilename);
<?php public function rename($source, $target)
{
if (true === @rename($source, $target)) {
return;
}
<?php if ($job['filename']) {
rename($job['filename'].'~', $job['filename']);
call_user_func($job['resolve'], $response);
} else {
call_user_func($job['resolve'], $response);
<?php throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
}
if (true !== @rename($origin, $target)) {
if (is_dir($origin)) {
$this->mirror($origin, $target, null, ['override' => $overwrite, 'delete' => $overwrite]);