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


PHP PEAR_DependencyDB::singleton方法代码示例

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


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

示例1: _initializeDepDB

 function _initializeDepDB()
 {
     if (!isset($this->_dependencyDB)) {
         static $initializing = false;
         if (!$initializing) {
             $initializing = true;
             if (!$this->_config) {
                 // never used?
                 if (OS_WINDOWS) {
                     $file = 'pear.ini';
                 } else {
                     $file = '.pearrc';
                 }
                 $this->_config =& new PEAR_Config($this->statedir . DIRECTORY_SEPARATOR . $file, '-');
                 // NO SYSTEM INI FILE
                 $this->_config->setRegistry($this);
                 $this->_config->set('php_dir', $this->install_dir);
             }
             $this->_dependencyDB =& PEAR_DependencyDB::singleton($this->_config);
             if (PEAR::isError($this->_dependencyDB)) {
                 // attempt to recover by removing the dep db
                 if (file_exists($this->_config->get('php_dir', null, 'pear.php.net') . DIRECTORY_SEPARATOR . '.depdb')) {
                     @unlink($this->_config->get('php_dir', null, 'pear.php.net') . DIRECTORY_SEPARATOR . '.depdb');
                 }
                 $this->_dependencyDB =& PEAR_DependencyDB::singleton($this->_config);
                 if (PEAR::isError($this->_dependencyDB)) {
                     echo $this->_dependencyDB->getMessage();
                     echo 'Unrecoverable error';
                     exit(1);
                 }
             }
             $initializing = false;
         }
     }
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:35,代码来源:Registry.php

示例2: getConfig

 public function getConfig()
 {
     if (!$this->_config) {
         $pear_dir = $this->getPearDir();
         $config = PEAR_Config::singleton($pear_dir . DS . 'pear.ini', '-');
         $config->set('auto_discover', 1);
         $config->set('cache_ttl', 60);
         #$config->set('preferred_state', 'beta');
         $config->set('bin_dir', $pear_dir);
         $config->set('php_dir', $pear_dir . DS . 'php');
         $config->set('download_dir', $pear_dir . DS . 'download');
         $config->set('temp_dir', $pear_dir . DS . 'temp');
         $config->set('data_dir', $pear_dir . DS . 'data');
         $config->set('cache_dir', $pear_dir . DS . 'cache');
         $config->set('test_dir', $pear_dir . DS . 'tests');
         $config->set('doc_dir', $pear_dir . DS . 'docs');
         foreach ($config->getKeys() as $key) {
             if (!(substr($key, 0, 5) === 'mage_' && substr($key, -4) === '_dir')) {
                 continue;
             }
             $config->set($key, preg_replace('#^\\.#', $this->getBaseDir(), $config->get($key)));
             #echo $key.' : '.$config->get($key).'<br>';
         }
         $reg = $this->getRegistry();
         $config->setRegistry($reg);
         PEAR_DependencyDB::singleton($config, $pear_dir . DS . 'php' . DS . '.depdb');
         PEAR_Frontend::setFrontendObject($this->getFrontend());
         #PEAR_Command::registerCommands(false, $pear_dir.DS.'php'.DS.'PEAR'.DS.'Command'.DS);
         $this->_config = $config;
     }
     return $this->_config;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:32,代码来源:Pear.php

示例3: PEAR_Dependency2

 /**
  * @param PEAR_Config
  * @param array installation options
  * @param array format of PEAR_Registry::parsedPackageName()
  * @param int installation state (one of PEAR_VALIDATE_*)
  */
 function PEAR_Dependency2(&$config, $installoptions, $package, $state = PEAR_VALIDATE_INSTALLING)
 {
     $this->_config =& $config;
     $this->_registry =& $config->getRegistry();
     $this->_dependencydb =& PEAR_DependencyDB::singleton($config);
     $this->_options = $installoptions;
     $this->_state = $state;
     $this->_os = new OS_Guess();
     $this->_currentPackage = $package;
 }
开发者ID:alex-k,项目名称:velotur,代码行数:16,代码来源:Dependency2.php

示例4: sortPackagesForUninstall

 /**
  * Sort a list of arrays of array(downloaded packagefilename) by dependency.
  *
  * It also removes duplicate dependencies
  * @param array an array of PEAR_PackageFile_v[1/2] objects
  * @return array|PEAR_Error array of array(packagefilename, package.xml contents)
  */
 function sortPackagesForUninstall(&$packages)
 {
     $this->_dependencyDB =& PEAR_DependencyDB::singleton($this->config);
     if (PEAR::isError($this->_dependencyDB)) {
         return $this->_dependencyDB;
     }
     usort($packages, array(&$this, '_sortUninstall'));
 }
开发者ID:zseand,项目名称:kloxo,代码行数:15,代码来源:Installer.php

示例5: PEAR_Dependency2

 /**
  * @param PEAR_Config
  * @param array installation options
  * @param array format of PEAR_Registry::parsedPackageName()
  * @param int installation state (one of PEAR_VALIDATE_*)
  */
 function PEAR_Dependency2(&$config, $installoptions, $package, $state = PEAR_VALIDATE_INSTALLING)
 {
     $this->_config =& $config;
     if (!class_exists('PEAR_DependencyDB')) {
         require_once 'PEAR/DependencyDB.php';
     }
     if (isset($installoptions['packagingroot'])) {
         // make sure depdb is in the right location
         $config->setInstallRoot($installoptions['packagingroot']);
     }
     $this->_registry =& $config->getRegistry();
     $this->_dependencydb =& PEAR_DependencyDB::singleton($config);
     if (isset($installoptions['packagingroot'])) {
         $config->setInstallRoot(false);
     }
     $this->_options = $installoptions;
     $this->_state = $state;
     if (!class_exists('OS_Guess')) {
         require_once 'OS/Guess.php';
     }
     $this->_os = new OS_Guess();
     $this->_currentPackage = $package;
 }
开发者ID:upmunspel,项目名称:abiturient,代码行数:29,代码来源:Dependency2.php

示例6: __construct

 /**
  * Private constructor to initialize the instance
  * with the necessary data.
  *
  * @param string $baseDir The Magento base directory
  * @return void
  */
 public function __construct($baseDir)
 {
     // check if the passed Magento base directory exists
     if (!is_dir($baseDir)) {
         throw new Exception('Magento base directory ' . $baseDir . ' doesn\'t exists');
     }
     // load the PEAR directory for the Magento channel
     $pearDir = $baseDir . DS . 'downloader' . DS . 'pearlib';
     // check if the Magento PEAR directory exists
     if (!is_dir($pearDir)) {
         throw new Exception('Magento PEAR base directory ' . $pearDir . ' doesn\'t exists');
     }
     // load the registry
     $this->_registry = new PEAR_Registry($pearDir . DS . 'php');
     // initialize the configuration with the channels configuration file
     $this->_config = PEAR_Config::singleton($pearDir . DS . 'pear.ini', '-');
     // overwrite the configuration values
     $this->_config->set('auto_discover', 1);
     $this->_config->set('cache_ttl', 60);
     $this->_config->set('preferred_state', 'alpha');
     $this->_config->set('bin_dir', $pearDir);
     $this->_config->set('php_dir', $pearDir . DS . 'php');
     $this->_config->set('download_dir', $pearDir . DS . 'download');
     $this->_config->set('temp_dir', $pearDir . DS . 'temp');
     $this->_config->set('data_dir', $pearDir . DS . 'data');
     $this->_config->set('cache_dir', $pearDir . DS . 'cache');
     $this->_config->set('test_dir', $pearDir . DS . 'tests');
     $this->_config->set('doc_dir', $pearDir . DS . 'docs');
     // initialize the Magento specific settings
     foreach ($this->_config->getKeys() as $key) {
         if (!(substr($key, 0, 5) === 'mage_' && substr($key, -4) === '_dir')) {
             continue;
         }
         $this->_config->set($key, preg_replace('#^\\.#', addslashes(Mage::getBaseDir()), $this->_config->get($key)));
     }
     // set the registry
     $this->_config->setRegistry($this->_registry);
     // initialize the dependeny database
     PEAR_DependencyDB::singleton($this->_config, $pearDir . DS . 'php' . DS . '.depdb');
     // register the commands, including the one for Magento
     PEAR_Command::registerCommands(true, $pearDir . DS . 'php' . DS . 'PEAR' . DS . 'Command' . DS);
     // initialize the PEAR frontend
     PEAR_Frontend::setFrontendClass('Faett_Core_Frontend_PEAR');
     $this->_ui = PEAR_Command::getFrontendObject();
     $this->_ui->setConfig($this->_config);
     // set the callback for rendering the messages
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this->_ui, "log"));
 }
开发者ID:BGCX067,项目名称:faett-core-svn-to-git,代码行数:55,代码来源:Service.php

示例7: PEAR_Dependency2

 /**
  * @param PEAR_Config
  * @param array installation options
  * @param array format of PEAR_Registry::parsedPackageName()
  * @param int installation state (one of PEAR_VALIDATE_*)
  */
 function PEAR_Dependency2(&$config, $installoptions, $package, $state = PEAR_VALIDATE_INSTALLING)
 {
     $this->_config =& $config;
     $this->_registry =& $config->getRegistry();
     if (!class_exists('PEAR_DependencyDB')) {
         require_once 'PEAR/DependencyDB.php';
     }
     $this->_dependencydb =& PEAR_DependencyDB::singleton($config);
     $this->_options = $installoptions;
     $this->_state = $state;
     if (!class_exists('OS_Guess')) {
         require_once 'OS/Guess.php';
     }
     $this->_os = new OS_Guess();
     $this->_currentPackage = $package;
 }
开发者ID:BackupTheBerlios,项目名称:dilps,代码行数:22,代码来源:Dependency2.php


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