action creates missing folders
@author Benjamin Butschell <bb@webprofil.at>
480460
public function createMissingFoldersAction(): void
    {
        if ($this->createMissingFolders()) {
            $this->addFlashMessage(LocalizationUtility::translate('tx_mask.all.createdmissingfolders',
                'mask'));
        }
        $this->redirect('list');
    }
31005
protected function createMissingSitesNode()
    {
        $this->dispatch(self::EVENT_NOTICE, sprintf('Checking for "%s" node ...', SiteService::SITES_ROOT_PATH));
        $rootNode = $this->contextFactory->create()->getRootNode();
        // We fetch the workspace to be sure it's known to the persistence manager and persist all
        // so the workspace and site node are persisted before we import any nodes to it.
        $rootNode->getContext()->getWorkspace();
        $this->persistenceManager->persistAll();
        $sitesNode = $rootNode->getNode(SiteService::SITES_ROOT_PATH);
        if ($sitesNode === null) {
            $taskDescription = sprintf('Create missing site node "<i>%s</i>"', SiteService::SITES_ROOT_PATH);
            $taskClosure = function () use ($rootNode) {
                $rootNode->createNode(NodePaths::getNodeNameFromPath(SiteService::SITES_ROOT_PATH));
                $this->persistenceManager->persistAll();
            };
            $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure);
        }
    }
333717
public function generateFolders()
    {
        foreach ($this->getFolders() as $folder) {
            $path = $this->component->getComponentPath($this->getName()) . '/' . $folder;

            $this->filesystem->makeDirectory($path, 0755, true);

            $this->generateGitKeep($path);
        }
    }
1358390
public function createAction()
    {
        $this->view->disable();
        $msg = "";
        if(!is_dir("upload/banner/")){
            if (!mkdir($this->path, 0777, true)) {
                die('Failed to create folders...');
            }
        }
        if($this->request->hasFiles() !== false) {

            $uploader = new \Uploader\Uploader([
                'directory' =>  "upload/banner/",
                'mimes'     =>  [
                    'image/gif',
                    'image/jpeg',
                    'image/png',
                ],
                'extensions'     =>  [
                    'gif',
                    'jpeg',
                    'jpg',
                    'png',
                ],

                'sanitize' => true,  // escape file & translate to latin
                'hash'     => 'md5'
            ]);

            if($uploader->isValid() === true) {

                $uploader->move();

                $file   = $uploader->getInfo();
                $alert  = "sukses";
                $msg    .= $file[0]['filename']." ";
                $_file  = $file[0]['filename'];
            }
            else {
                $alert  = "error";
                $msg    .= $uploader->getErrors()[0];
                $_file  = " ";
            }
        }
        $banner = new Banner();
        $banner->order          = $this->request->getPost("order");
        $banner->publish        = $this->request->getPost("publish");
        $banner->description    = $this->request->getPost("description");
        $banner->description1   = $this->request->getPost("description1");
        $banner->link           = $this->request->getPost("link");
        $banner->file           = $_file;
        $banner->create_user    = $this->auth->getIdentity()['id'];

        if (!$banner->save()) {
            $alert  = "error";
            foreach ($banner->getMessages() as $message) {
                $msg .= $message." ";
            }
        }else{
            $alert  = "sukses";
            $msg    .= "Banner was created successfully";
        }

        $response = new \Phalcon\Http\Response();
        $response->setContentType('application/json', 'UTF-8');
        $response->setJsonContent(array('_id' => $_file,'alert' => $alert, 'msg' => $msg ));
        return $response->send();
    }
913584
public function folders($folders)
    {
        foreach((array) $folders as $folderPath)
        {
            if (! $this->file->exists($folderPath))
            {
                $this->file->makeDirectory($folderPath);
            }
        }
    }
