Skip to content
Browse files

Fix installing with mysql db driver (issue #753)

  • Loading branch information...
1 parent 5f9fff8 commit 952a9e21e7520bda3a1f3a72823185d3e370080d @sourcejedi sourcejedi committed Mar 21, 2013
Showing with 30 additions and 25 deletions.
  1. +30 −25 bonfire/migrations/018_User_meta_move.php
View
55 bonfire/migrations/018_User_meta_move.php
@@ -44,36 +44,41 @@ public function up()
/*
Backup our users table
+
+ ...assuming BFPATH is set. It's not in the installer,
+ but we don't actually want a backup for fresh installs
*/
- $this->load->dbutil();
+ if (defined('BFPATH'))
+ {
+ $filename = BFPATH .'/db/backups/backup_meta_users_table.txt';
- $filename = defined('BFPATH') ? BFPATH : APPPATH;
- $filename .= '/db/backups/backup_meta_users_table.txt';
+ $this->load->dbutil();
- $prefs = array(
- 'tables' => $this->db->dbprefix .'users',
- 'format' => 'txt',
- 'filename' => $filename,
- 'add_drop' => true,
- 'add_insert' => true
- );
-
- // MySQLi does not support backups currently
- if ($this->db->dbdriver !== 'mysqli')
- {
- $backup =& $this->dbutil->backup($prefs);
+ $prefs = array(
+ 'tables' => $this->db->dbprefix .'users',
+ 'format' => 'txt',
+ 'filename' => $filename,
+ 'add_drop' => true,
+ 'add_insert' => true
+ );
- $this->load->helper('file');
- write_file($filename, $backup);
-
- if (file_exists($filename))
- {
- log_message('info', 'Backup file successfully saved. It can be found at <a href="/'. $filename .'">'. $filename . '</a>.');
- }
- else
+ // MySQLi does not support backups currently
+ if ($this->db->dbdriver !== 'mysqli')
{
- log_message('error', 'There was a problem saving the backup file.');
- die('There was a problem saving the backup file.');
+ $backup =& $this->dbutil->backup($prefs);
+
+ $this->load->helper('file');
+ write_file($filename, $backup);
+
+ if (file_exists($filename))
+ {
+ log_message('info', 'Backup file successfully saved. It can be found at <a href="/'. $filename .'">'. $filename . '</a>.');
+ }
+ else
+ {
+ log_message('error', 'There was a problem saving the backup file.');
+ die('There was a problem saving the backup file.');
+ }
}
}

0 comments on commit 952a9e2

Please sign in to comment.
Something went wrong with that request. Please try again.