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


PHP eZDir::mkdir方法代码示例

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


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

示例1: getArchiveFileName

    public function getArchiveFileName( $path, $seeds, $prefix = null, $realm = null )
    {
        $dirElements = array();
        $dirElements[] = $this->ArchiveDir;
        if ( isset( $realm ) )
        {
            $dirElements[]= $realm;
        }
        $seed = implode ( '', $seeds );
        $hash = hash( $this->hashAlgorithm, $seed );
        $multiLevelDir = eZDir::createMultiLevelPath( substr( $hash, 0 , $this->ArchiveDirLevels ), $this->ArchiveDirLevels );
        $dirElements[] = $multiLevelDir;
        $fileDirectory = implode( '/', $dirElements );
        if ( !file_exists( $fileDirectory ) )
        {
            eZDir::mkdir( $fileDirectory, false, true );
        }
        $archiveFileName = $fileDirectory . '/';
        if ( isset( $prefix ) )
        {
            $archiveFileName .= $prefix . '-';
        }
        $archiveFileName .= $hash;

        return $archiveFileName;
    }
开发者ID:ataxel,项目名称:tp,代码行数:26,代码来源:ezpfilearchivefilesystem.php

示例2: install

 function install( $package, $installType, $parameters,
                   $name, $os, $filename, $subdirectory,
                   $content, &$installParameters,
                   &$installData )
 {
     $collectionName = $parameters['collection'];
     $installVariables = array();
     if ( isset( $installParameters['variables'] ) )
         $installVariables = $installParameters['variables'];
     $iniFileVariables = false;
     if ( isset( $installParameters['ini'] ) )
         $iniFileVariables = $installParameters['ini'];
     $fileList = $package->fileList( $collectionName );
     if ( $fileList )
     {
         foreach ( $fileList as $fileItem )
         {
             $newFilePath = false;
             if ( $fileItem['type'] == 'thumbnail' )
             {
             }
             else
             {
                 $filePath = $package->fileItemPath( $fileItem, $collectionName );
                 if ( is_dir( $filePath ) )
                 {
                     $newFilePath = $package->fileStorePath( $fileItem, $collectionName, $installParameters['path'], $installVariables );
                     eZDir::mkdir( $newFilePath, false, true );
                 }
                 else
                 {
                     $newFilePath = $package->fileStorePath( $fileItem, $collectionName, $installParameters['path'], $installVariables );
                     if ( preg_match( "#^(.+)/[^/]+$#", $newFilePath, $matches ) )
                     {
                         eZDir::mkdir( $matches[1], false, true );
                     }
                     eZFileHandler::copy( $filePath, $newFilePath );
                 }
             }
             if ( $fileItem['type'] == 'ini' and $iniFileVariables and $newFilePath )
             {
                 $fileRole = $fileItem['role'];
                 $fileRoleValue = $fileItem['role-value'];
                 $fileVariableName = $fileItem['variable-name'];
                 $fileName = $fileItem['name'];
                 if ( $fileVariableName and
                      isset( $installParameters['variables'][$fileVariableName] ) )
                     $fileRoleValue = $installParameters['variables'][$fileVariableName];
                 if ( isset( $iniFileVariables[$fileRole][$fileRoleValue][$fileName] ) )
                 {
                     $variables = $iniFileVariables[$fileRole][$fileRoleValue][$fileName];
                     $ini = eZINI::fetchFromFile( $newFilePath );
                     $ini->setVariables( $variables );
                     $ini->save( false, false, false, false, false );
                 }
             }
         }
     }
     return true;
 }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:60,代码来源:ezfilepackagehandler.php

示例3: moveIfNeeded

