Author: Stig Bakken (ssb@php.net)
Author: Greg Beaver (cellog@php.net)
Inheritance: extends PEAR
コード例 #1
0
 /**
  * @param  string  $suiteClassName
  * @param  string  $suiteClassFile
  * @return ReflectionClass
  * @throws Exception
  * @access public
  */
 public function load($suiteClassName, $suiteClassFile = '')
 {
     $suiteClassName = str_replace('.php', '', $suiteClassName);
     $suiteClassFile = !empty($suiteClassFile) ? $suiteClassFile : str_replace('_', '/', $suiteClassName) . '.php';
     if (!class_exists($suiteClassName)) {
         if (!file_exists($suiteClassFile)) {
             $config = new PEAR_Config();
             $includePaths = explode(PATH_SEPARATOR, get_include_path());
             $includePaths[] = $config->get('test_dir');
             foreach ($includePaths as $includePath) {
                 $file = $includePath . DIRECTORY_SEPARATOR . $suiteClassFile;
                 if (file_exists($file)) {
                     $suiteClassFile = $file;
                     break;
                 }
             }
         }
         PHPUnit2_Util_Fileloader::checkAndLoad($suiteClassFile);
     }
     if (class_exists($suiteClassName)) {
         return new ReflectionClass($suiteClassName);
     } else {
         throw new Exception(sprintf('Class %s could not be found in %s.', $suiteClassName, $suiteClassFile));
     }
 }
コード例 #2
0
ファイル: Common.php プロジェクト: vojtajina/sitellite
 /**
  * This is called for each file to set up the directories and files
  * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
  * @param array attributes from the <file> tag
  * @param string file name
  * @return array an array consisting of:
  *
  *    1 the original, pre-baseinstalldir installation directory
  *    2 the final installation directory
  *    3 the full path to the final location of the file
  *    4 the location of the pre-installation file
  */
 function processInstallation($pkg, $atts, $file, $tmp_path, $layer = null)
 {
     if (!$this->_setup['locationconfig']) {
         return false;
     }
     if ($this->_setup['honorsbaseinstall']) {
         $dest_dir = $save_destdir = $this->config->get($this->_setup['locationconfig'], $layer, $pkg->getChannel());
         if (!empty($atts['baseinstalldir'])) {
             $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
         }
     } elseif ($this->_setup['unusualbaseinstall']) {
         $dest_dir = $save_destdir = $this->config->get($this->_setup['locationconfig'], null, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage();
         if (!empty($atts['baseinstalldir'])) {
             $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
         }
     } else {
         $dest_dir = $save_destdir = $this->config->get($this->_setup['locationconfig'], null, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage();
     }
     if (dirname($file) != '.' && empty($atts['install-as'])) {
         $dest_dir .= DIRECTORY_SEPARATOR . dirname($file);
     }
     if (empty($atts['install-as'])) {
         $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file);
     } else {
         $dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as'];
     }
     $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file;
     // Clean up the DIRECTORY_SEPARATOR mess
     $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
     list($dest_dir, $dest_file, $orig_file) = preg_replace(array('!\\\\+!', '!/!', "!{$ds2}+!"), array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), array($dest_dir, $dest_file, $orig_file));
     return array($save_destdir, $dest_dir, $dest_file, $orig_file);
 }
コード例 #3
0
 /**
  * Initialize Task.
  * This method includes any necessary PHPUnit2 libraries and triggers
  * appropriate error if they cannot be found.  This is not done in header
  * because we may want this class to be loaded w/o triggering an error.
  */
 function init()
 {
     if (version_compare(PHP_VERSION, '5.0.3') < 0) {
         throw new BuildException("PHPUnit2Task requires PHP version >= 5.0.3.", $this->getLocation());
     }
     /**
      * Ugly hack to get PHPUnit version number
      */
     $config = new PEAR_Config();
     $registry = new PEAR_Registry($config->get('php_dir'));
     $pkg_info = $registry->_packageInfo("PHPUnit", null, "pear.phpunit.de");
     if ($pkg_info != NULL) {
         if (version_compare($pkg_info['version']['api'], "3.0.0") >= 0) {
             PHPUnitUtil::$installedVersion = 3;
         } else {
             PHPUnitUtil::$installedVersion = 2;
         }
     } else {
         /**
          * Try to find PHPUnit2
          */
         require_once 'PHPUnit2/Util/Filter.php';
         if (!class_exists('PHPUnit2_Util_Filter')) {
             throw new BuildException("PHPUnit2Task depends on PEAR PHPUnit2 package being installed.", $this->getLocation());
         }
         PHPUnitUtil::$installedVersion = 2;
     }
     // other dependencies that should only be loaded when class is actually used.
     require_once 'phing/tasks/ext/phpunit/PHPUnitTestRunner.php';
     require_once 'phing/tasks/ext/phpunit/BatchTest.php';
     require_once 'phing/tasks/ext/phpunit/FormatterElement.php';
     //require_once 'phing/tasks/ext/phpunit/SummaryPHPUnit2ResultFormatter.php';
     // add some defaults to the PHPUnit filter
     if (PHPUnitUtil::$installedVersion == 3) {
         require_once 'PHPUnit/Util/Filter.php';
         // point PHPUnit_MAIN_METHOD define to non-existing method
         define('PHPUnit_MAIN_METHOD', 'PHPUnitTask::undefined');
         PHPUnit_Util_Filter::addFileToFilter('PHPUnitTask.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('PHPUnitTestRunner.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing/Task.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing/Target.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing/Project.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing/Phing.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing.php', 'PHING');
     } else {
         require_once 'PHPUnit2/Util/Filter.php';
         PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTask.php');
         PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTestRunner.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing/Task.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing/Target.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing/Project.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing/Phing.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing.php');
     }
 }
コード例 #4
0
ファイル: Pear.php プロジェクト: arslbbt/mangentovies
 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;
 }
