RainLab\Builder\Classes\MigrationModel::saveScriptFile PHP Method

saveScriptFile() protected method

protected saveScriptFile ( )
    protected function saveScriptFile()
    {
        $originalFileContents = $this->getOriginalFileContents();
        if (strlen($this->scriptFileName)) {
            $scriptFilePath = $this->getPluginUpdatesPath($this->scriptFileName . '.php');
            if (!File::put($scriptFilePath, $this->code)) {
                throw new SystemException(sprintf('Error saving file %s', $scriptFilePath));
            }
            @File::chmod($scriptFilePath);
        }
        if (strlen($this->originalScriptFileName) && $this->scriptFileName != $this->originalScriptFileName) {
            $originalScriptFilePath = $this->getPluginUpdatesPath($this->originalScriptFileName . '.php');
            if (File::isFile($originalScriptFilePath)) {
                @unlink($originalScriptFilePath);
            }
        }
        return $originalFileContents;
    }