本文整理汇总了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;
}
示例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' => ''))));
}
示例3: setUp
public function setUp()
{
parent::setUp();
$this->rootDir = ASSETS_PATH . '/AssetAdapterTest';
Filesystem::makeFolder($this->rootDir);
$this->originalServer = $_SERVER;
}
示例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');
}
}
示例5: writeTo
/**
* writeTo
*
* @param string $path
* @return void
*/
public function writeTo($path)
{
Filesystem::makeFolder(dirname($path));
if (is_dir(dirname($path))) {
self::writeImage($path);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
}
示例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));
}
}
示例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';
}
示例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');
}
示例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');
}
示例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;
}
示例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));
}
}