Author Topic: Invalid Token, in UpdateDatabase while AIO component >> update plug-in tables  (Read 4409 times)

marco.azzali.76

  • Beginner
  • *
  • Posts: 14
Hi,

I've just migrated my VM site on another host and different domain name; I performed most common post-migration activities already.
Then I updated Joomla from 2.5.17 to 2.5.20 and Virtuemart from 2.0.24 to 2.6.2.
This problem persists, even after completely uninstalling the AIO component and re-installing it:
when I click Update plugin tables in the AIO component ,  it gives me the error "Invalid Token, in UpdateDatabase".

PHP is 5.3.28

Thank you in advance

Marco

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28336
  • Always on vacation
    • Jenkin Hill Internet
There is no need to update the plugin tables at that time, so is not a problem.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VirtueMart  4.0.2 10661 on Joomla 3.10.9 PHP 7.4.29

marco.azzali.76

  • Beginner
  • *
  • Posts: 14
Thank you very much for your prompt answer Jenkinhill !

Anyway, can you please provide an explanation of the error, and/or where this table is located ?

I'm a little maniac in these things...

Thank
Marco

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10305
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Please go to controllers/updatesmigration.php in the BE (administrator...)

search there for updateDatabase

then replace the function against this one
Code: [Select]
function updateDatabase(){

$data = JRequest::get('get');
$token = JRequest::getVar($data['token'],false,'post');
if(!$token){
JRequest::setVar($data['token'], '1', 'post');
}
JRequest::checkToken() or jexit('Invalid Token, in ' . JRequest::getWord('task'));

if(!class_exists('com_virtuemartInstallerScript')) require(JPATH_VM_ADMINISTRATOR . DS . 'install' . DS . 'script.virtuemart.php');
$updater = new com_virtuemartInstallerScript();
$updater->update(false);
$this->setRedirect($this->redirectPath, 'Database updated');
}
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

JMJ

  • Beginner
  • *
  • Posts: 8
Hi Milbo!

tried the trick; didnt work....

Still the same error...

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10305
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
or use

Code: [Select]
function updateDatabase(){

vRequest::vmCheckToken();

if(!class_exists('com_virtuemartInstallerScript')) require(JPATH_VM_ADMINISTRATOR . DS . 'install' . DS . 'script.virtuemart.php');
$updater = new com_virtuemartInstallerScript();
$updater->update(false);
$this->setRedirect($this->redirectPath, 'Database updated');
}

Just tested and changed today to our vmCheckToken, which is automatically checking for a token as key and a token set as token=
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10579
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.8.8
hmm - still Invalid Token, in updateDatabase  here

for ...administrator/index.php?option=com_virtuemart_allinone&task=updateDatabase&bb95b3afe2ddd487b78d1603ebca1492=1

oddly doesn't seem to reach function updateDatabase() in administrator/components/com_virtuemart/controllers/updatesmigration.php

if I rename to function updateDatabasexxxx() I still get the Invalid Token, in updateDatabase message

ah --
changed in   administrator/components/com_virtuemart_allinone/admin.virtuemart_allinone.php  ~ line 32

Code: [Select]
vRequest::vmCheckToken() or jexit('Invalid Token, in ' . JRequest::getWord('task'));
//JRequest::checkToken() or jexit('Invalid Token, in ' . JRequest::getWord('task'));

works now

hmm - not actually checking the token  - vRequest::vmCheckToken() is always false

don't understand the code in vRequest

if (!self::uword($token, false)){  always true - but no idea what it's checking  so vRequest::vmCheckToken() is always false

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10305
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
vmCheckToken closes the application, if the token was not found or not equal.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10579
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.8.8
yep - got that far -- but   uword($token, false)  comes back true therefore fails if (!self::uword($token, false)){

what is uword($token, false) doing?

I see it calls filterUword($source,$custom)  but don't get it from there on in
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Fantastic4

  • Beginner
  • *
  • Posts: 10
  • VirtueMart Version: 3.6.3
Hi,
i have the same problem.
Invalid Token, in updateDatabase after update and trying to actualize VM-Plugin Tables.
I tried both solutions as descripted by Milbo but they didn't solve the problem.
So, is there any other solution for the Problem??
Installation parameter: Joomla 2.5.20, VM 2.6.4, PHP 5.319 and MySQL 5.5.28
Thank you

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10579
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.8.8
Code: [Select]
vRequest::vmCheckToken() or jexit('Invalid Token, in ' . JRequest::getWord('task'));
//JRequest::checkToken() or jexit('Invalid Token, in ' . JRequest::getWord('task'));

it then updates  - all my hack does is bypass the token check
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

marco.azzali.76

  • Beginner
  • *
  • Posts: 14
With VM 2.6.6 the problem seems solved for me !  ;)

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10579
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.8.8
Yep - annouced on the 2.6.6 release feed

fixes while updating the tables for the Joomla updater
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation