/**
  * Initializes application modules
  */
 public function initModules(Config $config)
 {
     $moduleLoader = new ModuleLoader($this->getDI());
     //registers modules defined in modules.php file
     $modulesFile = $config->application->configDir . Loader::MODULE_STATIC_FILE;
     /**
      * For non-default environment modules are being dumped in each application start
      */
     if (!file_exists($modulesFile) || $this->getDI()->get('environment') != Constants::DEFAULT_ENV) {
         $modules = $moduleLoader->dump($config->application->moduleDir, $config->application->configDir);
     } else {
         $modules = (require $modulesFile);
     }
     if (!is_array($modules)) {
         throw new InvalidModulesListException();
     }
     $this->getApplication()->registerModules($modules);
     //prepares modules configurations
     foreach ($this->getApplication()->getModules() as $module) {
         $moduleConfigFile = dirname($module['path']) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
         if (file_exists($moduleConfigFile)) {
             $moduleConfig = (require $moduleConfigFile);
             if (is_array($moduleConfig)) {
                 $config->merge($moduleConfig);
             }
         }
     }
     $this->getDI()->set('modules', function () {
         return $this->getApplication()->getModules();
     });
 }
Exemple #2
0
 /**
  * @param Config $config
  */
 public function __construct(Config $config)
 {
     $this->redirectUriAuthorize = $config->get('redirectUri');
     $this->clientId = $config->get('clientId');
     $this->clientSecret = $config->get('clientSecret');
     $this->logger = $this->getDI()->get('logger', ['auth.log']);
 }
Exemple #3
0
    public static function register(Di $di)
    {
        $environment = isset($_SERVER['PHWOOLCON_ENV']) ? $_SERVER['PHWOOLCON_ENV'] : 'production';
        // @codeCoverageIgnoreStart
        if (is_file($cacheFile = storagePath('cache/config-' . $environment . '.php'))) {
            static::$config = (include $cacheFile);
            Config::get('app.cache_config') or static::clearCache();
            return;
        }
        // @codeCoverageIgnoreEnd
        $defaultFiles = glob($_SERVER['PHWOOLCON_CONFIG_PATH'] . '/*.php');
        $environmentFiles = glob($_SERVER['PHWOOLCON_CONFIG_PATH'] . '/' . $environment . '/*.php');
        $config = new PhalconConfig(static::loadFiles($defaultFiles));
        $environmentSettings = static::loadFiles($environmentFiles);
        $environmentSettings['environment'] = $environment;
        $environmentConfig = new PhalconConfig($environmentSettings);
        $config->merge($environmentConfig);
        $di->remove('config');
        $di->setShared('config', $config);
        static::$config = $config->toArray();
        Config::get('database.default') and static::loadDb($config);
        // @codeCoverageIgnoreStart
        if (Config::get('app.cache_config')) {
            is_dir($cacheDir = dirname($cacheFile)) or mkdir($cacheDir, 0777, true);
            fileSaveArray($cacheFile, static::$config, function ($content) {
                $replacement = <<<'EOF'
$_SERVER['PHWOOLCON_ROOT_PATH'] . '
EOF;
                return str_replace("'{$_SERVER['PHWOOLCON_ROOT_PATH']}", $replacement, $content);
            });
        }
        // @codeCoverageIgnoreEnd
    }
Exemple #4
0
 /**
  * Initializes the config. Reads it from its location and
  * stores it in the Di container for easier access
  * @param array $aOptions
  */
 protected function initConfig($aOptions = array())
 {
     $oConfig = new PhConfig();
     $aSharedConfig = (require ROOT_PATH . '/config/config.php');
     $oConfig->merge(new PhConfig($aSharedConfig));
     $this->oDI->setShared('config', $oConfig);
 }
 /**
  * Get mongo connection URI
  *
  * @param \Phalcon\Config $config
  * @return string
  */
 private function getConnectUri(\Phalcon\Config $config)
 {
     if ($config->offsetExists('user') && $config->offsetExists('password')) {
         return "mongodb://" . $config['user'] . ":" . $config['password'] . "@" . $config['host'] . ":" . $config['port'] . "/" . $config['dbname'];
     } else {
         return "mongodb://" . $config['host'] . ":" . $config['port'] . "/" . $config['dbname'];
     }
 }
