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


PHP DirectoryList::getPath方法代码示例

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


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

示例1: remove

 /**
  * Run 'composer remove'
  *
  * @param array $packages
  * @return void
  */
 public function remove(array $packages)
 {
     $this->composerApp->resetComposer();
     $this->composerApp->setAutoExit(false);
     $vendor = (include $this->directoryList->getPath(DirectoryList::CONFIG) . '/vendor_path.php');
     $this->composerApp->run(new ArrayInput(['command' => 'remove', 'packages' => $packages, '--working-dir' => $this->directoryList->getRoot() . '/' . $vendor . '/..']));
 }
开发者ID:nja78,项目名称:magento2,代码行数:13,代码来源:Remove.php

示例2: create

 /**
  * Create \Composer\Composer
  *
  * @return \Composer\Composer
  * @throws \Exception
  */
 public function create()
 {
     if (!getenv('COMPOSER_HOME')) {
         putenv('COMPOSER_HOME=' . $this->directoryList->getPath(DirectoryList::COMPOSER_HOME));
     }
     return \Composer\Factory::create(new BufferIO(), $this->composerJsonFinder->findComposerJson());
 }
开发者ID:mage2pro,项目名称:core,代码行数:13,代码来源:ComposerFactory.php

示例3: load

 /**
  * Loads the configuration file
  *
  * @param string $fileKey
  * @return array
  * @throws \Exception
  */
 public function load($fileKey = null)
 {
     $path = $this->dirList->getPath(DirectoryList::CONFIG);
     if ($fileKey) {
         $result = @(include $path . '/' . $this->configFilePool->getPath($fileKey));
     } else {
         $configFiles = $this->configFilePool->getPaths();
         $result = [];
         foreach (array_keys($configFiles) as $fileKey) {
             $configFile = $path . '/' . $this->configFilePool->getPath($fileKey);
             $fileData = @(include $configFile);
             if (!empty($fileData)) {
                 $intersection = array_intersect_key($result, $fileData);
                 if (!empty($intersection)) {
                     $displayList = '';
                     foreach (array_keys($intersection) as $key) {
                         $displayList .= $key . PHP_EOL;
                     }
                     throw new \Exception("Key collision! The following keys occur in multiple config files:" . PHP_EOL . $displayList);
                 }
                 $result = array_merge($result, $fileData);
             }
         }
     }
     return $result ?: [];
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:33,代码来源:Reader.php

示例4: load

 /**
  * Loads the configuration file
  *
  * @param string $fileKey
  * @return array
  * @throws \Exception
  */
 public function load($fileKey = null)
 {
     $path = $this->dirList->getPath(DirectoryList::CONFIG);
     $fileDriver = $this->driverPool->getDriver(DriverPool::FILE);
     $result = [];
     if ($fileKey) {
         $filePath = $path . '/' . $this->configFilePool->getPath($fileKey);
         if ($fileDriver->isExists($filePath)) {
             $result = (include $filePath);
         }
     } else {
         $configFiles = $this->configFilePool->getPaths();
         $allFilesData = [];
         $result = [];
         foreach (array_keys($configFiles) as $fileKey) {
             $configFile = $path . '/' . $this->configFilePool->getPath($fileKey);
             if ($fileDriver->isExists($configFile)) {
                 $fileData = (include $configFile);
             } else {
                 continue;
             }
             $allFilesData[$configFile] = $fileData;
             if (!empty($fileData)) {
                 $intersection = array_intersect_key($result, $fileData);
                 if (!empty($intersection)) {
                     $displayMessage = $this->findFilesWithKeys(array_keys($intersection), $allFilesData);
                     throw new \Exception("Key collision! The following keys occur in multiple config files:" . PHP_EOL . $displayMessage);
                 }
                 $result = array_merge($result, $fileData);
             }
         }
     }
     return $result ?: [];
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:41,代码来源:Reader.php

示例5: updateTranslationFileContent

 /**
  * @param string $content
  * @return void
  */
 public function updateTranslationFileContent($content)
 {
     $translationDir = $this->directoryList->getPath(DirectoryList::STATIC_VIEW) . \DIRECTORY_SEPARATOR . $this->assetRepo->getStaticViewFileContext()->getPath();
     if (!$this->driverFile->isExists($this->getTranslationFileFullPath())) {
         $this->driverFile->createDirectory($translationDir, \Magento\Framework\Filesystem\Driver\File::WRITEABLE_DIRECTORY_MODE);
     }
     $this->driverFile->filePutContents($this->getTranslationFileFullPath(), $content);
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:12,代码来源:FileManager.php

示例6: updateTranslationFileContent

 /**
  * @param string $content
  * @return void
  */
 public function updateTranslationFileContent($content)
 {
     $translationDir = $this->directoryList->getPath(DirectoryList::STATIC_VIEW) . \DIRECTORY_SEPARATOR . $this->assetRepo->getStaticViewFileContext()->getPath();
     if (!$this->driverFile->isExists($this->getTranslationFileFullPath())) {
         $this->driverFile->createDirectory($translationDir);
     }
     $this->driverFile->filePutContents($this->getTranslationFileFullPath(), $content);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:FileManager.php

示例7: findComposerJson

 /**
  * Find absolute path to root Composer json file
  *
  * @return string
  * @throws \Exception
  */
 public function findComposerJson()
 {
     $composerJson = $this->directoryList->getPath(DirectoryList::ROOT) . '/composer.json';
     $composerJson = realpath($composerJson);
     if ($composerJson === false) {
         throw new \Exception('Composer file not found');
     }
     return $composerJson;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:15,代码来源:ComposerJsonFinder.php

示例8: getApplicationNonWritableDirectories

 /**
  * Retrieve list of recommended non-writable directories for application
  *
  * @return array
  */
 public function getApplicationNonWritableDirectories()
 {
     if (!$this->applicationNonWritableDirectories) {
         $data = [DirectoryList::CONFIG];
         foreach ($data as $code) {
             $this->applicationNonWritableDirectories[$code] = $this->directoryList->getPath($code);
         }
     }
     return array_values($this->applicationNonWritableDirectories);
 }
开发者ID:ViniciusAugusto,项目名称:magento2,代码行数:15,代码来源:FilePermissions.php

示例9: testDirectoriesCustomization

 public function testDirectoriesCustomization()
 {
     $config = [DirectoryList::APP => [DirectoryList::PATH => 'foo', DirectoryList::URL_PATH => 'bar']];
     $object = new DirectoryList('/root/dir', $config);
     $this->assertFileExists($object->getPath(DirectoryList::SYS_TMP));
     $this->assertEquals('/root/dir/foo', $object->getPath(DirectoryList::APP));
     $this->assertEquals('bar', $object->getUrlPath(DirectoryList::APP));
     $this->setExpectedException('\\Magento\\Framework\\Filesystem\\FilesystemException', "Unknown directory type: 'unknown'");
     $object->getPath('unknown');
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:10,代码来源:DirectoryListTest.php

示例10: load

 /**
  * Loads the configuration file
  *
  * @param string $configFile
  * @return array
  */
 public function load($configFile = null)
 {
     if ($configFile) {
         $file = $this->dirList->getPath(DirectoryList::CONFIG) . '/' . $configFile;
     } else {
         $file = $this->dirList->getPath(DirectoryList::CONFIG) . '/' . $this->file;
     }
     $result = @(include $file);
     return $result ?: [];
 }
开发者ID:opexsw,项目名称:magento2,代码行数:16,代码来源:Reader.php

示例11: findComposerJson

 /**
  * Find absolute path to root Composer json file
  *
  * @return string
  * @throws \Exception
  */
 public function findComposerJson()
 {
     // composer.json is in same directory as vendor
     $vendorPath = $this->directoryList->getPath(DirectoryList::CONFIG) . '/vendor_path.php';
     $vendorDir = (require "{$vendorPath}");
     $composerJson = $this->directoryList->getPath(DirectoryList::ROOT) . "/{$vendorDir}/../composer.json";
     $composerJson = realpath($composerJson);
     if ($composerJson === false) {
         throw new \Exception('Composer file not found');
     }
     return $composerJson;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:18,代码来源:ComposerJsonFinder.php

示例12: populateMappings

 /**
  * @param AutoloaderInterface $autoloader
  * @param DirectoryList $dirList
  * @return void
  */
 public static function populateMappings(AutoloaderInterface $autoloader, DirectoryList $dirList)
 {
     $generationDir = $dirList->getPath(DirectoryList::GENERATION);
     $frameworkDir = $dirList->getPath(DirectoryList::LIB_INTERNAL);
     $autoloader->addPsr4('Magento\\', [$generationDir . '/Magento/'], true);
     $autoloader->addPsr0('Cm_', $frameworkDir, true);
     $autoloader->addPsr0('Credis_', $frameworkDir, true);
     /** Required for Zend functionality */
     FileResolver::addIncludePath($frameworkDir);
     /** Required for code generation to occur */
     FileResolver::addIncludePath($generationDir);
     /** Required to autoload custom classes */
     $autoloader->addPsr0('', [$generationDir]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:19,代码来源:Populator.php

示例13: add

 public function add($contentFile, $cssFile)
 {
     $styleContent = preg_replace('/^\\/\\*[\\s\\S]+\\*\\//', '', file_get_contents($contentFile));
     if (empty($styleContent)) {
         return;
     }
     $mediaDir = $this->directoryList->getPath(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA);
     file_put_contents("{$mediaDir}/{$cssFile}", $styleContent, FILE_APPEND);
     $linkText = sprintf('<link  rel="stylesheet" type="text/css"  media="all" href="{{MEDIA_URL}}%s" />', $cssFile);
     $miscScriptsNode = 'design/head/includes';
     $miscScripts = $this->scopeConfig->getValue($miscScriptsNode);
     if (!$miscScripts || strpos($miscScripts, $linkText) === false) {
         $this->configWriter->save($miscScriptsNode, $miscScripts . $linkText);
         $this->configCacheType->clean();
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:16,代码来源:HeadStyle.php

示例14: __construct

 public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Module\ModuleList $moduleList, \Magento\Framework\App\Config\MutableScopeConfigInterface $scopeConfig, \Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\Session\SessionManagerInterface $session, \Wyomind\Core\Helper\Data $coreHelper, \Magento\Framework\Filesystem\Directory\ReadFactory $directoryRead, \Magento\Framework\Filesystem\File\ReadFactory $fileRead, \Magento\Framework\App\Filesystem\DirectoryList $directoryList, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [])
 {
     parent::__construct($context, $registry, $resource, $resourceCollection, $data);
     $this->_magentoVersion = $coreHelper->getMagentoVersion();
     $this->_moduleList = $moduleList;
     $this->_scopeConfig = $scopeConfig;
     $this->_urlBuilder = $urlBuilder;
     $this->_cacheManager = $context->getCacheManager();
     $this->_session = $session;
     $this->_coreHelper = $coreHelper;
     $root = $directoryList->getPath(\Magento\Framework\App\Filesystem\DirectoryList::ROOT);
     if (file_exists($root . "/vendor/wyomind/")) {
         $this->_directoryRead = $directoryRead->create($root . "/vendor/wyomind/");
     } else {
         $this->_directoryRead = $directoryRead->create($root . "/app/code/Wyomind/");
     }
     $this->_httpRead = $fileRead;
     $this->_directoryList = $directoryList;
     $this->_version = $this->_moduleList->getOne("Wyomind_Core")['setup_version'];
     $this->_refreshCache = false;
     $this->getValues();
     foreach ($this->_values as $ext) {
         $this->checkActivation($ext);
     }
     if ($this->_refreshCache) {
         $this->_cacheManager->clean(['config']);
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:28,代码来源:Notifications.php

示例15: addHeadInclude

 /**
  * Add Link to Head
  *
  * @return void
  */
 protected function addHeadInclude()
 {
     $styleContent = '';
     foreach ($this->moduleList->getNames() as $moduleName) {
         $fileName = substr($moduleName, strpos($moduleName, "_") + 1) . '/styles.css';
         $fileName = $this->fixtureHelper->getPath($fileName);
         if (!$fileName) {
             continue;
         }
         $style = file_get_contents($fileName);
         $styleContent .= preg_replace('/^\\/\\*[\\s\\S]+\\*\\//', '', $style);
     }
     if (empty($styleContent)) {
         return;
     }
     $mediaDir = $this->directoryList->getPath(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA);
     file_put_contents("{$mediaDir}/styles.css", $styleContent);
     $linkTemplate = '<link  rel="stylesheet" type="text/css"  media="all" href="%sstyles.css" />';
     $baseUrl = $this->baseUrl->getBaseUrl(['_type' => \Magento\Framework\UrlInterface::URL_TYPE_MEDIA]);
     $linkText = sprintf($linkTemplate, $baseUrl);
     $miscScriptsNode = 'design/head/includes';
     $miscScripts = $this->scopeConfig->getValue($miscScriptsNode);
     if (!$miscScripts || strpos($miscScripts, $linkText) === false) {
         $this->configWriter->save($miscScriptsNode, $miscScripts . $linkText);
         $this->configCacheType->clean();
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:32,代码来源:Setup.php


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