function __construct($name = null, $extensions = false) { jimport('legacy.component.helper'); JLoader::import('helpers.jupgradepro', JPATH_COMPONENT_ADMINISTRATOR); // Creating dabatase instance for this installation $this->_db = JFactory::getDBO(); // Set step table if ($extensions == false) { $this->_table = '#__jupgradepro_steps'; } else { if ($extensions === 'tables') { $this->_table = '#__jupgradepro_extensions_tables'; } else { if ($extensions == true) { $this->_table = '#__jupgradepro_extensions'; } } } // Get the old version $this->old_ver = JUpgradeproHelper::getVersion('old'); // Load the last step from database if ($name !== false) { $this->_load($name); } }
/** * Method to be called before migrate any data * * @return array * @since 3.2.0 * @throws Exception */ public function beforeHook() { // Insert needed value $query = $this->_db->getQuery(true); $query->insert('#__jupgradepro_menus')->columns('`old`, `new`')->values("0, 0"); try { $this->_db->setQuery($query)->execute(); } catch (RuntimeException $e) { throw new RuntimeException($e->getMessage()); } if ($this->params->keep_ids == 1) { // Clear the default database $query->clear(); $query->delete()->from('#__jupgradepro_default_menus')->where('id > 100'); try { $this->_db->setQuery($query)->execute(); } catch (RuntimeException $e) { throw new RuntimeException($e->getMessage()); } // Getting the menus $query->clear(); // 3.0 Changes if (version_compare(JUpgradeproHelper::getVersion('new'), '3.0', '>=')) { $query->select("`menutype`, `title`, `alias`, `note`, `path`, `link`, `type`, `published`, `parent_id`, `component_id`, `checked_out`, `checked_out_time`, `browserNav`, `access`, `img`, `template_style_id`, `params`, `home`, `language`, `client_id`"); } else { $query->select("`menutype`, `title`, `alias`, `note`, `path`, `link`, `type`, `published`, `parent_id`, `component_id`, `ordering`, `checked_out`, `checked_out_time`, `browserNav`, `access`, `img`, `template_style_id`, `params`, `home`, `language`, `client_id`"); } $query->from("#__menu"); $query->where("id > 100"); $query->where("alias != 'home'"); $query->order('id ASC'); $this->_db->setQuery($query); try { $menus = $this->_db->loadObjectList(); } catch (RuntimeException $e) { throw new RuntimeException($e->getMessage()); } foreach ($menus as $menu) { // Convert the array into an object. $menu = (object) $menu; try { $this->_db->insertObject('#__jupgradepro_default_menus', $menu); } catch (RuntimeException $e) { throw new RuntimeException($e->getMessage()); } } // Cleanup the entire menu $query->clear(); $query->delete()->from('#__menu')->where('id > 1'); try { $this->_db->setQuery($query)->execute(); } catch (RuntimeException $e) { throw new RuntimeException($e->getMessage()); } } }
/** * Sets the data in the destination database. * * @return void * @since 3.0. * @throws Exception */ public function dataHook($rows = null) { // Do some custom post processing on the list. foreach ($rows as &$row) { $row = (array) $row; if (version_compare(JUpgradeproHelper::getVersion('new'), '3.0', '>=')) { unset($row['imagepos']); } } return $rows; }
/** * Get the raw data for this part of the upgrade. * * @return array Returns a reference to the source data array. * @since 3.2.0 * @throws Exception */ public function &dataHook($rows) { // Do some custom post processing on the list. foreach ($rows as &$row) { $row = (array) $row; // Remove unused fields. if (version_compare(JUpgradeproHelper::getVersion('new'), '2.5', '=')) { unset($row['version']); unset($row['images']); } } return $rows; }
/** * Sets the data in the destination database. * * @return void * @since 0.5.3 * @throws Exception */ public function dataHook($rows = null) { $params = $this->getParams(); $table = $this->getDestinationTable(); // Get category mapping $query = "SELECT * FROM #__jupgradepro_categories WHERE section REGEXP '^[\\-\\+]?[[:digit:]]*\\.?[[:digit:]]*\$' AND old > 0"; $this->_db->setQuery($query); $catidmap = $this->_db->loadObjectList('old'); // Find uncategorised category id $query = "SELECT id FROM #__categories WHERE extension='com_content' AND path='uncategorised' LIMIT 1"; $this->_db->setQuery($query); $defaultId = $this->_db->loadResult(); // Initialize values $aliases = array(); $total = count($rows); // Insert content data foreach ($rows as $row) { $row = (array) $row; // Check if title and alias isn't blank $row['title'] = !empty($row['title']) ? $row['title'] : "###BLANK###"; $row['alias'] = !empty($row['alias']) ? $row['alias'] : "###BLANK###"; // Add tags if Joomla! is greater than 3.1 if (version_compare(JUpgradeproHelper::getVersion('new'), '3.1', '>=')) { $row['metadata'] = $row['metadata'] . "\ntags="; } // JTable:store() run an update if id exists into the object so we create them first $object = new stdClass(); $object->id = $row['id']; // Inserting the content if (!$this->_db->insertObject($table, $object)) { throw new Exception($this->_db->getErrorMsg()); } // Getting the asset table $content = JTable::getInstance('Content', 'JTable', array('dbo' => $this->_db)); // Bind data to save content if (!$content->bind($row)) { throw new Exception($content->getError()); } // Check the content if (!$content->check()) { throw new Exception($content->getError()); } // Insert the content if (!$content->store()) { throw new Exception($content->getError()); } // Updating the steps table $this->_step->_nextID($total); } return false; }
/** * Sets the data in the destination database. * * @return void * @since 3.0. * @throws Exception */ public function dataHook($rows = null) { // Getting the component parameter with global settings $params = $this->getParams(); // Do some custom post processing on the list. foreach ($rows as &$row) { // Convert the array into an object. $row = (array) $row; if (version_compare(JUpgradeproHelper::getVersion('new'), '3.0', '>=')) { unset($row['approved']); unset($row['archived']); unset($row['date']); unset($row['sid']); } } return $rows; }
/** * Sets the data in the destination database. * * @return void * @since 3.0. * @throws Exception */ public function dataHook($rows = null) { // Getting the component parameter with global settings $params = $this->getParams(); // Getting the categories id's $categories = $this->getMapList('categories', 'com_newsfeeds'); // Do some custom post processing on the list. foreach ($rows as &$row) { $row = (array) $row; $row['access'] = 1; $row['language'] = '*'; if (version_compare(JUpgradeproHelper::getVersion('new'), '3.0', '>=')) { unset($row['filename']); } $cid = $row['catid']; $row['catid'] =& $categories[$cid]->new; } return $rows; }
/** * Sets the data in the destination database. * * @return void * @since 0.4. * @throws Exception */ public function dataHook($rows) { // Do some custom post processing on the list. foreach ($rows as &$row) { $row = (array) $row; if (version_compare(JUpgradeproHelper::getVersion('new'), '3.0', '>=')) { unset($row['usertype']); if (isset($row['uid'])) { unset($row['uid']); } } // Chaging admin username and email if ($row['username'] == 'admin') { $row['username'] = $row['username'] . '-old'; $row['email'] = $row['email'] . '-old'; } // Remove unused fields. unset($row['gid']); } return $rows; }
/** * Sets the data in the destination database. * * @return void * @since 3.0. * @throws Exception */ public function dataHook($rows = null) { // Getting the component parameter with global settings $params = $this->getParams(); // Getting the categories id's $categories = $this->getMapList('categories', 'com_weblinks'); // Do some custom post processing on the list. foreach ($rows as &$row) { // Convert the array into an object. $row = (array) $row; $cid = $row['catid']; $row['catid'] =& $categories[$cid]->new; $row['language'] = '*'; if (version_compare(JUpgradeproHelper::getVersion('new'), '3.0', '>=')) { $row['created'] = $row['date']; unset($row['approved']); unset($row['archived']); unset($row['date']); unset($row['sid']); } unset($row['published']); } return $rows; }
/** * Method to get a map of the User id to ARO id. * * @returns array An array of the user id's keyed by ARO id. * @since 0.4.4 * @throws Exception on database error. */ protected function getUserIdAroMap($aro_id) { // Get the version $old_version = JUpgradeproHelper::getVersion('old'); // Get thge correct table key $key = $old_version == '1.0' ? 'aro_id' : 'id'; $this->_driver->_db_old->setQuery('SELECT value' . ' FROM #__core_acl_aro' . ' WHERE ' . $key . ' = ' . $aro_id); $return = $this->_driver->_db_old->loadResult(); $error = $this->_driver->_db_old->getErrorMsg(); // Check for query error. if ($error) { throw new Exception($error); } return $return; }
/** * Run custom code after hooks * * @return void * @since 3.0 */ public function afterHook() { // Fixing the parents $this->fixParents(); // Insert existing categories $this->insertExisting(); // Change protected to $observers object to disable it // @@ Prevent Joomla! 'Application Instantiation Error' when try to call observers // @@ See: https://github.com/joomla/joomla-cms/pull/3408 if (version_compare(JUpgradeproHelper::getVersion('new'), '3.0', '>=')) { $file = JPATH_LIBRARIES . '/joomla/observer/updater.php'; $read = JFile::read($file); $read = str_replace("//call_user_func_array(\$eventListener, \$params)", "call_user_func_array(\$eventListener, \$params)", $read); $read = JFile::write($file, $read); require_once $file; } }
/** * Sets the data in the destination database. * * @return void * @since 0.4. * @throws Exception */ public function dataHook($rows = null) { // Get the query $query = $this->_db->getQuery(true); // Get the params $params = $this->getParams(); // Get the table name $tablename = $this->getDestinationTable(); // Getting the extensions id's of the new Joomla installation $query->clear(); $query->select('extension_id, element'); $query->from('#__extensions'); $this->_db->setQuery($query); $extensions_ids = $this->_db->loadObjectList('element'); // Initialize values $unique_alias_suffix = 1; $total = count($rows); $oldnewmap = array(); // Getting the table and query $table = JTable::getInstance('Menu', 'JTable'); // Start the update foreach ($rows as &$row) { // Convert the array into an object. $row = (object) $row; // Converting params to JSON $row->params = $this->convertParams($row->params); // Fixing language $row->language = '*'; // Fixing access $row->access++; // Fixing level if (isset($row->sublevel)) { $row->level = $row->sublevel++; } // Prevent MySQL duplicate error // @@ Duplicate entry for key 'idx_client_id_parent_id_alias_language' $alias = $this->getAlias('#__menu', $row->alias); $row->alias = !empty($alias) ? $alias . "-" . rand(0, 999999) : $row->alias; // Fixing menus URLs $row = $this->migrateLink($row); // Get new/old id's values $rowMap = new stdClass(); // Save the old id $rowMap->old = $row->id; // Fixing id if == 1 (used by root) if ($row->id == 1) { $query->clear(); $query->select('id + 1'); $query->from('#__menu'); $query->order('id DESC'); $query->limit(1); $this->_db->setQuery($query); $row->id = $this->_db->loadResult(); } // Fixing extension_id if (isset($row->option)) { $row->component_id = isset($extensions_ids[$row->option]) ? $extensions_ids[$row->option]->extension_id : 0; } // Fixing name $row->title = $row->name; if (version_compare(JUpgradeproHelper::getVersion('new'), '3.0', '>=')) { unset($row->ordering); } // Not needed unset($row->id); unset($row->name); unset($row->option); unset($row->componentid); // Bind the data try { $table->bind((array) $row); } catch (RuntimeException $e) { throw new RuntimeException($e->getMessage()); } // Store to database try { $table->store(); } catch (RuntimeException $e) { throw new RuntimeException($e->getMessage()); } // Save the new id in rowmap and row $rowMap->new = $table->id; $row->id = $table->id; $oldnewmap[$rowMap->old] = $rowMap; // Save old and new id try { $this->_db->insertObject('#__jupgradepro_menus', $rowMap); } catch (Exception $e) { throw new Exception($e->getMessage()); } $table->reset(); $table->id = 0; } // now rebuild tree by fixing parents and location foreach ($rows as $row) { $table->reset(); $table->id = 0; $row->lft = $row->rgt = null; $row->parent = isset($oldnewmap[$row->parent]) ? $oldnewmap[$row->parent]->new : 1; // Bind the data try { $table->bind((array) $row); } catch (RuntimeException $e) { throw new RuntimeException($e->getMessage()); } $table->setLocation($row->parent, 'last-child'); try { $table->check(); } catch (RuntimeException $e) { throw new RuntimeException($e->getMessage()); } // Store to database try { $table->store(); } catch (RuntimeException $e) { throw new RuntimeException($e->getMessage()); } $table->rebuildPath($table->id); // Updating the steps table $this->_step->_nextID($total); } // rebuild table try { $table->rebuild(); } catch (RuntimeException $e) { throw new RuntimeException($e->getMessage()); } return false; }
/** * Sets the data in the destination database. * * @return void * @since 0.4. * @throws Exception */ public function dataHook($rows = null) { // Getting the source table $table = $this->getSourceTable(); // Getting the component parameter with global settings $params = $this->getParams(); // Set up the mapping table for the old positions to the new positions. $map = self::getPositionsMap(); $map_keys = array_keys($map); $total = count($rows); // foreach ($rows as $row) { // Convert the array into an object. $row = (object) $row; ## Change positions if ($params->positions == 0) { if (in_array($row->position, $map_keys)) { $row->position = $map[$row->position]; } } // Get old id $oldlist = new stdClass(); $oldlist->old = $row->id; unset($row->id); if (version_compare(JUpgradeproHelper::getVersion('new'), '1.5', '>=')) { unset($row->numnews); unset($row->iscore); unset($row->control); } // Insert module if (!$this->_db->insertObject($table, $row)) { throw new Exception($this->_db->getErrorMsg()); } // Get new id $oldlist->new = $this->_db->insertid(); // Save old and new id if (!$this->_db->insertObject('#__jupgradepro_modules', $oldlist)) { throw new Exception($this->_db->getErrorMsg()); } // Updating the steps table $this->_step->_nextID($total); } return false; }
/** * Sets the data in the destination database. * * @return void * @since 0.4. * @throws Exception */ public function dataHook($rows) { // Do some custom post processing on the list. foreach ($rows as &$row) { $row = (array) $row; if (version_compare(JUpgradeproHelper::getVersion('new'), '3.0', '>=')) { unset($row['usertype']); } // Remove unused fields. unset($row['gid']); } return $rows; }
/** * Sets the data in the destination database. * * @return void * @since 0.5.3 * @throws Exception */ public function dataHook($rows = null) { $params = $this->getParams(); $table = $this->getDestinationTable(); // Get category mapping $query = "SELECT * FROM #__jupgradepro_categories WHERE section REGEXP '^[\\-\\+]?[[:digit:]]*\\.?[[:digit:]]*\$' AND old > 0"; $this->_db->setQuery($query); $catidmap = $this->_db->loadObjectList('old'); // Find uncategorised category id $query = "SELECT id FROM #__categories WHERE extension='com_content' AND path='uncategorised' LIMIT 1"; $this->_db->setQuery($query); $defaultId = $this->_db->loadResult(); // Initialize values $aliases = array(); $total = count($rows); // // Insert content data // foreach ($rows as $row) { $row = (array) $row; // Check if title isn't blank $row['title'] = !empty($row['title']) ? $row['title'] : "###BLANK###"; // Map catid $row['catid'] = isset($catidmap[$row['catid']]) ? $catidmap[$row['catid']]->new : $defaultId; // Setting the default rules $rules = array(); $rules['core.delete'] = array('6' => true); $rules['core.edit'] = array('6' => true, '4' => 1); $rules['core.edit.state'] = array('6' => true, '5' => 1); $row['rules'] = $rules; // Add tags if Joomla! is greater than 3.1 if (version_compare(JUpgradeproHelper::getVersion('new'), '3.1', '>=')) { $row['metadata'] = $row['metadata'] . "\ntags="; } // Converting the metadata to JSON $row['metadata'] = $this->convertParams($row['metadata'], false); if ($this->params->keep_ids == 1) { // JTable:store() run an update if id exists into the object so we create them first $object = new stdClass(); $object->id = $row['id']; // Inserting the content if (!$this->_db->insertObject($table, $object)) { throw new Exception($this->_db->getErrorMsg()); } } else { unset($row['id']); } // Get the asset table $content = JTable::getInstance('Content', 'JTable', array('dbo' => $this->_db)); // Aliases $row['alias'] = !empty($row['alias']) ? $row['alias'] : "###BLANK###"; $row['alias'] = JApplication::stringURLSafe($row['alias']); // Prevent MySQL duplicate error // @@ Duplicate entry for key 'idx_client_id_parent_id_alias_language' if ($content->load(array('alias' => $row['alias'], 'catid' => $row['catid']))) { $content->reset(); $content->id = 0; // Set the modified alias $row['alias'] .= "-" . rand(0, 99999999); } // Bind data to save content if (!$content->bind($row)) { throw new Exception($content->getError()); } // Check the content if (!$content->check()) { throw new Exception($content->getError()); } // Insert the content if (!$content->store()) { throw new Exception($content->getError()); } // Updating the steps table $this->_step->_nextID($total); } return false; }
/** * Inserts a category * * @access public * @param row An array whose properties match table fields * @since 0.4. */ public function insertCategory($row, $parent = false) { // Get the category table $category = JTable::getInstance('Category', 'JTable', array('dbo' => $this->_db)); // Disable observers calls // @@ Prevent Joomla! 'Application Instantiation Error' when try to call observers // @@ See: https://github.com/joomla/joomla-cms/pull/3408 if (version_compare(JUpgradeproHelper::getVersion('new'), '3.0', '>=')) { //$category->_observers->doCallObservers(false); } // Get section and old id $oldlist = new stdClass(); $oldlist->section = !empty($row['extension']) ? $row['extension'] : 0; $oldlist->old = isset($row['old_id']) ? (int) $row['old_id'] : (int) $row['id']; unset($row['old_id']); // Setting the default rules $rules = array(); $rules['core.create'] = $rules['core.delete'] = $rules['core.edit'] = $rules['core.edit.state'] = $rules['core.edit.own'] = ''; $row['rules'] = $rules; // Fix language $row['language'] = !empty($row['language']) ? $row['language'] : '*'; // Fix language $row['level'] = !empty($row['level']) ? $row['level'] : 1; // Check if path is correct $row['path'] = empty($row['path']) ? $row['alias'] : $row['path']; // Get alias from title if its empty if ($row['alias'] == "") { $row['alias'] = JFilterOutput::stringURLSafe($row['title']); } // Check if has duplicated aliases $alias = $this->getAlias('#__categories', $row['alias'], $row['extension']); // Prevent MySQL duplicate error // @@ Duplicate entry for key 'idx_client_id_parent_id_alias_language' $row['alias'] = !empty($alias) ? $alias . "-" . rand(0, 999999) : $row['alias']; // Remove the default id if keep ids parameters is not enabled if ($this->params->keep_ids != 1) { // Unset id unset($row['id']); // Save the parent if old installation is 2.5 or greater if (version_compare(JUpgradeproHelper::getVersion('old'), '1.5', '>') && $row['parent_id'] != 1) { $oldlist->section = $row['parent_id']; } else { $parent = 1; } } else { if ($this->params->keep_ids == 1) { // Save section id if old Joomla! version is 1.0 if (version_compare(JUpgradeproHelper::getVersion('old'), '1.0', '=') && isset($row['section'])) { $oldlist->section = $row['section']; } else { if (version_compare(JUpgradeproHelper::getVersion('old'), '1.5', '>') && $row['parent_id'] != 1) { $oldlist->section = $row['parent_id']; } } } } // Correct extension if (isset($row['extension'])) { if (is_numeric($row['extension']) || $row['extension'] == "" || $row['extension'] == "category") { $row['extension'] = "com_content"; } } // Fixing extension name if it's section if ($row['extension'] == 'com_section') { unset($row['id']); $row['extension'] = "com_content"; $parent = 1; } // If has parent made $path and get parent id if ($parent !== false) { // Setting the location of the new category $category->setLocation($parent, 'last-child'); } else { $category->setLocation(1, 'last-child'); } // Bind data to save category if (!$category->bind($row)) { throw new Exception($category->getError()); } // Insert the category if (!$category->store()) { throw new Exception($category->getError()); } // Get new id $oldlist->new = (int) $category->id; // Insert the row backup if (!$this->_db->insertObject('#__jupgradepro_categories', $oldlist)) { throw new Exception($this->_db->getErrorMsg()); } return true; }
/** * Get the raw data for this part of the upgrade. * * @return array Returns a reference to the source data array. * @since 1.1.0 * @throws Exception */ protected function _processExtensions() { jimport('joomla.filesystem.folder'); // Getting the component parameter with global settings $params = JUpgradeproHelper::getParams(); $types = array('/^(.+)_(.+)_(.+)$/', '/^(.+)_(.+)$/'); function replaceClassName($matches) { if ($matches[1] == 'com') { $option = 'jUpgradeComponent' . ucfirst($matches[2]); } else { if ($matches[1] == 'mod') { $option = 'jUpgradeModule' . ucfirst($matches[2]); } else { if ($matches[1] == 'plg') { $option = 'jUpgradePlugin' . ucfirst($matches[2]) . ucfirst($matches[3]); } else { if ($matches[1] == 'tpl') { $option = 'jUpgradeTemplate' . ucfirst($matches[2]); } } } } return $option; } // Getting the plugins list $query = $this->_db->getQuery(true); $query->select('*'); $query->from('#__extensions'); $query->where("type = 'plugin'"); $query->where("folder = 'jupgradepro'"); $query->where("enabled = 1"); $query->where("state = 0"); // Setting the query and getting the result $this->_db->setQuery($query); $plugins = $this->_db->loadObjectList(); // Get the tables list and prefix from the old site if ($params->method == "database") { $old_tables = $this->_driver->_db_old->getTableList(); $old_prefix = $params->old_dbprefix; } else { if ($params->method == "rest") { $old_tables = json_decode($this->_driver->requestRest('tableslist')); $old_prefix = substr($old_tables[10], 0, strpos($old_tables[10], '_') + 1); } } // Get the old site version $old_version = JUpgradeproHelper::getVersion('old'); // Do some custom post processing on the list. foreach ($plugins as $plugin) { // Looking for xml files $files = (array) JFolder::files(JPATH_PLUGINS . "/jupgradepro/{$plugin->element}/extensions", '\\.xml$', true, true); foreach ($files as $xmlfile) { if (!empty($xmlfile)) { $element = JFile::stripExt(basename($xmlfile)); if (array_key_exists($element, $this->extensions)) { $extension = $this->extensions[$element]; // Read xml definition file $xml = simplexml_load_file($xmlfile); // Getting the php file if (!empty($xml->installer->file[0])) { $phpfile = JPATH_ROOT . '/' . trim($xml->installer->file[0]); } if (empty($phpfile)) { $default_phpfile = JPATH_PLUGINS . "/jupgradepro/{$plugin->element}/extensions/{$element}.php"; $phpfile = file_exists($default_phpfile) ? $default_phpfile : null; } // Getting the class if (!empty($xml->installer->class[0])) { $class = trim($xml->installer->class[0]); } if (empty($class)) { $class = preg_replace_callback($types, 'replaceClassName', $element); } // Saving the extensions and migrating the tables if (!empty($phpfile) || !empty($xmlfile)) { // Adding +1 to count $this->count = $this->count + 1; // Reset the $query object $query->clear(); $xmlpath = "{$plugin->element}/extensions/{$element}.xml"; // Checking if other migration exists $query = $this->_db->getQuery(true); $query->select('e.*'); $query->from('#__jupgradepro_extensions AS e'); $query->where('e.name = \'' . $element . '\''); $query->limit(1); $this->_db->setQuery($query); $exists = $this->_db->loadResult(); if (empty($exists)) { // Inserting the step to #__jupgradepro_extensions table $query->insert('#__jupgradepro_extensions')->columns('`version`, `name`, `title`, `class`, `xmlpath`')->values("'{$old_version}', '{$element}', '{$xml->name}', '{$class}', '{$xmlpath}'"); $this->_db->setQuery($query); $this->_db->execute(); } // Inserting the collection if exists if (isset($xml->name) && isset($xml->collection)) { $query->insert('#__update_sites')->columns('name, type, location, enabled')->values("'{$xml->name}', 'collection', '{$xml->collection}, 1"); $this->_db->setQuery($query); $this->_db->execute(); } // Converting the params if (version_compare($old_version, '1.5', '=')) { $extension->params = $this->convertParams($extension->params); } // Unset id unset($extension->extension_id); // Saving the extension to #__extensions table if (!$this->_db->insertObject('#__extensions', $extension)) { throw new Exception($this->_db->getErrorMsg()); } // Getting the extension id $extension->extension_id = $this->_db->insertid(); // Adding tables to migrate if (!empty($xml->tables[0])) { // Check if tables must to be replaced $main_replace = (string) $xml->tables->attributes()->replace; $count = count($xml->tables[0]->table); for ($i = 0; $i < $count; $i++) { // $table = new StdClass(); $table->name = $table->source = $table->destination = (string) $xml->tables->table[$i]; $table->eid = $extension->extension_id; $table->element = $element; $table->version = $old_version; $table->class = $class; $table->replace = (string) $xml->tables->table[$i]->attributes()->replace; $table->replace = !empty($table->replace) ? $table->replace : $main_replace; $table_name = $old_prefix . $table->name; if (in_array($table_name, $old_tables)) { if (!$this->_db->insertObject('#__jupgradepro_extensions_tables', $table)) { throw new Exception($this->_db->getErrorMsg()); } } } } // Add other extensions from the package if (!empty($xml->package[0])) { foreach ($xml->package[0]->extension as $xml_ext) { if (isset($this->extensions[(string) $xml_ext->name])) { $extension = $this->extensions[(string) $xml_ext->name]; $state->extensions[] = (string) $xml_ext->name; $extension->params = $this->convertParams($extension->params); if (!$this->_db->insertObject('#__extensions', $extension)) { throw new Exception($this->_db->getErrorMsg()); } unset($this->extensions[(string) $xml_ext->name]); } } } } //end if } // end if } // end if unset($class); unset($phpfile); unset($xmlfile); } // end foreach } // end foreach return $this->count; }