Exemple #6
0
 public function testFactoryShouldWorkIfCreatedFromConfigPHPArray()
 {
     $config = new Config(include INCUBATOR_FIXTURES . 'Acl/acl.php');
     $factory = new MemoryFactory();
     $acl = $factory->create($config->get('acl'));
     $this->assertInstanceOf('Phalcon\\Acl\\Adapter\\Memory', $acl);
     $this->assertAclIsConfiguredAsExpected($acl, $config);
 }
 public function testConfigMerge()
 {
     $configA = new Config(['paramA' => ['paramB' => 'valueA']]);
     $configB = new Config(['paramA' => ['paramB' => 'valueB', 'paramC' => 'valueC']]);
     $configB->merge($configA);
     $this->assertEquals('valueA', $configB->paramA->paramB);
     $this->assertEquals('valueC', $configB->paramA->paramC);
 }
 /**
  * Implement configurations
  *
  * @param \Phalcon\Config $config $config
  * @throws \Sonar\Exceptions\QueueServiceException
  */
 public function __construct(\Phalcon\Config $config)
 {
     if ($this->beanstalkMapper === null) {
         try {
             $this->beanstalkMapper = new BeanstalkMapper($config->toArray());
         } catch (BeanstalkMapperException $e) {
             throw new QueueServiceException($e->getMessage());
         }
     }
 }
 /**
  * Load configuration files
  */
 protected function initConfig()
 {
     // read in config arrays
     $defaultConfig = (require APP_PATH . '/etc/config.php');
     $localConfig = (require APP_PATH . '/etc/config.local.php');
     // instantiate them into the phalcon config
     $config = new Config($defaultConfig);
     $config->merge(new Config($localConfig));
     $this->di['config'] = $config;
 }
Exemple #10
0
 private function parseDefinitionArgument($argument)
 {
     if (Text::startsWith($argument, '!')) {
         return ['type' => 'parameter', 'value' => Arr::path($this->config->toArray(), substr($argument, 1))];
     } elseif (Text::startsWith($argument, '@')) {
         return ['type' => 'service', 'name' => substr($argument, 1)];
     } else {
         return ['type' => 'parameter', 'value' => $argument];
     }
 }
Exemple #11
0
 protected function compareConfig(array $actual, Config $expected)
 {
     $this->assertEquals($actual, $expected->toArray());
     foreach ($actual as $key => $value) {
         $this->assertTrue(isset($expected->{$key}));
         if (is_array($value)) {
             $this->compareConfig($value, $expected->{$key});
         }
     }
 }
 /**
  * Initial module configuration params
  *
  * @param \Phalcon\Config $config
  * @throws \Sonar\Exceptions\AppServiceException
  */
 public function __construct(\Phalcon\Config $config)
 {
     if (!$this->socketService) {
         if (isset($config->socket) === false) {
             throw new AppServiceException('There is no option `socket` in your configurations');
         }
         if ($config->offsetExists('debug') === true && boolval($config->debug) === true) {
             define('SONAR_VERBOSE', true);
         }
         $this->socketService = new SocketService($config);
     }
 }
Exemple #13
0
 /**
  * @param string $file
  */
 public function load($file)
 {
     $config = $this->cache->get($file);
     if (null === $config) {
         $config = $this->factory->buildFromPath($file);
         $this->cache->set($file, $config->toArray());
     } else {
         $config = new Config($config);
     }
     if ($config) {
         $this->config->merge($config);
     }
     return $this;
 }
Exemple #14
0
 /**
  * Runs the application, performing all initializations
  *
  * @return void
  */
 public function run()
 {
     $modules = $this->_config->get('modules');
     if (!$modules) {
         $modules = (object) [];
     }
     $di = $this->_dependencyInjector;
     $config = $this->_config;
     if (isset($this->_config->application)) {
         if ($this->_config->application->debug) {
             if (!isset($this->_config->application->useCachingInDebugMode)) {
                 $this->_config->application->useCachingInDebugMode = false;
             }
         }
     }
     $di->set('modules', function () use($modules) {
         return $modules;
     });
     // Set application event manager
     $eventsManager = new \Phalcon\Events\Manager();
     // Init services and engine system
     foreach ($this->_services as $serviceName) {
         $service = $this->_serviceNamespace . "\\" . ucfirst($serviceName);
         $service = new $service($di, $eventsManager, $config);
         if (!$service instanceof \Engine\Application\Service\AbstractService) {
             throw new \Engine\Exception("Service '{$serviceName}' not instance of AbstractService");
         }
         $service->init();
     }
     // register enabled modules
     $enabledModules = [];
     if (!empty($modules)) {
         foreach ($modules as $module => $enabled) {
             if (!$enabled) {
                 continue;
             }
             $moduleName = ucfirst($module);
             $enabledModules[$module] = array('className' => $moduleName . '\\Module', 'path' => ROOT_PATH . '/apps/modules/' . $moduleName . '/Module.php');
         }
         if (!empty($enabledModules)) {
             $this->registerModules($enabledModules);
         }
     }
     // Set default services to the DI
     $this->setEventsManager($eventsManager);
     $di->setShared('eventsManager', $eventsManager);
     $di->setShared('app', $this);
 }
