1<?php
2error_reporting(E_ALL|E_STRICT);
3require_once 'Tools.php';
4
5// require one or more databases in the array
6$databases = array ('blogs.sqlite','rkc.sqlite');
7
8// instantiate a new DB_Sqlite_Tools object
9$sqlite = new DB_Sqlite_Tools ($databases);
10$sqlite->showLogs = true ;
11
12/// we specify the path for our databases
13// and the destination path for rsync
14$dbpath ='/Users/davidcosta/Sites/dbsqlitetools/bkp/';
15$dest = '/Users/davidcosta/Sites/dbsqlitetools/sync/';
16
17$sqlite->localRsync($dbpath,$dest);
18
19
20// and add the event to a log db logs.sqlite
21// note that on the second parameter we specify
22// true for the table creation and eventually the table
23// name mylogs. This will work the first time with the table created, once we have a table
24// we will call it as $sqlite->sqliteLogs('logs.sqlite.',false,'mylogs');
25$sqlite->sqliteLogs('logs.sqlite.',false,'mylogs');
26
27
28/* sample output
29
30<logevent>  <class> DB_Sqlite_Tools </class>  <function> localRsync</function>  <data>'rsync --verbose --stats --recursive --progress --delete /Users/davidcosta/Sites/dbsqlitetools/bkp/ /Users/davidcosta/Sites/dbsqlitetools/sync/'</data> </logevent>
31
32 <logevent>  <class> DB_Sqlite_Tools </class>  <function> localRsync</function>  <data>'building file list ... 0 files... 3 files to consider created directory /Users/davidcosta/Sites/dbsqlitetools/sync blogs.sqlite.bkp  32768 15% 0.00kB/s 0:00:00  207872 100% 7.26MB/s 0:00:00 rkc.sqlite  32768 46% 0.00kB/s 0:00:00  70656 100% 18.07MB/s 0:00:00  Number of files: 3 Number of files transferred: 2 Total file size: 278528 bytes Total transferred file size: 278528 bytes Literal data: 278528 bytes Matched data: 0 bytes File list size: 70 Total bytes written: 278726 Total bytes read: 52  wrote 278726 bytes read 52 bytes 185852.00 bytes/sec total size is 278528 speedup is 1.00 '</data> </logevent>
33
34*/
35
36?>
37
38