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


PHP Write::changePermissions方法代码示例

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


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

示例1: install

 /**
  * Generate installation data and record them into local.xml using local.xml.template
  *
  * @return void
  */
 public function install()
 {
     $data = $this->getConfigData();
     $defaults = array('root_dir' => $this->_filesystem->getPath(\Magento\Framework\App\Filesystem::ROOT_DIR), 'app_dir' => $this->_filesystem->getPath(\Magento\Framework\App\Filesystem::APP_DIR), 'var_dir' => $this->_filesystem->getPath(\Magento\Framework\App\Filesystem::VAR_DIR), 'base_url' => $this->_request->getDistroBaseUrl());
     foreach ($defaults as $index => $value) {
         if (!isset($data[$index])) {
             $data[$index] = $value;
         }
     }
     if (isset($data['unsecure_base_url'])) {
         $data['unsecure_base_url'] .= substr($data['unsecure_base_url'], -1) != '/' ? '/' : '';
         if (strpos($data['unsecure_base_url'], 'http') !== 0) {
             $data['unsecure_base_url'] = 'http://' . $data['unsecure_base_url'];
         }
         if (!$this->_getInstaller()->getDataModel()->getSkipBaseUrlValidation()) {
             $this->_checkUrl($data['unsecure_base_url']);
         }
     }
     if (isset($data['secure_base_url'])) {
         $data['secure_base_url'] .= substr($data['secure_base_url'], -1) != '/' ? '/' : '';
         if (strpos($data['secure_base_url'], 'http') !== 0) {
             $data['secure_base_url'] = 'https://' . $data['secure_base_url'];
         }
         if (!empty($data['use_secure']) && !$this->_getInstaller()->getDataModel()->getSkipUrlValidation()) {
             $this->_checkUrl($data['secure_base_url']);
         }
     }
     $data['date'] = self::TMP_INSTALL_DATE_VALUE;
     $data['key'] = self::TMP_ENCRYPT_KEY_VALUE;
     $data['var_dir'] = $data['root_dir'] . '/var';
     $data['use_script_name'] = isset($data['use_script_name']) ? 'true' : 'false';
     $this->_getInstaller()->getDataModel()->setConfigData($data);
     $contents = $this->_configDirectory->readFile('local.xml.template');
     foreach ($data as $index => $value) {
         $contents = str_replace('{{' . $index . '}}', '<![CDATA[' . $value . ']]>', $contents);
     }
     $this->_configDirectory->writeFile($this->_localConfigFile, $contents);
     $this->_configDirectory->changePermissions($this->_localConfigFile, 0777);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:44,代码来源:Config.php


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