Exemple #15
0
 /**
  * \Phalcon\Config\Adapter\Ini constructor
  *
  * @param string $filePath
  * @throws Exception
  */
 public function __construct($filePath)
 {
     $array = array();
     if (is_string($filePath) === false) {
         throw new Exception('Invalid parameter type.');
     }
     @($d = parse_ini_file($filePath, true));
     if ($d === false) {
         throw new Exception('Configuration file ' . $filePath . " can't be loaded");
     }
     foreach ($d as $section => $directives) {
         if (is_array($directives) === false || empty($directives) === true) {
             $array[$section] = $directives;
         } else {
             foreach ($directives as $key => $value) {
                 if (strpos($key, '.') !== false) {
                     isset($array[$section]) === false && ($array[$section] = array());
                     $array[$section] = self::_parseKey($array[$section], $key, $value);
                 } else {
                     $array[$section][$key] = $value;
                 }
             }
         }
     }
     parent::__construct($array);
 }
Exemple #16
0
 public function testConfigMerge()
 {
     $config1 = new \Phalcon\Config(array("controllersDir" => "../x/y/z", "modelsDir" => "../x/y/z", "database" => array("adapter" => "Mysql", "host" => "localhost", "username" => "scott", "password" => "cheetah", "name" => "test_db", "charset" => array("primary" => "utf8"), "alternatives" => array("primary" => "latin1", "second" => "latin1"))));
     $config2 = new \Phalcon\Config(array("modelsDir" => "../x/y/z", "database" => array("adapter" => "Postgresql", "host" => "localhost", "username" => "peter", "options" => array("case" => "lower"), "alternatives" => array("primary" => "swedish", "third" => "american"))));
     $config1->merge($config2);
     $expected = \Phalcon\Config::__set_state(array('controllersDir' => '../x/y/z', 'modelsDir' => '../x/y/z', 'database' => \Phalcon\Config::__set_state(array('adapter' => 'Postgresql', 'host' => 'localhost', 'username' => 'peter', 'password' => 'cheetah', 'name' => 'test_db', 'charset' => \Phalcon\Config::__set_state(array('primary' => 'utf8')), 'alternatives' => \Phalcon\Config::__set_state(array('primary' => 'swedish', 'second' => 'latin1', 'third' => 'american')), 'options' => \Phalcon\Config::__set_state(array('case' => 'lower'))))));
     $this->assertEquals($expected, $config1);
 }
 /**
  * Class constructor.
  *
  * @param  string                    $filePath
  * @throws \Phalcon\Config\Exception
  */
 public function __construct($filePath)
 {
     if (!extension_loaded("json")) {
         throw new Exception('Json extension not loaded');
     }
     if (false === ($result = json_decode(file_get_contents($filePath), true))) {
         throw new Exception('Configuration file ' . $filePath . ' can\'t be loaded');
     }
     parent::__construct($result);
 }