コード例 #5
0
ファイル: Role.php プロジェクト: jubinpatel/horde
 /**
  * Run task after prompt.
  *
  * @param array $info   Parameter array.
  * @param string $name  Postinstall phase.
  */
 public function run($info, $phase)
 {
     if ($phase !== 'first') {
         return;
     }
     if (!$this->_config->set('horde_dir', $info['horde_dir'], 'user', 'pear.horde.org')) {
         print "Could not save horde_dir configuration value to PEAR config.\n";
         return;
     }
     $res = $this->_config->writeConfigFile();
     if ($res instanceof PEAR_Error) {
         print 'ERROR: ' . $res->getMessage() . "\n";
         exit;
     }
     print "Configuration successfully saved to PEAR config.\n";
 }
コード例 #6
0
ファイル: Horde.php プロジェクト: raz0rsdge/horde
 function setup(&$installer, $pkg, $atts, $file)
 {
     /* Check for proper setup. */
     $pear_config = PEAR_Config::singleton();
     if (!$pear_config->get('horde_dir')) {
         return PEAR::raiseError('Missing "horde_dir" configuration in PEAR.');
     }
 }
コード例 #7
0
ファイル: Migration.php プロジェクト: raz0rsdge/horde
 /**
  * Constructor.
  *
  * Searches all installed applications and libraries for migration
  * directories and builds lists of migrateable modules and directories.
  *
  * @param string $basedir   Base directory of a Git checkout. If provided
  *                          a framework/ sub directory is searched for
  *                          migration scripts too.
  * @param string $pearconf  Path to a PEAR configuration file.
  */
 public function __construct($basedir = null, $pearconf = null)
 {
     // Loop through all applications.
     foreach ($GLOBALS['registry']->listAllApps() as $app) {
         $dir = $GLOBALS['registry']->get('fileroot', $app) . '/migration';
         if (is_dir($dir)) {
             $this->apps[] = $app;
             $this->_lower[] = Horde_String::lower($app);
             $this->dirs[] = realpath($dir);
         }
     }
     // Silence PEAR errors.
     $old_error_reporting = error_reporting();
     error_reporting($old_error_reporting & ~E_DEPRECATED);
     $pear = new PEAR_Config($pearconf);
     // Loop through local framework checkout.
     if ($basedir) {
         $packageFile = new PEAR_PackageFile($pear);
         foreach (glob($basedir . '/framework/*/migration') as $dir) {
             $package = $packageFile->fromPackageFile(dirname($dir) . '/package.xml', PEAR_VALIDATE_NORMAL);
             if ($package instanceof PEAR_Error) {
                 Horde::log(sprintf('%s: %s', $package->getMessage(), print_r($package->getUserInfo(), true)), Horde_Log::ERR);
                 continue;
             }
             $this->apps[] = $package->getName();
             $this->_lower[] = Horde_String::lower($package->getName());
             $this->dirs[] = realpath($dir);
         }
     }
     // Loop through installed PEAR packages.
     $registry = $pear->getRegistry();
     foreach (glob($pear->get('data_dir') . '/*/migration') as $dir) {
         $package = $registry->getPackage(basename(dirname($dir)), 'pear.horde.org');
         if ($package == false) {
             Horde::log("Ignoring package in directory {$dir}", Horde_Log::WARN);
             continue;
         }
         $app = $package->getName();
         if (!in_array($app, $this->apps)) {
             $this->apps[] = $app;
             $this->_lower[] = Horde_String::lower($app);
             $this->dirs[] = realpath($dir);
         }
     }
     error_reporting($old_error_reporting);
 }
