/** * Builds directories for all buckets and pickupdir * * @param \BackupStore $store * @return int returnstate * @author : Rafał Trójniak rafal@trojniak.net */ function run(\BackupStore $store) { echo "== Build\n"; $dirs=$store->getDirs(); $dirs['pickup']=$store->getPickup(); $ret=0; foreach($dirs as $id=>$dir){ echo "[$id]:"; $path=$dir->getPath(); if(!is_dir($path)){ echo "\tC"; if(!mkdir($path, 0777, true)){ echo "! - failed to create"; $ret++; } } echo "\n"; } if($ret===0){ return true; } return $ret; }
/** * Runs cleanning command on all pickupdirs * * @param \BackupStore $store * @return int returnstate * @author : Rafał Trójniak rafal@trojniak.net */ function run(\BackupStore $store) { echo "== Clean\n"; $dirs=$store->getDirs(); foreach($dirs as $id=>$dir){ echo "[$id]:\n"; $toClean=$dir->clean(); foreach($toClean as $backup){ echo "\t-\t".$backup->getCreation()->format(\DateTime::ISO8601)."\n"; } } return true; }
/** * Runs rotating (rotates backup from pickup to backupdirs) * * @param \BackupStore $store * @return int returnstate * @author : Rafał Trójniak rafal@trojniak.net */ function run(\BackupStore $store) { echo "== List rotating\n"; $dirs=$store->getDirs(); $pickup=$store->getPickup(); foreach($dirs as $id=>$dir){ echo "[$id]:\n"; $pick=$dir->pickup($pickup); foreach($pick as $backup){ echo "\t+\t".$backup->getCreation()->format(\DateTime::ISO8601)."\n"; } } return true; }
/** * Prints bucket contents * * @param \BackupStore $store * @return int returnstate * @author : Rafał Trójniak rafal@trojniak.net */ function run(\BackupStore $store) { if($this->bucket!==false){ $dir=$store->getDir($this->bucket); if(is_null($dir)){ throw new \RuntimeException('Bucket "'.addslashes($this->bucket).'" not found'); } $this->listBackup($dir); }else{ echo "== List backups\n"; $dirs=$store->getDirs(); foreach($dirs as $id=>$dir){ echo "[$id]:\n"; $this->listBackup($dir); } } return true; }