diff options
| author | Michael Save <savetheinternet@tinyboard.org> | 2012-03-15 18:42:17 +1100 |
|---|---|---|
| committer | Michael Save <savetheinternet@tinyboard.org> | 2012-03-15 18:42:17 +1100 |
| commit | f3d784de510fc550eb384a4cefe58c76f6e9c3f4 (patch) | |
| tree | 0c125fb5982d75f4f5ae70f0711df383613c23ee /migration/kusabax.php | |
| parent | 9fab9253a358c96a2fcfa5004da6018901467bf4 (diff) | |
Fixed bug redeclaring gettext functions. Edit KusabaX config before including it.
Diffstat (limited to 'migration/kusabax.php')
| -rwxr-xr-x | migration/kusabax.php | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/migration/kusabax.php b/migration/kusabax.php index 789802f2..1561214f 100755 --- a/migration/kusabax.php +++ b/migration/kusabax.php @@ -6,8 +6,9 @@ /* Config */ // Path to KusabaX configuration file (config.php) + // Warning: This script will ignore anything past the first `require`. This is only a problem if you've extensively modified your config.php $kusabaxc['config'] = ''; - + /* End config */ @@ -20,8 +21,25 @@ if(!isset($kusabaxc['config']) || empty($kusabaxc['config'])) error('Did you forget to configure the script?'); + if(!file_exists($kusabaxc['config']) || !is_readable($kusabaxc['config'])) + error('Kusaba X config file doesn\'t exist or I can\'t read it.'); + + $temp = tempnam($config['tmp'], 'kusabax'); + + $raw_config = file_get_contents($kusabaxc['config']); + + // replace __FILE__ with the actual filename + $raw_config = str_replace('__FILE__', '\'' . addslashes(realpath($kusabaxc['config'])) . '\'', $raw_config); + + // remove anything after the first `require` + $raw_config = substr($raw_config, 0, strpos($raw_config, 'require KU_ROOTDIR')); + + file_put_contents($temp, $raw_config); + // Load KusabaX config - require $kusabaxc['config']; + require $temp; + + unlink($temp); if(KU_DBTYPE != 'mysql' && KU_DBTYPE != 'mysqli') error('Database type <strong>' . KU_DBTYPE . '</strong> not supported!'); |
