Welcome Guest, Not a member yet? Register   Sign In
[solved] Finding a bug when you don't find the right action to make a situation when bug appears
#1

[eluser]SPeed_FANat1c[/eluser]
Hi,

I will try describe the algorithm.

I have a website, with articles. Administrator can upload image files and then put them into the article.
Sometimes it can happen that admin uploads file but does not save the article and closes the browser. So the file isn't needed anymore - it is a trash in the server.
To solve this - I made a table, which contains filenames together with article id's. When admin saves the article - the filenamaes of images to that article are also added to database table.

So now we can make a function which deletes files that are not in the database - by checking the table for a file name, and if there is not such filename in table, it removes it from server.

Now the problem - somehow after some time I found that many of the file names are gone from the database table, which are actually needed. So the function which cleans unneeded files cleans also the needed ones, because it does not find them in a table.

But I cannot find when do they dissapear from the table or maybe they are not inserted at all. I try myself to write artile, upload files, remove files, edit article, edit and remove files and everything works well while I am trying. I also tried searching for the table name in all CI instalation files, and only there are 3 files where that table name is used, so I checked the code and tried again to make that code execute to make all situations and still cannot find where it could not work.

So don't know what to do, maybe I miss something. What to do in such situation? Smile leave everything as it is and wait until something goes wrong? Smile

Edit:

I cannot leave the clean trash function, because I am not sure if everything will work. And yet I will have to manually insert the needed filenames into the filenames table with the article ids. Because there is no way to know for an algorithm which filename is for what article.


Messages In This Thread
[solved] Finding a bug when you don't find the right action to make a situation when bug appears - by El Forum - 04-06-2011, 09:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB