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


PHP Filesystem::makeFolder方法代码示例

本文整理汇总了PHP中Filesystem::makeFolder方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::makeFolder方法的具体用法?PHP Filesystem::makeFolder怎么用?PHP Filesystem::makeFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Filesystem的用法示例。


在下文中一共展示了Filesystem::makeFolder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generatePDF

 function generatePDF()
 {
     // tempfolder
     $tmpBaseFolder = TEMP_FOLDER . '/shopsystem';
     $tmpFolder = project() ? "{$tmpBaseFolder}/" . project() : "{$tmpBaseFolder}/site";
     if (is_dir($tmpFolder)) {
         Filesystem::removeFolder($tmpFolder);
     }
     if (!file_exists($tmpFolder)) {
         Filesystem::makeFolder($tmpFolder);
     }
     $baseFolderName = basename($tmpFolder);
     //Get site
     Requirements::clear();
     $link = Director::absoluteURL($this->pdfLink() . "/?view=1");
     $response = Director::test($link);
     $content = $response->getBody();
     $content = utf8_decode($content);
     $contentfile = "{$tmpFolder}/" . $this->PublicURL . ".html";
     if (!file_exists($contentfile)) {
         // Write to file
         if ($fh = fopen($contentfile, 'w')) {
             fwrite($fh, $content);
             fclose($fh);
         }
     }
     return $contentfile;
 }
开发者ID:pstaender,项目名称:ShopSystem,代码行数:28,代码来源:ShopInvoice.php

示例2: setTemporaryPath

 /**
  * Setup the environment to point to a temporary location
  *
  * @param type $path
  */
 protected function setTemporaryPath($path)
 {
     $this->envPath = $path;
     Filesystem::makeFolder($this->envPath);
     $this->envPath = realpath($this->envPath);
     Injector::inst()->load(array('DNData' => array('properties' => array('EnvironmentDir' => $this->envPath, 'KeyDir' => TEMP_FOLDER . '/deploynaut_test/gitkeys', 'DataTransferDir' => Director::baseFolder() . '/assets/transfers', 'GitUser' => ''))));
 }
开发者ID:ss23,项目名称:deploynaut,代码行数:12,代码来源:DeploynautTest.php