function moveIfNeeded($oldPath, $newPath) {
    global $fileToRemove;
    
    $success = true;
    $cli = eZCLI::instance();
    
    if (!file_exists($newPath)) {
        if (!file_exists($oldPath)) {
            $cli->warning('Source file not exist : ' . $oldPath);
            return false;
        }
    
        eZDir::mkdir( dirname( $newPath ), false, true );
        $success = copy($oldPath, $newPath);
        
        $cli = eZCLI::instance();
        if ($success) {
            $fileToRemove[] = $oldPath;
            $cli->notice('Move ' . $oldPath . ' => ' . $newPath);
        } else {
            $cli->warning('Fail to move ' . $oldPath . ' => ' . $newPath);
        }
    } else {
        $fileToRemove[] = $oldPath;
    }
    
    return $success;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:28,代码来源:image_refactor.php

示例4: create

 static function create($filename, $directory = false, $data = false, $atomic = false)
 {
     $filepath = $filename;
     if ($directory) {
         if (!file_exists($directory)) {
             eZDir::mkdir($directory, false, true);
             //                 eZDebugSetting::writeNotice( 'ezfile-create', "Created directory $directory", 'eZFile::create' );
         }
         $filepath = $directory . '/' . $filename;
     }
     // If atomic creation is needed we will use a temporary
     // file when writing the data, then rename it to the correct path.
     if ($atomic) {
         $realpath = $filepath;
         $dirname = dirname($filepath);
         if (strlen($dirname) != 0) {
             $dirname .= "/";
         }
         $filepath = $dirname . "ezfile-tmp." . md5($filepath . getmypid() . mt_rand());
     }
     $file = fopen($filepath, 'wb');
     if ($file) {
         //             eZDebugSetting::writeNotice( 'ezfile-create', "Created file $filepath", 'eZFile::create' );
         if ($data) {
             fwrite($file, $data);
         }
         fclose($file);
         if ($atomic) {
             eZFile::rename($filepath, $realpath);
         }
         return true;
     }
     //         eZDebugSetting::writeNotice( 'ezfile-create', "Failed creating file $filepath", 'eZFile::create' );
     return false;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:35,代码来源:ezfile.php

示例5: downloadFile

 /**
  * Downloads file.
  *
  * Sets $this->ErrorMsg in case of an error.
  *
  * \private
  * \param $url            URL.
  * \param $outDir         Directory where to put downloaded file to.
  * \param $forcedFileName Force saving downloaded file under this name.
  * \return false on error, path to downloaded package otherwise.
  */
 function downloadFile($url, $outDir, $forcedFileName = false)
 {
     $fileName = $outDir . "/" . ($forcedFileName ? $forcedFileName : basename($url));
     eZDebug::writeNotice("Downloading file '{$fileName}' from {$url}");
     // Create the out directory if not exists.
     if (!file_exists($outDir)) {
         eZDir::mkdir($outDir, false, true);
     }
     // First try CURL
     if (extension_loaded('curl')) {
         $ch = curl_init($url);
         $fp = eZStepSiteTypes::fopen($fileName, 'wb');
         if ($fp === false) {
             $this->ErrorMsg = ezpI18n::tr('design/standard/setup/init', 'Cannot write to file') . ': ' . $this->FileOpenErrorMsg;
             return false;
         }
         curl_setopt($ch, CURLOPT_FILE, $fp);
         curl_setopt($ch, CURLOPT_HEADER, 0);
         curl_setopt($ch, CURLOPT_FAILONERROR, 1);
         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
         // Get proxy
         $ini = eZINI::instance();
         $proxy = $ini->hasVariable('ProxySettings', 'ProxyServer') ? $ini->variable('ProxySettings', 'ProxyServer') : false;
         if ($proxy) {
             curl_setopt($ch, CURLOPT_PROXY, $proxy);
             $userName = $ini->hasVariable('ProxySettings', 'User') ? $ini->variable('ProxySettings', 'User') : false;
             $password = $ini->hasVariable('ProxySettings', 'Password') ? $ini->variable('ProxySettings', 'Password') : false;
             if ($userName) {
                 curl_setopt($ch, CURLOPT_PROXYUSERPWD, "{$userName}:{$password}");
             }
         }
         if (!curl_exec($ch)) {
             $this->ErrorMsg = curl_error($ch);
             return false;
         }
         curl_close($ch);
         fclose($fp);
     } else {
         $parsedUrl = parse_url($url);
         $checkIP = isset($parsedUrl['host']) ? ip2long(gethostbyname($parsedUrl['host'])) : false;
         if ($checkIP === false) {
             return false;
         }
         // If we don't have CURL installed we used standard fopen urlwrappers
         // Note: Could be blocked by not allowing remote calls.
         if (!copy($url, $fileName)) {
             $buf = eZHTTPTool::sendHTTPRequest($url, 80, false, 'eZ Publish', false);
             $header = false;
             $body = false;
             if (eZHTTPTool::parseHTTPResponse($buf, $header, $body)) {
                 eZFile::create($fileName, false, $body);
             } else {
                 $this->ErrorMsg = ezpI18n::tr('design/standard/setup/init', 'Failed to copy %url to local file %filename', null, array("%url" => $url, "%filename" => $fileName));
                 return false;
             }
         }
     }
     return $fileName;
 }
开发者ID:nlenardou,项目名称:ezpublish,代码行数:70,代码来源:ezstep_site_types.php

示例6: eZMutex

 function eZMutex($name)
 {
     $this->Name = md5($name);
     $mutexPath = eZDir::path(array(eZSys::cacheDirectory(), 'ezmutex'));
     eZDir::mkdir($mutexPath, false, true);
     $this->FileName = eZDir::path(array($mutexPath, $this->Name));
     $this->MetaFileName = eZDir::path(array($mutexPath, $this->Name . '_meta'));
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:8,代码来源:ezmutex.php

示例7: __construct

 /**
  * Constructs a new CjwNewsletterTransportFile
  *
  * @param string $mailDir
  * @return void
  */
 public function __construct($mailDir = 'var/log/mail')
 {
     // $this->mailDir = eZSys::siteDir().eZSys::varDirectory().'/log/mail';
     if (is_dir($mailDir) or eZDir::mkdir($mailDir, false, true)) {
         $this->mailDir = $mailDir;
     } else {
         // TODO Fehlerbehandlung wenn verzeichnis nicht angelegt werden kann
     }
 }
开发者ID:heliopsis,项目名称:cjw_newsletter,代码行数:15,代码来源:cjwnewslettertransportfile.php

示例8: copyDir

function copyDir( $source, $destination )
{
    // Attempt to create destination dir.
    $status = eZDir::mkdir( $destination );

    // If no success: bail out.
    if ( !$status )
    {
        return false;
    }

    // Get the contents of the directory.
    $entries = getDirEntries( $source );

    // Bail if contents is unavailable.
    if ( $entries == false )
    {
        return false;
    }
    // Else: contents is OK:
    else
    {
        // Copy each and every entry:
        foreach ( $entries as $entry )
        {
            if ( $entry )
            {
                $from = "$source/$entry";
                $to   = "$destination/$entry";

                // Is this a directory? -> special case.
                if ( is_dir( $from ) )
                {
                    $status = copyDir( $from, $to );
                    if (!$status)
                    {
                        return false;
                    }
                }
                // Else: simple file case.
                else
                {
                    $status = copy( $from, $to );
                    if (!$status)
                    {
                        return false;
                    }
                }
            }
        }

    }

    // Phew: if we got this far then everything is OK.
    return true;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:56,代码来源:ezwebdavfileserver.php

示例9: __construct

 /**
  * Creates a new cache storage for a given location through eZ Publish cluster mechanism
  * Options can contain the 'ttl' ( Time-To-Life ). This is per default set
  * to 1 day.
  *
  * @param string $location Path to the cache location inside the cluster
  * @param array(string=>string) $options Options for the cache.
  */
 public function __construct($location, $options = array())
 {
     $path = eZSys::cacheDirectory() . '/rest/' . $location;
     if (!file_exists($path)) {
         if (!eZDir::mkdir($path, false, true)) {
             throw new ezcBaseFilePermissionException($path, ezcBaseFileException::WRITE, 'Cache location is not writeable.');
         }
     }
     parent::__construct($path);
     $this->properties['options'] = new ezpCacheStorageClusterOptions($options);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:19,代码来源:cluster.php

示例10: store

 function store($sub_dir = false, $suffix = false, $mimeData = false)
 {
     if (!$this->IsTemporary) {
         eZDebug::writeError("Cannot store non temporary file: " . $this->Filename, "eZHTTPFile");
         return false;
     }
     $this->IsTemporary = false;
     $ini = eZINI::instance();
     //         $storage_dir = $ini->variable( "FileSettings", "VarDir" ) . '/' . $ini->variable( "FileSettings", "StorageDir" );
     $storage_dir = eZSys::storageDirectory();
     if ($sub_dir !== false) {
         $dir = $storage_dir . "/{$sub_dir}/";
     } else {
         $dir = $storage_dir . "/";
     }
     if ($mimeData) {
         $dir = $mimeData['dirpath'];
     }
     if (!$mimeData) {
         $dir .= $this->MimeCategory;
     }
     if (!file_exists($dir)) {
         if (!eZDir::mkdir($dir, false, true)) {
             return false;
         }
     }
     $suffixString = false;
     if ($suffix != false) {
         $suffixString = ".{$suffix}";
     }
     if ($mimeData) {
         $dest_name = $mimeData['url'];
     } else {
         $dest_name = $dir . "/" . md5(basename($this->Filename) . microtime() . mt_rand()) . $suffixString;
     }
     if (!move_uploaded_file($this->Filename, $dest_name)) {
         eZDebug::writeError("Failed moving uploaded file " . $this->Filename . " to destination {$dest_name}");
         unlink($dest_name);
         $ret = false;
     } else {
         $ret = true;
         $this->Filename = $dest_name;
         $perm = $ini->variable("FileSettings", "StorageFilePermissions");
         $oldumask = umask(0);
         chmod($dest_name, octdec($perm));
         umask($oldumask);
         // Write log message to storage.log
         $storageDir = $dir . "/";
         eZLog::writeStorageLog(basename($this->Filename), $storageDir);
     }
     return $ret;
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:52,代码来源:ezhttpfile.php

示例11: getCssFilePath

    /**
     * @return mixed
     */
    public function getCssFilePath()
    {
        if ( is_null($this->_cssFilePath) )
        {
            $cssDirectory = eZSys::cacheDirectory() . '/css';
            $this->_cssFilePath = $cssDirectory .'/' . md5( $this->getLessFilePath() ) . '.css';
            if ( !file_exists( $cssDirectory ))
            {
                eZDir::mkdir( $cssDirectory );
            }
        }

        return $this->_cssFilePath;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:17,代码来源:KLessFile.php

示例12: getTmpDir

 /**
  * tmp dir for mail parser
  *    ezvardir / cjw_newsletter/tmp/
  * @return string dirname
  */
 public function getTmpDir($createDirIfNotExists = true)
 {
     $varDir = eZSys::varDirectory();
     // $dir = $varDir . "/cjw_newsletter/tmp/";
     $dir = eZDir::path(array($varDir, 'cjw_newsletter', 'tmp'));
     $fileSep = eZSys::fileSeparator();
     $filePath = $dir . $fileSep;
     if ($createDirIfNotExists === true) {
         if (!file_exists($filePath)) {
             eZDir::mkdir($filePath, false, true);
         }
     }
     return $filePath;
 }
开发者ID:hudri,项目名称:cjw_newsletter,代码行数:19,代码来源:cjwnewslettermailparser.php

示例13: copyFilesFromDB

function copyFilesFromDB($excludeScopes, $remove)
{
    global $cli, $fileHandler;
    $cli->output("Exporting files from database:");
    $filePathList = $fileHandler->getFileList($excludeScopes, true);
    foreach ($filePathList as $filePath) {
        $cli->output("- " . $filePath);
        eZDir::mkdir(dirname($filePath), false, true);
        $fileHandler->fileFetch($filePath);
        if ($remove) {
            $fileHandler->fileDelete($filePath);
        }
    }
    $cli->output();
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:15,代码来源:clusterize.php

示例14: __construct

    /**
     * Creates a new cache storage for a given location through eZ Publish cluster mechanism
     * Options can contain the 'ttl' ( Time-To-Life ). This is per default set
     * to 1 day.
     * @param string $location Path to the cache location inside the cluster
     * @param array(string=>string) $options Options for the cache.
     */
    public function __construct( $location, $options = array() )
    {
        $apiName = ezpRestPrefixFilterInterface::getApiProviderName();
        $apiVersion = ezpRestPrefixFilterInterface::getApiVersion();
        $location = eZSys::cacheDirectory().'/rest/'.$location;
        if( !file_exists( $location ) )
        {
            if( !eZDir::mkdir( $location, false, true ) )
            {
                throw new ezcBaseFilePermissionException(
                    $location,
                    ezcBaseFileException::WRITE,
                    'Cache location is not writeable.'
                );
            }
        }

        parent::__construct( $location );
        $this->properties['options'] = new ezpCacheStorageClusterOptions( $options );
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:27,代码来源:cluster.php

示例15: appendLogEntry

 /**
  * Logs the string $logString to the logfile webservices.log
  * in the current log directory (usually var/log).
  * If logging is disabled, nothing is done.
  *
  * In dev mode, also writes to the eZP logs to ease debugging (this happens
  * regardless of the logging level set for the extension itself)
  */
 static function appendLogEntry($logString, $debuglevel)
 {
     $ini = eZINI::instance('site.ini');
     if ($ini->variable('DebugSettings', 'DebugOutput') == 'enabled' && $ini->variable('TemplateSettings', 'DevelopmentMode') == 'enabled') {
         switch ($debuglevel) {
             case 'info':
             case 'notice':
                 eZDebug::writeNotice($logString, 'ggwebservices');
                 break;
             case 'debug':
                 eZDebug::writeDebug($logString, 'ggwebservices');
                 break;
             case 'warning':
                 eZDebug::writeWarning($logString, 'ggwebservices');
                 break;
             case 'error':
             case 'critical':
                 eZDebug::writeError($logString, 'ggwebservices');
                 break;
         }
     }
     if (!self::isLoggingEnabled($debuglevel)) {
         return false;
     }
     $varDir = eZSys::varDirectory();
     $logDir = 'log';
     $logName = 'webservices.log';
     $fileName = $varDir . '/' . $logDir . '/' . $logName;
     if (!file_exists($varDir . '/' . $logDir)) {
         //include_once( 'lib/ezfile/classes/ezdir.php' );
         eZDir::mkdir($varDir . '/' . $logDir, 0775, true);
     }
     if ($logFile = fopen($fileName, 'a')) {
         $nowTime = date("Y-m-d H:i:s : ");
         $text = $nowTime . $logString;
         /*if ( $label )
           $text .= ' [' . $label . ']';*/
         fwrite($logFile, $text . "\n");
         fclose($logFile);
     }
 }
开发者ID:gggeek,项目名称:ggwebservices,代码行数:49,代码来源:ggezwebservices.php


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