Example #1
0
 protected function copyTable_k2_items($table)
 {
     $this->source = $this->destination = "#__{$table}";
     // Clone table
     $this->cloneTable($this->source, $this->destination);
     // Get data
     $rows = parent::getSourceData('*');
     // Do some custom post processing on the list.
     foreach ($rows as &$row) {
         $row['access'] = $row['access'] == 0 ? 1 : $row['access'] + 1;
         $row['params'] = $this->convertParams($row['params']);
         $row['plugins'] = $this->convertParams($row['plugins']);
     }
     $this->setDestinationData($rows);
     return true;
 }
Example #2
0
 /**
  * Get the raw data for this part of the upgrade.
  *
  * @return	array	Returns a reference to the source data array.
  * @since	0.5.6
  * @throws	Exception
  */
 protected function &getSourceData()
 {
     $where = "section = 'com_weblinks'";
     $rows = parent::getSourceData('`id` AS sid, `title`, `alias`, `section` AS extension, `description`, `published`, `checked_out`, `checked_out_time`, `access`, `params`', null, $where, 'id');
     // Do some custom post processing on the list.
     foreach ($rows as &$row) {
         $row['params'] = $this->convertParams($row['params']);
         $row['access'] = $row['access'] == 0 ? 1 : $row['access'] + 1;
         $row['language'] = '*';
         // Correct alias
         if ($row['alias'] == "") {
             $row['alias'] = JFilterOutput::stringURLSafe($row['title']);
         }
     }
     return $rows;
 }
Example #3
0
 /**
  * Get the raw data for this part of the upgrade.
  *
  * @return	array	Returns a reference to the source data array.
  * @since	0.4.5
  * @throws	Exception
  */
 protected function &getSourceData()
 {
     $where = "o.section REGEXP '^[\\-\\+]?[[:digit:]]*\\.?[[:digit:]]*\$'";
     $rows = parent::getSourceData('`id`, `title`, NULL AS `alias`, `title_alias`, `introtext`, `fulltext`, `state`, ' . '`mask`, o.new AS catid, `created`, `created_by`, `created_by_alias`, ' . '`modified`, `modified_by`, `checked_out`, `checked_out_time`, `publish_up`, `publish_down`, ' . '`images`, `urls`, `attribs`, `version`, `parentid`, `ordering`, `metakey`, `metadesc`, ' . '`access`, `hits` ', 'LEFT JOIN j16_jupgrade_categories AS o ON o.old = c.catid', $where, 'id');
     // Do some custom post processing on the list.
     foreach ($rows as &$row) {
         $row['title'] = str_replace("'", "\\'", $row['title']);
         $row['introtext'] = str_replace("'", "\\'", $row['introtext']);
         $row['fulltext'] = str_replace("'", "\\'", $row['fulltext']);
         $row['attribs'] = $this->convertParams($row['attribs']);
         $row['access'] = $row['access'] == 0 ? 1 : $row['access'] + 1;
         $row['language'] = '*';
         // Correct alias
         if ($row['alias'] == "") {
             $row['alias'] = JFilterOutput::stringURLSafe($row['title']);
         }
         // Correct state
         if ($row['state'] == -1) {
             $row['state'] = 2;
         }
     }
     return $rows;
 }
Example #4
0
 /**
  * Copy kunena_categories table from old site to new site.
  *
  * You can create custom copy functions for all your tables.
  *
  * If you want to copy your table in many smaller chunks,
  * please store your custom state variables into $this->state and return false.
  * Returning false will force jUpgrade to call this function again,
  * which allows you to continue import by reading $this->state before continuing.
  *
  * @return	boolean Ready (true/false)
  * @since	1.6.4
  * @throws	Exception
  */
 protected function copyTable_kunena_categories($table)
 {
     $this->source = $this->destination = "#__{$table}";
     // Clone table
     $this->cloneTable($this->source, $this->destination);
     // Get data
     $rows = parent::getSourceData('*');
     // Do some custom post processing on the list.
     foreach ($rows as &$row) {
         if (!isset($row['accesstype']) || $row['accesstype'] == 'none') {
             if ($row['admin_access'] != 0) {
                 $row['admin_access'] = $this->mapUserGroup($row['admin_access']);
             }
             if ($row['pub_access'] == -1) {
                 // All registered
                 $row['pub_access'] = 2;
                 $row['pub_recurse'] = 1;
             } elseif ($row['pub_access'] == 0) {
                 // Everybody
                 $row['pub_access'] = 1;
                 $row['pub_recurse'] = 1;
             } elseif ($row['pub_access'] == 1) {
                 // Nobody
                 $row['pub_access'] = 8;
             } else {
                 // User groups
                 $row['pub_access'] = $this->mapUserGroup($row['pub_access']);
             }
         } elseif ($row['accesstype'] == 'joomla.level') {
             // Convert Joomla access levels
             $row['access']++;
         }
     }
     $this->setDestinationData($rows);
     return true;
 }
