/**
  * Override parent
  */
 function handleFileUpload($fileParameters, $id)
 {
     $filename = NULL;
     if (array_key_exists($this->parameterFile, $_FILES) and array_key_exists('name', $_FILES[$this->parameterFile]) and $_FILES[$this->parameterFile]['name'] != '') {
         $fileHelper = new FileHelper();
         $filename = $fileHelper->upload($this->fileBasename, $id, $_FILES[$this->parameterFile]);
     }
     return $filename;
 }
Exemplo n.º 2
0
 public static function updateTagRelationCache($manualLock = false)
 {
     if (!$manualLock) {
         self::checkTagRelationCache('lock');
     }
     try {
         $tagRelationsFile = sfConfig::get('sf_root_dir') . "/cache/objcache/tagsRelations.php";
         $c = new Criteria();
         $allTags = TagPeer::doSelect($c);
         $content = "<?php \n";
         foreach ($allTags as $singleTag) {
             $c = new Criteria();
             $c->add(TagrelationPeer::TAG_ID, $singleTag->getId());
             $tagRelations = TagrelationPeer::doSelect($c);
             if ($tagRelations) {
                 $elementsArr = "array(";
                 foreach ($tagRelations as $tagRelation) {
                     $elementsArr .= $tagRelation->getId() . ",";
                 }
                 $content .= "\$_TagRel['" . $singleTag->getTagId() . "'] = " . substr($elementsArr, 0, -1) . ");\n";
             }
         }
         $content .= "\n?>";
         if (FileHelper::writeFile($tagRelationsFile, $content)) {
             BackendService::loadTagsRelations();
         } else {
             echo FileHelper::Log("Unable to write tag cache in: " . $tagRelationsFile, UtilsHelper::MSG_ERROR);
         }
     } catch (Exception $e) {
         echo FileHelper::Log("Unable to refresh tag cache: " . $e->getMessage(), UtilsHelper::MSG_ERROR);
     }
     if (!$manualLock) {
         self::checkTagRelationCache('unlock');
     }
 }
 public static function writeFile($file)
 {
     $supported_image = array('gif', 'jpg', 'jpeg', 'png');
     // get the file extension
     $extension = $file->getClientOriginalExtension();
     // make it lowercase
     $extension = strtolower($extension);
     // check if it is valid
     if (!in_array($extension, $supported_image)) {
         // if is not valid, return an error
         $obj = new stdClass();
         $obj->success = false;
         $obj->error = $extension . " is not an valid image type!";
         return $obj;
     }
     // add extension to name
     $name = FileHelper::generateRandomString(10);
     $name = $name . '.' . $extension;
     // create the file
     $file->move(__DIR__ . '/images', $name);
     // return an success message
     $obj = new stdClass();
     $obj->success = true;
     $obj->message = "Image successfully uploaded!";
     $obj->imagePath = $name;
     return $obj;
 }
Exemplo n.º 4
0
 public function applyTo($path)
 {
     return parent::applyTo($path);
     $pathMap = $this->pathMap;
     if (empty($pathMap)) {
         if (($basePath = $this->getBasePath()) === null) {
             throw new InvalidConfigException('The "basePath" property must be set.');
         }
         $pathMap = [Yii::$app->getBasePath() => [$basePath]];
     }
     $path = FileHelper::normalizePath($path);
     foreach ($pathMap as $from => $tos) {
         $from = FileHelper::normalizePath(Yii::getAlias($from)) . DIRECTORY_SEPARATOR;
         if (strpos($path, $from) === 0) {
             $n = strlen($from);
             foreach ((array) $tos as $to) {
                 $to = FileHelper::normalizePath(Yii::getAlias($to)) . DIRECTORY_SEPARATOR;
                 $file = $to . substr($path, $n);
                 if (is_file($file)) {
                     return $file;
                 }
             }
         }
     }
     return $path;
 }
