summaryrefslogtreecommitdiff
path: root/lib/lib_rss.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-20 11:54:31 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-20 11:54:31 +0200
commit7080a32650ab8b19e917d8add944a75cc98381bc (patch)
treea06593be4c12fcb21566c0d249af3ee63d8429df /lib/lib_rss.php
parent3bad4d138e5c4a86aa3f88dea3787c3335861ce4 (diff)
Add checking installation feature
Diffstat (limited to 'lib/lib_rss.php')
-rw-r--r--lib/lib_rss.php62
1 files changed, 62 insertions, 0 deletions
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index 2f9a2ea45..dbed207d0 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -245,3 +245,65 @@ function is_referer_from_same_domain() {
}
return (isset($host['port']) ? $host['port'] : 0) === (isset($referer['port']) ? $referer['port'] : 0);
}
+
+
+/**
+ *
+ */
+function check_install_php() {
+ return array(
+ 'php' => version_compare(PHP_VERSION, '5.2.1') >= 0,
+ 'minz' => file_exists(LIB_PATH . '/Minz'),
+ 'curl' => extension_loaded('curl'),
+ 'pdo_mysql' => extension_loaded('pdo_mysql'),
+ 'pdo_sqlite' => extension_loaded('pdo_sqlite'),
+ 'pdo' => extension_loaded('pdo_mysql') || extension_loaded('pdo_sqlite'),
+ 'pcre' => extension_loaded('pcre'),
+ 'ctype' => extension_loaded('ctype'),
+ 'dom' => class_exists('DOMDocument'),
+ 'json' => extension_loaded('json'),
+ 'zip' => extension_loaded('zip'),
+ );
+}
+
+
+/**
+ *
+ */
+function check_install_files() {
+ return array(
+ 'data' => DATA_PATH && is_writable(DATA_PATH),
+ 'cache' => CACHE_PATH && is_writable(CACHE_PATH),
+ 'logs' => LOG_PATH && is_writable(LOG_PATH),
+ 'favicons' => is_writable(DATA_PATH . '/favicons'),
+ 'persona' => is_writable(DATA_PATH . '/persona'),
+ 'tokens' => is_writable(DATA_PATH . '/tokens'),
+ );
+}
+
+
+/**
+ *
+ */
+function check_install_database() {
+ $status = array(
+ 'connection' => true,
+ 'tables' => false,
+ 'categories' => false,
+ 'feeds' => false,
+ 'entries' => false,
+ );
+
+ try {
+ $dbDAO = FreshRSS_Factory::createDatabaseDAO();
+
+ $status['tables'] = $dbDAO->tablesAreCorrect();
+ $status['categories'] = $dbDAO->categoryIsCorrect();
+ $status['feeds'] = $dbDAO->feedIsCorrect();
+ $status['entries'] = $dbDAO->entryIsCorrect();
+ } catch(Minz_PDOConnectionException $e) {
+ $status['connection'] = false;
+ }
+
+ return $status;
+}