Ejemplo n.º 1
0
 /**
  * Get the raw data for this part of the upgrade.
  *
  * @return	array
  * @since	0.4.4
  * @throws	Exception
  */
 protected function &getSourceData()
 {
     $rows = parent::getSourceData();
     // Set up the mapping table for the old groups to the new groups.
     $groupMap = jUpgradeUsergroups::getUsergroupIdMap();
     // Set up the mapping table for the ARO id's to the new user id's.
     $userMap = $this->getUserIdAroMap();
     // Do some custom post processing on the list.
     // The schema for old group map is: group_id, section_value, aro_id
     // The schema for new groups is: user_id, group_id
     foreach ($rows as &$row) {
         $row['user_id'] = $userMap[$row['aro_id']];
         // Note, if we are here, these are custom groups we didn't know about.
         if ($row['group_id'] <= 30) {
             $row['group_id'] = $groupMap[$row['group_id']];
         }
         // Remove unused fields.
         unset($row['section_value']);
         unset($row['aro_id']);
     }
     return $rows;
 }
Ejemplo n.º 2
0
$jupgrade = new jUpgrade();
// Select the steps
$query = "SELECT * FROM j16_jupgrade_steps AS s WHERE s.status != 1 ORDER BY s.id ASC LIMIT 1";
$jupgrade->db_new->setQuery($query);
$step = $jupgrade->db_new->loadObject();
// Check for query error.
$error = $jupgrade->db_new->getErrorMsg();
// Require the file
require_once JPATH_BASE . '/migrate_' . $step->name . '.php';
switch ($step->name) {
    case 'users':
        // Migrate the users.
        $u1 = new jUpgradeUsers();
        $u1->upgrade();
        // Migrate the usergroups.
        $u2 = new jUpgradeUsergroups();
        $u2->upgrade();
        // Migrate the user-to-usergroup mapping.
        $u2 = new jUpgradeUsergroupMap();
        $u2->upgrade();
        break;
    case 'modules':
        // Migrate the Modules.
        $modules = new jUpgradeModules();
        $modules->upgrade();
        // Migrate the Modules Menus.
        $modulesmenu = new jUpgradeModulesMenu();
        $modulesmenu->upgrade();
        break;
    case 'categories':
        // Migrate the Categories.