Exemplo n.º 5
0
 public function build($runData)
 {
     // get current backups
     $site = $runData->getTemp("site");
     $c = new Criteria();
     $c->add("site_id", $site->getSiteId());
     $sb = DB_SiteBackupPeer::instance()->selectOne($c);
     if ($sb) {
         if ($sb->getStatus() == "completed") {
             // get backup file size
             $path = WIKIDOT_ROOT . '/web/files--sites/' . $site->getUnixName() . '/backup/' . $sb->getRand() . '/backup.zip';
             // check if file exists
             if (!file_exists($path)) {
                 // in case something failed
                 DB_SiteBackupPeer::instance()->delete($c);
                 $sb = null;
             } else {
                 $size = filesize($path);
                 $sizeFormatted = FileHelper::formatSize($size);
                 $runData->contextAdd('size', $sizeFormatted);
             }
         }
     }
     $runData->contextAdd("site", $site);
     $runData->contextAdd("backup", $sb);
 }
Exemplo n.º 6
0
 public function actionDownload_client()
 {
     $afterDownload = false;
     if (isset($_POST['download'])) {
         $currentUser = Yii::app()->db->createCommand("SELECT * FROM external_users_usr WHERE id_usr="******"SELECT * FROM external_users_usr WHERE id_usr="******"norman-sampleshare-client-example.zip"');
             header('Content-Transfer-Encoding: binary');
             readfile($tmpPath . 'zip.zip');
             // step 6. clean folder
             unlink($tmpPath . 'sampleshare.inc');
             unlink($tmpPath . 'sampleshare.php');
             unlink($tmpPath . 'zip.zip');
             rmdir($tmpPath);
             unset($_SESSION['password']);
         } else {
             Yii::app()->user->setFlash('_error', 'Wrong password!');
         }
     }
     $this->render('download_client', array('afterDownload' => $afterDownload));
 }
Exemplo n.º 7
0
 /**
  * 管理员上传
  */
 function actionIndex()
 {
     $name = $_REQUEST['field'];
     if (!$name) {
         exit;
     }
     $file = new FileHelper();
     $file->uid = Yii::app()->user->id;
     $file->admin = 1;
     $rt = $file->upload();
     if (!$rt) {
         return;
     }
     $new[] = $rt;
     $out = FileHelper::input($new, $name);
     echo $out;
     exit;
 }
