NULL, // Photo File to Move 'batch'=>NULL, // Number of photos to move in a batch 'useid'=>TRUE, // If date not in photo use ID 'verbose'=>FALSE, // Show some debuggig ); protected function _execute(array $params) { if ($params['file']) { $po = ORM::factory('Photo',array('filename'=>$params['file'])); } else { $p = ORM::factory('Photo') ->where_open() ->where('remove','!=',TRUE) ->or_where('remove','is',NULL) ->where_close() ->where_open() ->where('duplicate','!=',TRUE) ->or_where('duplicate','is',NULL) ->where_close(); } $c = 0; foreach ($p->find_all() as $po) { if ($po->file_path() == $po->file_path(FALSE,($params['useid'] OR $po->date_taken) ? TRUE : FALSE)) continue; if ($params['verbose']) printf("Processing [%s], file [%s] - newpath [%s]\n",$po->id,$po->file_path(),$po->file_path(FALSE,($params['useid'] OR $po->date_taken) ? TRUE : FALSE)); if ($po->move()) printf("Photo [%s] moved to %s.\n",$po->id,$po->file_path()); else printf("Photo [%s] NOT moved to %s.\n",$po->id,$po->file_path(FALSE,TRUE)); $c++; if (! is_null($params['batch']) AND $c >= $params['batch']) break; } return sprintf("Images processed [%s]\n",$c); } } ?>