Exemplo n.º 1
0
 public function getDefinition()
 {
     $path = $this->basePath . DIRECTORY_SEPARATOR . $this->definitionName;
     if (!is_file($path) || !is_readable($path)) {
         throw new RuntimeException('The upgrade base path doesn\'t have a definition file for upgrading (' . $path . ')');
     }
     return sfSimpleYamlConfigHandler::replaceConstants(sfSimpleYamlConfigHandler::getConfiguration(array($path)));
 }
Exemplo n.º 2
0
 public static function getPluginListForDatabase()
 {
     $config = sfSimpleYamlConfigHandler::getConfiguration(array(sfConfig::get('sf_root_dir') . '/config/databases.yml'));
     if (isset($config['all']['master'])) {
         $connConfig = $config['all']['master']['param'];
     } elseif (isset($config['all']['doctrine'])) {
         $connConfig = $config['all']['doctrine']['param'];
     } else {
         $connConfig = array_shift($config['all']);
         $connConfig = $connConfig['param'];
     }
     $connConfig = array_merge(array('password' => null), $connConfig);
     $result = array();
     try {
         $conn = new PDO($connConfig['dsn'], $connConfig['username'], $connConfig['password']);
         $state = $conn->query('SELECT name, is_enabled FROM ' . sfConfig::get('op_table_prefix', '') . 'plugin');
         if ($state) {
             foreach ($state as $row) {
                 $result[$row['name']] = (bool) $row['is_enabled'];
             }
         }
     } catch (PDOException $e) {
         // do nothing
     }
     return $result;
 }