From 5e26c9102450cdf4e635fc401b88e293402fca25 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 5 Feb 2015 00:05:43 +0100 Subject: renamed wallabag_compatibility_test since it doesn't do that anymore --- install/install_functions.php | 88 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 install/install_functions.php (limited to 'install/install_functions.php') diff --git a/install/install_functions.php b/install/install_functions.php new file mode 100644 index 00000000..3b465851 --- /dev/null +++ b/install/install_functions.php @@ -0,0 +1,88 @@ + + * @copyright 2013 + * @license http://opensource.org/licenses/MIT see COPYING file + */ + +function status() { +$app_name = 'wallabag'; + +$php_ok = (function_exists('version_compare') && version_compare(phpversion(), '5.3.3', '>=')); +$pdo_ok = class_exists('PDO'); +$pcre_ok = extension_loaded('pcre'); +$zlib_ok = extension_loaded('zlib'); +$mbstring_ok = extension_loaded('mbstring'); +$dom_ok = extension_loaded('DOM'); +$iconv_ok = extension_loaded('iconv'); +$tidy_ok = function_exists('tidy_parse_string'); +$curl_ok = function_exists('curl_exec'); +$parse_ini_ok = function_exists('parse_ini_file'); +$parallel_ok = ((extension_loaded('http') && class_exists('HttpRequestPool')) || ($curl_ok && function_exists('curl_multi_init'))); +$allow_url_fopen_ok = (bool)ini_get('allow_url_fopen'); +$filter_ok = extension_loaded('filter'); +$gettext_ok = function_exists("gettext"); +$gd_ok = extension_loaded('gd'); +$pdo_drivers_passing = extension_loaded('pdo_sqlite') || extension_loaded('pdo_mysql') || extension_loaded('pdo_pgsql'); + +if (extension_loaded('xmlreader')) { + $xml_ok = true; +} elseif (extension_loaded('xml')) { + $parser_check = xml_parser_create(); + xml_parse_into_struct($parser_check, '&', $values); + xml_parser_free($parser_check); + $xml_ok = isset($values[0]['value']); +} else { + $xml_ok = false; +} + +$status = array('app_name' => $app_name, 'php' => $php_ok, 'pdo' => $pdo_ok, 'pdo_drivers_passing' => $pdo_drivers_passing, 'xml' => $xml_ok, 'pcre' => $pcre_ok, 'zlib' => $zlib_ok, 'mbstring' => $mbstring_ok, 'dom' => $dom_ok, 'iconv' => $iconv_ok, 'tidy' => $tidy_ok, 'curl' => $curl_ok, 'parse_ini' => $parse_ini_ok, 'parallel' => $parallel_ok, 'allow_url_fopen' => $allow_url_fopen_ok, 'filter' => $filter_ok, 'gettext' => $gettext_ok, 'gd' => $gd_ok); + +return $status; +} +function isOkay() { + return !in_array(false, status()); +} + +function isPassing() { + $status = status(); + unset($status['curl'], $status['parallel'], $status['tidy'], $status['gd'], $status['filter']); + return !in_array(false, $status); +} + +/* Function taken from at http://php.net/manual/en/function.rmdir.php#110489 + * Idea : nbari at dalmp dot com + * Rights unknown + * Here in case of .gitignore files + */ + +function delTree($dir) { + $files = array_diff(scandir($dir), array('.','..')); + foreach ($files as $file) { + (is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file"); + } + return rmdir($dir); + } + +function generate_salt() { + mt_srand(microtime(true)*100000 + memory_get_usage(true)); + return md5(uniqid(mt_rand(), true)); +} + +function executeQuery($handle, $sql, $params) { + try + { + $query = $handle->prepare($sql); + $query->execute($params); + return $query->fetchAll(); + } + catch (Exception $e) + { + return FALSE; + } +} + +?> \ No newline at end of file -- cgit v1.2.3 From 8d7ec54658cfe94cd7cab0f5979afcec962188f5 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 10 Feb 2015 00:32:38 +0100 Subject: improvements for the installer --- install/install_functions.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'install/install_functions.php') diff --git a/install/install_functions.php b/install/install_functions.php index 3b465851..4a18d7d8 100644 --- a/install/install_functions.php +++ b/install/install_functions.php @@ -26,7 +26,10 @@ $allow_url_fopen_ok = (bool)ini_get('allow_url_fopen'); $filter_ok = extension_loaded('filter'); $gettext_ok = function_exists("gettext"); $gd_ok = extension_loaded('gd'); -$pdo_drivers_passing = extension_loaded('pdo_sqlite') || extension_loaded('pdo_mysql') || extension_loaded('pdo_pgsql'); +$pdo_drivers = pdoDrivers(); +$pdo_drivers_passing = $pdo_drivers['sqlite'] || $pdo_drivers['mysql'] || $pdo_drivers['postgres']; + + if (extension_loaded('xmlreader')) { $xml_ok = true; @@ -39,7 +42,11 @@ if (extension_loaded('xmlreader')) { $xml_ok = false; } -$status = array('app_name' => $app_name, 'php' => $php_ok, 'pdo' => $pdo_ok, 'pdo_drivers_passing' => $pdo_drivers_passing, 'xml' => $xml_ok, 'pcre' => $pcre_ok, 'zlib' => $zlib_ok, 'mbstring' => $mbstring_ok, 'dom' => $dom_ok, 'iconv' => $iconv_ok, 'tidy' => $tidy_ok, 'curl' => $curl_ok, 'parse_ini' => $parse_ini_ok, 'parallel' => $parallel_ok, 'allow_url_fopen' => $allow_url_fopen_ok, 'filter' => $filter_ok, 'gettext' => $gettext_ok, 'gd' => $gd_ok); +$status = array('app_name' => $app_name, 'php' => $php_ok, 'pdo' => $pdo_ok, + 'pdo_drivers_passing' => $pdo_drivers_passing, 'xml' => $xml_ok, 'pcre' => $pcre_ok, + 'zlib' => $zlib_ok, 'mbstring' => $mbstring_ok, 'dom' => $dom_ok, 'iconv' => $iconv_ok, 'tidy' => $tidy_ok, 'curl' => $curl_ok, + 'parse_ini' => $parse_ini_ok, 'parallel' => $parallel_ok, 'allow_url_fopen' => $allow_url_fopen_ok, 'filter' => $filter_ok, + 'gettext' => $gettext_ok, 'gd' => $gd_ok); return $status; } @@ -53,6 +60,17 @@ function isPassing() { return !in_array(false, $status); } +function pdoDrivers() { + $pdo_driver_sqlite = extension_loaded('pdo_sqlite'); + $pdo_driver_mysql = extension_loaded('pdo_mysql'); + $pdo_driver_postgres = extension_loaded('pdo_pgsql'); + + $pdo_drivers = array('sqlite' => $pdo_driver_sqlite, 'mysql' => $pdo_driver_mysql, + 'postgres' => $pdo_driver_postgres); + + return $pdo_drivers; +} + /* Function taken from at http://php.net/manual/en/function.rmdir.php#110489 * Idea : nbari at dalmp dot com * Rights unknown -- cgit v1.2.3 From af13787e74ea45d7edc1005810f15a8baa428a77 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 13 Feb 2015 17:13:11 +0100 Subject: fix #1078 --- install/install_functions.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'install/install_functions.php') diff --git a/install/install_functions.php b/install/install_functions.php index 4a18d7d8..a4830569 100644 --- a/install/install_functions.php +++ b/install/install_functions.php @@ -28,6 +28,7 @@ $gettext_ok = function_exists("gettext"); $gd_ok = extension_loaded('gd'); $pdo_drivers = pdoDrivers(); $pdo_drivers_passing = $pdo_drivers['sqlite'] || $pdo_drivers['mysql'] || $pdo_drivers['postgres']; +$urlfetching = $curl_ok || $allow_url_fopen_ok; @@ -46,7 +47,7 @@ $status = array('app_name' => $app_name, 'php' => $php_ok, 'pdo' => $pdo_ok, 'pdo_drivers_passing' => $pdo_drivers_passing, 'xml' => $xml_ok, 'pcre' => $pcre_ok, 'zlib' => $zlib_ok, 'mbstring' => $mbstring_ok, 'dom' => $dom_ok, 'iconv' => $iconv_ok, 'tidy' => $tidy_ok, 'curl' => $curl_ok, 'parse_ini' => $parse_ini_ok, 'parallel' => $parallel_ok, 'allow_url_fopen' => $allow_url_fopen_ok, 'filter' => $filter_ok, - 'gettext' => $gettext_ok, 'gd' => $gd_ok); + 'gettext' => $gettext_ok, 'gd' => $gd_ok, 'urlfetching' => $urlfetching); return $status; } @@ -56,7 +57,7 @@ function isOkay() { function isPassing() { $status = status(); - unset($status['curl'], $status['parallel'], $status['tidy'], $status['gd'], $status['filter']); + unset($status['curl'], $status['parallel'], $status['tidy'], $status['gd'], $status['filter'], $status['allow_url_fopen']); return !in_array(false, $status); } -- cgit v1.2.3 From 8df902951b4a42436a3fb09de610fd94e756f96f Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sat, 14 Feb 2015 16:15:17 +0100 Subject: update improvements --- install/install_functions.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'install/install_functions.php') diff --git a/install/install_functions.php b/install/install_functions.php index a4830569..3cfe13fb 100644 --- a/install/install_functions.php +++ b/install/install_functions.php @@ -78,12 +78,16 @@ function pdoDrivers() { * Here in case of .gitignore files */ -function delTree($dir) { +function delTree($dir, $withdirectory="true") { $files = array_diff(scandir($dir), array('.','..')); foreach ($files as $file) { (is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file"); } - return rmdir($dir); + if ($withdirectory) { + return rmdir($dir); + } else { + return true; + } } function generate_salt() { -- cgit v1.2.3