Exemplo n.º 8
0
 /**
  * Populates Source View Model
  * @return Source_Vm
  */
 public function Build()
 {
     $fname = FileHelper::getFilename();
     $data = FileHelper::getFile(Config::$SongDirectory . $fname);
     $viewModel = new Source_Vm();
     $viewModel->PageTitle = 'Song Source for &quot;' . $fname . '&quot; ChordPro (CPM)/UkeGeeks File Format';
     $viewModel->Body = htmlspecialchars($data);
     return $viewModel;
 }
 public function actionPost()
 {
     $model = new PostResumeForm(Yii::app()->user->id);
     //check max job post
     if ($model->getCountUserJobs() < Yii::app()->params['maxResumeJobTitles']) {
         if (isset($_POST['PostResumeForm'])) {
             $model->attributes = $_POST['PostResumeForm'];
             $model->resumeFile = CUploadedFile::getInstance($model, 'resumeFile');
             $model->portfolioFile = CUploadedFile::getInstance($model, 'portfolioFile');
             if ($model->validate()) {
                 //checks the number of job titles submitted are within the limit boundry
                 if (count($model->jobTitles) + $model->getCountUserJobs() > Yii::app()->params['maxResumeJobTitles']) {
                     Yii::app()->user->setFlash('warning', sprintf(Yii::t('app', 'msg.warning.max_job_titles_exceed'), Yii::app()->params['maxResumeJobTitles']));
                     $this->redirect(Yii::app()->createAbsoluteUrl($this->getModule()->returnUrl));
                     Yii::app()->end();
                     return;
                 }
                 $extension = FileHelper::getExtension($model->resumeFile->name);
                 if (!empty($model->portfolioFile->name)) {
                     $extension_PortFolio = FileHelper::getExtension($model->portfolioFile->name);
                 } else {
                     $extension_PortFolio = "";
                 }
                 //saved file name in the following pattern
                 // {user_id}cv{time_stamp_string}.{extension}
                 $fileName = Yii::app()->user->id . 'cv' . Yii::app()->dateFormatter->format('yyyy-MM-dd_H-mm-ss', time()) . '.' . $extension;
                 if (!empty($extension_PortFolio)) {
                     $fileName_PortFolio = Yii::app()->user->id . 'pf' . Yii::app()->dateFormatter->format('yyyy-MM-dd_H-mm-ss', time()) . '.' . $extension_PortFolio;
                 } else {
                     $fileName_PortFolio = "";
                 }
                 if ($model->save(Yii::app()->user->id, $fileName, $fileName_PortFolio)) {
                     //if(!empty($fileName_PortFolio))
                     //{
                     $userFilePath = FileHelper::getFilePath(Yii::getPathOfAlias('site.files') . '/resumes/' . Yii::app()->user->id . '/');
                     $model->resumeFile->saveAs($userFilePath . $fileName);
                     if (!empty($fileName_PortFolio)) {
                         $model->portfolioFile->saveAs($userFilePath . $fileName_PortFolio);
                     }
                     Yii::app()->user->setFlash('success', Yii::t('app', 'msg.success.post_resume'));
                     //}
                 }
                 //checks the number of job titles submitted are within the limit boundry
                 if (count($model->jobTitles) + $model->getCountUserJobs() > Yii::app()->params['maxResumeJobTitles']) {
                     $this->refresh(true);
                 } else {
                     $this->redirect($this->createAbsoluteUrl('index'));
                 }
             }
         }
         $this->render('post', array('model' => $model));
     } else {
         Yii::app()->user->setFlash('warning', sprintf(Yii::t('app', 'msg.warning.max_job_titles_exceed'), Yii::app()->params['maxResumeJobTitles']));
         $this->redirect(Yii::app()->createAbsoluteUrl($this->getModule()->returnUrl));
     }
 }
 public function actionDownload($name, $id)
 {
     if ($name !== null) {
         $userFilePath = Yii::getPathOfAlias('site.files') . '/workshops/' . $id;
         $userFilePath .= "/" . $name;
         if (!FileHelper::outputFile($name, $userFilePath)) {
             throw new CHttpException(404, 'File not found');
         }
     }
 }
 /**
  * Fetches (with curl) a binary or normal file (via http or https) from a remote site as string using HTTPBasicAuth.
  * EXAMPLE: FileHelper::fetchDataBasicAuthentication('http://localhost/bli/bla/blum.xml','username','password');
  * @param string $url of the data to fetch
  * @param string $usr optional username (do not use HTTPBasicAuth if $usr==NULL); default: NULL
  * @param string $pass optional password; default: ''
  * @return string $filename OR FALSE if HTTP_RESPONSE >= 400. If larger than the PHP memory limit the request should crash - this is actually a security feature?
  * @static
  */
 function fetchDataBasicAuthenticationTmpFile($url, $postData = null, $usr = NULL, $pass = '')
 {
     $fn = tempnam("/tmp", "tmpFH");
     $data = FileHelper::fetchDataBasicAuthentication($url, $postData, $usr, $pass);
     if ($data == FALSE) {
         return FALSE;
     }
     file_put_contents($fn, $data);
     return $fn;
 }
Exemplo n.º 12
0
 /**
  * Generate the actual filesystem path for a filekey
  */
 protected function _getRealFilePath($filekey, $createDir = true)
 {
     $filekey = substr(sha1($filekey), 0, 32);
     $path = sprintf('%s/%s/', rtrim($this->_filepath, '/'), substr($filekey, 0, self::STUB_KEY_LENGTH));
     // ensure directory path exists
     if ($createDir && !is_dir($path)) {
         FileHelper::createDirectory($path);
     }
     return $path . $filekey;
 }
Exemplo n.º 13
0
 public static function getFile($fileName, $fileType = 'csv')
 {
     //make sure the file name is unqiue
     $fileName = Yii::$app->getRuntimePath() . '/temp/' . $fileName . '.' . strtolower($fileType);
     $filePath = dirname($fileName);
     if (!is_dir($filePath)) {
         FileHelper::createDirectory($filePath, 0777, true);
     }
     return $fileName;
 }