コード例 #8
0
ファイル: ExportCSV.php プロジェクト: vih/intranet.vih.dk
 function renderTxt()
 {
     $date = date('Y-m-d');
     if ($this->query('date')) {
         $post = $this->query();
         $date = $post['date']['Y'] . '-' . $post['date']['M'] . '-' . $post['date']['d'];
     }
     // Ensures that PEAR uses correct config file.
     PEAR_Config::singleton(PATH_ROOT . '.pearrc');
     $this->db->query("SELECT tilmelding.id, tilmelding.dato_slut\n            FROM langtkursus_tilmelding tilmelding\n                INNER JOIN langtkursus ON langtkursus.id = tilmelding.kursus_id\n                INNER JOIN adresse ON tilmelding.adresse_id = adresse.id\n            WHERE\n                ((tilmelding.dato_slut > langtkursus.dato_slut AND tilmelding.dato_start < DATE_ADD('{$date}', INTERVAL 3 DAY) AND tilmelding.dato_slut > NOW())\n                OR (tilmelding.dato_slut <= langtkursus.dato_slut AND tilmelding.dato_start < DATE_ADD('{$date}', INTERVAL 3 DAY) AND tilmelding.dato_slut > '{$date}')\n                OR (tilmelding.dato_slut = '0000-00-00' AND langtkursus.dato_start < DATE_ADD('{$date}', INTERVAL 3 DAY) AND langtkursus.dato_slut > '{$date}'))\n                AND tilmelding.active = 1\n            ORDER BY adresse.fornavn ASC, adresse.efternavn ASC");
     $list = array();
     $i = 0;
     while ($this->db->nextRecord()) {
         $t = new VIH_Model_LangtKursus_Tilmelding($this->db->f('id'));
         // strange way to do it, but only way to get the header match data!
         $list[$i][3] = $t->get('navn');
         $list[$i][5] = $t->get('email');
         $list[$i][6] = $t->get('adresse');
         $list[$i][7] = $t->get('postby');
         $list[$i][8] = $t->get('postnr');
         $list[$i][11] = $t->get('telefon');
         // $list[$i][10] = $t->get('nationalitet');
         $list[$i][13] = $t->get('mobil');
         $i++;
     }
     $address_book = new Contact_AddressBook();
     $csv_builder = $address_book->createBuilder('csv_wab');
     if (PEAR::isError($csv_builder)) {
         throw new Exception('CSV_builder error: ' . $csv_builder->getUserInfo());
     }
     $result = $csv_builder->setData($list);
     if (PEAR::isError($result)) {
         throw new Exception('CSV_builder data error: ' . $result->getUserInfo());
     }
     // @todo some error in the build. It has been traced back to getConfig();
     $result = $csv_builder->build();
     if (PEAR::isError($result)) {
         throw new Exception('CSV_builder build error: ' . $result->getUserInfo());
     }
     // This could be nice, but there is an error in the method!
     // echo $csv_builder->download('holdliste');
     // instead the following should do the job!
     if (headers_sent()) {
         throw new Exception('Cannot process headers, headers already sent');
     }
     $filename = 'holdliste.csv';
     if (Net_UserAgent_Detect::isIE()) {
         // IE need specific headers
         header('Content-Disposition: inline; filename="' . $filename . '"');
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         header('Pragma: public');
     } else {
         header('Content-Disposition: attachment; filename="' . $filename . '"');
         header('Pragma: no-cache');
     }
     header('Content-Type: ' . $csv_builder->mime);
     return $csv_builder->result;
 }
