本文整理汇总了PHP中Includes\Utils\FileManager::mkdirRecursive方法的典型用法代码示例。如果您正苦于以下问题:PHP FileManager::mkdirRecursive方法的具体用法?PHP FileManager::mkdirRecursive怎么用?PHP FileManager::mkdirRecursive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Includes\Utils\FileManager
的用法示例。
在下文中一共展示了FileManager::mkdirRecursive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStoreFileSystemRoot
/**
* Get valid file system storage root
*
* @return string
*/
protected function getStoreFileSystemRoot()
{
$shipments = $this->getLink()->getManifest()->getShipments();
$path = parent::getStoreFileSystemRoot() . $shipments[0]->getParcel()->getOrder()->getOrderId() . LC_DS;
\Includes\Utils\FileManager::mkdirRecursive($path);
return $path;
}
示例2: executeHookHandler
/**
* Execute certain hook handle
*
* @return void
*/
public function executeHookHandler()
{
if (!$this->areProxiesExist()) {
// Create the proxies folder
\Includes\Utils\FileManager::mkdirRecursive(LC_DIR_CACHE_PROXY);
// Create model proxy classes (second step of cache generation)
\Includes\Decorator\Plugin\Doctrine\Utils\EntityManager::generateProxies();
}
}
示例3: __construct
/**
* Constructor
* Creates directory for locks if needed
*/
public function __construct()
{
if (!\Includes\Utils\FileManager::isExists(rtrim(static::LOCK_DIR, LC_DS))) {
\Includes\Utils\FileManager::mkdirRecursive(rtrim(static::LOCK_DIR, LC_DS));
}
if (!\Includes\Utils\FileManager::isReadable(static::LOCK_DIR) || !\Includes\Utils\FileManager::isWriteable(static::LOCK_DIR)) {
\XLite\Logger::getInstance()->log('Cannot create lock for keys', LOG_DEBUG);
}
parent::__construct();
}
示例4: setPath
/**
* Set cache path
*
* @param string $path Path
*
* @return void
*/
public function setPath($path)
{
if (is_string($path)) {
if (!file_exists($path)) {
\Includes\Utils\FileManager::mkdirRecursive($path);
}
if (file_exists($path) && is_dir($path)) {
$this->path = $path;
}
}
}
示例5: updateCustomImages
/**
* Update custom images
*
* @return void
*/
protected function updateCustomImages()
{
$dir = \XLite\Module\XC\ThemeTweaker\Main::getThemeDir() . 'images' . LC_DS;
if ($_FILES && $_FILES['new_images'] && $_FILES['new_images']['name']) {
if (!\Includes\Utils\FileManager::isExists($dir)) {
\Includes\Utils\FileManager::mkdirRecursive($dir);
}
if (\Includes\Utils\FileManager::isDirWriteable($dir)) {
foreach ($_FILES['new_images']['name'] as $i => $data) {
\Includes\Utils\FileManager::moveUploadedFileByMultiple('new_images', $i, $dir);
}
} else {
\XLite\Core\TopMessage::addError('The directory {{dir}} does not exist or is not writable.', array('dir' => $dir));
}
}
$delete = \XLite\Core\Request::getInstance()->delete;
if ($delete && is_array($delete)) {
foreach ($delete as $file => $del) {
if ($del) {
\Includes\Utils\FileManager::deleteFile($dir . $file);
}
}
}
}
示例6: define
define('LC_CUSTOMER_AREA_SKIN', LC_DIR_SKINS . 'default' . LC_DS . 'en' . LC_DS);
define('LC_ADMIN_AREA_SKIN', LC_DIR_SKINS . 'admin' . LC_DS . 'en' . LC_DS);
// Images subsystem settings
define('LC_IMAGES_URL', 'images');
define('LC_IMAGES_CACHE_URL', LC_VAR_URL . '/images');
// Files
define('LC_FILES_URL', 'files');
define('LC_HORN', 'Ly93d3cueC1jYXJ0LmNvbS9pbWc');
// OS
define('LC_OS_NAME', preg_replace('/^([^ ]+)/', '\\1', PHP_OS));
define('LC_OS_CODE', strtolower(substr(LC_OS_NAME, 0, 3)));
define('LC_OS_IS_WIN', LC_OS_CODE === 'win');
// Session type
define('LC_SESSION_TYPE', 'Sql');
set_include_path(get_include_path() . PATH_SEPARATOR . LC_DIR_LIB);
// Some common functions
require_once LC_DIR_ROOT . 'Includes' . LC_DS . 'functions.php';
// Common error reporting settings
$path = LC_DIR_LOG . 'php_errors.log.' . date('Y-m-d') . '.php';
if (!file_exists(dirname($path)) && is_writable(LC_DIR_VAR)) {
\Includes\Utils\FileManager::mkdirRecursive(dirname($path));
}
if ((!file_exists($path) || 16 > filesize($path)) && is_writable(dirname($path))) {
file_put_contents($path, '<' . '?php die(1); ?' . '>' . "\n");
ini_set('error_log', $path);
}
ini_set('log_errors', true);
ini_set("auto_detect_line_endings", true);
unset($path);
// Set default memory limit
func_set_memory_limit('128M');
示例7: checkLogSecurityHeader
/**
* Check security header for specified file
*
* @param string $path File path
*
* @return void
*/
protected function checkLogSecurityHeader($path)
{
if (!file_exists(dirname($path))) {
\Includes\Utils\FileManager::mkdirRecursive(dirname($path));
}
if (!file_exists($path) || $this->securityHeader > filesize($path)) {
file_put_contents($path, $this->securityHeader . "\n");
}
}
示例8: doActionImport
/**
* Import action
*
* @return void
*/
protected function doActionImport()
{
foreach (\XLite\Logic\Import\Importer::getImportOptionsList() as $key) {
\XLite\Core\Database::getRepo('XLite\\Model\\Config')->createOption(array('category' => 'Import', 'name' => $key, 'value' => isset(\XLite\Core\Request::getInstance()->options[$key]) ? \XLite\Core\Request::getInstance()->options[$key] : false));
}
\XLite\Core\Config::updateInstance();
$dirTo = LC_DIR_VAR . \XLite\Logic\Import\Importer::getImportDir();
if (!\Includes\Utils\FileManager::isExists($dirTo)) {
\Includes\Utils\FileManager::mkdirRecursive($dirTo);
}
$filesToImport = array();
if ($_FILES && isset($_FILES['files']) && $_FILES['files']['name'] && $_FILES['files']['name'][0] && \Includes\Utils\FileManager::isDirWriteable($dirTo)) {
$list = glob($dirTo . LC_DS . '*');
if ($list) {
foreach ($list as $path) {
if (is_file($path)) {
\Includes\Utils\FileManager::deleteFile($path);
}
}
}
$files = $_FILES['files'];
foreach ($files['name'] as $key => $name) {
$path = null;
if ($name && UPLOAD_ERR_OK === $files['error'][$key]) {
$path = \Includes\Utils\FileManager::getUniquePath($dirTo, $name ?: $files['name'][$key]);
if (move_uploaded_file($files['tmp_name'][$key], $path)) {
if (\XLite\Core\Archive::getInstance()->isArchive($path) || 'csv' == substr(strrchr($path, '.'), 1)) {
$filesToImport[] = $path;
} else {
\XLite\Core\TopMessage::addError('The "{{file}}" is not CSV or archive', array('file' => $name));
\Includes\Utils\FileManager::deleteFile($path);
}
} else {
$path = null;
}
}
if (!$path) {
\XLite\Core\TopMessage::addError('The "{{file}}" file was not uploaded', array('file' => $name));
}
}
}
if ($filesToImport) {
\XLite\Logic\Import\Importer::run(\XLite\Logic\Import\Importer::assembleImportOptions() + array('files' => $filesToImport));
}
}
示例9: die
// For module XC\MultiVendor
$auth = \XLite\Core\Auth::getInstance();
if (!$auth->isAdmin()) {
die('forbidden');
} elseif (method_exists($auth, 'isVendor') && $auth->isVendor()) {
$vendor = 'vendor_' . $auth->getProfile()->getProfileId();
$upload_dir = 'filemanager' . LC_DS . 'uploads' . LC_DS . $vendor;
// path from the base_url to the uploads folder
$thumbs_dir = 'filemanager' . LC_DS . 'thumbs' . LC_DS . $vendor;
// path from the base_url to thumbs folder
}
if (!is_dir($root . $upload_dir)) {
\Includes\Utils\FileManager::mkdirRecursive($root . $upload_dir);
}
if (!is_dir($root . $thumbs_dir)) {
\Includes\Utils\FileManager::mkdirRecursive($root . $thumbs_dir);
}
$MaxSizeUpload = 1000;
//Mb
//**********************
//Image config
//**********************
//set max width pixel or the max height pixel for all images
//If you set dimension limit, automatically the images that exceed this limit are convert to limit, instead
//if the images are lower the dimension is maintained
//if you don't have limit set both to 0
$image_max_width = 0;
$image_max_height = 0;
//Automatic resizing //
//If you set true $image_resizing the script convert all images uploaded to image_width x image_height resolution
//If you set width or height to 0 the script calcolate automatically the other size
示例10: prepareImageData
/**
* Additional preparations for images.
* Upload them into specific directory
*
* @param string $optionValue Option value
* @param string $imageType Image type
*
* @return string
*/
protected function prepareImageData($optionValue, $imageType)
{
$dir = static::getLogoFaviconDir();
if ($_FILES && $_FILES[$imageType] && $_FILES[$imageType]['name']) {
$path = null;
$realName = preg_replace('/([^a-zA-Z0-9_\\-\\.]+)/', '_', $_FILES[$imageType]['name']);
if ($this->isImage($_FILES[$imageType]['tmp_name'], $realName)) {
if (!\Includes\Utils\FileManager::isDir($dir)) {
\Includes\Utils\FileManager::mkdirRecursive($dir);
}
if (\Includes\Utils\FileManager::isDir($dir)) {
// Remove file with same name as uploaded file in the destination directory
\Includes\Utils\FileManager::deleteFile($dir . LC_DS . ('favicon' === $imageType ? static::FAVICON : $realName));
// Move uploaded file to destination directory
$path = \Includes\Utils\FileManager::moveUploadedFile($imageType, $dir, 'favicon' === $imageType ? static::FAVICON : $realName);
if ($path) {
if ($optionValue && 'favicon' !== $imageType && basename($optionValue) != $realName) {
// Remove old image file
\Includes\Utils\FileManager::deleteFile($dir . basename($optionValue));
}
$optionValue = static::getLogoFaviconSubDir() . basename($path);
}
}
if (!isset($path)) {
$this->logoFaviconValidation = false;
\XLite\Core\TopMessage::addError('The "{{file}}" file was not uploaded', array('file' => $realName));
}
} else {
$this->logoFaviconValidation = false;
\XLite\Core\TopMessage::addError('The "{{file}}" file is not allowed image and was not uploaded. Allowed images are: {{extensions}}', array('file' => $realName, 'extensions' => implode(', ', $this->getImageExtensions())));
}
} elseif (\XLite\Core\Request::getInstance()->useDefaultImage[$imageType]) {
if ($optionValue) {
\Includes\Utils\FileManager::deleteFile($dir . basename($optionValue));
}
$optionValue = '';
}
return $optionValue;
}
示例11: func_unlock
function func_unlock($lockname)
{
global $_lock_hash;
$options = \Includes\Utils\ConfigParser::getOptions();
if (empty($lockname) || empty($_lock_hash[$lockname])) {
return false;
}
$lockDir = $options["decorator_details"]["lockDir"];
// remove last '/'
if ($lockDir[strlen($lockDir) - 1] == '/') {
$lockDir = substr($lockDir, 0, strlen($lockDir) - 1);
}
if (!is_dir($lockDir)) {
\Includes\Utils\FileManager::mkdirRecursive($lockDir);
}
$fname = $lockDir . "/" . $lockname . ".lock";
if (!file_exists($fname)) {
return false;
}
$fp = fopen($fname, "r");
if (!$fp) {
return false;
}
$tmp = fread($fp, 43);
fclose($fp);
$file_id = substr($tmp, 0, 32);
$file_time = (int) substr($tmp, 32);
if ($file_id == $_lock_hash[$lockname]) {
@unlink($fname);
}
unset($_lock_hash[$lockname]);
return true;
}
示例12: checkPermissions
/**
* Check directory permissions and try to correct them
*
* @param string $dir Path to check
*
* @return void
*/
protected static function checkPermissions($dir)
{
\Includes\Utils\FileManager::mkdirRecursive($dir);
if (!\Includes\Utils\FileManager::isDirWriteable($dir)) {
@\Includes\Utils\FileManager::chmod($dir, static::getDirDefaultPermissions($dir));
if (!\Includes\Utils\FileManager::isDirWriteable($dir)) {
static::fireDirPermissionsError($dir);
}
}
}
示例13: doMakeBackup
/**
* Make backup
*
* @return void
* @see ____func_see____
* @since 1.0.11
*/
protected function doMakeBackup($path)
{
ob_start();
xlite_make_sql_backup($path);
ob_end_clean();
\Includes\Utils\FileManager::unlinkRecursive(LC_DIR . '/../.dev/tests/images');
\Includes\Utils\FileManager::mkdirRecursive(LC_DIR . '/../.dev/tests/images');
\Includes\Utils\FileManager::copyRecursive(LC_DIR_IMAGES, LC_DIR . '/../.dev/tests/images/');
}
示例14: macro_file_put_contents
/**
* Safe write to file
*
* @param string $path Path
* @param string $data File content
*
* @return void
* @see ____func_see____
* @since 1.0.18
*/
function macro_file_put_contents($path, $data)
{
if (!\Includes\Utils\FileManager::mkdirRecursive(dirname($path))) {
macro_error('Directory \'' . $path . '\' write-protected!');
}
if (!@file_put_contents($path, $data)) {
macro_error('File \'' . $path . '\' write-protected!');
}
}
示例15: isDirExists
/**
* isDirExists
*
* @return boolean
*/
protected function isDirExists()
{
$result = is_dir(LC_DIR_BACKUP);
if (!$result) {
\Includes\Utils\FileManager::mkdirRecursive(LC_DIR_BACKUP);
}
$result = is_dir(LC_DIR_BACKUP) && is_writable(LC_DIR_BACKUP);
return $result;
}