Exemplo n.º 14
0
 public function testSanitize()
 {
     $this->assertEquals("Mixed_with_English_and", $this->object->sanitize("Mixed with English and 日本人"));
     $this->assertEquals("Mixed_with_English_and_.doc", $this->object->sanitize("Mixed with English and 日本人.doc"));
     $this->assertEquals("Mixed_with_English_and_.", $this->object->sanitize("Mixed with English and 日本人.日本人"));
     $this->assertEquals("903910d73b335d7ef5c78fec3ca36891", $this->object->sanitize("日本人"));
     $this->assertEquals("a4a76883426db812ed7e71efbb9fcea0.doc", $this->object->sanitize("日本人.doc"));
     $this->assertEquals("f491ec23fce87df961290adb8fc8f153", $this->object->sanitize("日本人.日本人"));
 }
 /**
  * Map a database row result to object
  * 
  * @param array $row
  * @return PressReview
  */
 function mapRowToObject($row)
 {
     $pressReview = new PressReview();
     $pressReview->id = $row['id'];
     $pressReview->source = stripslashes($row['sourceInfo']);
     $pressReview->author = stripslashes($row['author']);
     $pressReview->label = stripslashes($row['label']);
     $pressReview->url = stripslashes($row['url']);
     $pressReview->file = $row['filename'];
     $pressReview->date = $row['dateEvent'];
     $pressReview->state = $row['state'];
     //echo "label : ".$row['label'];
     //echo "label : ".stripslashes($row['label']);
     //echo "label : ".$pressReview->label;
     if ($pressReview->file != NULL) {
         $fileHelper = new FileHelper();
         $pressReview->fileType = $fileHelper->getFileType($pressReview->file);
     }
     return $pressReview;
 }
Exemplo n.º 16
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!$this->uploadRootPath) {
         throw new InvalidConfigException('The "savePath" attribute must be set.');
     } else {
         $this->uploadRootPath = rtrim(Yii::getAlias($this->uploadRootPath), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
         if (!file_exists($this->uploadRootPath) && !FileHelper::createDirectory($this->uploadRootPath)) {
             throw new InvalidCallException('Directory specified in "savePath" attribute doesn\'t exist or cannot be created.');
         }
     }
 }
Exemplo n.º 17
0
 public function url_for_parent_directory($entry, $parent_id = null)
 {
     if (is_array($entry)) {
         $entry = reset($entry);
     }
     if (!is_object($entry)) {
         $entry = new DirectoryEntry($entry);
     }
     $parent_id = $parent_id ?: FileHelper::getParentId($entry->id) ?: $this->context_id;
     $parent_page = $this->getPageForIndex($entry->indexInparent());
     return $this->url_for('document/files/index/' . $parent_id . '/' . $parent_page);
 }
Exemplo n.º 18
0
 /**
  * Populates SongList View Model by reading and parsing filenames in the source directory
  * @return SongList_Vm
  */
 public function Build()
 {
     $files = FileHelper::getFilenames(Config::$SongDirectory);
     $viewModel = new SongList_Vm();
     foreach ($files as $filename) {
         // Parse the filename (to make a Title) and create URL.
         $s = preg_replace(Config::FileNamePattern, '$1', $filename);
         $viewModel->Add($this->getTitle($s), Ugs::MakeUri(Actions::Song, $s));
     }
     $viewModel->Sort();
     return $viewModel;
 }
Exemplo n.º 19
0
function image_url($file, $option = array())
{
    $value = serialize($option);
    $id = 'image_fuel' . md5($file . $value);
    $data = cache($id);
    if (!$data) {
        cache($id, $option);
    }
    $name = FileHelper::name($file);
    $ext = FileHelper::ext($file);
    return base_url() . "/imagine/" . $name . "={$id}{$ext}";
}
Exemplo n.º 20
0
Arquivo: Page.php Projeto: kotow/work
 public function getHref($absolute = true)
 {
     $protocol = "http://";
     $server = '';
     if ($absolute) {
         if ($_SERVER['HTTP_HOST']) {
             $host = $_SERVER['HTTP_HOST'];
         } else {
             $website = Document::getDocumentByExclusiveTag("website_website_default");
             if ($website) {
                 $host = $website->getUrl();
             }
         }
         if (!$host) {
             FileHelper::Log("Can not retrieve website URL or HTTP_HOST", UtilsHelper::MSG_ERROR);
         } else {
             if (substr($host, -1) != "/") {
                 $host .= "/";
             }
             if (substr($host, 0, 7) == "http://") {
                 $host = substr($host, 7);
             }
             if (substr($host, 0, 8) == "https://") {
                 $host = substr($host, 8);
             }
         }
         $server = $protocol . $host;
     }
     if ($this->getPageType() == "CONTENT") {
         if ($rewriteUrl = $this->getRewriteUrl()) {
             return $server . $rewriteUrl;
         }
         //			else
         //			{
         //				return "/website/display/pageref/".$this->getId();
         //			}
     } else {
         if ($this->getPageType() == "REFERENCE") {
             $ref = Document::getDocumentInstance($this->getPageId());
             return $ref->getHref($absolute);
         } else {
             if ($this->getPageType() == "EXTERNAL") {
                 return $this->getUrl();
             }
         }
     }
     if ($absolute) {
         return $server . "website/display/pageref/" . $this->getId();
     } else {
         return "/website/display/pageref/" . $this->getId();
     }
 }
