当前位置: 首页>>代码示例>>PHP>>正文


PHP Filesystem::createDir方法代码示例

本文整理汇总了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;
 }
开发者ID:denoll,项目名称:yii2-file-storage,代码行数:34,代码来源:WebDAVFlysystemBuilder.php

示例2: system

 public function system()
 {
     $adapter = new Local(__DIR__ . '/../../storage/');
     $filesystem = new Filesystem($adapter);
     $filesystem->createDir($this->getZipName());
     return $filesystem;
 }
开发者ID:mnking,项目名称:download-facebook-allbum-photos,代码行数:7,代码来源:GetPage.php

示例3: mkdir

 /**
  * {@inheritdoc}
  */
 public function mkdir($path)
 {
     if ($this->file_exists($path)) {
         return false;
     }
     return $this->flysystem->createDir($this->buildPath($path));
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:10,代码来源:Flysystem.php

示例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);
 }
开发者ID:ValentinGot,项目名称:trakt-api-wrapper,代码行数:12,代码来源:EndpointGenerator.php

示例5: _mkdir

 /**
  * @inheritdoc
  */
 protected function _mkdir($path, $name)
 {
     $path = $this->_joinPath($path, $name);
     if ($this->fs->createDir($path)) {
         return $path;
     }
     return false;
 }
开发者ID:manyoubaby123,项目名称:imshop,代码行数:11,代码来源:FlysystemDriver.php

示例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;
 }
开发者ID:petrknap,项目名称:php-filestorage,代码行数:12,代码来源:FileSystem.php

示例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");
     }
 }
开发者ID:JayBizzle,项目名称:mysqldumper,代码行数:9,代码来源:MySQLDumperCommand.php

示例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';
 }
开发者ID:ardeelete,项目名称:FileRequester,代码行数:12,代码来源:HomeController.php

示例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);
 }
开发者ID:rajeshpillai,项目名称:dfe-common,代码行数:30,代码来源:Archivist.php

示例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';
     }
 }
开发者ID:iris-it,项目名称:irispass-webapp-laravel,代码行数:12,代码来源:CrmService.php

示例11: testCreateDir

 public function testCreateDir()
 {
     $this->prophecy->createDir('dirname', $this->config)->willReturn(['path' => 'dirname', 'type' => 'dir']);
     $output = $this->filesystem->createDir('dirname');
     $this->assertTrue($output);
 }
开发者ID:mechiko,项目名称:staff-october,代码行数:6,代码来源:FilesystemTests.php

示例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);
//.........这里部分代码省略.........
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:101,代码来源:ExportVocab.php

示例13: createFolderIfNotExists

 /**
  * Create folder if not exists.
  *
  * @param $folder
  */
 public function createFolderIfNotExists($folder)
 {
     if ($this->system->has($folder) === false) {
         $this->system->createDir($folder);
     }
 }
开发者ID:HarryBosh,项目名称:laracasts-downloader,代码行数:11,代码来源:Controller.php

示例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;
 }
开发者ID:ramcda,项目名称:files-module,代码行数:16,代码来源:AdapterFilesystem.php

示例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);
 }
开发者ID:da-vinci-studio,项目名称:file-bundle,代码行数:12,代码来源:Local.php


注:本文中的League\Flysystem\Filesystem::createDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。