tetsuo13 / MediaWiki-to-DokuWiki-Importer

Convert MediaWiki to DokuWiki
31 stars 10 forks source link

could not find driver #23

Open nstephens opened 11 years ago

nstephens commented 11 years ago

I have a server properly running a mediawiki install and a dokuwiki install.. however when I try to run this script, I am given a very bland "could not find driver" error, and then it exits. This error leads me to believe that it is a PDO issue, however I cannot seem to work around that.. I have verified that I have everything installed as I should (i think?), but nada. I even went so far as to setup a new virtualbox install of debian with a fresh install of everything below, and received the same error.

I know that the script says it has only been tested against an older version of mediawiki.. is that why it is failing for me? I figured I would give it a try and see how well it went (expecting it to miss some newer features potentially), but I didn't think it would die this early in the process.

Am I doing something wrong, or is this behaviour to be expected?

Thanks!

Debian 6.0.7 32bit mysqld 5.1 php 5.3.3-7+squeeze16 apache 2.2.16 mediawiki 1.21.1 dokuwiki 2013-05-10a

nstephens commented 11 years ago

For testing purposes, I grabbed an older backup of the mediawiki install (1.16) and installed that with the same results. I am now leaning more towards this being a php/pdo_mysql issue, but I'm hoping you might have some insight!

tetsuo13 commented 11 years ago

There's five variables it tries to grab from LocalSettings.php that may be where the problem is. The variables are

Since this is a working MediaWiki installation then it's probably just not grabbing one or more of those variables correctly. Can you copy and paste those lines in here? Please replace the sensitive information with garbage text.

nstephens commented 11 years ago

Here ya go! The only weirdness in here is that for some reason (i think during testing a long time ago) i have the same values commented out immediately following them, as shown below. The other possibility is that my password could have special characters that are messing it up. I have brackets, semicolons, etc in the password..

$wgDBtype = "mysql"; #mysql $wgDBserver = "localhost"; #localhost $wgDBname = "my_wp"; #my_wp $wgDBuser = "my_wp"; #my_wp $wgDBpassword = "complex-password-with-lots-of-special-characters"; #same password commented out

tetsuo13 commented 11 years ago

I've rewritten the LocalSettings.php parsing routine so now it can handle inline comments and strings as complex as "Q?u>U(]\c;e+~e0l|;g~df<}byG/hJ?\'iL.!7HO7s"+". Please give the latest in master another try to see if it fixes the issue.

AlasdairKing commented 10 years ago

I got this because LocalSettings.php did not contain a value for "wgDBtype". I added this value to my MediaWiki's LocalSettings.php and the error went away. ("mysql" is the default, so I guess MediaWiki does not need it explicitly defined unless it is not "mysql" - but the Importer script does)

$wgDBtype = "mysql";

sajjadG commented 10 years ago

I have the same issue here. I have a working MediaWiki installation that uses PostgreSQL. and I have $wgDBtype = "postgres"; in my MW LocalSettings.php but I get could not find driver error when I run the script in terminal. my DB setting in LocalSettings.php as follows:

## Database settings
$wgDBtype = "postgres";
$wgDBserver = "localhost";
$wgDBname = "my_wiki";
$wgDBuser = "postgres";
$wgDBpassword = "123456";

# Postgres specific settings
$wgDBport = "5432";
$wgDBmwschema = "mediawiki";

@tetsuo13 please reopen this bug.

fischfutter commented 3 years ago

I had the same error, "could not find driver". I found out, that my LocalSettings.php had some leading spaces in front of the variables. After removing them, it was possible to migrate. So this string here fixed it : sed -i 's/^[ \t]*//' LocalSettings.php

tetsuo13 commented 3 years ago

Ah! The issue seems to be related to this function:

https://github.com/tetsuo13/MediaWiki-to-DokuWiki-Importer/blob/767955b590fdb46d20f29e943c3d18aa0a413180/src/MediaWiki2DokuWiki/MediaWiki/Settings.php#L150

It parses each line in LocalSettings.php and assumes that variables start at the beginning of the line. This could be fixed by calling trim() on each line before attempting to use it.

maximiliansport commented 1 year ago

I've got the same error "could not find driver"

Database settings

$wgDBtype = "mysql"; $wgDBserver = "localhost:8083"; $wgDBname = "nameaufmediawikidb"; $wgDBuser = "user"; $wgDBpassword = "pwd";

What should I do? Have I add a trim() into these function above? And where exactly? I had tried it, but maybe on wrong place.