Exemple #18
0
 /**
  * Phalcon\Config\Adapter\Yaml
  *
  * @param string $filePath
  */
 public function __construct($filePath, $callbacks = array())
 {
     if (!extension_loaded('yaml')) {
         throw new Exception('Yaml extension not loaded');
     }
     if (false === ($result = @yaml_parse_file($filePath, 0, $ndocs, $callbacks))) {
         throw new Exception('Configuration file ' . $filePath . ' can\'t be loaded');
     }
     parent::__construct($result);
 }
 public static function setCurrentVersion($lastVersion, $currentVersion)
 {
     if (is_null(self::$_connection)) {
         self::connSetup(self::$_config->get('database'));
     }
     if (!is_null(self::$_config->get('migrationsLog')) && 'database' == self::$_config->get('migrationsLog')) {
         self::$_connection->execute('UPDATE `phalcon_migrations` SET `version`="' . (string) $currentVersion . '" WHERE `version`="' . (string) $lastVersion . '" LIMIT 1;');
     } else {
         file_put_contents(self::$_migrationFid, (string) $currentVersion);
     }
 }
 /**
  * @param \Phalcon\Config|array $config
  */
 public function build($config)
 {
     $routes = $config instanceof \Phalcon\Config ? $config->toArray() : $config;
     foreach ($routes as $name => $value) {
         $names = explode('_', $name);
         $value['url'] = isset($value['url']) ? $value['url'] : '/' . str_replace('_', '/', $name);
         // normalized url
         $length = strlen($value['url']);
         if ($value['url'][$length - 1] === '/' && $length > 1 && $this->_removeExtraSlashes) {
             $value['url'] = rtrim($value['url'], '/');
         }
         $value['controller'] = isset($value['controller']) ? $value['controller'] : $names[0];
         if (isset($value['action'])) {
         } elseif (isset($names[1])) {
             $value['action'] = $names[1];
         } else {
             $value['action'] = 'index';
         }
         $this->add($value['url'], $value)->setName($name)->via($value['method']);
     }
 }
Exemple #21
0
 /**
  * Index a single document
  *
  * @param Posts $post
  */
 protected function doIndex(Posts $post)
 {
     $params = [];
     $karma = $post->number_views + ($post->votes_up - $post->votes_down) * 10 + $post->number_replies;
     if ($karma > 0) {
         $params['body'] = ['id' => $post->id, 'title' => $post->title, 'category' => $post->categories_id, 'content' => $post->content, 'karma' => $karma];
         $params['index'] = $this->config->get('index', 'phosphorum');
         $params['type'] = 'post';
         $params['id'] = 'post-' . $post->id;
         $this->client->index($params);
     }
 }
Exemple #22
0
 protected function initLoader()
 {
     $autoload = static::$config->get('autoload');
     if ($autoload) {
         $loader = new Loader();
         if ($autoload->get('dir') instanceof Config) {
             $loader->registerDirs($autoload->get('dir')->toArray());
         }
         if ($autoload->get('namespace') instanceof Config) {
             $loader->registerNamespaces($autoload->get('namespace')->toArray());
         }
         $loader->register();
     }
 }
Exemple #23
0
 /**
  * \Phalcon\Config\Adapter\Json constructor
  *
  * @param string $filePath
  * @throws Exception
  */
 public function __construct($filePath)
 {
     if (is_string($filePath) === false) {
         throw new Exception('Invalid parameter type.');
     }
     @($contents = file_get_contents($filePath));
     if (is_string($contents) === true) {
         $array = json_decode($contents, true);
         if (json_last_error() !== \JSON_ERROR_NONE) {
             throw new Exception('Invalid json file.');
         }
         parent::__construct($array);
     } else {
         throw new Exception('Unable to read json file.');
     }
 }
 /**
  * Resolves the DB Schema
  *
  * @param \Phalcon\Config $config
  * @return null|string
  */
 public static function resolveDbSchema(Config $config)
 {
     if ($config->offsetExists('schema')) {
         return $config->get('schema');
     }
     if (self::DB_ADAPTER_POSTGRESQL == $config->get('adapter')) {
         return 'public';
     }
     if ($config->offsetExists('dbname')) {
         return $config->get('dbname');
     }
     return null;
 }
Exemple #25
0
 /**
  * Resolves the DB Schema
  *
  * @param \Phalcon\Config $config
  * @return null|string
  */
 public static function resolveDbSchema(Config $config)
 {
     if ($config->offsetExists('schema')) {
         return $config->get('schema');
     }
     if (self::DB_ADAPTER_POSTGRESQL == $config->get('adapter')) {
         return 'public';
     }
     if (self::DB_ADAPTER_SQLITE == $config->get('adapter')) {
         // SQLite only supports the current database, unless one is
         // attached. This is not the case, so don't return a schema.
         return null;
     }
     if ($config->offsetExists('dbname')) {
         return $config->get('dbname');
     }
     return null;
 }
