Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error updating from 0.5.0 to 0.7 #942

Closed
3 tasks done
kini24 opened this issue Jun 13, 2020 · 9 comments · Fixed by #979
Closed
3 tasks done

Error updating from 0.5.0 to 0.7 #942

kini24 opened this issue Jun 13, 2020 · 9 comments · Fixed by #979

Comments

@kini24
Copy link

kini24 commented Jun 13, 2020

Baikal version: 0.5.0

  • I have searched open and closed issues for duplicates
  • I have installed the release zip, not the source code zip
  • I have moved the whole, untouched Specific and config folders to the new installation

Problem:
I am trying to update. I check the data of the installation wizard and at the end click "Start Upgrade" and get the following error:
"Error: Call to a member function getPDO() on null in /var/www/vhosts/dav/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php:98
Stack trace:
#0 /var/www/vhosts/dav/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php(68): BaikalAdmin\Controller\Install\VersionUpgrade->upgrade('0.5.0', '0.7.1')
#1 /var/www/vhosts/dav/Core/Frameworks/Flake/Core/Render/Container.php(69): BaikalAdmin\Controller\Install\VersionUpgrade->render()
#2 /var/www/vhosts/dav/Core/Frameworks/Flake/Controller/Page.php(90): Flake\Core\Render\Container->renderBlocks()
#3 /var/www/vhosts/dav/html/admin/install/index.php(100): Flake\Controller\Page->render()
#4 {main}"

As a base, I use MySQL:
mysql Ver 15.1 Distrib 10.1.43-MariaDB, for Linux (x86_64) using readline 5.1

My operating system:
Linux server 4.9.196-std-def-alt0.M80P.1 # 1 SMP Mon Oct 7 20:45:53 UTC 2019 x86_64 GNU / Linux

@ByteHamster
Copy link
Member

I just tested the upgrade from 0.5.1 to 0.7.1. Works fine on my PC. Does the file config/baikal.yaml contain the correct database details?

@kini24
Copy link
Author

kini24 commented Jun 14, 2020

My update steps.

  1. Logged in to check the installed version. It is equal to 0.5.0.
  2. Overwrite all files from the archive with the new version. I left only the configuration files and the site icon.
  3. Clear the browser cache and go to the server page. He launched the configuration wizard. I checked the data, entered the current baikal admin password, and then clicked the Save changes button
  4. At the next step, I checked that the Use MySQL item is checked (the settings are not displayed at the same time), clicked on the Save Changes button.
  5. In the next step, I returned to the console, manually entered the MySQL connection data into the yaml file (they were empty). Saved the changes to the file and returned to the web interface.
  6. Clicked Start Upgrade and got the following error

Uncaught exception during upgrade: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'asc NOT NULL, calendarid integer, principaluri text, access integer ' at line 2 in /var/www/vhosts/dav/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php:370 Stack trace: #0 /var/www/vhosts/dav/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php(370): PDO->exec('CREATE TABLE ca...') #1 /var/www/vhosts/dav/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php(68): BaikalAdmin\Controller\Install\VersionUpgrade->upgrade('0.5.0', '0.7.1') #2 /var/www/vhosts/dav/Core/Frameworks/Flake/Core/Render/Container.php(69): BaikalAdmin\Controller\Install\VersionUpgrade->render() #3 /var/www/vhosts/dav/Core/Frameworks/Flake/Controller/Page.php(90): Flake\Core\Render\Container->renderBlocks() #4 /var/www/vhosts/dav/html/admin/install/index.php(100): Flake\Controller\Page->render() #5 {main}

My yaml

system:
    configured_version: 0.5.0
    timezone: Asia/Krasnoyarsk
    card_enabled: true
    cal_enabled: true
    dav_auth_type: Basic
    admin_passwordhash: 91a5ee2147ab8069d2844279fba32101d0ef68304ef9ef695fffc80cfac3d511
    auth_realm: BaikalDAV
    base_uri: ''
    invite_from: ''
database:
    sqlite_file: /var/www/vhosts/dav/Specific/db/db.sqlite
    mysql: true
    mysql_host: localhost
    mysql_dbname: baikal
    mysql_username: baikal
    mysql_password: mysecretpassword
    encryption_key: b2354dc7e7b2bcdec2b252152e1655e7
    configured_version: ''

@kini24
Copy link
Author

kini24 commented Jun 15, 2020

I had to go a little longer way. First, I successfully upgraded the server to version 0.5.1. Then I replaced the files from the archive version 0.7.1 and updated the server again. Successful again.

@marcelbrueckner
Copy link

Thanks @kini24. I had a similar issue upgrading from 0.4.5 to 0.7.1.
baikal-upgrade-045-071

I've made an intermediate upgrade from 0.4.5 to 0.6.1 prior upgrading to 0.7.1

@ByteHamster
Copy link
Member

Sorry for the late reply. Baikal does not officially support MariaDB, only SQLite and MySQL. The error Syntax error or access violation: 1064 You have an error in your SQL syntax seems to be caused by sending MySQL statements to a MariaDB database, which might have a subtly different syntax.

@rubenvandeven
Copy link

It doesn't seem to be a problem with MariaDB (which is a MySQL fork), but rather a side effect of the config update. And seems to be the same issue as #965.
The problem seems to be line 368 of VersionUpgrade.php. It checks whether it's using Mysql using the constants from the old config file.. which don't exist. This causes it to fire the SQLite statements to MySQL (or MariaDB).

@ByteHamster
Copy link
Member

@rubenvandeven Good catch! Would you be interested in creating a pull request for this?

@MichaIng
Copy link

Reading through the code it looks like MySQL connection data is read from the new config file before it has been migrated from the old config file (or re-read from input): #946 (comment)
Would make sense that upgrade works from 0.5.1 on only then since from that version on there is no migration step done anymore.

#979 seems to fix it, but I'm not the best in reading that PHP code 😉.

@rubenvandeven
Copy link

Sorry for not following up on this sooner, it was a sort of in-between find that I had solved by applying a true. @benbz thanks for working on a proper fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants