Current time: 04-25-2014, 09:00 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Delete Archived Test Result
01-22-2013, 10:26 AM
Post: #1
Delete Archived Test Result
Hi Patrick,

We are running a private WPT/WPT Monitor network. We run a lot of tests per day, and have been using Archive.php to reduce the number of files, and total disk space used.

We want to be able to delete/purge specific tests, based on which site they have been run against.
I have looked at ./cli/purge.php and ./delete.php, but can't seem to figure out how they work. Also, they don't seem to be aware of archived tests.

Any suggestions would be greatly appreciated.
Find all posts by this user
Quote this message in a reply
01-23-2013, 02:29 AM
Post: #2
RE: Delete Archived Test Result
You'll probably have to hack something up because I don't have anything that deletes archived tests. The easiest way would probably be to parse the test logs in logs/*, get the test ID's for everything you want to delete and then go to the archive directories and delete them (there is a helper function that will get you the full path to any archived test by test ID).

Alternatively you can walk the archive directory directly, extract the testinfo.json.gz (or testinfo.ini) from the zip, decide if it is one you want to delete and delete it.
Visit this user's website Find all posts by this user
Quote this message in a reply
01-25-2013, 04:34 AM (This post was last modified: 01-25-2013 04:37 AM by timmckenzie.)
Post: #3
RE: Delete Archived Test Result
Thanks for the reply,

I have added a DeleteArchive function in archive.ini, which is working well.

One thing that I am confused about is in delete.php. The if statement which decides whether or not to delete, what does the line
PHP Code:
strpos($testPath'relay') !== false 
do. When I call that on my box the test is never deleted because the 'relay' check always fails. I removed that line and code path goes into the IF statement.

PHP Code:
if( strpos($testPath'results') !== false
    
&& strpos($testPath'relay') !== false
    
&& strpos($testPath'..') === false
    
&& is_dir($testPath) ) 

Thanks
Find all posts by this user
Quote this message in a reply
01-29-2013, 01:56 AM
Post: #4
RE: Delete Archived Test Result
Not sure if it helps any but I have some code that I just put together to clean up the archives on webpagetest.org: http://webpagetest.googlecode.com/svn/tr...rchive.php

You'd probably want to modify a few things because right now it only deletes archived tests if they were flagged with an archive.dat (stored on a 2nd-level archive in my case) but it crawls the archives and extracts the test information from within each archived test and then decides if it should be deleted.

If you remove the $info_file check in the main loop and then adjust the logic inside of PruneTests right after the "// for now, only delete tests that were not priority 0 or that used an api key" comment to use whatever criteria you want it should be able to clean up tests based on arbitrary rules.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)