src/components/File.php
public function save()
    {
        $dir = dirname($this->path);

        if (!is_dir($dir)) {
            $mask = @umask(0);
            $result = @mkdir($dir, $this->dirMode, true);
            @umask($mask);

            if (!$result) {
                throw new Exception("Unable to create the directory '$dir'.");
            }
        }

        if (@file_put_contents($this->path, $this->content) === false) {
            throw new Exception("Unable to write the file '{$this->path}'.");
        }

        $mask = @umask(0);
        @chmod($this->path, $this->mode);
        @umask($mask);

        return true;
    }
public function save()
    {
        $dir = dirname($this->path);

        if (!is_dir($dir)) {
            $mask = @umask(0);
            $result = @mkdir($dir, $this->dirMode, true);
            @umask($mask);

            if (!$result) {
                throw new Exception("Unable to create the directory '$dir'.");
            }
        }

        if (@file_put_contents($this->path, $this->content) === false) {
            throw new Exception("Unable to write the file '{$this->path}'.");
        }

        $mask = @umask(0);
        @chmod($this->path, $this->mode);
        @umask($mask);

        return true;
    }
public function save ( ) { $ dir = dirname ( $ this -> path ) ; if ( ! is_dir ( $ dir ) ) { $ mask = @ umask ( 0 ) ; $ result = @ mkdir ( $ dir , $ this -> dirMode , true ) ; @ umask ( $ mask ) ; if ( ! $ result ) { throw new Exception ( "Unable to create the directory '$dir'." ) ; } } if ( @ file_put_contents ( $ this -> path , $ this -> content ) === false ) { throw new Exception ( "Unable to write the file '{$this->path}'." ) ; } $ mask = @ umask ( 0 ) ; @ chmod ( $ this -> path , $ this -> mode ) ; @ umask ( $ mask ) ; return true ; }
Saves this file.

@return boolean whether the file was saved successfully.
@throws \crisu83\yii_caviar\Exception if the file or the directory cannot be created.
Saves this file .