Exemplo n.º 21
0
 /**
  *
  * @return \JamesMoss\Flywheel\Repository
  */
 private function getFlywheelRepo($module)
 {
     if (!isset($this->flywheel_config)) {
         $config_dir = \Yii::getAlias($module->flywheel_config);
         if (!file_exists($config_dir)) {
             FileHelper::createDirectory($config_dir);
         }
         $this->flywheel_config = new Config($config_dir);
     }
     if (!isset($this->flywheel_repo)) {
         $this->flywheel_repo = new Repository($module->flywheel_repo, $this->flywheel_config);
     }
     return $this->flywheel_repo;
 }
Exemplo n.º 22
0
 public static function downloadAvatar($fileSource, $fileName = '')
 {
     $fileSystem = new Filesystem();
     $storagePath = SITE_PATH . DS . 'storage';
     $year = date('Y');
     $month = date('m');
     $day = date('d');
     $folderPathDest = $storagePath . DS . $year . '_' . $month . DS . $day . DS . 'source';
     FileHelper::_makeFolder($folderPathDest);
     $ext = explode('.', $fileSource);
     $fileDest = $folderPathDest . DS . $fileName . '.' . $ext[count($ext) - 1];
     $download = FileHelper::_downloadFileCurl($fileSource, $fileDest);
     return $year . '_' . $month . '/' . $day . '/source/' . $fileName . '.' . $ext[count($ext) - 1];
 }
Exemplo n.º 23
0
 public function actionIndex($ajax = null)
 {
     $load = SystemHelper::getLoad();
     $totalspace = disk_total_space(VIREX_STORAGE_PATH);
     $freespace = disk_free_space(VIREX_STORAGE_PATH);
     $slov = new ProgressBar(100, $load, 150);
     $slov->suff = '';
     $slov->doneBg = '#9BB947';
     $duov = new ProgressBar($totalspace, $totalspace - $freespace, 150);
     $duov->suff = '';
     $duov->doneBg = '#9BB947';
     $sysHealth = array(array('id' => 2, 'Property' => 'Operating System', 'Value' => PHP_OS, 'Overview' => ''), array('id' => 3, 'Property' => 'Web server', 'Value' => $_SERVER["SERVER_SOFTWARE"], 'Overview' => ''), array('id' => 4, 'Property' => 'PHP version', 'Value' => PHP_VERSION, 'Overview' => ''), array('id' => 5, 'Property' => 'MySQL version', 'Value' => Yii::app()->db->serverVersion, 'Overview' => ''), array('id' => 1, 'Property' => 'Storage space', 'Value' => FileHelper::formatSize($totalspace - $freespace) . ' / ' . FileHelper::formatSize($totalspace), 'Overview' => $duov->display()), array('id' => 6, 'Property' => 'System load / CPU usage', 'Value' => '', 'Overview' => $slov->display()));
     $this->render('index', array('systemHealth' => new CArrayDataProvider($sysHealth)));
 }
Exemplo n.º 24
0
 /**
  * Gets the meta information for a file element e.g. description
  * 
  * @param string $file_content
  * 
  * @return array
  */
 private function get_file_element_meta($file_content)
 {
     $meta = array();
     $comments = FileHelper::get_file_doc_comments($file_content);
     foreach ($comments as $comment) {
         $comment_lines = explode("\n", $comment);
         foreach ($comment_lines as $comment_line) {
             if (preg_match('/@Description (.*)/', $comment_line, $match)) {
                 $meta['description'] = trim($match[1]);
             }
         }
     }
     return $meta;
 }
 public function actionImageDelete($name)
 {
     $directory = \Yii::getAlias('@frontend/web/img/temp') . DIRECTORY_SEPARATOR . Yii::$app->session->id;
     if (is_file($directory . DIRECTORY_SEPARATOR . $name)) {
         unlink($directory . DIRECTORY_SEPARATOR . $name);
     }
     $files = FileHelper::findFiles($directory);
     $output = [];
     foreach ($files as $file) {
         $path = '/img/temp/' . Yii::$app->session->id . DIRECTORY_SEPARATOR . basename($file);
         $output['files'][] = ['name' => basename($file), 'size' => filesize($file), "url" => $path, "thumbnailUrl" => $path, "deleteUrl" => 'image-delete?name=' . basename($file), "deleteType" => "POST"];
     }
     return Json::encode($output);
 }
