Exemple #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;
 }
Exemple #2
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;
 }
Exemple #3
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;
 }
Exemple #4
0
 /**
  * The public entry point for the class.
  *
  * @return	void
  * @since	0.5.6
  * @throws	Exception
  */
 public function upgrade()
 {
     if (parent::upgrade()) {
         // Rebuild the categories table
         $table = JTable::getInstance('Category', 'JTable', array('dbo' => $this->db_new));
         if (!$table->rebuild()) {
             echo JError::raiseError(500, $table->getError());
         }
     }
 }
Exemple #5
0
 /**
  * Migrate the folders.
  *
  * @return  boolean
  *
  * @since   2.0
  */
 protected function migrateExtensionFolders()
 {
     return parent::migrateExtensionFolders();
 }
Exemple #6
0
 /**
  * Get a single row
  *
  * @return   step object
  */
 public function requestRest($task = 'total', $table = false)
 {
     // Initialize jupgrade class
     $jupgrade = new jUpgrade();
     // JHttp instance
     jimport('joomla.http.http');
     $http = new JHttp();
     $data = $jupgrade->getRestData();
     // Getting the total
     $data['task'] = $task;
     $data['table'] = $table;
     $request = $http->get($jupgrade->params->get('rest_hostname'), $data);
     return $request->body;
 }
Exemple #7
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;
 }
Exemple #8
0
 /**
  * The public entry point for the class.
  *
  * @return	void
  * @since	0.5.2
  * @throws	Exception
  */
 public function upgrade()
 {
     if (parent::upgrade()) {
         // Rebuild the menu nested set values.
         $table = JTable::getInstance('Menu', 'JTable', array('dbo' => $this->_db));
         if (!$table->rebuild()) {
             echo JError::raiseError(500, $table->getError());
         }
     }
 }
Exemple #9
0
 * @version		$Id: download.php 20858 2011-02-26 06:49:36Z maguirre $
 * @package		MatWare
 * @subpackage	com_jupgrade
 * @copyright	Copyright 2006 - 2011 Matias Aguire. All rights reserved.
 * @license		GNU General Public License version 2 or later.
 * @author		Matias Aguirre <*****@*****.**>
 * @link		http://www.matware.com.ar
 */
define('_JEXEC', 1);
define('JPATH_BASE', dirname(__FILE__));
define('DS', DIRECTORY_SEPARATOR);
// Includes
require_once JPATH_BASE . '/defines_old.php';
require_once JPATH_BASE . '/jupgrade.class.php';
// jUpgrade class
$jupgrade = new jUpgrade();
// Getting the component parameter with global settings
$params = $jupgrade->getParams();
// Define filenames
$sizefile = JPATH_ROOT . '/tmp/size.tmp';
$molajofile = JPATH_ROOT . '/tmp/molajo16.zip';
$joomlafile = JPATH_ROOT . '/tmp/joomla16.zip';
// Cleanup
if (file_exists($sizefile)) {
    unlink($sizefile);
}
if (file_exists($molajofile)) {
    unlink($molajofile);
}
if (file_exists($joomlafile)) {
    unlink($joomlafile);
Exemple #10
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;
	}
Exemple #11
0
 /**
  * Get a list of images to migrate
  *
  * @return   step object
  */
 public function getImage()
 {
     // Initialize jupgrade class
     $jupgrade = new jUpgrade();
     // JHttp instance
     jimport('joomla.http.http');
     $http = new JHttp();
     $data = $jupgrade->getRestData();
     // Getting the total
     $data['task'] = "image";
     $data['files'] = 'images';
     $response = $http->get($jupgrade->params->get('rest_hostname'), $data);
     $id = $this->_getID('files_images');
     $id = $id + 1;
     $name = $this->_getImageName($id);
     $write = JFile::write(JPATH_ROOT . '/images.new/' . $name, $response->body);
     $this->_updateID($id, 'files_images');
 }
Exemple #12
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;
 }
Exemple #13
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;
 }