示例3: setUp

 public function setUp()
 {
     parent::setUp();
     $this->rootDir = ASSETS_PATH . '/AssetAdapterTest';
     Filesystem::makeFolder($this->rootDir);
     $this->originalServer = $_SERVER;
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:7,代码来源:AssetAdapterTest.php

示例4: setUp

 public function setUp()
 {
     parent::setUp();
     // Set backend root to /ImageTest
     AssetStoreTest_SpyStore::activate('FileTest');
     // Create a test folders for each of the fixture references
     $folderIDs = $this->allFixtureIDs('Folder');
     foreach ($folderIDs as $folderID) {
         $folder = DataObject::get_by_id('Folder', $folderID);
         $filePath = ASSETS_PATH . '/FileTest/' . $folder->getFilename();
         SS_Filesystem::makeFolder($filePath);
     }
     // Create a test files for each of the fixture references
     $fileIDs = $this->allFixtureIDs('File');
     foreach ($fileIDs as $fileID) {
         $file = DataObject::get_by_id('File', $fileID);
         $root = ASSETS_PATH . '/FileTest/';
         if ($folder = $file->Parent()) {
             $root .= $folder->getFilename();
         }
         $path = $root . substr($file->getHash(), 0, 10) . '/' . basename($file->getFilename());
         SS_Filesystem::makeFolder(dirname($path));
         $fh = fopen($path, "w+");
         fwrite($fh, str_repeat('x', 1000000));
         fclose($fh);
     }
     // Conditional fixture creation in case the 'cms' module is installed
     if (class_exists('ErrorPage')) {
         $page = new ErrorPage(array('Title' => 'Page not Found', 'ErrorCode' => 404));
         $page->write();
         $page->publish('Stage', 'Live');
     }
 }
开发者ID:biggtfish,项目名称:silverstripe-framework,代码行数:33,代码来源:FileTest.php

示例5: writeTo

 /**
  * writeTo
  *
  * @param string $path
  * @return void
  */
 public function writeTo($path)
 {
     Filesystem::makeFolder(dirname($path));
     if (is_dir(dirname($path))) {
         self::writeImage($path);
     }
 }
开发者ID:miamollie,项目名称:echoAerial,代码行数:13,代码来源:ImagickBackend.php

示例6: transform

 /**
  *
  * @param SilverStripeContentItem $item
  * @param type $parentObject
  * @param type $duplicateStrategy
  * @return TransformResult 
  */
 public function transform($item, $parentObject, $duplicateStrategy)
 {
     $newFile = $this->getTypeForFile($item->Name);
     $newFile = new $newFile();
     $folderPath = $parentObject->getRelativePath();
     $parentId = $parentObject ? $parentObject->ID : 0;
     $filter = '"ParentID" = \'' . Convert::raw2sql($parentId) . '\' and "Title" = \'' . Convert::raw2sql($item->Name) . '\'';
     $existing = DataObject::get_one('File', $filter);
     if ($existing && $duplicateStrategy == ExternalContentTransformer::DS_SKIP) {
         // just return the existing children
         return new TransformResult($existing, null);
     } else {
         if ($existing && $duplicateStrategy == ExternalContentTransformer::DS_OVERWRITE) {
             $newFile = $existing;
         }
     }
     $newFile->Name = $item->Name;
     $newFile->RemoteNodeId = $item->getSS_ID();
     $newFile->RemoteSystemId = $item->getSource()->ID;
     $newFile->Title = $item->Title;
     $newFile->ParentID = $parentId;
     $newFile->write();
     $filepath = Director::baseFolder() . '/' . $newFile->Filename;
     Filesystem::makeFolder(dirname($filepath));
     $item->streamContent($filepath);
     return new TransformResult($newFile, null);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-silverstripe-connector,代码行数:34,代码来源:SilverStripeFileImporter.php

示例7: setUp

 public function setUp()
 {
     parent::setUp();
     $this->logInWithPermission('ADMIN');
     Versioned::reading_stage('Stage');
     // Set backend root to /AssetFieldTest
     AssetStoreTest_SpyStore::activate('AssetFieldTest');
     $create = function ($path) {
         Filesystem::makeFolder(dirname($path));
         $fh = fopen($path, "w+");
         fwrite($fh, str_repeat('x', 1000000));
         fclose($fh);
     };
     // Write all DBFile references
     foreach (AssetFieldTest_Object::get() as $object) {
         $path = AssetStoreTest_SpyStore::getLocalPath($object->File);
         $create($path);
     }
     // Create a test files for each of the fixture references
     $files = File::get()->exclude('ClassName', 'Folder');
     foreach ($files as $file) {
         $path = AssetStoreTest_SpyStore::getLocalPath($file);
         $create($path);
     }
 }
开发者ID:assertchris,项目名称:silverstripe-framework,代码行数:25,代码来源:AssetFieldTest.php

示例8: setUp

 public function setUp()
 {
     parent::setUp();
     $this->loginWithPermission('ADMIN');
     // Save versioned state
     $this->oldReadingMode = Versioned::get_reading_mode();
     Versioned::set_stage(Versioned::DRAFT);
     // Set backend root to /UploadFieldTest
     AssetStoreTest_SpyStore::activate('UploadFieldTest');
     // Set the File Name Filter replacements so files have the expected names
     Config::inst()->update('FileNameFilter', 'default_replacements', array('/\\s/' => '-', '/_/' => '-', '/[^A-Za-z0-9+.\\-]+/' => '', '/[\\-]{2,}/' => '-', '/^[\\.\\-_]+/' => ''));
     // Create a test folders for each of the fixture references
     foreach (Folder::get() as $folder) {
         $path = AssetStoreTest_SpyStore::getLocalPath($folder);
         Filesystem::makeFolder($path);
     }
     // Create a test files for each of the fixture references
     $files = File::get()->exclude('ClassName', 'Folder');
     foreach ($files as $file) {
         $path = AssetStoreTest_SpyStore::getLocalPath($file);
         Filesystem::makeFolder(dirname($path));
         $fh = fopen($path, "w+");
         fwrite($fh, str_repeat('x', 1000000));
         fclose($fh);
     }
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:26,代码来源:UploadFieldTest.php

示例9: setUp

 public function setUp()
 {
     if (get_class($this) == "ImageTest") {
         $this->skipTest = true;
     }
     parent::setUp();
     if ($this->skipTest) {
         return;
     }
     // Set backend root to /ImageTest
     AssetStoreTest_SpyStore::activate('ImageTest');
     // Copy test images for each of the fixture references
     $files = File::get()->exclude('ClassName', 'Folder');
     foreach ($files as $image) {
         $filePath = AssetStoreTest_SpyStore::getLocalPath($image);
         // Only correct for test asset store
         $sourcePath = BASE_PATH . '/framework/tests/model/testimages/' . $image->Name;
         if (!file_exists($filePath)) {
             SS_Filesystem::makeFolder(dirname($filePath));
             if (!copy($sourcePath, $filePath)) {
                 user_error('Failed to copy test images', E_USER_ERROR);
             }
         }
     }
 }
开发者ID:XDdesigners,项目名称:silverstripe-framework,代码行数:25,代码来源:ImageTest.php

示例10: onSyncro

 public function onSyncro($properties)
 {
     if (isset($properties->RAW_FILE)) {
         $path = $this->owner->getFullPath();
         Filesystem::makeFolder(dirname($path));
         file_put_contents($path, base64_decode($properties->RAW_FILE));
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-syncrotron,代码行数:8,代码来源:SyncroableFile.php

示例11: setUp

 public function setUp()
 {
     parent::setUp();
     $this->envPath = '/tmp/deploynaut_test/envs';
     Filesystem::makeFolder($this->envPath);
     Config::inst()->update('Injector', 'DNData', array('constructor' => array(0 => $this->envPath, 1 => '/tmp/deploynaut_test/gitkeys', 2 => Director::baseFolder() . '/assets/transfers')));
     parent::setUp();
     $this->project = new DNProject();
     $this->project->Name = 'testproject';
 }
开发者ID:adrexia,项目名称:deploynaut,代码行数:10,代码来源:DNProjectTest.php

示例12: setUp

 function setUp()
 {
     parent::setUp();
     $this->orig['ErrorPage_staticfilepath'] = ErrorPage::get_static_filepath();
     $this->tmpAssetsPath = sprintf('%s/_tmp_assets_%s', TEMP_FOLDER, rand());
     Filesystem::makeFolder($this->tmpAssetsPath . '/ErrorPageTest');
     ErrorPage::set_static_filepath($this->tmpAssetsPath . '/ErrorPageTest');
     $this->orig['Director_environmenttype'] = Director::get_environment_type();
     Director::set_environment_type('live');
 }
开发者ID:rixrix,项目名称:silverstripe-cms,代码行数:10,代码来源:ErrorPageTest.php

示例13: setUp

 public function setUp()
 {
     parent::setUp();
     $this->orig['ErrorPage_staticfilepath'] = ErrorPage::config()->static_filepath;
     $this->tmpAssetsPath = sprintf('%s/_tmp_assets_%s', TEMP_FOLDER, rand());
     Filesystem::makeFolder($this->tmpAssetsPath . '/ErrorPageTest');
     ErrorPage::config()->static_filepath = $this->tmpAssetsPath . '/ErrorPageTest';
     $this->origEnvType = Config::inst()->get('Director', 'environment_type');
     Config::inst()->update('Director', 'environment_type', 'live');
 }
开发者ID:miamollie,项目名称:echoAerial,代码行数:10,代码来源:ErrorPageTest.php

示例14: getJobDir

 /**
  * Gets the path to the queuedjob cache directory
  */
 protected function getJobDir()
 {
     // make sure our temp dir is in place. This is what will be inotify watched
     $jobDir = Config::inst()->get('QueuedJobService', 'cache_dir');
     if ($jobDir[0] != '/') {
         $jobDir = getTempFolder() . '/' . $jobDir;
     }
     if (!is_dir($jobDir)) {
         Filesystem::makeFolder($jobDir);
     }
     return $jobDir;
 }
开发者ID:nyeholt,项目名称:silverstripe-queuedjobs,代码行数:15,代码来源:QueuedJobDescriptor.php

示例15: setUp

 public function setUp()
 {
     parent::setUp();
     AssetStoreTest_SpyStore::activate('SiteTreeHtmlEditorFieldTest');
     $this->logInWithPermission('ADMIN');
     // Write file contents
     $files = File::get()->exclude('ClassName', 'Folder');
     foreach ($files as $file) {
         $destPath = AssetStoreTest_SpyStore::getLocalPath($file);
         Filesystem::makeFolder(dirname($destPath));
         file_put_contents($destPath, str_repeat('x', 1000000));
     }
 }
开发者ID:helpfulrobot,项目名称:comperio-silverstripe-cms,代码行数:13,代码来源:SiteTreeHTMLEditorFieldTest.php


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