diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-07-31 07:33:00 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-07-31 07:33:00 +0000 |
commit | 87d14792fd28b1e5cef413d6634dcf9524fd0253 (patch) | |
tree | c274c1101768ee971d856cb7868c2cdf67e34b33 /lib | |
parent | c7b024af540bd0eb38d06108349aad12e8e7a60e (diff) | |
download | ampache-87d14792fd28b1e5cef413d6634dcf9524fd0253.tar.gz ampache-87d14792fd28b1e5cef413d6634dcf9524fd0253.tar.bz2 ampache-87d14792fd28b1e5cef413d6634dcf9524fd0253.zip |
added check in clean for catalog path readability, if unreadable stop clean and do not remove files
Diffstat (limited to 'lib')
-rw-r--r-- | lib/class/catalog.class.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index 61bc19fa..11d69781 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -34,6 +34,7 @@ class Catalog { public $rename_pattern; public $sort_pattern; public $catalog_type; + public $path; /* This is a private var that's used during catalog builds */ private $_playlists = array(); @@ -1235,6 +1236,17 @@ class Catalog { require_once Config::get('prefix') . '/templates/show_clean_catalog.inc.php'; flush(); + /* Do a quick check to make sure that the root of the catalog is readable, error if not + * this will minimize the loss of catalog data if mount points fail + */ + if (!is_readable($this->path)) { + debug_event('catalog','Catalog path:' . $this->path . ' unreadable, clean failed','1'); + Error::add('general',_('Catalog Root unreadable, stopping clean')); + Error::display('general'); + return false; + } + + /* Get all songs in this catalog */ $sql = "SELECT `id`,`file` FROM `song` WHERE `catalog`='$this->id' AND enabled='1'"; $db_results = Dba::query($sql); |