public function execute($params, $options = array()) { if (count($params) > 0) { $this->_checkForCustomLinks(); foreach ($params as $table) { $do = DB_DataObject::factory($table); if (PEAR::isError($do)) { $this->error('Table problem with ' . $table . ' : ' . $do->getMessage()); continue; } $defs = $do->_getPluginsDef(); if (key_exists('guid', $defs)) { $this->_removeGuidFromTable($table); } else { $this->line($table . ' dont have guid installed. IGNORED'); } } } else { if (!$this->confirm('You are about to uninstall guid on the whole project! ARE YOU SURE ?')) { echo 'Aborting'; return; } $this->_checkForCustomLinks(); $g = new DB_DataObject_Advgenerator(); $generators = $g->getGenerators(); $officepacktables = array(); // First loop : creating new primary key. foreach ($generators as $agenerator) { foreach ($agenerator->tables as $table) { $this->line('Checking guid value for ' . $table); $d = DB_DataObject::factory($table); $defs = $d->_getPluginsDef(); if (key_exists('guid', $defs)) { $this->line($table . ' has guid plugin. Uninstalling it....'); $this->_removeGuidFromTable($table); } } } } // Regenerating modified tables /* $options = &PEAR::getStaticProperty('DB_DataObject', 'options'); $oldoption = $options['generator_include_regex']; $options['generator_include_regex'] = '`^('.explode('|',$this->toRegenerate).')$`';*/ if (!$options['noregen']) { $this->line('regenerating models'); $generator = new DB_DataObject_Advgenerator(); $generator->start(); /* $options['generator_include_regex'] = $oldoption;*/ // Removing guid plugin to the DO file foreach ($this->toRemove as $table) { $this->line('removing plugin guid for table ' . $table); $data = file_get_contents(APP_ROOT . 'models/' . ucfirst($table) . '.php'); $data = ereg_replace('(\'|")guid(\'|")[[:space:]]*=>[[:space:]]*(true|1),*', '', $data); file_put_contents(APP_ROOT . 'models/' . ucfirst($table) . '.php', $data); } } }
public function execute($params, $options = array()) { if (count($params) > 0) { foreach ($params as $table) { $this->_checkAndInstall($table); } } else { $g = new DB_DataObject_Advgenerator(); $generators = $g->getGenerators(); foreach ($generators as $agenerator) { foreach ($agenerator->tables as $table) { $this->_checkAndInstall($table); } } } }