Let the platform do the work

File Map Modification API

Overview

Methods to modify files in the AutoLoader API. All the functions below return true on success and false on failure.

addToMap($filename, $save = true)

Adds an existing file to the file map. If $save is true, the new map will be saved to the disk file map, otherwise, it will persist only until the end of the request. This method does not create the file on the filesystem.

  SugarAutoloader::addToMap('custom/myFile.php');

delFromMap($filename, $save = true)

Removes a file from the file map. If $filename points to a directory, this directory and all files under it are removed from the map. If $save is true, the new map will be saved to the disk file map, otherwise, it will persist only until the end of the request. This method does not delete the file from the filesystem.

  SugarAutoloader::delFromMap('custom/myFile.php');

put($filename, $data, $save = false)

Saves data to a file on the filesystem and adds it to the file map. If $save is true, the new map will be saved to the disk file map, otherwise, it will persist only until the end of the request.

  $file = 'custom/myFile.php';

SugarAutoloader::touch($file, true);

SugarAutoloader::put($file, '<?php /*file content*/ ?>', true);

touch($filename, $save = false)

Creates the specified file on the filesystem and adds it to the file map. If $save is true, the new map will be saved to the disk file map, otherwise, it will persist only until the end of the request.

  SugarAutoloader::touch('custom/myFile.php', true);

unlink($filename, $save = false)

Removes the specified file from the filesystem and from the current file map. If $save is true, the new map will be saved to the disk file map, otherwise, it will persist only until the end of the request.

  SugarAutoloader::unlink('custom/myFile.php', true);