コード例 #9
0
ファイル: Package.php プロジェクト: alex-k/velotur
 /**
  * @param array output of package.getDownloadURL
  * @param string|array|object information for detecting packages to be downloaded, and
  *                            for errors
  * @param array name information of the package
  * @param array|null packages to be downloaded
  * @access private
  */
 function _analyzeDownloadURL($info, $param, $pname, $params = null)
 {
     if (!is_string($param) && PEAR_Downloader_Package::willDownload($param, $params)) {
         return false;
     }
     if (!$info) {
         if (!is_string($param)) {
             $saveparam = ", cannot download \"{$param}\"";
         } else {
             $saveparam = '';
         }
         // no releases exist
         return PEAR::raiseError('No releases for package "' . $this->_registry->parsedPackageNameToString($pname, true) . '" exist' . $saveparam);
     }
     if (strtolower($info['info']->getChannel()) != strtolower($pname['channel'])) {
         $err = false;
         if ($pname['channel'] == 'pear.php.net') {
             if ($info['info']->getChannel() != 'pecl.php.net') {
                 $err = true;
             }
         } else {
             $err = true;
         }
         if ($err) {
             return PEAR::raiseError('SECURITY ERROR: package in channel "' . $pname['channel'] . '" retrieved another channel\'s name for download! ("' . $info['info']->getChannel() . '")');
         }
     }
     if (!isset($info['url'])) {
         // releases exist, but we failed to get any
         if (isset($this->_downloader->_options['force'])) {
             if (isset($pname['version'])) {
                 $vs = ', version "' . $pname['version'] . '"';
             } elseif (isset($pname['state'])) {
                 $vs = ', stability "' . $pname['state'] . '"';
             } else {
                 $vs = ' within preferred state ' . $this->_config->get('preferred_state') . '"';
             }
             if (!isset($options['soft'])) {
                 $this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] . '/' . $pname['package'] . $vs . ', will instead download version ' . $info['version'] . ', stability "' . $info['info']->getState() . '"');
             }
             // download the latest release
             return $this->_downloader->_getPackageDownloadUrl(array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version']));
         } else {
             // construct helpful error message
             if (isset($pname['version'])) {
                 $vs = ', version "' . $pname['version'] . '"';
             } elseif (isset($pname['state'])) {
                 $vs = ', stability "' . $pname['state'] . '"';
             } else {
                 $vs = ' within preferred state ' . $this->_downloader->config->get('preferred_state') . '"';
             }
             $err = PEAR::raiseError('Failed to download ' . $this->_registry->parsedPackageNameToString(array('channel' => $pname['channel'], 'package' => $pname['package']), true) . $vs . ', latest release is version ' . $info['version'] . ', stability "' . $info['info']->getState() . '", use "' . $this->_registry->parsedPackageNameToString(array('channel' => $pname['channel'], 'package' => $pname['package'], 'version' => $info['version'])) . '" to install');
             return $err;
         }
     }
     return $info;
 }
コード例 #10
0
ファイル: SqlTest.php プロジェクト: jubinpatel/horde
 public static function setUpBeforeClass()
 {
     self::$_migrationDir = __DIR__ . '/../../../../migration/Horde/Lock';
     if (!is_dir(self::$_migrationDir)) {
         error_reporting(E_ALL & ~E_DEPRECATED);
         self::$_migrationDir = PEAR_Config::singleton()->get('data_dir', null, 'pear.horde.org') . '/Horde_Lock/migration';
         error_reporting(E_ALL | E_STRICT);
     }
 }
コード例 #11
0
ファイル: Pear.php プロジェクト: mikejw/empathy
 public static function getConfigDir()
 {
     $er = error_reporting();
     error_reporting(0);
     require_once 'PEAR/Config.php';
     $global_config_dir = \PEAR_Config::singleton()->get('cfg_dir');
     error_reporting($er);
     return $global_config_dir;
 }
コード例 #12
0
ファイル: RunTest.php プロジェクト: manishkhanchandani/mkgxy
 /**
  * An object that supports the PEAR_Common->log() signature, or null
  * @param PEAR_Common|null
  */
 function PEAR_RunTest($logger = null, $options = array())
 {
     $this->ini_overwrites[] = 'error_reporting=' . E_ALL;
     if (is_null($logger)) {
         require_once 'PEAR/Common.php';
         $logger = new PEAR_Common();
     }
     $this->_logger = $logger;
     $this->_options = $options;
     $conf =& PEAR_Config::singleton();
     $this->_php = $conf->get('php_bin');
 }
コード例 #13
0
 /**
  * Constructor for the data repository
  */
 private function __construct()
 {
     $pearDataDir = PEAR_Config::singleton()->get('data_dir') . DIRECTORY_SEPARATOR . 'Xinc';
     $customInstallDataDir = dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'data';
     if (is_dir($pearDataDir)) {
         $this->baseDir = $pearDataDir;
     } else {
         if (is_dir($customInstallDataDir)) {
             $this->baseDir = $customInstallDataDir;
         }
     }
 }
コード例 #14
0
ファイル: Base.php プロジェクト: raz0rsdge/horde
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     self::$logger = new Horde_Log_Logger(new Horde_Log_Handler_Cli());
     //self::$db->setLogger(self::$logger);
     self::$dir = __DIR__ . '/../../../../migration/Horde/History';
     if (!is_dir(self::$dir)) {
         error_reporting(E_ALL & ~E_DEPRECATED);
         self::$dir = PEAR_Config::singleton()->get('data_dir', null, 'pear.horde.org') . '/Horde_History/migration';
         error_reporting(E_ALL | E_STRICT);
     }
     self::$history = new Horde_History_Sql('test_user', self::$db);
 }
