wimleers / fileconveyor

File Conveyor is a daemon written in Python to detect, process and sync files. In particular, it's designed to sync files to CDNs. Amazon S3 and Rackspace Cloud Files, as well as any Origin Pull or (S)FTP Push CDN, are supported. Originally written for my bachelor thesis at Hasselt University in Belgium.
https://wimleers.com/fileconveyor
The Unlicense
341 stars 95 forks source link

Path correction in db #47

Closed mkalbere closed 13 years ago

mkalbere commented 13 years ago

Hello & thanks for this great work ! I have a little annoying problem: I wrongly configured config.xml, when I realize my mistake I correct it and relaunch fileconveyor. But since 20G have already been transfered I don't want to re-upload everything. cssurlupdater keep tring to upload

// instead of / seems to cause the problem : /var/www/pressflow/sites/all/themes/courrier/css//images/arrow_btn.png
but /var/www/pressflow/sites/all/themes/courrier/css/images/arrow_btn.png exists on S3.

How could I erase/modify/update that entry ? ++ Marc

mkalbere commented 13 years ago

answering my own question:

By changinf the sqllite db directly :

Something like : copy/paste dirty code, just for info ...

$dbh = new PDO('sqlite:/var/www/fileconveyor/code/synced_files.db'); $l=$dbh->prepare('SELECT * FROM synced_files where input_file like "/var/www%" limit 0,50'); $l->execute(); $list=$l->fetchAll(); $l->closeCursor(); foreach ($list as $row) { $delete=array(); $old=$row['input_file']; $new=str_replace("//","/",$old); $new=str_replace("/space2/files/courrier","/var/www/pressflow/sites/default/files/courrier",$new); $new=str_replace("/var/www/pressflow/","",$new); if ($new!=$old){ echo "Update $old => $new
";flush(); $dbh->beginTransaction(); if (!$dbh->query("update synced_files set input_file='".$new."' where input_file='".$old."';" )){ $error=$dbh->errorInfo(); echo "Error:".print_r($error[2],true)."
"; $delete[]=$old; $delete[]=$new; $dbh->rollBack(); } else $dbh->commit(); }else echo "Skip $old => $new
";flush();