Example #5
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;
 }
Example #6
0
	/**
	 * Copy kunena_categories table from old site to new site.
	 *
	 * You can create custom copy functions for all your tables.
	 *
	 * If you want to copy your table in many smaller chunks,
	 * please store your custom state variables into $this->state and return false.
	 * Returning false will force jUpgrade to call this function again,
	 * which allows you to continue import by reading $this->state before continuing.
	 *
	 * @return	boolean Ready (true/false)
	 * @since	1.6.4
	 * @throws	Exception
	 */
	protected function copyTable_kunena_categories($table) {
		$this->source = $this->destination = "#__{$table}";

		// Clone table
		$this->cloneTable($this->source, $this->destination);

		// Get data
		$rows = parent::getSourceData('*');

		// Set up the mapping table for the old groups to the new groups.
		$map = $this->getUsergroupIdMap();

		// Do some custom post processing on the list.
		foreach ($rows as &$row) {
			if (isset($row['accesstype']) || $row['accesstype'] == 'none' ) {
				if ($row['admin_access'] != 0) {
					$row['admin_access'] = $map[$row['admin_access']];
				}
				if ($row['pub_access'] == -1) {
					// All registered
					$row['pub_access'] = 2;
					$row['pub_recurse'] = 1;
				} elseif ($row['pub_access'] == 0) {
					// Everybody
					$row['pub_access'] = 1;
					$row['pub_recurse'] = 1;
				} elseif ($row['pub_access'] == 1) {
					// Nobody
					$row['pub_access'] = 8;
				} else {
					// User groups
					$row['pub_access'] = $map[$row['pub_access']];
				}
			}
		}
		$this->setDestinationData($rows);
		return true;
	}
Example #7
0
 /**
  * Get the raw data for this part of the upgrade.
  *
  * @return	array	Returns a reference to the source data array.
  * @since	0.4.5
  * @throws	Exception
  */
 protected function &getSourceData()
 {
     // Getting the map id's for modules and menus
     $modules = $this->getMapList('modules');
     $menus = $this->getMapList('menus');
     // Getting the menus keys to prevent 'Notice: Undefined index'
     $menus_keys = array_keys($menus);
     $where = "m.moduleid NOT IN (1, 16, 17, 18)";
     // Getting the data
     $rows = parent::getSourceData('*', null, $where, 'm.moduleid');
     // Do some custom post processing on the list.
     foreach ($rows as &$row) {
         if (in_array($row['menuid'], $menus_keys)) {
             $moduleid_new = $modules[$row['moduleid']]->new;
             $menuid_new = $menus[$row['menuid']]->new;
             //echo "<b> MODULE ID:</b> {$moduleid_new} <==> <b> MENU ID:</b> {$menuid_new}";
             //echo "<br><br>.................<br><br>";
             $row['moduleid'] = $moduleid_new == '' ? 0 : $moduleid_new;
             $row['menuid'] = $menuid_new == '' ? 0 : $menuid_new;
         }
     }
     return $rows;
 }
Example #8
0
 /**
  * Get the raw data for this part of the upgrade.
  *
  * @return	array	Returns a reference to the source data array.
  * @since	0.4.5
  * @throws	Exception
  */
 protected function &getSourceData()
 {
     $rows = parent::getSourceData('*', null, $this->db_old->nameQuote('id') . ' > 1', 'id');
     return $rows;
 }