diff --git a/conf/ffprobe.patch b/conf/ffprobe.patch new file mode 100644 index 0000000..c5d298e --- /dev/null +++ b/conf/ffprobe.patch @@ -0,0 +1,13 @@ +diff --git a/vendor/lychee-org/php-exif/lib/PHPExif/Adapter/FFprobe.php b/vendor/lychee-org/php-exif/lib/PHPExif/Adapter/FFprobe.php +index 9ececfe..106eadd 100644 +--- a/vendor/lychee-org/php-exif/lib/PHPExif/Adapter/FFprobe.php ++++ b/vendor/lychee-org/php-exif/lib/PHPExif/Adapter/FFprobe.php +@@ -33,7 +33,7 @@ class FFprobe extends AdapterAbstract + * + * @var string + */ +- protected $toolPath; ++ protected $toolPath = '/usr/bin/ffprobe'; + + /** + * @var string-e diff --git a/scripts/install b/scripts/install index 65d74d1..e0c43d8 100755 --- a/scripts/install +++ b/scripts/install @@ -136,11 +136,17 @@ pushd $final_path php$phpversion artisan migrate -n --force php$phpversion artisan config:clear -n php$phpversion artisan config:cache -n + patch -p1 < "$YNH_CWD/../conf/ffprobe.patch" popd # Setup custom user.css file ynh_add_config --template="../conf/user.css.example" --destination="$final_path/public/dist/user.css" +ynh_replace_string --match_string="\$ffmpeg = FFMpeg::create();" --replace_string="\$ffmpeg = FFMpeg::create(array(\ + 'ffmpeg.binaries' => '/usr/bin/ffmpeg',\ + 'ffprobe.binaries' => '/usr/bin/ffprobe',\ +));" --target_file="$final_path/app/Actions/Photo/Extensions/VideoEditing.php" + #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index faea48f..884d63d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -144,6 +144,11 @@ ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env ynh_add_config --template="../conf/user.css.example" --destination="$final_path/public/dist/user.css" +ynh_replace_string --match_string="\$ffmpeg = FFMpeg::create();" --replace_string="\$ffmpeg = FFMpeg::create(array(\ + 'ffmpeg.binaries' => '/usr/bin/ffmpeg',\ + 'ffprobe.binaries' => '/usr/bin/ffprobe',\ +));" --target_file="$final_path/app/Actions/Photo/Extensions/VideoEditing.php" + #================================================= # INSTALL AND INITIALIZE COMPOSER #================================================= @@ -151,9 +156,11 @@ ynh_script_progression --message="Upgrading $app source files..." --weight=4 ynh_exec_warn_less ynh_composer_exec --commands=\"dump-autoload\" -( cd $final_path && php$phpversion artisan migrate -n --force ) -( cd $final_path && php$phpversion artisan config:clear -n ) -( cd $final_path && php$phpversion artisan config:cache -n ) +pushd $final_path + php$phpversion artisan migrate -n --force + php$phpversion artisan config:clear -n + php$phpversion artisan config:cache -n +popd #================================================= # RELOAD NGINX diff --git a/sources/app-00-ffmpeg.patch b/sources/app-00-ffmpeg.patch new file mode 100644 index 0000000..336b9f3 --- /dev/null +++ b/sources/app-00-ffmpeg.patch @@ -0,0 +1,16 @@ +diff --git a/app/Actions/Photo/Extensions/VideoEditing.php b/app/Actions/Photo/Extensions/VideoEditing.php +index 1a96769..5842606 100644 +--- a/app/Actions/Photo/Extensions/VideoEditing.php ++++ b/app/Actions/Photo/Extensions/VideoEditing.php +@@ -45,7 +45,10 @@ trait VideoEditing + /** + * ! check if we can use path instead of this ugly thing. + */ +- $ffmpeg = FFMpeg::create(); ++ $ffmpeg = FFMpeg::create(array( ++ 'ffmpeg.binaries' => '/usr/bin/ffmpeg', ++ 'ffprobe.binaries' => '/usr/bin/ffprobe', ++ )); + /** @var Video */ + $video = $ffmpeg->open(Storage::path('big/' . $photo->url)); + if (!($tmp = tempnam(sys_get_temp_dir(), 'lychee')) ||