diff options
| author | 2014-07-03 22:11:25 +0200 | |
|---|---|---|
| committer | 2014-07-03 22:11:25 +0200 | |
| commit | 2501bb337e75c41f97570f25775e20131faf2f2a (patch) | |
| tree | b87abb05d74925dd442febea67b14f213f61afec | |
| parent | d6f414108667f32fe2b480adeb7ec9c218db2f4a (diff) | |
Preparation #2 for SQLite
https://github.com/marienfressinaud/FreshRSS/issues/100
| -rw-r--r-- | app/Models/EntryDAOSQLite.php (renamed from app/Models/EntryDAO_SQLite.php) | 2 | ||||
| -rw-r--r-- | app/Models/Factory.php | 2 | ||||
| -rw-r--r-- | app/SQL/install.sql.sqlite.php | 2 | ||||
| -rw-r--r-- | app/install.php | 16 |
4 files changed, 15 insertions, 7 deletions
diff --git a/app/Models/EntryDAO_SQLite.php b/app/Models/EntryDAOSQLite.php index f148f3c63..45d3a3ea9 100644 --- a/app/Models/EntryDAO_SQLite.php +++ b/app/Models/EntryDAOSQLite.php @@ -1,6 +1,6 @@ <?php -class FreshRSS_EntryDAO_SQLite extends FreshRSS_EntryDAO { +class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO { public function markRead($ids, $is_read = true) { if (is_array($ids)) { //Many IDs at once diff --git a/app/Models/Factory.php b/app/Models/Factory.php index bea89c114..3ef68c41d 100644 --- a/app/Models/Factory.php +++ b/app/Models/Factory.php @@ -5,7 +5,7 @@ class FreshRSS_Factory { public static function createEntryDao() { $db = Minz_Configuration::dataBase(); if ($db['type'] === 'sqlite') { - return new FreshRSS_EntryDAO_SQLite(); + return new FreshRSS_EntryDAOSQLite(); } else { return new FreshRSS_EntryDAO(); } diff --git a/app/SQL/install.sql.sqlite.php b/app/SQL/install.sql.sqlite.php index 5bd294fde..8cdec981f 100644 --- a/app/SQL/install.sql.sqlite.php +++ b/app/SQL/install.sql.sqlite.php @@ -49,7 +49,7 @@ $SQL_CREATE_TABLES = array( 'CREATE INDEX IF NOT EXISTS entry_is_favorite_index ON `%1$sentry`(`is_favorite`);', 'CREATE INDEX IF NOT EXISTS entry_is_read_index ON `%1$sentry`(`is_read`);', -'INSERT OR IGNORE INTO `%1$scategory` (id, name) VALUES(1, "%1$s");', +'INSERT OR IGNORE INTO `%1$scategory` (id, name) VALUES(1, "%2$s");', ); define('SQL_DROP_TABLES', 'DROP TABLES %1$sentry, %1$sfeed, %1$scategory'); diff --git a/app/install.php b/app/install.php index 9863dd556..357a8e340 100644 --- a/app/install.php +++ b/app/install.php @@ -366,7 +366,7 @@ function newPdo() { ); break; case 'sqlite': - $str = 'sqlite:' . DATA_PATH . '/' . $_SESSION['bd_base'] . '.sqlite'; + $str = 'sqlite:' . DATA_PATH . '/' . $_SESSION['default_user'] . '.sqlite'; $driver_options = array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, ); @@ -407,7 +407,7 @@ function postUpdate() { } function deleteInstall () { - $res = unlink (DATA_PATH . 'do-install.txt'); + $res = unlink (DATA_PATH . '/do-install.txt'); if ($res) { header ('Location: index.php'); } @@ -665,7 +665,7 @@ function checkBD () { $str = 'mysql:host=' . $_SESSION['bd_host'] . ';dbname=' . $_SESSION['bd_base']; break; case 'sqlite': - $str = 'sqlite:' . DATA_PATH . '/' . $_SESSION['bd_base'] . '.sqlite'; + $str = 'sqlite:' . DATA_PATH . '/' . $_SESSION['default_user'] . '.sqlite'; $driver_options = array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, ); @@ -921,7 +921,7 @@ function printStep3 () { <div class="form-group"> <label class="group-name" for="type"><?php echo _t ('bdd_type'); ?></label> <div class="group-controls"> - <select name="type" id="type"> + <select name="type" id="type" onchange="mySqlShowHide()"> <option value="mysql" <?php echo (isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'mysql') ? 'selected="selected"' : ''; ?>> MySQL @@ -934,6 +934,7 @@ function printStep3 () { </div> </div> + <div id="mysql"> <div class="form-group"> <label class="group-name" for="host"><?php echo _t ('host'); ?></label> <div class="group-controls"> @@ -968,6 +969,13 @@ function printStep3 () { <input type="text" id="prefix" name="prefix" maxlength="16" pattern="[0-9A-Za-z_]{1,16}" value="<?php echo isset ($_SESSION['bd_prefix']) ? $_SESSION['bd_prefix'] : 'freshrss_'; ?>" /> </div> </div> + </div> + <script> + function mySqlShowHide() { + document.getElementById('mysql').style.display = document.getElementById('type').value === 'mysql' ? 'block' : 'none'; + } + mySqlShowHide(); + </script> <div class="form-group form-actions"> <div class="group-controls"> |
