本文整理汇总了PHP中Includes\Utils\FileManager::mkdir方法的典型用法代码示例。如果您正苦于以下问题:PHP FileManager::mkdir方法的具体用法?PHP FileManager::mkdir怎么用?PHP FileManager::mkdir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Includes\Utils\FileManager
的用法示例。
在下文中一共展示了FileManager::mkdir方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteAllFiles
/**
* Delete all files
*
* @return void
*/
public function deleteAllFiles()
{
$dir = \Includes\Utils\FileManager::getRealPath(LC_DIR_VAR . $this->getOptions()->dir);
if (!\Includes\Utils\FileManager::isExists($dir)) {
\Includes\Utils\FileManager::mkdir($dir);
}
$list = glob($dir . LC_DS . '*');
if ($list) {
foreach ($list as $path) {
if (is_file($path)) {
\Includes\Utils\FileManager::deleteFile($path);
} else {
\Includes\Utils\FileManager::unlinkRecursive($path);
}
}
}
}
示例2: writeDataToFile
/**
* Write data from request into a file
*
* @param \PEAR2\HTTP\Request\Response $response Response to get data
*
* @return string
*/
protected function writeDataToFile(\PEAR2\HTTP\Request\Response $response)
{
if (!\Includes\Utils\FileManager::isDir(LC_DIR_TMP)) {
\Includes\Utils\FileManager::mkdir(LC_DIR_TMP);
}
if (!\Includes\Utils\FileManager::isDirWriteable(LC_DIR_TMP)) {
\Includes\ErrorHandler::fireError('Directory "' . LC_DIR_TMP . '" is not writeable');
}
$path = \Includes\Utils\FileManager::getUniquePath(LC_DIR_TMP, uniqid() . '.' . \Includes\Utils\PHARManager::getExtension() ?: 'tar');
return isset($response->body) && \Includes\Utils\FileManager::write($path, $response->body) ? $path : null;
}
示例3: initializeWrite
/**
* Initialize write
*
* @return void
*/
protected function initializeWrite()
{
if (!\Includes\Utils\FileManager::isExists(LC_DIR_DATA)) {
\Includes\Utils\FileManager::mkdir(LC_DIR_DATA);
if (!\Includes\Utils\FileManager::isExists(LC_DIR_DATA)) {
\XLite\Logger::getInstance()->log('The directory ' . LC_DIR_DATA . ' can not be created.' . ' Check the permissions to create directories.', LOG_ERR);
}
}
$this->fileIndex = null;
$this->emptyFile = true;
}
示例4: copyResource
/**
* Copy resource
*
* @param \XLite\Model\Base\Storage $storage Storage
* @param string $subdirectory Subdirectory
*
* @return boolean
*/
protected function copyResource(\XLite\Model\Base\Storage $storage, $subdirectory)
{
$dir = LC_DIR_VAR . $this->generator->getOptions()->dir . LC_DS . $subdirectory;
if (!\Includes\Utils\FileManager::isExists($dir)) {
\Includes\Utils\FileManager::mkdir($dir);
}
$name = basename($storage->getPath());
return \Includes\Utils\FileManager::write($dir . LC_DS . $name, $storage->getBody()) ? $subdirectory . LC_DS . $name : false;
}
示例5: download
/**
* Download pack
*
* @param \XLite\Core\Pack\APack $pack Files to pack
* @param boolean $compress Flag OPTIONAL
*
* @return void
*/
protected static function download(\XLite\Core\Pack\APack $pack, $compress = true)
{
if (!\Includes\Utils\FileManager::isDir(LC_DIR_TMP)) {
\Includes\Utils\FileManager::mkdir(LC_DIR_TMP);
}
if (!\Includes\Utils\FileManager::isDirWriteable(LC_DIR_TMP)) {
\Includes\ErrorHandler::fireError('Directory "' . LC_DIR_TMP . '" is not writeable');
}
$path = LC_DIR_TMP . $pack->getName() . '.tar';
$phar = static::pack($path, $pack->getDirectoryIterator(), $pack->getMetadata(), $compress);
header('Content-Type: application/force-download');
header('Content-Disposition: attachment; filename="' . basename($path) . '"');
header('Content-Length: ' . filesize($path));
echo \Includes\Utils\FileManager::read($path);
\Includes\Utils\FileManager::deleteFile($path);
exit(0);
}