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


PHP mkdir_recursive函数代码示例

本文整理汇总了PHP中mkdir_recursive函数的典型用法代码示例。如果您正苦于以下问题:PHP mkdir_recursive函数的具体用法?PHP mkdir_recursive怎么用?PHP mkdir_recursive使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: save

function save($file, $data)
{
    mkdir_recursive($file);
    $fh = fopen($file, 'w') or print "can't open file";
    fwrite($fh, $data);
    fclose($fh);
}
开发者ID:baki250,项目名称:angular-io-app,代码行数:7,代码来源:lib.global.php

示例2: setupFiles

 public static function setupFiles($modules, $files, $custom_directory)
 {
     self::$modules = $modules;
     self::$files = $files;
     self::$has_dir = array();
     foreach (self::$modules as $module) {
         if (!file_exists("custom/modules/{$module}/metadata")) {
             mkdir_recursive("custom/modules/{$module}/metadata", true);
         }
         if (file_exists("custom/modules/{$module}")) {
             self::$has_dir[$module] = true;
         }
         foreach (self::$files as $file) {
             if (file_exists("custom/modules/{$module}/metadata/{$file}")) {
                 copy("custom/modules/{$module}/metadata/{$file}.php", "custom/modules/{$module}/metadata/{$file}.php.bak");
             }
             if (file_exists("custom/modules/{$module}/metadata/{$file}.php.suback.php")) {
                 copy("custom/modules/{$module}/metadata/{$file}.php.suback.php", "custom/modules/{$module}/metadata/{$file}.php.suback.bak");
             }
             if (file_exists("{$custom_directory}/custom/modules/{$module}/metadata/{$file}.php")) {
                 copy("{$custom_directory}/custom/modules/{$module}/metadata/{$file}.php", "custom/modules/{$module}/metadata/{$file}.php");
             }
         }
         //foreach
     }
     //foreach
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:27,代码来源:SugarTestMergeUtilities.php

示例3: setUp

 public function setUp()
 {
     parent::setUp();
     //If somehow this package already exists copy it
     if (file_exists('custom/modules/' . $this->package)) {
         $this->packageExists = true;
         mkdir_recursive('custom/modules/' . $this->package . '_bak');
         copy_recursive('custom/modules/' . $this->package, 'custom/modules/' . $this->package . '_bak');
     }
     //Make the custom package directory and simulate copying the file in
     mkdir_recursive('custom/modules/' . $this->package . '/Ext/WirelessLayoutdefs');
     $theArray = array($this->package => array('subpanel_setup' => array($this->package . '_accounts' => array('order' => 100, 'module' => 'Contacts', 'subpanel_name' => 'default', 'title_key' => 'LBL_BUG48784TEST', 'get_subpanel_data' => 'Bug48748Test'))));
     $theFile = 'custom/modules/' . $this->package . '/Ext/WirelessLayoutdefs/wireless.subpaneldefs.ext.php';
     write_array_to_file('layout_defs', $theArray, $theFile);
     sugar_chmod('custom/modules/' . $this->package . '/Ext/WirelessLayoutdefs/wireless.subpaneldefs.ext.php', 0655);
     global $beanList, $beanFiles, $current_user;
     //$beanList['Contacts'] = 'Contact';
     //$beanFiles['Bug48784Mock'] = 'modules/Contacts/Contact.php';
     //Create an anonymous user for login purposes/
     $current_user = SugarTestUserUtilities::createAnonymousUser();
     $current_user->status = 'Active';
     $current_user->is_admin = 1;
     $current_user->save();
     $GLOBALS['db']->commit();
     // Making sure we commit any changes before continuing
     $_SESSION['avail_modules'][$this->package] = 'write';
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:27,代码来源:Bug48748Test.php

示例4: setUp

 public function setUp()
 {
     if (file_exists('custom/modules/Opportunities/metadata/SearchFields.php')) {
         $this->hasExistingCustomSearchFields = true;
         copy('custom/modules/Opportunities/metadata/SearchFields.php', 'custom/modules/Opportunities/metadata/SearchFields.php.bak');
         unlink('custom/modules/Opportunities/metadata/SearchFields.php');
     } else {
         if (!file_exists('custom/modules/Opportunities/metadata')) {
             mkdir_recursive('custom/modules/Opportunities/metadata');
         }
     }
     //Setup Opportunities module and date_closed field
     $_REQUEST['view_module'] = 'Opportunities';
     $_REQUEST['name'] = 'date_closed';
     $templateDate = new TemplateDate();
     $templateDate->enable_range_search = true;
     $templateDate->populateFromPost();
     include 'custom/modules/Opportunities/metadata/SearchFields.php';
     //Prepare SearchForm
     $seed = new Opportunity();
     $module = 'Opportunities';
     $this->searchForm = new SearchForm($seed, $module);
     $this->searchForm->searchFields = array('range_date_closed' => array('query_type' => 'default', 'enable_range_search' => 1, 'is_date_field' => 1, 'value' => '[this_year]', 'operator' => 'this_year'), 'start_range_date_closed' => array('query_type' => 'default', 'enable_range_search' => 1, 'is_date_field' => 1), 'end_range_date_closed' => array('query_type' => 'default', 'enable_range_search' => 1, 'is_date_field' => 1), 'range_amount' => array('query_type' => 'default', 'enable_range_search' => true), 'start_range_amount' => array('query_type' => 'default', 'enable_range_search' => true), 'end_range_amount' => array('query_type' => 'default', 'enable_range_search' => true));
     $this->originalDbType = $GLOBALS['db']->dbType;
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:25,代码来源:RangeSearchTest.php

示例5: download

 public function download($save_to_file, $post_data = array())
 {
     // DOWNLOAD USES CURL AS GUZZLE DOWNLOAD DOES NOT WORK
     // http://stackoverflow.com/questions/16939794/copy-remote-file-using-guzzle
     // https://gist.github.com/romainneutron/5340930
     if ($save_to_file != false) {
         $dn = dirname($save_to_file);
         if (!is_dir($dn)) {
             mkdir_recursive($dn);
         }
         if (is_dir($dn)) {
             $url = $this->url;
             if (function_exists('set_time_limit')) {
                 @set_time_limit(0);
             }
             $fp = fopen($save_to_file, 'w+');
             //This is the file where we save the    information
             $ch = curl_init(str_replace(' ', '%20', $url));
             //Here is the file we are downloading, replace spaces with %20
             curl_setopt($ch, CURLOPT_TIMEOUT, 120);
             curl_setopt($ch, CURLOPT_FILE, $fp);
             // write curl response to file
             curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
             curl_exec($ch);
             // get curl response
             curl_close($ch);
             fclose($fp);
         }
     }
 }
开发者ID:microweber,项目名称:microweber,代码行数:30,代码来源:Guzzle.php

示例6: __construct

 function __construct($previewFilename)
 {
     $GLOBALS['log']->debug(get_class($this) . "->__construct( {$previewFilename} )");
     $this->_previewFilename = $previewFilename;
     $this->_list = array();
     $this->_dirname = dirname($this->_previewFilename);
     // create the history directory if it does not already exist
     if (!is_dir($this->_dirname)) {
         mkdir_recursive($this->_dirname);
     }
     $this->_basename = basename($this->_previewFilename);
     // Reconstruct the history from the saved files
     foreach (scandir($this->_dirname) as $filename) {
         if ($filename != "." && $filename != "..") {
             // history files are of the form {$basename}_{$timestamp}
             if (preg_match('/(' . $this->_basename . ')_(.*)/', $filename, $matches) == 1) {
                 $this->_list[$matches[2]] = $matches[2];
             }
         }
     }
     // now sort the files, oldest first
     if (count($this->_list) > 0) {
         ksort($this->_list);
     }
 }
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:25,代码来源:History.php

示例7: __construct

 public function __construct($previewFilename)
 {
     $GLOBALS['log']->debug(get_class($this) . "->__construct( {$previewFilename} )");
     $this->_previewFilename = $previewFilename;
     $this->_list = array();
     $this->_basename = basename($this->_previewFilename);
     $this->_dirname = dirname($this->_previewFilename);
     $this->_historyLimit = isset($GLOBALS['sugar_config']['studio_max_history']) ? $GLOBALS['sugar_config']['studio_max_history'] : 50;
     // create the history directory if it does not already exist
     if (!is_dir($this->_dirname)) {
         mkdir_recursive($this->_dirname);
     } else {
         // Reconstruct the history from the saved files
         $filenameList = glob($this->getFileByTimestamp('*'));
         if (!empty($filenameList)) {
             foreach ($filenameList as $filename) {
                 if (preg_match('/(\\d+)$/', $filename, $match)) {
                     $this->_list[] = $match[1];
                 }
             }
         }
     }
     // now sort the files, oldest first
     if (count($this->_list) > 0) {
         sort($this->_list);
     }
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:27,代码来源:History.php

示例8: setUp

 function setUp()
 {
     $this->modules = array('Leads');
     $this->has_dir = array();
     foreach ($this->modules as $module) {
         if (!file_exists("custom/modules/{$module}/metadata")) {
             mkdir_recursive("custom/modules/{$module}/metadata", true);
         }
         if (file_exists("custom/modules/{$module}")) {
             $this->has_dir[$module] = true;
         }
         $files = array('detailviewdefs', 'editviewdefs');
         foreach ($files as $file) {
             if (file_exists("custom/modules/{$module}/metadata/{$file}")) {
                 copy("custom/modules/{$module}/metadata/{$file}.php", "custom/modules/{$module}/metadata/{$file}.php.bak");
             }
             if (file_exists("custom/modules/{$module}/metadata/{$file}.php.suback.php")) {
                 copy("custom/modules/{$module}/metadata/{$file}.php.suback.php", "custom/modules/{$module}/metadata/{$file}.php.suback.bak");
             }
             if (file_exists("tests/modules/UpgradeWizard/SugarMerge/metadata_files/custom/modules/{$module}/metadata/{$file}.php")) {
                 copy("tests/modules/UpgradeWizard/SugarMerge/metadata_files/custom/modules/{$module}/metadata/{$file}.php", "custom/modules/{$module}/metadata/{$file}.php");
             }
         }
         //foreach
     }
     //foreach
 }
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:27,代码来源:LeadsMergeTest.php

示例9: setUp

    public function setUp()
    {
        global $beanList, $beanFiles, $dictionary;
        //Add entries to simulate custom module
        $beanList['Bug44030_TestPerson'] = 'Bug44030_TestPerson';
        $beanFiles['Bug44030_TestPerson'] = 'modules/Bug44030_TestPerson/Bug44030_TestPerson.php';
        VardefManager::loadVardef('Contacts', 'Contact');
        $dictionary['Bug44030_TestPerson'] = $dictionary['Contact'];
        //Copy over custom SearchFields.php file
        if (!file_exists('custom/modules/Bug44030_TestPerson/metadata')) {
            mkdir_recursive('custom/modules/Bug44030_TestPerson/metadata');
        }
        if ($fh = @fopen('custom/modules/Bug44030_TestPerson/metadata/SearchFields.php', 'w+')) {
            $string = <<<EOQ
<?php
\$searchFields['Bug44030_TestPerson']['email'] = array(
'query_type' => 'default',
'operator' => 'subquery',
'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE',
'db_field' => array('id',),
'vname' =>'LBL_ANY_EMAIL',
);
?>
EOQ;
            fputs($fh, $string);
            fclose($fh);
        }
        //Remove the cached unified_search_modules.php file
        $this->unified_search_modules_file = $GLOBALS['sugar_config']['cache_dir'] . 'modules/unified_search_modules.php';
        if (file_exists($this->unified_search_modules_file)) {
            copy($this->unified_search_modules_file, $this->unified_search_modules_file . '.bak');
            unlink($this->unified_search_modules_file);
        }
    }
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:34,代码来源:Bug44030Test.php

示例10: __construct

 public function __construct()
 {
     parent::__construct();
     if (!file_exists(SUGAR_SMARTY_DIR)) {
         mkdir_recursive(SUGAR_SMARTY_DIR, true);
     }
     if (!file_exists(SUGAR_SMARTY_DIR . 'templates_c')) {
         mkdir_recursive(SUGAR_SMARTY_DIR . 'templates_c', true);
     }
     if (!file_exists(SUGAR_SMARTY_DIR . 'configs')) {
         mkdir_recursive(SUGAR_SMARTY_DIR . 'configs', true);
     }
     if (!file_exists(SUGAR_SMARTY_DIR . 'cache')) {
         mkdir_recursive(SUGAR_SMARTY_DIR . 'cache', true);
     }
     $this->template_dir = '.';
     $this->compile_dir = SUGAR_SMARTY_DIR . 'templates_c';
     $this->config_dir = SUGAR_SMARTY_DIR . 'configs';
     $this->cache_dir = SUGAR_SMARTY_DIR . 'cache';
     $this->request_use_auto_globals = true;
     // to disable Smarty from using long arrays
     if (file_exists('custom/include/Smarty/plugins')) {
         $plugins_dir[] = 'custom/include/Smarty/plugins';
     }
     $plugins_dir[] = 'include/Smarty/plugins';
     $this->plugins_dir = $plugins_dir;
     $this->assign("VERSION_MARK", getVersionedPath(''));
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:28,代码来源:Sugar_Smarty.php

示例11: Sugar_Smarty

 function Sugar_Smarty()
 {
     if (!file_exists(SUGAR_SMARTY_DIR)) {
         mkdir_recursive(SUGAR_SMARTY_DIR, true);
     }
     if (!file_exists(SUGAR_SMARTY_DIR . 'templates_c')) {
         mkdir_recursive(SUGAR_SMARTY_DIR . 'templates_c', true);
     }
     if (!file_exists(SUGAR_SMARTY_DIR . 'configs')) {
         mkdir_recursive(SUGAR_SMARTY_DIR . 'configs', true);
     }
     if (!file_exists(SUGAR_SMARTY_DIR . 'cache')) {
         mkdir_recursive(SUGAR_SMARTY_DIR . 'cache', true);
     }
     $this->template_dir = '.';
     $this->compile_dir = SUGAR_SMARTY_DIR . 'templates_c';
     $this->config_dir = SUGAR_SMARTY_DIR . 'configs';
     $this->cache_dir = SUGAR_SMARTY_DIR . 'cache';
     $this->request_use_auto_globals = true;
     // to disable Smarty from using long arrays
     $plugins_dir = array('include/Smarty/plugins');
     if (file_exists('custom/include/Smarty/plugins')) {
         $plugins_dir[] = 'custom/include/Smarty/plugins';
     }
     $this->plugins_dir = $plugins_dir;
 }
开发者ID:razorinc,项目名称:sugarcrm-example,代码行数:26,代码来源:Sugar_Smarty.php

示例12: getTableRow

    function getTableRow($record, $value, $formType)
    {
        global $preSaveTempId, $SETTINGS, $menu;
        $prefixText = @$this->fieldPrefix;
        $description = @$this->description;
        if ($prefixText) {
            $prefixText .= "<br/>";
        }
        // create uploadList url
        $uploadList = "?menu=" . urlencode($menu) . "&amp;action=uploadList" . "&amp;fieldName=" . urlencode($this->name) . "&amp;num=" . urlencode(@$_REQUEST['num']) . "&amp;preSaveTempId=" . urlencode($preSaveTempId) . "&amp;formType=" . urlencode($formType);
        // create uploadLink url
        $uploadLink = "?menu=" . urlencode($menu) . "&amp;action=uploadForm" . "&amp;fieldName=" . urlencode($this->name) . "&amp;num=" . urlencode(@$_REQUEST['num']) . "&amp;preSaveTempId=" . urlencode($preSaveTempId) . "&amp;TB_iframe=true&amp;height=350&amp;width=700&amp;modal=true";
        // error checking
        $errors = '';
        $uploadDir = @$this->useCustomUploadDir ? $this->customUploadDir : $SETTINGS['uploadDir'];
        if (!file_exists($uploadDir)) {
            mkdir_recursive($uploadDir, 0755);
        }
        // create upload dir (if not possible, dir not exists error will show below)
        if (!file_exists($uploadDir)) {
            $errors .= "Upload directory '" . htmlencode($uploadDir) . "' doesn't exist!.<br/>\n";
        } elseif (!is_writable($uploadDir)) {
            $errors .= "Upload directory '" . htmlencode($uploadDir) . "' isn't writable!.<br/>\n";
        }
        // display errors
        if ($errors) {
            $html = <<<__HTML__
<tr>
 <td valign="top"><br/>{$this->label}<br/></td>
 <td><div id='alert'><span>{$errors}</span></div></td>
</tr>
__HTML__;
            return $html;
        }
        // display field
        $html = '';
        $html .= "<tr>\n";
        $html .= "  <td style='vertical-align: top'>{$this->label}</td>\n";
        $html .= "  <td>\n";
        $html .= "    {$prefixText}\n";
        $html .= "    <iframe id='{$this->name}_iframe' src='{$uploadList}' height='100' width='100%' frameborder='0' class='uploadIframe'></iframe><br/>\n";
        // show upload buttons
        if ($formType == 'edit') {
            $html .= "    <div style='position: relative; height: 24px;'>\n";
            $html .= "      <div style='position: absolute; top: 6px; width: 100%; text-align: center;'>\n";
            $html .= "        <a href='{$uploadLink}' class='thickbox'><b>" . t('Add or Upload File(s)') . "</b></a>\n";
            $html .= "      </div>\n";
            $html .= "      <div style='position: absolute; z-index: 1; width: 100%; text-align: center;'>\n";
            $html .= "        <div id='{$this->name}_uploadButton'></div>\n";
            $html .= "      </div>\n";
            $html .= "    </div>\n";
            $html .= $this->_getFlashUploaderHTML();
        } else {
            $html .= "<br/>";
        }
        $html .= "  </td>\n";
        $html .= "</tr>\n";
        return $html;
    }
开发者ID:afineedge,项目名称:thinkbeforeyoulaunch,代码行数:59,代码来源:upload.php

示例13: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
     $GLOBALS['current_user']->is_admin = "1";
     $GLOBALS['current_language'] = "en_us";
     $GLOBALS['app_strings'] = return_application_language($GLOBALS['current_language']);
     $GLOBALS['mod_strings'] = return_module_language($GLOBALS['current_language'], 'Administration');
     mkdir_recursive("cache/ExtTest");
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:9,代码来源:ExtTest.php

示例14: setUp

 public function setUp()
 {
     if (file_exists($this->file)) {
         $this->customConnectors = file_get_contents($this->file);
     } else {
         mkdir_recursive('custom/modules/Connectors/metadata');
         file_put_contents($this->file, '<?php ');
     }
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:9,代码来源:Bug50720Test.php

示例15: setUp

    function setUp()
    {
        if (file_exists($this->tableDictionaryExtFile1)) {
            copy($this->tableDictionaryExtFile1, $this->tableDictionaryExtFile1 . '.backup');
            unlink($this->tableDictionaryExtFile1);
        } else {
            if (!file_exists('custom/Extension/application/Ext/TableDictionary')) {
                mkdir_recursive('custom/Extension/application/Ext/TableDictionary');
            }
        }
        if ($fh = @fopen($this->tableDictionaryExtFile1, 'w+')) {
            $string = <<<EOQ
<?php

//WARNING: The contents of this file are auto-generated
include('custom/metadata/bug43208Test_productsMetaData.php');

//WARNING: The contents of this file are auto-generated
include('custom/Extension/application/Ext/TableDictionary/Bug43208_module.php');
?>
EOQ;
            fputs($fh, $string);
            fclose($fh);
        }
        if (file_exists($this->tableDictionaryExtFile2)) {
            copy($this->tableDictionaryExtFile2, $this->tableDictionaryExtFile2 . '.backup');
            unlink($this->tableDictionaryExtFile2);
        } else {
            if (!file_exists('custom/application/Ext/TableDictionary')) {
                mkdir_recursive('custom/application/Ext/TableDictionary');
            }
        }
        if ($fh = @fopen($this->tableDictionaryExtFile2, 'w+')) {
            $string = <<<EOQ
<?php

//WARNING: The contents of this file are auto-generated
include('custom/metadata/bug43208Test_productsMetaData.php');

//WARNING: The contents of this file are auto-generated
include('custom/Extension/application/Ext/TableDictionary/Bug43208_module.php');
?>
EOQ;
            fputs($fh, $string);
            fclose($fh);
        }
        if ($fh = @fopen($this->corruptExtModuleFile, 'w+')) {
            $string = <<<EOQ
<?php
 //WARNING: The contents of this file are auto-generated
 \tinclude( "custom/metadata/bug43208Test_productsMetaData.php" ); 
?>
EOQ;
            fputs($fh, $string);
            fclose($fh);
        }
    }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:57,代码来源:Bug43208Test.php


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