0 && !hook("replaceupdatepreview", '', array($ref, $resourceinfo[0]))) { if (!empty($resourceinfo[0]['file_path'])) { $ingested = false; } else { $ingested = true; } if ($delete_existing) { delete_previews($ref); } create_previews($ref, false, ($previewbased ? "jpg" : $resourceinfo[0]["file_extension"]), false, $previewbased, -1, true, $ingested, true, $sizes); hook("afterupdatepreview", "", array($ref)); update_disk_usage($ref); return true; } return false; } if (!isset($collectionid)) { $conditions = array(); $conditions_params = array("i", (int)$ref); if (isset($max)) { $conditions[] = "ref <= ?"; $conditions_params = array_merge($conditions_params, array("i", $max)); } if ($videoupdate) { $conditions[] = "file_extension in (" . ps_param_insert(count($ffmpeg_supported_extensions)) . ")"; $conditions_params = array_merge($conditions_params, ps_param_fill($ffmpeg_supported_extensions, "s")); } if (isset($resource_deletion_state)) { $conditions[] = "archive <> ?"; $conditions_params = array_merge($conditions_params, array("i", $resource_deletion_state)); } if (!empty($resource_types)) { $conditions[] = "resource_type in (" . ps_param_insert(count($resource_types)) . ")"; $conditions_params = array_merge($conditions_params, ps_param_fill($resource_types, "i")); } $resources = ps_array("SELECT ref value FROM resource WHERE ref >= ?" . ((count($conditions) > 0) ? " AND " . implode(" AND ", $conditions) : "") . " ORDER BY ref asc", $conditions_params, 0); } else { $resources = get_collection_resources($collectionid); } if (is_array($resources) && count($resources) > 0) { hook('beforescriptaction'); foreach ($resources as $resource) { if ($videoupdate) { $checkflvpreview = get_resource_path($resource, true, 'pre', false, 'flv', true, 1, false, ''); $correctvideo_preview = get_resource_path($resource, true, 'pre', false, $ffmpeg_preview_extension, true, 1, false); echo "Checking for video preview of resource #" . $resource . "....."; if (file_exists($correctvideo_preview)) { echo "...already exists, skipping\n"; continue; } } echo "Recreating previews for resource #" . $resource . "..."; ob_flush(); if (update_preview($resource, $previewbased, $sizes, $delete_existing)) { echo "....completed\n"; } else { echo "FAILED - skipping\n"; } ob_flush(); } } else { echo "No resources found\n"; } echo "\nFinished\n";