本文整理汇总了PHP中League\Flysystem\Filesystem::createDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::createDir方法的具体用法?PHP Filesystem::createDir怎么用?PHP Filesystem::createDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类League\Flysystem\Filesystem
的用法示例。
在下文中一共展示了Filesystem::createDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build
public function build()
{
\yii\base\Event::on(\denoll\filekit\Storage::className(), \denoll\filekit\Storage::EVENT_BEFORE_SAVE, function ($event) {
/** @var \denoll\filekit\Storage $storage */
$storage = $event->sender;
if (!$storage->getFilesystem()->has('.dirindex')) {
$storage->getFilesystem()->write('.dirindex', 1);
$dirindex = 1;
} else {
$dirindex = $storage->getFilesystem()->read('.dirindex');
}
if ($storage->maxDirFiles !== -1) {
if ($storage->getFilesystem()->has($dirindex)) {
$filesCount = count($storage->getFilesystem()->listContents($dirindex));
if ($filesCount > $storage->maxDirFiles) {
$dirindex++;
$storage->getFilesystem()->createDir($dirindex);
}
} else {
$storage->getFilesystem()->createDir($dirindex);
}
}
});
$client = new \Sabre\DAV\Client(['baseUri' => 'https://webdav.yandex.ru']);
$client->addCurlSetting(CURLOPT_SSL_VERIFYPEER, false);
$client->addCurlSetting(CURLOPT_HTTPHEADER, ['Authorization: OAuth TOKENTOKENTOKEN', 'Accept: */*', 'Host: webdav.yandex.ru']);
$adapter = new WebDAVAdapter($client, '/');
$flysystem = new Filesystem($adapter);
if (!$flysystem->has($this->pathPrefix)) {
$flysystem->createDir($this->pathPrefix);
}
$adapter->setPathPrefix($this->pathPrefix);
return $flysystem;
}
示例2: system
public function system()
{
$adapter = new Local(__DIR__ . '/../../storage/');
$filesystem = new Filesystem($adapter);
$filesystem->createDir($this->getZipName());
return $filesystem;
}
示例3: mkdir
/**
* {@inheritdoc}
*/
public function mkdir($path)
{
if ($this->file_exists($path)) {
return false;
}
return $this->flysystem->createDir($this->buildPath($path));
}
示例4: handleDirectory
/**
* @param $properties
* @param $content
*/
private function handleDirectory(Collection $properties, $content)
{
$properties->push($content['filename']);
$this->filesystem->createDir('Api/' . $this->endpoint->first());
$generator = new EndpointGenerator($this->inputInterface, $this->out, $this->dialogHelper);
$endpoint = str_replace("Request/", "", $content['path']);
$generator->generateForEndpoint($endpoint);
}
示例5: _mkdir
/**
* @inheritdoc
*/
protected function _mkdir($path, $name)
{
$path = $this->_joinPath($path, $name);
if ($this->fs->createDir($path)) {
return $path;
}
return false;
}
示例6: createDir
/**
* @inheritdoc
*/
public function createDir($dirname, array $config = [])
{
$innerDirname = $this->getInnerPath($dirname);
$return = $this->fileSystem->createDir($innerDirname, $config);
if ($return !== false) {
$this->invokePlugin("addPathToIndex", [$dirname, $innerDirname], $this);
}
return $return;
}
示例7: createArchiveFolder
public function createArchiveFolder()
{
// Set the name of the dated archive folder
$this->archive_folder = date('YmdHi');
// Create the output folder
if (!$this->localAdapter->createDir($this->relativeDumpPath())) {
throw \Exception("Couldn't create folder");
}
}
示例8: index
public function index()
{
$accessToken = 'Z8PuqT2g6U0AAAAAAAAACVpHcg95JybQkwwVJ6-Qj3L0zoxAcPcXqDZG5RW7aynW';
$appSecret = 'fsd52oajpnywijp';
$client = new Client($accessToken, $appSecret);
$adapter = new DropboxAdapter($client);
$filesystem = new Filesystem($adapter);
//$file = $filesystem->get('hello.txt');
$filesystem->createDir('/classrequests');
//$token->get('');
return 'success';
}
示例9: archiveTree
/**
* @param Filesystem $source The source file system to archive
* @param string $archiveFile The name of the archive/zip file. Extension is optional, allowing me to decide
*
* @return bool|string If successful, the actual file name (without a path) is return. False otherwise
*/
protected static function archiveTree(Filesystem $source, $archiveFile)
{
// Add file extension if missing
$archiveFile = static::ensureFileSuffix('.zip', $archiveFile);
// Create our zip container
$_archive = new Filesystem(new ZipArchiveAdapter($archiveFile));
try {
foreach ($source->listContents('', true) as $_file) {
if ('dir' == $_file['type']) {
$_archive->createDir($_file['path']);
} elseif ('link' == $_file['type']) {
$_archive->put($_file['path'], $_file['target']);
} elseif ('file' == $_file['type']) {
file_exists($_file['path']) && static::writeStream($_archive, $_file['path'], $_file['path']);
}
}
} catch (\Exception $_ex) {
\Log::error('Exception exporting instance storage: ' . $_ex->getMessage());
return false;
}
// Force-close the zip
static::flushZipArchive($_archive);
return basename($archiveFile);
}
示例10: reactivate
public function reactivate($identifier)
{
$adapter = new Local('/var/www/crm_container');
$filesystem = new Filesystem($adapter);
$filesystem->createDir('disabled');
if ($this->checkExistance($identifier) === true) {
exec('mv /var/www/crm_container/disabled/' . $identifier . ' /var/www/crm_container/');
return true;
} else {
return 'error';
}
}
示例11: testCreateDir
public function testCreateDir()
{
$this->prophecy->createDir('dirname', $this->config)->willReturn(['path' => 'dirname', 'type' => 'dir']);
$output = $this->filesystem->createDir('dirname');
$this->assertTrue($output);
}
示例12: write
public function write()
{
$adapter = new Adapter("/");
$filesystem = new Filesystem($adapter);
if ( ! $filesystem->has($this->path)) {
$filesystem->createDir($this->path);
}
$filename = $this->path . $this->getFileName();
$writer = new CsvWriter( "," );
$writer->setStream( fopen( $filename, 'w' ) );
$header = $this->getPrologHeader();
if ($this->includeProlog) {
$header[ 1 ][ 0 ] = 'uri';
ksort($header[1]);
$header[ 2 ][ 0 ] = 'lang';
$header[ 2 ][ 1 ] = $this->getSchema()->getLanguage(); //default language
ksort($header[2]);
$header[ 3 ][ 0 ] = 'type';
$header[ 3 ][ 1 ] = 'uri'; //default type
ksort($header[3]);
}
foreach ( $header as $line )
{
$writer->writeItem( $line );
}
if ($this->includeProlog) {
$metadata = $this->getMetadata();
foreach ($metadata as $line) {
$writer->writeItem($line);
}
$prefixRows = $this->getPrefixRows();
foreach ($prefixRows as $line) {
$writer->writeItem($line);
}
}
//get the data
if ( $this->populate )
{
$prefixes = $this->getPrefixes();
$prefixPattern = array();
$prefixReplacement = array();
foreach ( $prefixes as $prefix => $namespace )
{
if (trim($prefix)) {
if ( ! is_int($prefix)) {
$prefixPattern[] = "|" . $namespace . "|";
$prefixReplacement[] = $prefix . ":";
}
}
}
$map = $this->getHeaderMap();
$c = new \Criteria();
$c->clearSelectColumns();
if ('schema' === $this->type) {
$c->addSelectColumn(\SchemaPropertyPeer::ID);
$c->add(\SchemaPropertyPeer::SCHEMA_ID, $this->schema->getId());
if ($this->excludeDeprecated) {
$c->add(\SchemaPropertyPeer::STATUS_ID, 8, \Criteria::NOT_EQUAL);
}
$c->addAscendingOrderByColumn(\SchemaPropertyPeer::URI);
$properties = \SchemaPropertyPeer::doSelectRS($c);
} else {
$c->addSelectColumn(\ConceptPeer::ID);
$c->addSelectColumn(\ConceptPeer::URI);
$c->addSelectColumn(\ConceptPeer::STATUS_ID);
$c->add(\ConceptPeer::VOCABULARY_ID, $this->schema->getId());
if ($this->excludeDeprecated) {
$c->add(\ConceptPeer::STATUS_ID, 8, \Criteria::NOT_EQUAL);
}
$c->addAscendingOrderByColumn(\ConceptPeer::URI);
$properties = \ConceptPeer::doSelectRS($c);
}
foreach ( $properties as $property )
{
$line = array_fill( 0, $this->getHeaderCount(), '' );
$line[0] = $property[0];
$map = $this->getHeaderMap();
$ce = new \Criteria();
if ('schema' === $this->type) {
$ce->add(\BaseSchemaPropertyElementPeer::SCHEMA_PROPERTY_ID, $property[0]);
if (!$this->includeDeleted) {
$ce->add(\BaseSchemaPropertyElementPeer::DELETED_AT, null);
}
if ($this->includeDeleted) {
$ce->addAscendingOrderByColumn(\SchemaPropertyElementPeer::UPDATED_AT);
}
$elements = \SchemaPropertyElementPeer::doSelectJoinProfileProperty($ce);
} else {
$ce->add(\ConceptPropertyPeer::CONCEPT_ID, $property[0]);
if (!$this->includeDeleted) {
$ce->add(\ConceptPropertyPeer::DELETED_AT, null);
//.........这里部分代码省略.........
示例13: createFolderIfNotExists
/**
* Create folder if not exists.
*
* @param $folder
*/
public function createFolderIfNotExists($folder)
{
if ($this->system->has($folder) === false) {
$this->system->createDir($folder);
}
}
示例14: createDir
/**
* Create a directory.
*
* @param string $dirname The name of the new directory.
* @param array $config An optional configuration array.
*
* @return bool True on success, false on failure.
*/
public function createDir($dirname, array $config = [])
{
$result = parent::createDir($dirname, $config);
if ($result && ($resource = $this->get($dirname))) {
return $this->dispatch(new SyncFolder($resource));
}
return $result;
}
示例15: createDir
/**
* Create a directory.
*
* @param string $dirname The name of the new directory.
* @param array $config An optional configuration array.
*
* @return bool True on success, false on failure.
*/
public function createDir($dirname, array $config = [])
{
return $this->filesystem->createDir($dirname, $config);
}