aboutsummaryrefslogtreecommitdiffstats
path: root/include/Contact.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/Contact.php')
-rw-r--r--include/Contact.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/Contact.php b/include/Contact.php
index 64779d45f..9a3b91dc4 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -207,6 +207,7 @@ function account_remove($account_id,$local = true,$unset_session=true) {
intval($account_id)
);
+
if ($unset_session) {
unset($_SESSION['authenticated']);
unset($_SESSION['uid']);
@@ -216,6 +217,28 @@ function account_remove($account_id,$local = true,$unset_session=true) {
return $r;
}
+// recursively delete a directory
+function rrmdir($path)
+{
+ if (is_dir($path) === true)
+ {
+ $files = array_diff(scandir($path), array('.', '..'));
+
+ foreach ($files as $file)
+ {
+ rrmdir(realpath($path) . '/' . $file);
+ }
+
+ return rmdir($path);
+ }
+
+ else if (is_file($path) === true)
+ {
+ return unlink($path);
+ }
+
+ return false;
+}
function channel_remove($channel_id, $local = true, $unset_session=true) {
@@ -311,6 +334,19 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
dbesc($channel['channel_hash'])
);
}
+
+ //remove from file system
+ $r = q("select channel_address from channel where channel_id = %d",
+ intval($channel_id)
+ );
+ if($r)
+ $channel_address = $r[0]['channel_address'] ;
+ if ($channel_address !== '') {
+ $f = 'store/' . $channel_address.'/';
+ logger ('delete '. $f);
+ if(is_dir($f))
+ @rrmdir($f);
+ }
proc_run('php','include/directory.php',$channel_id);