function WritableStreamBackupFile::write in Backup and Migrate 8.4
Write a line to the file.
Parameters
string $data A string to write to the file.:
Throws
\Exception
Overrides BackupFileWritableInterface::write
1 call to WritableStreamBackupFile::write()
- WritableStreamBackupFile::writeAll in lib/
backup_migrate_core/ src/ File/ WritableStreamBackupFile.php - A shorthand function to open the file, write the given contents and close the file. Used for small amounts of data that can fit in memory.
File
- lib/
backup_migrate_core/ src/ File/ WritableStreamBackupFile.php, line 63
Class
- WritableStreamBackupFile
- Class TempFile.
Namespace
BackupMigrate\Core\FileCode
function write($data) {
if (!$this
->isOpen()) {
$this
->openForWrite();
}
if ($this->handle) {
if (fwrite($this->handle, $data) === FALSE) {
throw new \Exception('Cannot write to file: ' . $this
->realpath());
}
else {
$this->dirty = TRUE;
}
}
else {
throw new \Exception('File not open for writing.');
}
}