method save documentation in bbn\Appui\Ide

Saves a file.

function(array $file) { if (empty($file['full_path'])) { throw new \Exception(X::_("No file given to save")); } $file['full_path'] = str_replace('/_end_', '', $file['full_path']); if ($this->_set_current_file($this->decipherPath($file['full_path']))) { /*if ( $this->getOrigin() !== 'appui-ide' ){ die(var_dump(self::$current_file, self::$current_id)); }*/ // Delete the file if code is empty and if it isn't a super controller if (empty($file['code']) && ($file['tab'] !== '_ctrl')) { if (@unlink(self::$current_file)) { if ($file['extension'] === 'ts') { @unlink(substr(self::$current_file, 0, -2) . 'js'); } //temporaney if ($this->getOrigin() !== 'appui-ide') { // Remove permissions $this->deletePerm(); } if (!empty(self::$current_id)) { // Remove ide backups ad file preference $this->_backup_history($file, 'delete'); } return ['deleted' => true]; } } //in case of file create or modify history and if exists file prference modify if ($this->fs->isFile(self::$current_file)) { $this->_backup_history($file, 'create'); $this->_backup_preference_files($file, $file['state'], 'change'); } elseif (!$this->fs->isDir(X::dirname(self::$current_file))) { $this->fs->createPath(X::dirname(self::$current_file)); } if (!empty($file['tab']) && ($file['tab'] === 'php') && !$this->fs->isFile(self::$current_file)) { if (!$this->createPermByReal($file['full_path'])) { return $this->error(X::_("Impossible to create the option")); } } if (!file_put_contents(self::$current_file, $file['code'])) { return $this->error(X::_('Error: Save')); } if ($file['extension'] === 'ts') { $cmd = "tsc -t 'ES2015' "; if (!defined('BBN_IS_DEV') || !BBN_IS_DEV) { $cmd .= '--removeComments '; } $error = shell_exec($cmd . escapeshellcmd(self::$current_file)); if ($error) { return ['success' => true, 'error' => $error]; } } return ['success' => true]; } return $this->error(X::_('Error: Save')); }

Saves a file. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.