NULL, // Photo File to Move 'batch'=>NULL, // Number of photos to move in a batch ); 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,TRUE)) continue; 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); } } ?>