<?php defined('SYSPATH') or die('No direct access allowed.');

/**
 * Find photos that dont match their database entries.
 *
 * @package    Photo
 * @category   Tasks
 * @author     Deon George
 * @copyright  (c) 2014 Deon George
 * @license    http://dev.leenooks.net/license.html
 */
class Task_Photo_Stat extends Minion_Task {
	protected $_options = array(
	);

	protected function _execute(array $params) {
		$p = ORM::factory('Photo')->find_all();

		foreach ($p as $po) {
			if (! file_exists($po->file_path())) {
				printf("ID [%s] doesnt exist (%s)?\n",$po->id,$po->file_path());
				continue;
			}

			if (($x=$po->io()->getImageSignature()) !== $po->signature) {
				printf("ID [%s] signature doesnt match (%s) [%s != %s]?\n",$po->id,$po->file_path(),$po->signature,$x);
				continue;
			}
		}
	}
}
?>