コード例 #15
0
ファイル: v2.php プロジェクト: harryboulderdash/PlayGFC
 /**
  * Initialize post-install scripts for running
  *
  * This method can be used to detect post-install scripts, as the return value
  * indicates whether any exist
  * @return bool
  */
 function initPostinstallScripts()
 {
     $filelist = $this->getFilelist();
     $contents = $this->getContents();
     $contents = $contents['dir']['file'];
     if (!is_array($contents) || !isset($contents[0])) {
         $contents = array($contents);
     }
     $taskfiles = array();
     foreach ($contents as $file) {
         $atts = $file['attribs'];
         unset($file['attribs']);
         if (count($file)) {
             $taskfiles[$atts['name']] = $file;
         }
     }
     $common = new PEAR_Common();
     $common->debug = $this->_config->get('verbose');
     $this->_scripts = array();
     foreach ($taskfiles as $name => $tasks) {
         if (!isset($filelist[$name])) {
             // file was not installed due to installconditions
             continue;
         }
         $atts = $filelist[$name];
         foreach ($tasks as $tag => $raw) {
             $taskname = $this->getTask($tag);
             $task =& new $taskname($this->_config, $common, PEAR_TASK_INSTALL);
             if (!$task->isScript()) {
                 continue;
                 // scripts are only handled after installation
             }
             $lastversion = isset($this->_packageInfo['_lastversion']) ? $this->_packageInfo['_lastversion'] : null;
             $task->init($raw, $atts, $lastversion);
             $res = $task->startSession($this, $atts['installed_as']);
             if (!$res) {
                 continue;
                 // skip this file
             }
             if (PEAR::isError($res)) {
                 return $res;
             }
             $assign =& $task;
             $this->_scripts[] =& $assign;
         }
     }
     if (count($this->_scripts)) {
         return true;
     }
     return false;
 }
コード例 #16
0
ファイル: Base.php プロジェクト: horde/horde
 protected function _getCache($params = array())
 {
     $logger = new Horde_Log_Logger(new Horde_Log_Handler_Cli());
     //$this->db->setLogger($logger);
     $dir = __DIR__ . '/../../../../migration/Horde/Cache';
     if (!is_dir($dir)) {
         error_reporting(E_ALL & ~E_DEPRECATED);
         $dir = PEAR_Config::singleton()->get('data_dir', null, 'pear.horde.org') . '/Horde_Cache/migration';
         error_reporting(E_ALL | E_STRICT);
     }
     $this->migrator = new Horde_Db_Migration_Migrator($this->db, null, array('migrationsPath' => $dir, 'schemaTableName' => 'horde_cache_schema_info'));
     $this->migrator->up();
     return new Horde_Cache(new Horde_Cache_Storage_File(array_merge(array('db' => $this->db), $params)));
 }
コード例 #17
0
ファイル: Base.php プロジェクト: jubinpatel/horde
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $logger = new Horde_Log_Logger(new Horde_Log_Handler_Cli());
     //self::$db->setLogger($logger);
     $dir = __DIR__ . '/../../../../../migration/Horde/Alarm';
     if (!is_dir($dir)) {
         error_reporting(E_ALL & ~E_DEPRECATED);
         $dir = PEAR_Config::singleton()->get('data_dir', null, 'pear.horde.org') . '/Horde_Alarm/migration';
         error_reporting(E_ALL | E_STRICT);
     }
     self::$migrator = new Horde_Db_Migration_Migrator(self::$db, null, array('migrationsPath' => $dir, 'schemaTableName' => 'horde_alarm_test_schema'));
     self::$migrator->up();
 }
コード例 #18
0
ファイル: Gnupg.php プロジェクト: cheeepsan/pear-core
 function createGpgCmd()
 {
     if ($this->_config->get('sig_type') != 'gpg') {
         return PEAR::raiseError("only support 'gpg' for signature type");
     }
     $sig_bin = $this->_config->get('sig_bin');
     if (empty($sig_bin) || !file_exists($sig_bin)) {
         return PEAR::raiseError("can't access gpg binary: {$sig_bin}");
     }
     $keyid = trim($this->_config->get('sig_keyid'));
     $keydir = trim($this->_config->get('sig_keydir'));
     if (strlen($keydir) && !file_exists($keydir) && !@mkdir($keydir)) {
         return PEAR::raiseError("sig_keydir '{$keydir}' doesn't exist or is not accessible");
     }
     $cmd = escapeshellcmd($sig_bin);
     if (strlen($keyid)) {
         $cmd .= " --default-key " . escapeshellarg($keyid);
     }
     if (strlen($keydir)) {
         $cmd .= " --homedir " . escapeshellarg($keydir);
     }
     return $cmd;
 }
