Exemple #1
0
 /**
  * Update script
  * Triggers after database processing
  *
  * @param object JInstallerComponent parent
  * @return boolean True on success
  */
 public function update($loadVm = true)
 {
     if ($loadVm) {
         $this->loadVm();
     }
     if (!$this->checkIfUpdate()) {
         return $this->install($loadVm);
     }
     if (!class_exists('JFile')) {
         require JPATH_VM_LIBRARIES . DS . 'joomla' . DS . 'filesystem' . DS . 'file.php';
     }
     if (!class_exists('JFolder')) {
         require JPATH_VM_LIBRARIES . DS . 'joomla' . DS . 'filesystem' . DS . 'folder.php';
     }
     //Delete Cache
     $cache = JFactory::getCache();
     $cache->clean();
     $this->_db = JFactory::getDBO();
     if (empty($this->path)) {
         $this->path = JPATH_VM_ADMINISTRATOR;
     }
     $params = JComponentHelper::getParams('com_languages');
     $lang = $params->get('site', 'en-GB');
     //use default joomla
     $lang = strtolower(strtr($lang, '-', '_'));
     if (!class_exists('VmModel')) {
         require $this->path . DS . 'helpers' . DS . 'vmmodel.php';
     }
     if (!class_exists('VirtueMartModelUpdatesMigration')) {
         require $this->path . DS . 'models' . DS . 'updatesmigration.php';
     }
     $model = new VirtueMartModelUpdatesMigration();
     //JModel::getInstance('updatesmigration', 'VirtueMartModel');
     $model->execSQLFile($this->path . DS . 'install' . DS . 'install.sql');
     $this->joomlaSessionDBToMediumText();
     $this->alterTable('#__virtuemart_product_prices', array('product_price_vdate' => '`product_price_publish_up` DATETIME NULL DEFAULT NULL AFTER `product_currency`', 'product_price_edate' => '`product_price_publish_down` DATETIME NULL DEFAULT NULL AFTER `product_price_publish_up`'));
     $this->alterTable('#__virtuemart_customs', array('custom_field_desc' => '`custom_desc` char(255) COMMENT \'description or unit\''));
     $this->alterTable('#__virtuemart_product_customfields', array('custom_value' => ' `customfield_value` text NULL DEFAULT NULL', 'custom_price' => ' `customfield_price` DECIMAL(15,6) NULL DEFAULT NULL COMMENT \'price\'', 'custom_param' => ' `customfield_params` text NULL DEFAULT NULL', 'idx_custom_value' => ' INDEX `idx_published` (`published`)'));
     $this->alterTable('#__virtuemart_medias', array('file_url' => '`file_url` varchar(900) NOT NULL DEFAULT ""', 'file_params' => '`file_params` varchar(17500)', 'file_url_thumb' => '`file_url_thumb` varchar(900) NOT NULL DEFAULT ""'));
     $this->alterTable('#__virtuemart_userfields', array('params' => '`userfield_params` varchar(17500) NOT NULL DEFAULT "" COMMENT \'userfield params\''));
     //todo Maik, please take a look, this should not be anylonger necessary
     /*$this->alterTable('#__virtuemart_order_items',
     			array(
     				'product_discountedPriceWithoutTax' => '',
     			),
     			'DROP'
     		);*/
     if (!class_exists('GenericTableUpdater')) {
         require $this->path . DS . 'helpers' . DS . 'tableupdater.php';
     }
     $updater = new GenericTableUpdater();
     $updater->updateMyVmTables();
     $result = $updater->createLanguageTables();
     $this->checkAddDefaultShoppergroups();
     $this->adjustDefaultOrderStates();
     $this->fixOrdersVendorId();
     $this->updateAdminMenuEntries();
     $this->migrateCustoms();
     //copy sampel media
     $src = $this->path . DS . 'assets' . DS . 'images' . DS . 'vmsampleimages';
     if (JFolder::exists($src)) {
         $dst = JPATH_ROOT . DS . 'images' . DS . 'stories' . DS . 'virtuemart';
         $this->recurse_copy($src, $dst);
     }
     //fix joomla BE menu
     //$model = VmModel::getModel('updatesmigration');
     //$model->checkFixJoomlaBEMenuEntries();
     if ($loadVm) {
         $this->displayFinished(true);
     }
     return true;
 }
 /**
  * Update script
  * Triggers after database processing
  *
  * @param object JInstallerComponent parent
  * @return boolean True on success
  */
 public function update($loadVm = true)
 {
     if ($loadVm) {
         $this->loadVm();
     }
     if (!$this->checkIfUpdate()) {
         return $this->install($loadVm);
     }
     $this->_db = JFactory::getDBO();
     if (empty($this->path)) {
         $this->path = JPATH_VM_ADMINISTRATOR;
     }
     $params = JComponentHelper::getParams('com_languages');
     $lang = $params->get('site', 'en-GB');
     //use default joomla
     $lang = strtolower(strtr($lang, '-', '_'));
     if (!class_exists('VirtueMartModelUpdatesMigration')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'updatesmigration.php';
     }
     $model = new VirtueMartModelUpdatesMigration();
     //JModel::getInstance('updatesmigration', 'VirtueMartModel');
     $model->execSQLFile($this->path . DS . 'install' . DS . 'install.sql', $lang);
     $this->joomlaSessionDBToMediumText();
     $this->alterTable('#__virtuemart_product_prices', array('product_price_vdate' => ' `product_price_publish_up` DATETIME NULL DEFAULT NULL AFTER `product_currency`', 'product_price_edate' => ' `product_price_publish_down` DATETIME NULL DEFAULT NULL AFTER `product_price_publish_up`'));
     $this->alterTable('#__virtuemart_medias', array('file_url' => '`file_url` varchar(900) NOT NULL DEFAULT ""', 'file_params' => '`file_params` varchar(17500)', 'file_url_thumb' => '`file_url_thumb` varchar(900) NOT NULL DEFAULT ""'));
     $this->deleteReCreatePrimaryKey('#__virtuemart_userinfos', 'virtuemart_userinfo_id');
     if (!class_exists('GenericTableUpdater')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'tableupdater.php';
     }
     $updater = new GenericTableUpdater();
     $updater->updateMyVmTables();
     $result = $updater->createLanguageTables();
     $this->checkAddDefaultShoppergroups();
     $this->adjustDefaultOrderStates();
     $this->fixOrdersVendorId();
     $this->fixConfigValues();
     if ($loadVm) {
         $this->displayFinished(true);
     }
     return true;
 }
 /**
  * Update script
  * Triggers after database processing
  *
  * @param object JInstallerComponent parent
  * @return boolean True on success
  */
 public function update($loadVm = true)
 {
     if ($loadVm) {
         $this->loadVm();
     }
     if (!$this->checkIfUpdate()) {
         return $this->install($loadVm);
     }
     $this->_db = JFactory::getDBO();
     if (empty($this->path)) {
         $this->path = JPATH_VM_ADMINISTRATOR;
     }
     $params = JComponentHelper::getParams('com_languages');
     $lang = $params->get('site', 'en-GB');
     //use default joomla
     $lang = strtolower(strtr($lang, '-', '_'));
     if (!class_exists('VirtueMartModelUpdatesMigration')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'updatesmigration.php';
     }
     $model = new VirtueMartModelUpdatesMigration();
     //JModelLegacy ::getInstance('updatesmigration', 'VirtueMartModel');
     $model->execSQLFile($this->path . DS . 'install' . DS . 'install.sql', $lang);
     // 			$this->displayFinished(true);
     //return false;
     $this->joomlaSessionDBToMediumText();
     // 			$this->portOverwritePrices();
     /*			$table = '#__virtuemart_customs';
     			$fieldname = 'field_type';
     			$fieldvalue = 'G';
     			$this->addToRequired($table,$fieldname,$fieldvalue,"INSERT INTO `#__virtuemart_customs`
     					(`custom_parent_id`, `admin_only`, `custom_title`, `custom_tip`, `custom_value`, `custom_field_desc`,
     					 `field_type`, `is_list`, `is_hidden`, `is_cart_attribute`, `published`) VALUES
     						(0, 0, 'COM_VIRTUEMART_STOCKABLE_PRODUCT', 'COM_VIRTUEMART_STOCKABLE_PRODUCT_TIP', NULL,
     					'COM_VIRTUEMART_STOCKABLE_PRODUCT_DESC', 'G', 0, 0, 0, 1 );");
     */
     $this->alterTable('#__virtuemart_product_prices', array('product_price_vdate' => ' `product_price_publish_up` DATETIME NULL DEFAULT NULL AFTER `product_currency`', 'product_price_edate' => ' `product_price_publish_down` DATETIME NULL DEFAULT NULL AFTER `product_price_publish_up`'));
     $this->alterTable('#__virtuemart_medias', array('file_url' => '`file_url` varchar(900) NOT NULL DEFAULT ""', 'file_params' => '`file_params` varchar(17500)', 'file_url_thumb' => '`file_url_thumb` varchar(900) NOT NULL DEFAULT ""'));
     $this->alterTable('#__virtuemart_order_items', array('product_discountedPriceWithoutTax' => ''), 'DROP');
     $this->deleteReCreatePrimaryKey('#__virtuemart_userinfos', 'virtuemart_userinfo_id');
     //$this->renameVdateToPublishDown();
     if (!class_exists('GenericTableUpdater')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'tableupdater.php';
     }
     $updater = new GenericTableUpdater();
     $updater->updateMyVmTables();
     $result = $updater->createLanguageTables();
     $this->checkAddDefaultShoppergroups();
     $this->adjustDefaultOrderStates();
     $this->fixOrdersVendorId();
     $this->fixConfigValues();
     if ($loadVm) {
         $this->displayFinished(true);
     }
     return true;
 }
 /**
  * Update script
  * Triggers after database processing
  *
  * @param object JInstallerComponent parent
  * @return boolean True on success
  */
 public function update($loadVm = true)
 {
     if ($loadVm) {
         $this->loadVm();
     }
     if (!$this->checkIfUpdate()) {
         return $this->install($loadVm);
     }
     $this->_db = JFactory::getDBO();
     if (empty($this->path)) {
         $this->path = JPATH_VM_ADMINISTRATOR;
     }
     $params = JComponentHelper::getParams('com_languages');
     $lang = $params->get('site', 'en-GB');
     //use default joomla
     $lang = strtolower(strtr($lang, '-', '_'));
     if (!class_exists('VirtueMartModelUpdatesMigration')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'updatesmigration.php';
     }
     $model = new VirtueMartModelUpdatesMigration();
     //JModel::getInstance('updatesmigration', 'VirtueMartModel');
     $model->execSQLFile($this->path . DS . 'install' . DS . 'install.sql', $lang);
     // 			$this->displayFinished(true);
     //return false;
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $fields = array('data' => '`data` text NULL AFTER `time`');
         $this->alterTable('#__session', $fields);
     }
     // 			$this->portOverwritePrices();
     /*			$table = '#__virtuemart_customs';
     			$fieldname = 'field_type';
     			$fieldvalue = 'G';
     			$this->addToRequired($table,$fieldname,$fieldvalue,"INSERT INTO `#__virtuemart_customs`
     					(`custom_parent_id`, `admin_only`, `custom_title`, `custom_tip`, `custom_value`, `custom_field_desc`,
     					 `field_type`, `is_list`, `is_hidden`, `is_cart_attribute`, `published`) VALUES
     						(0, 0, 'COM_VIRTUEMART_STOCKABLE_PRODUCT', 'COM_VIRTUEMART_STOCKABLE_PRODUCT_TIP', NULL,
     					'COM_VIRTUEMART_STOCKABLE_PRODUCT_DESC', 'G', 0, 0, 0, 1 );");
     */
     $this->deleteReCreatePrimaryKey('#__virtuemart_userinfos', 'virtuemart_userinfo_id');
     if (!class_exists('GenericTableUpdater')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'tableupdater.php';
     }
     $updater = new GenericTableUpdater();
     $updater->updateMyVmTables();
     $result = $updater->createLanguageTables();
     $this->checkAddDefaultShoppergroups();
     $this->adjustDefaultOrderStates();
     $this->fixOrdersVendorId();
     if ($loadVm) {
         $this->displayFinished(true);
     }
     return true;
 }