Exemple #26
0
 /**
  * Phalcon\Config\Adapter\Xml constructor
  *
  * @param string $filePath
  * @throws Exception
  */
 public function __construct($filePath)
 {
     if (!extension_loaded('SimpleXML')) {
         throw new Exception("SimpleXML extension not loaded");
     }
     libxml_use_internal_errors(true);
     $data = simplexml_load_file($filePath, 'SimpleXMLElement', LIBXML_NOCDATA);
     foreach (libxml_get_errors() as $error) {
         /** @var \LibXMLError $error */
         switch ($error->code) {
             case LIBXML_ERR_WARNING:
                 trigger_error($error->message, E_USER_WARNING);
                 break;
             default:
                 throw new Exception($error->message);
         }
     }
     libxml_use_internal_errors(false);
     parent::__construct(json_decode(json_encode((array) $data), true));
 }
Exemple #27
0
 /**
  * Options Constructor
  *
  * @param array $options
  *
  * @throws \InvalidArgumentException If flags is not an integer
  */
 public function __construct(array $options)
 {
     parent::__construct($options);
 }
 /**
  * Returns database name
  *
  * @return mixed
  */
 public static function getDbName()
 {
     return self::$_databaseConfig->get('dbname');
 }
Exemple #29
0
 public function testMaintainConfigObjectReference()
 {
     $config = new Config(['basedir' => static::$basedir]);
     $b = new Bootstrap(self::getUserOptions(), $config, static::$di);
     $b->getConfig()->foo = 'bar';
     $this->assertEquals('bar', $config->get('foo'));
 }
 /**
  * Look for table definition modifications and apply to real table
  *
  * @param $tableName
  * @param $definition
  *
  * @throws \Phalcon\Db\Exception
  */
 public function morphTable($tableName, $definition)
 {
     $defaultSchema = self::$_databaseConfig->get('dbname');
     $tableExists = self::$_connection->tableExists($tableName, $defaultSchema);
     if (isset($definition['columns'])) {
         if (count($definition['columns']) == 0) {
             throw new DbException('Table must have at least one column');
         }
         $fields = array();
         foreach ($definition['columns'] as $tableColumn) {
             if (!is_object($tableColumn)) {
                 throw new DbException('Table must have at least one column');
             }
             /**
              * @var \Phalcon\Db\ColumnInterface $tableColumn
              * @var \Phalcon\Db\ColumnInterface[] $fields
              */
             $fields[$tableColumn->getName()] = $tableColumn;
         }
         if ($tableExists == true) {
             $localFields = array();
             /**
              * @var \Phalcon\Db\ColumnInterface[] $description
              * @var \Phalcon\Db\ColumnInterface[] $localFields
              */
             $description = self::$_connection->describeColumns($tableName, $defaultSchema);
             foreach ($description as $field) {
                 $localFields[$field->getName()] = $field;
             }
             foreach ($fields as $fieldName => $tableColumn) {
                 /**
                  * @var \Phalcon\Db\ColumnInterface $tableColumn
                  * @var \Phalcon\Db\ColumnInterface[] $localFields
                  */
                 if (!isset($localFields[$fieldName])) {
                     self::$_connection->addColumn($tableName, $tableColumn->getSchemaName(), $tableColumn);
                 } else {
                     $changed = false;
                     if ($localFields[$fieldName]->getType() != $tableColumn->getType()) {
                         $changed = true;
                     }
                     if ($localFields[$fieldName]->getSize() != $tableColumn->getSize()) {
                         $changed = true;
                     }
                     if ($tableColumn->isNotNull() != $localFields[$fieldName]->isNotNull()) {
                         $changed = true;
                     }
                     if ($tableColumn->getDefault() != $localFields[$fieldName]->getDefault()) {
                         $changed = true;
                     }
                     if ($changed == true) {
                         self::$_connection->modifyColumn($tableName, $tableColumn->getSchemaName(), $tableColumn);
                     }
                 }
             }
             foreach ($localFields as $fieldName => $localField) {
                 if (!isset($fields[$fieldName])) {
                     self::$_connection->dropColumn($tableName, null, $fieldName);
                 }
             }
         } else {
             self::$_connection->createTable($tableName, $defaultSchema, $definition);
             if (method_exists($this, 'afterCreateTable')) {
                 $this->afterCreateTable();
             }
         }
     }
     if (isset($definition['references'])) {
         if ($tableExists == true) {
             $references = array();
             foreach ($definition['references'] as $tableReference) {
                 $references[$tableReference->getName()] = $tableReference;
             }
             $localReferences = array();
             $activeReferences = self::$_connection->describeReferences($tableName, $defaultSchema);
             foreach ($activeReferences as $activeReference) {
                 $localReferences[$activeReference->getName()] = array('referencedTable' => $activeReference->getReferencedTable(), 'columns' => $activeReference->getColumns(), 'referencedColumns' => $activeReference->getReferencedColumns());
             }
             foreach ($definition['references'] as $tableReference) {
                 if (!isset($localReferences[$tableReference->getName()])) {
                     self::$_connection->addForeignKey($tableName, $tableReference->getSchemaName(), $tableReference);
                 } else {
                     $changed = false;
                     if ($tableReference->getReferencedTable() != $localReferences[$tableReference->getName()]['referencedTable']) {
                         $changed = true;
                     }
                     if ($changed == false) {
                         if (count($tableReference->getColumns()) != count($localReferences[$tableReference->getName()]['columns'])) {
                             $changed = true;
                         }
                     }
                     if ($changed == false) {
                         if (count($tableReference->getReferencedColumns()) != count($localReferences[$tableReference->getName()]['referencedColumns'])) {
                             $changed = true;
                         }
                     }
                     if ($changed == false) {
                         foreach ($tableReference->getColumns() as $columnName) {
                             if (!in_array($columnName, $localReferences[$tableReference->getName()]['columns'])) {
                                 $changed = true;
                                 break;
                             }
                         }
                     }
                     if ($changed == false) {
                         foreach ($tableReference->getReferencedColumns() as $columnName) {
                             if (!in_array($columnName, $localReferences[$tableReference->getName()]['referencedColumns'])) {
                                 $changed = true;
                                 break;
                             }
                         }
                     }
                     if ($changed == true) {
                         self::$_connection->dropForeignKey($tableName, $tableReference->getSchemaName(), $tableReference->getName());
                         self::$_connection->addForeignKey($tableName, $tableReference->getSchemaName(), $tableReference);
                     }
                 }
             }
             foreach ($localReferences as $referenceName => $reference) {
                 if (!isset($references[$referenceName])) {
                     self::$_connection->dropForeignKey($tableName, null, $referenceName);
                 }
             }
         }
     }
     if (isset($definition['indexes'])) {
         if ($tableExists == true) {
             $indexes = array();
             foreach ($definition['indexes'] as $tableIndex) {
                 $indexes[$tableIndex->getName()] = $tableIndex;
             }
             $localIndexes = array();
             $actualIndexes = self::$_connection->describeIndexes($tableName, $defaultSchema);
             foreach ($actualIndexes as $actualIndex) {
                 $localIndexes[$actualIndex->getName()] = $actualIndex->getColumns();
             }
             foreach ($definition['indexes'] as $tableIndex) {
                 if (!isset($localIndexes[$tableIndex->getName()])) {
                     if ($tableIndex->getName() == 'PRIMARY') {
                         self::$_connection->addPrimaryKey($tableName, $tableColumn->getSchemaName(), $tableIndex);
                     } else {
                         self::$_connection->addIndex($tableName, $tableColumn->getSchemaName(), $tableIndex);
                     }
                 } else {
                     $changed = false;
                     if (count($tableIndex->getColumns()) != count($localIndexes[$tableIndex->getName()])) {
                         $changed = true;
                     } else {
                         foreach ($tableIndex->getColumns() as $columnName) {
                             if (!in_array($columnName, $localIndexes[$tableIndex->getName()])) {
                                 $changed = true;
                                 break;
                             }
                         }
                     }
                     if ($changed == true) {
                         if ($tableIndex->getName() == 'PRIMARY') {
                             self::$_connection->dropPrimaryKey($tableName, $tableColumn->getSchemaName());
                             self::$_connection->addPrimaryKey($tableName, $tableColumn->getSchemaName(), $tableIndex);
                         } else {
                             self::$_connection->dropIndex($tableName, $tableColumn->getSchemaName(), $tableIndex->getName());
                             self::$_connection->addIndex($tableName, $tableColumn->getSchemaName(), $tableIndex);
                         }
                     }
                 }
             }
             foreach ($localIndexes as $indexName => $indexColumns) {
                 if (!isset($indexes[$indexName])) {
                     self::$_connection->dropIndex($tableName, null, $indexName);
                 }
             }
         }
     }
 }