Problem to delete piwik folder


(benten) #1

I want to redo my installation but I can not delete the folder “piwik” from my server, access is not permitted either by FTP or administration.

HELP


#2

i am seriously thinking of changing my web hosting company
since neither they nor i know how to delete /piwik
it really reflects very badly on the whole package that there is this problem


(Matthieu Aubry) #3

Thank you for the suggestion! it is important to make it easy to delete and uninstall Piwik :slight_smile:

I have updated the FAQ: Installation - Analytics Platform - Matomo

and added a new script that should work. Let me know here if it doesn’t


#4

thank you for your post matt.
i haven’t tried it yet but i will.
just deleting the files and folders with ftp appeared to have done it
but in fact they were still there.
that is what my web host provider did for me and i did

so i wrote a php script with ulink($file) and which will delete a piwik file
why it works when the usual delete does not i do not know
tried to get my web server provider to do something like

sudo su
password:
cd /home/my_account
rmdir piwik

but they could not or would not do it for me

glob(.) cannot work in a folder other than where it is running.
i did not even have permission to add a file to a piwik folder.
so it was necessary to specify each file individually (about 50 of them)
then upload the new php script and then run it in my public_html directory
it took about 5 hours but was worth it to me since i have been trying for a year
then there was the problem of the empty folders
rmdir($directory) and sometimes a chmod to 777 and they got deleted
of course the now empty folder piwik will still not delete and so remains
also i notice that most of the internet web pages about the problem
do not tell you much

what does piwik do that causes this problem
and how does it help anything or anybody to do it in this way

to remove one piwik file:-

Attempt to delete piwik

Attempt to delete piwik

<?php $file = "/home/my_account/public_html/piwik/tmp/templates_c/%%F7^F70^F708E4D1%%menu.tpl.php"; if(file_exists($file)) echo("file $file found
\n"); else die("file $file not found
\n"); if (unlink($file)) echo ("Deleted $file
\n"); else echo ("Error deleting $file
\n"); echo("completed
\n"); ?>

to remove an empty piwik directory:-

Attempt to delete piwik

Attempt to delete piwik

<?php $directory = "/home/my_account/public_html/piwik/a_directory"; if(file_exists($directory)) echo("Directory $directory exists
\n"); else die("Directory $directory does not exist
\n"); //chown ("/home/my_account/public_html/piwik/", "my_account"); //does not work - do not have permission to do this if (rmdir($directory)) echo ("Deleted empty directory $directory
\n"); else echo ("Cannot delete directory $directory
\n"); echo("completed \n"); ?>

or variations on the theme
basically just persist and the files and folders will go
but the empty folder piwik is still there and still has a few more tricks…
there is a really complicated delete script which may be needed
other than that it may be necessary to close the web hosting account
and then start a new account.


#5

hello matt
thank you for your script which worked great
it had only the empty folder piwik to delete and it did it
pity i didn’t have it before
i wonder what’s the difference between rmdir() and @rmdir(),
unlink() and @unlink(), opendir() and @opendir()
indirect reference methinks but what and why
that seems to be the key to this whole problem
good luck to you
sorry that i won’t be using piwik
it is much too sophisticated for me
i only installed it as an experiment into php
i have wiki, phpbb and joomla plus some of my own php
i love php
it is very powerful and much easier than perl
john


#6

hello matt,

i spoke too soon
your script did not delete my empty piwik folder. i thought that it had.
so i ran it again and still that pesky folder remains stuck there.
give us a clue - what is it about piwik files and folders that makes them so different

after one year i still have a piwik folder on my root

john

<?php // How to remove the piwik/ directory if it does not work in FTP? // 1) Download and upload this file to your webserver // 2) Put this file in the folder that contains the piwik/ directory (above the piwik/ directory) // For example if the piwik/ folder is at http://your-site/piwik/ you put the file in http://your-site/uninstall-delete-piwik-directory.php // 3) Go with your browser to http://your-site/uninstall-delete-piwik-directory.php // 4) The folder http://your-site/piwik/ should now be deleted! // We hope you enjoyed Piwik. If you have any feedback why you stopped using Piwik, // please let us know at hello@piwik.org - we are interested by your experience function unlinkRecursive($dir) { if(!$dh = @opendir($dir)) return "Warning: folder $dir couldn't be read by PHP"; while (false !== ($obj = readdir($dh))) { if($obj == '.' || $obj == '..') { continue; } if (!@unlink($dir . '/' . $obj)) { unlinkRecursive($dir.'/'.$obj, true); } } closedir($dh); @rmdir($dir); return "Folder $dir deleted!"; } echo unlinkRecursive('piwik/');

(Matthieu Aubry) #7

Maybe, remove the @ from the code, and try again, it will output some errors?


#8

thank you for your post

i will take your recommendation under caution
i don’t want to have to reload my entire website
i will try first to understand your script
it is a little advanced for me
best wishes and thank you for your attention to this matter

john