246877
public function createBackup()
    {
        $this->output->outputLine();

        if ( !file_exists($this->createFilePath([$this->localBackupTarget, 'key'])) ) {
            $this->output->outputLine('<b>You don\'t have a keyfile!</b>');
            $this->output->outputLine();
            $this->output->outputLine('Call \'./flow backup:key\' to to generate it.');
            $this->output->outputLine();
            return;
        }

        $this->output->outputLine('<b>Prepare Backup</b>');
        $this->output->outputLine();

        $this->emitBackupStarted();
        $newVersion = time();

        $stats = array(
            'checked' => 0,
            'added' => 0,
            'updated' => 0,
            'removed' => 0,
        );

        $this->collectSystemSettings();

        $this->dumpDatabase();

        foreach ($this->backupFolders as $folderIndex => $folder) {
            $relativeFolder = $this->getPathByFlowRoot($folder);

            $this->output->outputLine('<b>'.($folderIndex+1).'/'.count($this->backupFolders).' Backup '.$relativeFolder.'</b>');
            $this->output->outputLine();
            $this->output->outputLine('Load Backup Versions..');

            $latestFlatBackup = $this->getFlatBackup($folder);
            $newBackupClean = $this->getBackupActions($folder, $newVersion, $latestFlatBackup);
            $stats['checked'] = $stats['checked'] + count($latestFlatBackup);

            if ( count($newBackupClean)>0 ) {
                // encrypt and create backup..
                $this->files->createDirectoryRecursively($this->createDirectoryPath([$this->localBackupTarget, $newVersion, $relativeFolder]));
                $this->output->outputLine('Backup Files..');
                $this->output->progressStart(count($newBackupClean));
                $i = 0;
                foreach ($newBackupClean as $sha1 => $fileItem) {
                    if ($fileItem['action'] == 'add' || $fileItem['action'] == 'update') {
                        if ($fileItem['action'] == 'add') {
                            $stats['added']++;
                        } else {
                            $stats['updated']++;
                        }

                        $this->cryptService->encryptFileToFile(
                            $this->createFilePath([FLOW_PATH_ROOT, $fileItem['file']]),
                            $this->createFilePath([$this->localBackupTarget, $newVersion, $relativeFolder, $sha1 . '.file']));
                        file_put_contents(
                            $this->createFilePath([$this->localBackupTarget, $newVersion, $relativeFolder, $sha1 . '.meta']),
                            json_encode($fileItem));

                    } else {
                        if ($fileItem['action'] == 'remove') {
                            $stats['removed']++;

                            file_put_contents(
                                $this->createFilePath([$this->localBackupTarget, $newVersion, $relativeFolder, $sha1 . '.meta']),
                                json_encode($fileItem));
                        }
                    }
                    $i++;
                    $this->output->progressSet($i);
                }
                $this->output->progressFinish();
                $this->output->outputLine();
            }
        }

        if ( file_exists($this->createDirectoryPath([$this->localBackupTarget, $newVersion])) ) {
            $this->meta['version'] = $newVersion;
            $now = new \DateTime();
            $this->meta['timestamp'] = $now->getTimestamp();
            $this->meta['stats'] = $stats;
            file_put_contents($this->createFilePath([$this->localBackupTarget, $newVersion, 'info.meta']),
                json_encode($this->meta, JSON_PRETTY_PRINT));
        }

        $this->deleteTempFolders();

        $this->removeOldBackups();

        $this->output->outputLine('<b>Backup Finished</b>');
        $this->output->outputLine(' - Checked: '.$stats['checked']);
        $this->output->outputLine(' - Added:   '.$stats['added']);
        $this->output->outputLine(' - Updated: '.$stats['updated']);
        $this->output->outputLine(' - Removed: '.$stats['removed']);
        $this->output->outputLine();
        $this->emitBackupFinished($this->output, $stats);
        return;
    }
1072887
public function folder() {
		if (!empty($this->params['extensions'])) {
			$this->settings['files'] = Text::tokenize($this->params['extensions']);
		}
		if (!empty($this->params['again'])) {
			$this->settings['againWithHalf'] = true;
		}

		$folder = null;
		if (!empty($this->args)) {
			if (!empty($this->args[0]) && $this->args[0] !== 'app') {
				$folder = $this->args[0];
				if ($folder === '/') {
					$folder = APP;
				}

				$folder = realpath($folder);
				if (!file_exists($folder)) {
					$this->abort('folder not exists: ' . $folder . '');
				}
				$this->_paths[] = $folder;
			} elseif ($this->args[0] === 'app') {
				$this->_paths[] = APP;
			}

			if (!empty($this->params['files'])) {
				$this->settings['files'] = explode(',', $this->params['files']);
			}

			$this->out($folder);
			$this->out('searching...');
			$this->_searchFiles();

			$this->out('found: ' . count($this->_files));
			if (empty($this->params['dry-run'])) {
				if (!$this->params['force']) {
					$continue = $this->in('Modifying files! Continue?', ['y', 'n'], 'n');
					if (mb_strtolower($continue) !== 'y' && mb_strtolower($continue) !== 'yes') {
						$this->abort('...aborted');
					}
				}

				$this->_correctFiles();
				$this->out('DONE');
			}

		} else {
			$this->out('Usage: cake intend folder');
			$this->out('"folder" is then intended recursivly');
			$this->out('default file types are');
			$this->out('[' . implode(', ', $this->settings['files']) . ']');

			$this->out('');
			$this->out('Specify file types manually:');
			$this->out('-files php,js,css');
		}
	}
