Save the last selected filemanager folder in the user settings.

@return boolean
192094
public function actionSaveFilemanagerFolderState()
    {
        $folderId = Yii::$app->request->getBodyParam('folderId');
        
        if ($folderId) {
            return Yii::$app->adminuser->identity->setting->set('filemanagerFolderId', $folderId);
        } else {
            return Yii::$app->adminuser->identity->setting->remove('filemanagerFolderId');
        }
    }
248660
public function save()
    {
        $result = true;

        if (!empty($this->changedData)) {
            foreach ($this->changedData as $scope => $rowData) {
                foreach ($rowData as $layoutName => $layoutData) {
                    if (empty($scope) || empty($layoutName)) {
                        continue;
                    }
                    $layoutPath = $this->getLayoutPath($scope, true);
                    $data = Json::encode($layoutData, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);

                    $result &= $this->getFileManager()->putContents(array($layoutPath, $layoutName.'.json'), $data);
                }
            }
        }

        if ($result == true) {
            $this->clearChanges();
        }

        return (bool) $result;
    }
742524
private function ensureStorage()
    {
        if (!isset($this->storage)) {
            $this->storage = $this->getCache()->get($this->cacheKey);

            if ($this->storage === false) {
                $this->storage = $this->getSettingsStorage()->getBounded($this->settingsStorageKey);
                $this->cache();
            }
        }

        return $this->storage;
    }
998826
function save() {
		$fw=Base::instance();
		if ($this->flag) {
			if (!is_dir($dir=$fw->get('TEMP')))
				mkdir($dir,Base::MODE,TRUE);
			$this->count++;
			$fw->write($dir.'/'.
				$fw->hash($fw->get('ROOT').$fw->get('BASE')).'.'.
				$fw->hash($this->file).'-'.$this->count.'.png',
				$this->dump());
		}
		return $this;
	}
1130563
public function save()
    {

        $ok = $this->getDataConnector()->saveContext($this);
        if ($ok) {
            $this->settingsChanged = false;
        }

        return $ok;

    }
741748
public function save()
    {
        // Update time - now
        $updated = time();

        // Update timestamp
        $this->entries[$this->timestampKey] = $updated;

        // Update timestamp manager
        if ($this->timestampManager) {
            $this->timestampManager->update($updated);
        }

        return (bool) file_put_contents($this->path, json_encode($this->entries));
    }
1300451
public function save()
    {
        $filePath = $this->getRename();
        if (!UploadHelper::getDisk()->exists($filePath)) {
            $type = $this->getMimeType();
            $fileContent = FileHelper::readAndDelete($this->tempName);
            UploadHelper::getDisk()->put($filePath, $fileContent, [
                'visibility' => AdapterInterface::VISIBILITY_PUBLIC
            ]);
            $model = new Attachment([
                'filename' => basename($filePath),
                'original_name' => $this->name,
                'path' => $filePath,
                'size' => $this->size,
                'type' => $type,
            ]);
            if ($model->save()) {
                return $model;
            }
        }
        return false;
    }
1240479
public function save()
    {
        // Grab the directory and create it if needed
        $info = pathinfo($this->fname);
        $dir  = $info['dirname'];

        if (!is_dir($dir)) {
            // dir doesn't exist, make it
          mkdir($dir, 0777, true);
        }


        return file_put_contents($this->fname, json_encode($this->data));
    }
1034338
public function actionFilemanagerMoveFiles()
    {
        $this->checkRouteAccess(self::PERMISSION_ROUTE);
        
        $toFolderId = Yii::$app->request->post('toFolderId', 0);
        $fileIds = Yii::$app->request->post('fileIds', []);
        
        $currentPageId = Yii::$app->request->post('currentPageId', 0);
        $currentFolderId = Yii::$app->request->post('currentFolderId', 0);
        
        $response = Storage::moveFilesToFolder($fileIds, $toFolderId);
        $this->flushApiCache($currentFolderId, $currentPageId);
        $this->flushApiCache($toFolderId, $currentPageId);
        $this->flushHasCache($toFolderId, 0);
        return $response;
    }
28836
public function saveCacheListing()
    {
        if (md5(json_encode($this->cacheListing)) === $this->md5Sum) {
            return false;
        }

        return apc_add('cacheListing', $this->cacheListing);
    }
1018986
public function show_save() {
        foreach($this->settings as $setting) {
            if (empty($setting->nosave)) {
                return true;
            }
        }
        return false;
    }
1017689
private function saveFile()
    {
        $dirMedia = $this->filesystem->getDirectoryWrite(ADirList::MEDIA);
        $dirTarget = $dirMedia->getAbsolutePath(self::MEDIA_SUBFOLDER);
        $fileId = self::FIELDSET . '[' . self::FIELD_CSV_FILE . ']';
//        $fileId = self::FIELD_CSV_FILE;
//        $fileId = self::FIELDSET;
        $uploader = $this->factUploader->create(['fileId' => $fileId]);
        $uploader->setAllowRenameFiles(true);
        $result = $uploader->save($dirTarget);
        if (isset($result['path']) && isset($result['file'])) {
            $fullpath = $result['path'] . $result['file'];
            $this->logger->info("Uploaded file is saved into '$fullpath'.");
        }
        return $result;
    }
972818
protected function saveCurrentVersion()
    {
        // Ensure we re-fetch fresh record from database (in case it was recently renamed / moved)
        $file = File::get()->byID($this->FileID);
        if ($file->ParentID) {
            $base = Controller::join_links(
                $file->Parent()->getFullPath(),
                self::VERSION_FOLDER,
                $this->FileID
            );
        } else {
            $base = Controller::join_links(
                Director::baseFolder(),
                ASSETS_DIR,
                self::VERSION_FOLDER,
                $this->FileID
            );
        }

        Filesystem::makeFolder($base);

        $extension = $file->getExtension();
        $basename  = basename($file->Name, $extension);
        $version   = $this->VersionNumber;

        $cachedPath = Controller::join_links(
            $base, "{$basename}$version.$extension"
        );

        if (!copy($file->getFullPath(), $cachedPath)) {
            throw new Exception(
                "Unable to copy version #$version of file #$this->FileID from:\n \"{$file->getFullPath()}\"\nto:\n\"$cachedPath\""
            );
        }

        return Director::makeRelative($cachedPath);
    }
1275595
public function saveCacheListing()
    {

        if (md5(json_encode($this->cacheListing)) === $this->md5Sum) return false;

        return parent::set('cacheListing', $this->cacheListing);
    }
1351834
public function clear()
    {
        $this->settings = array();
        $this->save($this->path, $this->filename);
        $this->load($this->path, $this->filename);
    }
798580
private function saveData(): bool
    {
        if ($cacheTime = $this->getMeta()->getCache()) {
            return Cache::set(
                $this->key,
                $this->getData(),
                $cacheTime,
                ['system', 'data']
            );
        }
        return false;
    }
1023559
public function getLastModified()
	{
		if (is_null($this->lastModified)) {
			$this->lastModified = new \DateTime('@' . filemtime($this->path));
		}
		return $this->lastModified;
	}