Пример #1
0
 /**
  * Get Garp_Auth instance
  * @return Garp_Auth
  */
 public static function getInstance(Garp_Cli_Ui_Protocol $feedback = null)
 {
     if (!Garp_Spawn_MySql_Manager::$_instance) {
         Garp_Spawn_MySql_Manager::$_instance = new Garp_Spawn_MySql_Manager($feedback);
     }
     return Garp_Spawn_MySql_Manager::$_instance;
 }
Пример #2
0
 /**
  * Syncs source and target tables with one another, trying to resolve any conflicts.
  * @param   Bool    Whether to remove no longer configured columns. This can be triggered
  *                  separately with the cleanUp() method.
  * @return  Bool    In sync
  */
 public function sync($removeRedundantColumns = true)
 {
     $target = $this->getTarget();
     $keysInSync = true;
     $configuredKeys = $this->_getConfiguredKeys();
     $keySyncer = new Garp_Spawn_MySql_Key_Set_Synchronizer($configuredKeys, $target->keys, $this->getFeedback());
     if (!$keySyncer->removeKeys()) {
         $keysInSync = false;
     }
     $colsInSync = $this->_syncColumns($target);
     $i18nTableFork = $this->_detectI18nTableFork();
     if ($i18nTableFork) {
         $dbManager = Garp_Spawn_MySql_Manager::getInstance($this->_feedback);
         $dbManager->onI18nTableFork($this->getModel());
     }
     if ($removeRedundantColumns) {
         $this->_deleteRedundantColumns();
     }
     if (!$keySyncer->addKeys() || !$keySyncer->modifyKeys()) {
         $keysInSync = false;
     }
     return $colsInSync && $keysInSync;
 }
Пример #3
0
 protected function _spawnDb()
 {
     $modelSet = $this->getModelSet();
     $progress = $this->_getFeedbackInstance();
     $progress->displayHeader("Database");
     $dbManager = Garp_Spawn_MySql_Manager::getInstance($progress);
     $dbManager->setInteractive($this->getFeedback()->isInteractive());
     $dbManager->run($modelSet);
     $cacheDir = $this->_getCacheDir();
     Garp_Cache_Manager::purgeStaticCache(null, $cacheDir);
     Garp_Cache_Manager::purgeMemcachedCache(null);
     if ($this->getFeedback()->isInteractive()) {
         Garp_Cli::lineOut("All cache purged.");
     }
 }