コード例 #19
0
 /**
  * This is called for each file to set up the directories and files
  * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
  * @param array attributes from the <file> tag
  * @param string file name
  * @return array an array consisting of:
  *
  *    1 the original, pre-baseinstalldir installation directory
  *    2 the final installation directory
  *    3 the full path to the final location of the file
  *    4 the location of the pre-installation file
  */
 function processInstallation($pkg, $atts, $file, $tmp_path, $layer = null)
 {
     $role = $this->getRoleFromClass();
     $info = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' . $role);
     if (PEAR::isError($info)) {
         return $info;
     }
     if (!$info['locationconfig']) {
         return false;
     }
     if ($info['honorsbaseinstall']) {
         $dest_dir = $save_destdir = $this->config->get($info['locationconfig'], $layer, $pkg->getChannel());
         if (!empty($atts['baseinstalldir'])) {
             $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
         }
     } elseif ($info['unusualbaseinstall']) {
         $dest_dir = $save_destdir = $this->config->get($info['locationconfig'], $layer, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage();
         if (!empty($atts['baseinstalldir'])) {
             $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
         }
     } else {
         $save_destdir = $dest_dir = $this->config->get($info['locationconfig'], $layer, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage();
     }
     if (dirname($file) != '.' && empty($atts['install-as'])) {
         $dest_dir .= DIRECTORY_SEPARATOR . dirname($file);
     }
     if (empty($atts['install-as'])) {
         $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file);
     } else {
         $dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as'];
     }
     $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file;
     // Clean up the DIRECTORY_SEPARATOR mess
     $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
     list($dest_dir, $dest_file, $orig_file) = preg_replace(array('!\\\\+!', '!/!', "!{$ds2}+!"), array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), array($dest_dir, $dest_file, $orig_file));
     return array($save_destdir, $dest_dir, $dest_file, $orig_file);
 }
コード例 #20
0
ファイル: Downloader.php プロジェクト: hendricson/couponator
 function getPackageDownloadUrl($package, $version = null)
 {
     if ($version) {
         $package .= "-{$version}";
     }
     if ($this === null || $this->_config === null) {
         $package = "http://pear.php.net/get/{$package}";
     } else {
         $package = "http://" . $this->_config->get('master_server') . "/get/{$package}";
     }
     if (!extension_loaded("zlib")) {
         $package .= '?uncompress=yes';
     }
     return $package;
 }
コード例 #21
0
ファイル: Base.php プロジェクト: raz0rsdge/horde
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $logger = new Horde_Log_Logger(new Horde_Log_Handler_Cli());
     //self::$db->setLogger($logger);
     $dir = dirname(__FILE__) . '/../../../../../migration/Horde/SessionHandler';
     if (!is_dir($dir)) {
         error_reporting(E_ALL & ~E_DEPRECATED);
         $dir = PEAR_Config::singleton()->get('data_dir', null, 'pear.horde.org') . '/Horde_SessionHandler/migration';
         error_reporting(E_ALL | E_STRICT);
     }
     self::$migrator = new Horde_Db_Migration_Migrator(self::$db, null, array('migrationsPath' => $dir, 'schemaTableName' => 'horde_sessionhandler_schema_info'));
     self::$migrator->up();
     self::$handler = new Horde_SessionHandler_Storage_Sql(array('db' => self::$db));
 }
コード例 #22
0
 /**
  * Set up the registry/location of dependency DB
  * @param PEAR_Config|false
  * @param string|false full path to the dependency database, or false to use default
  */
 function setConfig(&$config, $depdb = false)
 {
     if (!$config) {
         $this->_config =& PEAR_Config::singleton();
     } else {
         $this->_config =& $config;
     }
     $this->_registry =& $this->_config->getRegistry();
     if (!$depdb) {
         $this->_depdb = $this->_config->get('php_dir', null, 'pear.php.net') . DIRECTORY_SEPARATOR . '.depdb';
     } else {
         $this->_depdb = $depdb;
     }
     $this->_lockfile = dirname($this->_depdb) . DIRECTORY_SEPARATOR . '.depdblock';
 }
コード例 #23
0
ファイル: Base.php プロジェクト: raz0rsdge/horde
 public static function setUpBeforeClass()
 {
     //$logger = new Horde_Log_Logger(new Horde_Log_Handler_Cli());
     //self::$db->setLogger($logger);
     $dir = __DIR__ . '/../../../../../../migration/Horde/Prefs';
     if (!is_dir($dir)) {
         error_reporting(E_ALL & ~E_DEPRECATED);
         $dir = PEAR_Config::singleton()->get('data_dir', null, 'pear.horde.org') . '/Horde_Prefs/migration';
         error_reporting(E_ALL | E_STRICT);
     }
     self::$migrator = new Horde_Db_Migration_Migrator(self::$db, null, array('migrationsPath' => $dir, 'schemaTableName' => 'horde_prefs_schema_info'));
     self::$migrator->up();
     self::$db->insert('INSERT INTO horde_prefs (pref_uid, pref_scope, pref_name, pref_value) VALUES (?, ?, ?, ?)', array('joe', 'horde', 'theme', new Horde_Db_Value_Binary('silver')));
     self::$prefs = new Horde_Prefs_Storage_Sql('joe', array('db' => self::$db));
 }