Exemplo n.º 26
0
 /**
  * Does not validate values, but does ensure only valid JSON was provided.
  * @method getSettings
  * @return string
  */
 private function getSettings()
 {
     $settings = FileHelper::getFile(Config::$AppDirectory . 'settings.json');
     if ($settings === null) {
         return '{}';
     }
     if (!function_exists('json_decode')) {
         return $settings;
     }
     $json = preg_replace("#(/\\*([^*]|[\r\n]|(\\*+([^*/]|[\r\n])))*\\*+/)|([\\s\t]//.*)|(^//.*)#", '', $settings);
     if (json_decode($json)) {
         return $settings;
     }
     return '{"invalidJson": "There is a problem with your settings: invalid JSON. Please check for typos."}';
 }
 /**
  * Override parent
  */
 function handleFileUpload($fileParameters, $id)
 {
     $filename = NULL;
     if (array_key_exists($this->parameterFile, $_FILES) and array_key_exists('name', $_FILES[$this->parameterFile]) and $_FILES[$this->parameterFile]['name'] != '') {
         $fileHelper = new FileHelper();
         // hack pour pouvoir avoir la catégorie
         $filename = $this->fileBasename;
         /*if (isset($_POST["object_category"])) {
         			$category = $_POST["object_category"];
         			$filename = $category ."_".self::fileBasename;
         		}*/
         $filename = $fileHelper->upload($filename, $id, $_FILES[$this->parameterFile]);
     }
     return $filename;
 }
Exemplo n.º 28
0
 private static function write($meta, $data)
 {
     $root = self::getTmpDir();
     FileHelper::write($root, 'content.xml', $data['content']);
     FileHelper::write($root, 'Revisions/' . $meta['id'] . '/revisions.xml', $data['revisions']);
     FileHelper::write($root, 'Revisions/' . $meta['id'] . '/rev-1-' . $meta['timestamp'] . '.xml', $data['rev']);
     FileHelper::write($root, 'meta.xml', $data['meta']);
     FileHelper::write($root, '/META-INF/manifest.xml', $data['manifest']);
     if (count($data['attachments']) > 0) {
         mkdir($root . 'attachments');
         foreach ($data['attachments'] as $attach) {
             rename($attach['origin'], $root . $attach['filepath']);
         }
     }
     return $root;
 }
Exemplo n.º 29
0
 public function __construct()
 {
     parent::__construct('', XMLHelper::parse('data/data.xml'));
     $this->isDeveloper = true;
     if ($this->data == null) {
         ErrorHelper::logError('Failed to load developer data');
         return;
     }
     $gamedirs = FileHelper::getGames('data');
     foreach ($gamedirs as $gamedir) {
         $this->games[$gamedir] = new Game($gamedir);
     }
     // sorts the games according to the sort_order property
     // if no value is set, zero is assumed
     uasort($this->games, 'Developer::_sort');
 }
Exemplo n.º 30
0
 /**
  * @param ChangeFile $cf
  * @param bool $overwrite
  * @throws Exception
  */
 public function store(Change $cf, $overwrite = true)
 {
     if ($cf->getIssueNumber() == '') {
         throw new Exception('Issue# is empty.');
     }
     if ((int) $cf->getIssueCount() == 0) {
         throw new Exception('Issue Count is empty.');
     }
     $filename = $cf->generateFilename($cf->getIssueNumber(), $cf->getIssueCount());
     if (!$overwrite) {
         if (parent::fileExists($this->getDir(self::FILE_ROOT), $filename)) {
             throw new Exception('Change already exists.');
         }
     }
     parent::save($this->getDir(self::FILE_ROOT), $filename, $cf->stringify());
 }