1078958
private function createFolders() {
        foreach ($this->oMetadata->getSchemas() as $valueSchema) {
            if (!is_dir($this->ormFolder . $valueSchema)) {
                $this->fileFolder->mkdir($this->ormFolder . $this->toCamelCase($valueSchema) . DS . 'Entities');
                $this->fileFolder->mkdir($this->ormFolder . $this->toCamelCase($valueSchema) . DS . 'Tables');
            }
        }
        return $this;
    }
887903
function doInstall(settings, destination) {
  // Create application directories if they don't exist.
  var folders = [
    destination,
    path.join(destination, '/public'),
    path.join(destination, '/extensions')
  ];
  folders.forEach(function(folder) {
    if (!fs.existsSync(folder)) {
      fs.mkdirSync(folder);
    }
  });

  // Create settings.json.
  fs.writeFileSync(path.join(destination, 'settings.json'), JSON.stringify(settings, null, '  '), {flag: 'w'});
}
621639
private void createActions() {
        maximizeAction = new MaximizeAction();
        iconifyAction  = new IconifyAction();
        closeAction    = new CloseAction();
        restoreAction  = new RestoreAction();
        moveAction     = new MoveAction();
        sizeAction     = new SizeAction();
    }
1194911
def folder_create(self, foldername=None, parent_key=None,
                      action_on_duplicate=None, mtime=None):
        
        return self.request('folder/create', QueryParams({
            'foldername': foldername,
            'parent_key': parent_key,
            'action_on_duplicate': action_on_duplicate,
            'mtime': mtime
        }))
1260846
public function createFolder($path)
    {
        $pathinfo = pathinfo($path);

        $parentDir = ($pathinfo['dirname'] != '.') ? $pathinfo['dirname'] : '';
        $url = self::BASE_URI.$this->getFolderUrl($parentDir).'children';

        $folder = new Folder();
        $folder->name = $pathinfo['basename'];

        return $this->getResponse('POST', $url, json_encode($folder), ['Content-Type' => 'application/json']);
    }
206759
public function listAction()
    {
        $this->checkFolders();
        $this->view->assign('missingFolders', $this->missingFolders);
        $this->view->assign('storages', $this->storageRepository->load());
    }
174962
function createDirectory(filenames, next) {
        fs.exists(config.folder, function(exists) {
          if (!exists) {
            fs.mkdir(config.folder, function(err) {
              if (err) {
                next(err);
              } else {
                next(null, filenames);
              }
            });
          } else {
            next(null, filenames);
          }
        });
      }
1312630
public function createCache() {

		if($this->hasCache(TRUE)) {
			return $this->path.self::CACHE_PATH . DIRECTORY_SEPARATOR;
		}

		if(!@mkdir($this->path.self::CACHE_PATH)) {
			throw new FilesystemFolderException(sprintf('Cache folder %s could not be created!', $this->path . self::CACHE_PATH));
		}
		else {
			chmod($this->path.self::CACHE_PATH, 0777);
			return $this->path.self::CACHE_PATH . DIRECTORY_SEPARATOR;
		}

	}
942622
function uploadMissing(missing, request, host, log, fn) {
  var batch = new Batch();

  missing.forEach(function(file) {
    batch.push(uploadFile(file, request, host));
  });

  batch.on('progress', function() {
    log('.');
  });

  batch.end(function(err, res) {
    log(' done\n');
    fn(err, res);
  });
}
1005401
public function build_folder_tree(&$arrFolders, $folder, $delm = '/', $path = '')
    {
        // Handle namespace prefix
        $prefix = '';
        if (!$path) {
            $n_folder = $folder;
            $folder   = $this->storage->mod_folder($folder);

            if ($n_folder != $folder) {
                $prefix = substr($n_folder, 0, -strlen($folder));
            }
        }

        $pos = strpos($folder, $delm);

        if ($pos !== false) {
            $subFolders    = substr($folder, $pos+1);
            $currentFolder = substr($folder, 0, $pos);

            // sometimes folder has a delimiter as the last character
            if (!strlen($subFolders)) {
                $virtual = false;
            }
            else if (!isset($arrFolders[$currentFolder])) {
                $virtual = true;
            }
            else {
                $virtual = $arrFolders[$currentFolder]['virtual'];
            }
        }
        else {
            $subFolders    = false;
            $currentFolder = $folder;
            $virtual       = false;
        }

        $path .= $prefix . $currentFolder;

        if (!isset($arrFolders[$currentFolder])) {
            $arrFolders[$currentFolder] = array(
                'id'      => $path,
                'name'    => rcube_charset::convert($currentFolder, 'UTF7-IMAP'),
                'virtual' => $virtual,
                'folders' => array()
            );
        }
        else {
            $arrFolders[$currentFolder]['virtual'] = $virtual;
        }

        if (strlen($subFolders)) {
            $this->build_folder_tree($arrFolders[$currentFolder]['folders'], $subFolders, $delm, $path.$delm);
        }
    }