コード例 #24
0
ファイル: apidoc-queue.php プロジェクト: stof/pearweb
 /**
  * Returns information about a package file.  Expects the name of
  * a gzipped tar file as input.
  *
  * @param string  $file  name of .tgz file
  *
  * @return array  array with package information
  *
  * @access public
  * @deprecated use PEAR_PackageFile->fromTgzFile() instead
  *
  */
 function infoFromTgzFile($file)
 {
     $config =& PEAR_Config::singleton();
     $packagefile = new PEAR_PackageFile($config);
     $pf =& $packagefile->fromTgzFile($file, PEAR_VALIDATE_NORMAL);
     if (PEAR::isError($pf)) {
         $errs = $pf->getUserinfo();
         if (is_array($errs)) {
             foreach ($errs as $error) {
                 $e = $this->raiseError($error['message'], $error['code'], null, null, $error);
             }
         }
         return $pf;
     }
     return $this->_postProcessValidPackagexml($pf);
 }
コード例 #25
0
 public function __construct()
 {
     // Create the local PEAR config.
     if (!@(include_once 'PEAR/Config.php') || !@(include_once 'PEAR/PackageFile.php')) {
         throw new Exception('PEAR libraries are not in the PHP include_path.');
     }
     /* We are heavily relying on the PEAR libraries which are not clean
      * with regard to E_STRICT. */
     if (defined('E_DEPRECATED')) {
         error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);
     } else {
         error_reporting(E_ALL & ~E_STRICT);
     }
     $pear_config = PEAR_Config::singleton();
     $this->pear_pkg = new PEAR_PackageFile($pear_config);
 }
コード例 #26
0
ファイル: PearLocal.php プロジェクト: hiroki-ta/my.project
 /**
  *  config for local.
  *
  *  @return true|Ethna_Error
  *  @access private 
  */
 protected function _setLocalConfig()
 {
     $true = true;
     // determine dirs
     $base = $this->target_ctl->getBaseDir();
     $bin = $this->target_ctl->getDirectory('bin');
     $tmp = $this->target_ctl->getDirectory('tmp');
     $lib = "{$base}/lib";
     $dirs = array('php_dir' => "{$lib}", 'bin_dir' => "{$base}/bin", 'cache_dir' => "{$tmp}/.pear/cache", 'download_dir' => "{$lib}/.pear/download", 'temp_dir' => "{$lib}/.pear/temp", 'doc_dir' => "{$lib}/.pear/doc", 'ext_dir' => "{$lib}/.pear/ext", 'data_dir' => "{$lib}/.pear/data", 'test_dir' => "{$lib}/.pear/test");
     $default_pearrc = "{$base}" . DIRECTORY_SEPARATOR . "lib" . DIRECTORY_SEPARATOR . "pear.conf";
     $app_config = $this->target_ctl->getConfig();
     $app_pearrc = $app_config->get('app_pear_local_config');
     $pearrc = empty($app_pearrc) ? $default_pearrc : "{$base}/{$app_pearrc}";
     $this->conf_file = $pearrc;
     $this->config = PEAR_Config::singleton($pearrc);
     // read local .pearrc if exists.
     if (is_file($pearrc) && is_readable($pearrc)) {
         $this->config->readConfigFile($pearrc);
     }
     // set dirs to config
     foreach ($dirs as $key => $dir) {
         $_dir = $this->config->get($key, 'user');
         if (!isset($_dir)) {
             if (is_dir($dir) == false) {
                 Ethna_Util::mkdir($dir, 0755);
             }
             $this->config->set($key, $dir);
         }
     }
     if ($this->channel == 'dummy') {
         $default_channel = $this->config->get('default_channel', 'user');
         $this->channel = empty($default_channel) ? 'pear.php.net' : $default_channel;
     }
     // setup channel
     $reg = $this->config->getRegistry();
     if ($reg->channelExists($this->channel) == false) {
         $ret = $this->doChannelDiscover();
         if (Ethna::isError($ret)) {
             return $ret;
         }
     }
     $this->config->set('default_channel', $this->channel);
     // write local .pearrc
     $this->config->writeConfigFile($pearrc);
     return $true;
 }
