summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2012-08-23 19:36:59 +0400
committerAndrew Dolgov <[email protected]>2012-08-23 19:36:59 +0400
commit639ad600353120d60c455bcb476227214ecfd049 (patch)
tree37e56a0f8f72a30aa5ea93cd6fa35e993ead789e
parent9435c4dca4fcd4eeaf874a46b9628b4294a71e2a (diff)
update-self: fix wrong work directory, better work directory checking
-rw-r--r--include/update_self.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/update_self.php b/include/update_self.php
index e33fe4bfa..6e57213b9 100644
--- a/include/update_self.php
+++ b/include/update_self.php
@@ -1,6 +1,7 @@
<?php
function update_self($link, $force = false) {
- $work_dir = dirname(__FILE__);
+ // __FILE__ is in include/ so we need to go one level up
+ $work_dir = dirname(dirname(__FILE__));
$parent_dir = dirname($work_dir);
if (!is_writable($work_dir) && !is_writable("$parent_dir")) {
@@ -8,6 +9,11 @@
exit;
}
+ if (!file_exists("$work_dir/config.php") || !file_exists("$work_dir/include/sanity_check.php")) {
+ _debug("Work directory $work_dir doesn't look like tt-rss installation.");
+ exit;
+ }
+
if (!is_writable(sys_get_temp_dir())) {
_debug("System temporary directory should be writable as current user.");
exit;