aboutsummaryrefslogtreecommitdiff
path: root/app/Models/DatabaseDAOSQLite.php
blob: 7f53f967daa6bd1952c60f27d6d721a279f3a97d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php

/**
 * This class is used to test database is well-constructed (SQLite).
 */
class FreshRSS_DatabaseDAOSQLite extends FreshRSS_DatabaseDAO {
	public function tablesAreCorrect() {
		$sql = 'SELECT name FROM sqlite_master WHERE type="table"';
		$stm = $this->bd->prepare($sql);
		$stm->execute();
		$res = $stm->fetchAll(PDO::FETCH_ASSOC);
		
		$tables = array(
			'category' => false,
			'feed' => false,
			'entry' => false,
		);
		foreach ($res as $value) {
			$tables[$value['name']] = true;
		}

		return count(array_keys($tables, true, true)) == count($tables);
	}

	public function getSchema($table) {
		$sql = 'PRAGMA table_info(' . $table . ')';
		$stm = $this->bd->prepare($sql);
		$stm->execute();

		return $this->listDaoToSchema($stm->fetchAll(PDO::FETCH_ASSOC));
	}

	public function entryIsCorrect() {
		return $this->checkTable('entry', array(
			'id', 'guid', 'title', 'author', 'content', 'link', 'date', 'is_read',
			'is_favorite', 'id_feed', 'tags'
		));
	}

	public function daoToSchema($dao) {
		return array(
			'name' => $dao['name'],
			'type' => strtolower($dao['type']),
			'notnull' => $dao['notnull'] === '1' ? true : false,
			'default' => $dao['dflt_value'],
		);
	}
}
sues/1434 2016-11-28Add curl user-agent to retrive faviconGravatar Alexandre Alapetite https://github.com/FreshRSS/FreshRSS/issues/1380 2016-11-20extension_loaded fileinfoGravatar Alexandre Alapetite https://github.com/FreshRSS/FreshRSS/issues/1375 2016-11-15Function to disable MySQL buffering for large exportsGravatar Alexandre Alapetite 2016-11-06Fix small bugs in installGravatar Alexandre Alapetite Small fixes in install (e.g. better check that DB password works) 2016-11-05CLI: IEC prefix (binary) for unitsGravatar Alexandre Alapetite Updated according to https://wiki.ubuntu.com/UnitsPolicy (I got confused due `ls`, which is still using 1024 but is listed as an exception) And use the formatting function already included in FreshRSS 2016-10-24CLI actualize-userGravatar Alexandre Alapetite https://github.com/FreshRSS/FreshRSS/issues/1095 2016-10-24CLI do-installGravatar Alexandre Alapetite https://github.com/FreshRSS/FreshRSS/issues/1095 https://github.com/FreshRSS/FreshRSS/issues/1090 2016-10-23CLI import ZIP/OPML/JSON for userGravatar Alexandre Alapetite https://github.com/FreshRSS/FreshRSS/issues/1095 https://github.com/FreshRSS/FreshRSS/issues/851 2016-10-22CLI list-users and create-userGravatar Alexandre Alapetite https://github.com/FreshRSS/FreshRSS/issues/1095 https://github.com/FreshRSS/FreshRSS/issues/1090 2016-10-20Merge pull request #1337 from Alkarex/SimplePie-feed_or_html-UTF8-BOMGravatar Alexandre Alapetite Add support for UTF-8 BOM in SimplePie feed_or_html() 2016-10-20Add support for UTF-8 BOM in SimplePie feed_or_html()Gravatar Alexandre Alapetite https://github.com/FreshRSS/FreshRSS/issues/1336 2016-10-20Extract function safe_ascii()Gravatar Alexandre Alapetite 2016-10-12Minz::Log bug when currentUser is empty stringGravatar Alexandre Alapetite `Minz_Session::param('currentUser', '_')` could return an empty string 2016-10-12Cron refresh faviconsGravatar Alexandre Alapetite Related to https://github.com/FreshRSS/FreshRSS/issues/1181 https://github.com/FreshRSS/FreshRSS/issues/1298 2016-10-08W3C resource-priorities have been abandonnedGravatar Alexandre Alapetite https://github.com/FreshRSS/FreshRSS/issues/1222 2016-10-07Auto-refresh faviconsGravatar Alexandre Alapetite Every 15 days. https://github.com/FreshRSS/FreshRSS/issues/1181 2016-10-01Merge pull request #1270 from Alkarex/Minz-urlGravatar Alexandre Alapetite Minz URL bug 2016-10-01PostgreSQL case-insensitive SQL LIKEGravatar Alexandre Alapetite Compatibility with MySQL and SQLite 2016-09-30Minz URL bugGravatar Alexandre Alapetite More general fix for https://github.com/FreshRSS/FreshRSS/pull/1269 2016-09-27Merge branch 'FreshRSS/dev' into PostgreSQLGravatar Alexandre Alapetite 2016-09-25Fix SimplePie autodiscovery for text/xml HTML pagesGravatar Alexandre Alapetite https://github.com/FreshRSS/FreshRSS/issues/1264 2016-09-25Merge branch 'FreshRSS/dev' into PostgreSQLGravatar Alexandre Alapetite 2016-09-24Refactor controller for actualize feedGravatar Alexandre Alapetite 2016-09-11Merge dev: custom ports for PostgreSQL tooGravatar Alexandre Alapetite https://github.com/FreshRSS/FreshRSS/issues/1241 https://github.com/FreshRSS/FreshRSS/pull/1244 2016-09-05Support custom MySQL portsGravatar Alexandre Alapetite https://github.com/FreshRSS/FreshRSS/issues/1241 2016-08-31Quoted upper-cases instead of string replaceGravatar Alexandre Alapetite 2016-08-31MinzPDO inheritanceGravatar Alexandre Alapetite 2016-08-31Merge branch 'FreshRSS/dev' into PostgreSQLGravatar Alexandre Alapetite 2016-08-28SimplePie better messageGravatar Alexandre Alapetite 2016-08-28SimplePie error message XML PCREGravatar Alexandre Alapetite https://github.com/FreshRSS/FreshRSS/issues/1227 2016-08-23More PostgreSQLGravatar Alexandre Alapetite 2016-08-20Merge branch 'FreshRSS/dev' into PostgreSQLGravatar Alexandre Alapetite 2016-08-14Merge dev conflictsGravatar Alexandre Alapetite