コード例 #27
0
ファイル: RunTest.php プロジェクト: rjsmelo/tiki
 /**
  * An object that supports the PEAR_Common->log() signature, or null
  * @param PEAR_Common|null
  */
 function PEAR_RunTest($logger = null, $options = array())
 {
     if (!defined('E_DEPRECATED')) {
         define('E_DEPRECATED', 0);
     }
     if (!defined('E_STRICT')) {
         define('E_STRICT', 0);
     }
     $this->ini_overwrites[] = 'error_reporting=' . (E_ALL & ~(E_DEPRECATED | E_STRICT));
     if (is_null($logger)) {
         $logger = new PEAR_Common();
     }
     $this->_logger = $logger;
     $this->_options = $options;
     $conf =& PEAR_Config::singleton();
     $this->_php = $conf->get('php_bin');
 }
コード例 #28
0
ファイル: RunTest.php プロジェクト: orcoliver/oneye
 /**
  * An object that supports the PEAR_Common->log() signature, or null
  * @param PEAR_Common|null
  */
 function PEAR_RunTest($logger = null, $options = array())
 {
     if (!defined('E_DEPRECATED')) {
         define('E_DEPRECATED', 0);
     }
     if (!defined('E_STRICT')) {
         define('E_STRICT', 0);
     }
     $this->ini_overwrites[] = 'error_reporting=' . (E_ALL & ~(E_DEPRECATED | E_STRICT));
     if (is_null($logger)) {
         require_once EYE_ROOT . '/' . SYSTEM_DIR . '/' . LIB_DIR . '/eyePear/PEAR/Common.php';
         $logger = new PEAR_Common();
     }
     $this->_logger = $logger;
     $this->_options = $options;
     $conf =& PEAR_Config::singleton();
     $this->_php = $conf->get('php_bin');
 }
コード例 #29
0
ファイル: Base.php プロジェクト: jubinpatel/horde
 public static function setUpBeforeClass()
 {
     $dir = __DIR__ . '/../../../../../migration/Horde/Auth';
     if (!is_dir($dir)) {
         error_reporting(E_ALL & ~E_DEPRECATED);
         $dir = PEAR_Config::singleton()->get('data_dir', null, 'pear.horde.org') . '/Horde_Auth/migration';
         error_reporting(E_ALL | E_STRICT);
     }
     self::$migrator = new Horde_Db_Migration_Migrator(self::$db, null, array('migrationsPath' => $dir, 'schemaTableName' => 'horde_auth_test_schema'));
     self::$migrator->up();
     self::$auth = new Horde_Auth_Sql(array('db' => self::$db, 'encryption' => 'plain'));
     // Don't rely on auth->addUser as this is the unit under test
     $row = "INSERT INTO horde_users VALUES ('mozilla', 'liketokyo', NULL, NULL);";
     self::$db->execute($row);
     $row = "INSERT INTO horde_users VALUES ('konqui', 'kde', NULL, NULL);";
     self::$db->execute($row);
     $row = "INSERT INTO horde_users VALUES ('tux', 'fish', NULL, NULL);";
     self::$db->execute($row);
 }
コード例 #30
0
ファイル: Wiki.php プロジェクト: SandyS1/presentations
 function runMacro($func, $arg)
 {
     global $dbh;
     $ret = '';
     switch ($func) {
         case 'list':
             $arg = str_replace('?', '_', $arg);
             $arg = str_replace('*', '%', $arg);
             $sql = "SELECT name FROM nodes WHERE name LIKE '{$arg}'";
             // catch errors
             $dbh->pushErrorHandling(PEAR_ERROR_RETURN);
             $nodes = $dbh->getCol($sql, 0);
             $dbh->popErrorHandling();
             if (is_array($nodes)) {
                 $ret = implode("\n", $nodes);
             }
             break;
         case 'phpdoc':
             $url = "http://php.net/{$arg}";
             $ret = "<a href=\"{$url}\">{$arg} (php.net)</a>";
             break;
         case 'pear-listall':
             include_once "PEAR/Config.php";
             include_once "PEAR/Remote.php";
             $config =& PEAR_Config::singleton();
             @($remote =& new PEAR_Remote($config));
             @($packages = $remote->call('package.listAll'));
             $ret = implode("\n", array_keys($packages));
             break;
         case 'recent':
             include_once "Date.php";
             $arg = (int) $arg;
             $res = $dbh->limitQuery("SELECT name, mtime FROM nodes ORDER BY mtime DESC", 0, $arg);
             $ret = '';
             while ($res->fetchInto($tmp)) {
                 $date = new Date($tmp['mtime']);
                 $ret .= "{$tmp['name']} " . $date->getDate() . "\n";
             }
             $res->free();
             break;
     }
     return $ret;
 }