Skip to content

Commit

Permalink
PHRAS-4067: admin - dashboard - 500 error (#4513)
Browse files Browse the repository at this point in the history
* fix error 500 on dashboard : remove unused swiftools requirement

* unused

* patch on 4.1.8
  • Loading branch information
aynsix authored Jun 10, 2024
1 parent 0c0021d commit b878685
Show file tree
Hide file tree
Showing 15 changed files with 73 additions and 97 deletions.
3 changes: 0 additions & 3 deletions config/configuration.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ main:
binaries:
ghostscript_binary: null
php_binary: null
swf_extract_binary: null
pdf2swf_binary: null
swf_render_binary: null
unoconv_binary: null
ffmpeg_binary: null
ffprobe_binary: null
Expand Down
3 changes: 0 additions & 3 deletions infra/tools/stack_migration/storage_conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ echo `date +"%Y-%m-%d %H:%M:%S"` - "update binaries path in accordance of docker

bin/setup system:config -s set main.binaries.php_binary "/usr/local/bin/php"
bin/setup system:config -s set main.binaries.ghostscript_binary "/usr/bin/gs"
bin/setup system:config -s set main.binaries.swf_extract_binary "/usr/bin/swfextract"
bin/setup system:config -s set main.binaries.pdf2swf_binary null
bin/setup system:config -s set main.binaries.swf_render_binary "/usr/bin/swfrender"
bin/setup system:config -s set main.binaries.unoconv_binary "/usr/bin/unoconv"
bin/setup system:config -s set main.binaries.ffmpeg_binary "/usr/local/bin/ffmpeg"
bin/setup system:config -s set main.binaries.ffprobe_binary "/usr/local/bin/ffprobe"
Expand Down
3 changes: 0 additions & 3 deletions lib/Alchemy/Phrasea/Command/Setup/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,6 @@ private function detectBinaries()
{
return [
'php_binary' => $this->executableFinder->find('php'),
'pdf2swf_binary' => $this->executableFinder->find('pdf2swf'),
'swf_extract_binary' => $this->executableFinder->find('swfextract'),
'swf_render_binary' => $this->executableFinder->find('swfrender'),
'unoconv_binary' => $this->executableFinder->find('unoconv'),
'ffmpeg_binary' => $this->executableFinder->find('ffmpeg', $this->executableFinder->find('avconv')),
'ffprobe_binary' => $this->executableFinder->find('ffprobe', $this->executableFinder->find('avprobe')),
Expand Down
3 changes: 0 additions & 3 deletions lib/Alchemy/Phrasea/Controller/Api/V1Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,6 @@ private function getGlobalValuesInformation()
'binary' => [
'phpCli' => isset($binaries['php_binary']) ? $binaries['php_binary'] : null,
'phpIni' => $conf->get(['registry', 'executables', 'php-conf-path']),
'swfExtract' => isset($binaries['swf_extract_binary']) ? $binaries['swf_extract_binary'] : null,
'pdf2swf' => isset($binaries['pdf2swf_binary']) ? $binaries['pdf2swf_binary'] : null,
'swfRender' => isset($binaries['swf_render_binary']) ? $binaries['swf_render_binary'] : null,
'unoconv' => isset($binaries['unoconv_binary']) ? $binaries['unoconv_binary'] : null,
'ffmpeg' => isset($binaries['ffmpeg_binary']) ? $binaries['ffmpeg_binary'] : null,
'ffprobe' => isset($binaries['ffprobe_binary']) ? $binaries['ffprobe_binary'] : null,
Expand Down
3 changes: 0 additions & 3 deletions lib/Alchemy/Phrasea/Controller/SetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,6 @@ public function doInstall(Request $request)
$binaryData = [];
foreach ([
'php_binary' => $request->request->get('binary_php'),
'swf_extract_binary' => $request->request->get('binary_swfextract'),
'pdf2swf_binary' => $request->request->get('binary_pdf2swf'),
'swf_render_binary' => $request->request->get('binary_swfrender'),
'unoconv_binary' => $request->request->get('binary_unoconv'),
'ffmpeg_binary' => $request->request->get('binary_ffmpeg'),
'mp4box_binary' => $request->request->get('binary_MP4Box'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ public function register(Application $app)
$app['media-alchemyst.configuration'] = $app->share(function (Application $app) {
$configuration = [];
$parameters = [
'swftools.pdf2swf.binaries' => 'pdf2swf_binary',
'swftools.swfrender.binaries' => 'swf_render_binary',
'swftools.swfextract.binaries' => 'swf_extract_binary',
'unoconv.binaries' => 'unoconv_binary',
'mp4box.binaries' => 'mp4box_binary',
'gs.binaries' => 'ghostscript_binary',
Expand Down
3 changes: 0 additions & 3 deletions lib/Alchemy/Phrasea/Setup/Probe/BinariesProbe.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ public function __construct(array $binaries)
{
parent::__construct(array_filter([
'php_binary' => isset($binaries['php_binary']) ? $binaries['php_binary'] : null,
'pdf2swf_binary' => isset($binaries['pdf2swf_binary']) ? $binaries['pdf2swf_binary'] : null,
'unoconv_binary' => isset($binaries['unoconv_binary']) ? $binaries['unoconv_binary'] : null,
'swf_extract_binary' => isset($binaries['swf_extract_binary']) ? $binaries['swf_extract_binary'] : null,
'swf_render_binary' => isset($binaries['swf_render_binary']) ? $binaries['swf_render_binary'] : null,
'mp4box_binary' => isset($binaries['mp4box_binary']) ? $binaries['mp4box_binary'] : null,
'pdftotext_binary' => isset($binaries['pdftotext_binary']) ? $binaries['pdftotext_binary'] : null,
'ffmpeg_binary' => isset($binaries['ffmpeg_binary']) ? $binaries['ffmpeg_binary'] : null,
Expand Down
58 changes: 0 additions & 58 deletions lib/Alchemy/Phrasea/Setup/Requirements/BinariesRequirements.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class BinariesRequirements extends RequirementCollection implements RequirementI
{
const FILE_VERSION = '5.04';
const IMAGICK_VERSION = '6.2.9';
const SWFTOOLS_VERSION = '0.9.0';
const UNOCONV_VERSION = '0.5';
const MP4BOX_VERSION = '0.4.0';
const EXIFTOOL_VERSION = '9.15';
Expand Down Expand Up @@ -79,21 +78,6 @@ public function __construct($binaries = [])
);
}

$pdf2swf = isset($binaries['pdf2swf_binary']) ? $binaries['pdf2swf_binary'] : $finder->find('pdf2swf');

if (null !== $pdf2swf) {
$output = null;
exec($pdf2swf . ' --version', $output);
$data = sscanf($output[0], 'pdf2swf - part of swftools %d.%d.%d');
$version = sprintf('%d.%d.%d', $data[0], $data[1], $data[2]);

$this->addRecommendation(
version_compare(static::SWFTOOLS_VERSION, $version, '<='),
sprintf('SWFTools (pdf2swf) version %s or higher is required (%s provided)', static::SWFTOOLS_VERSION, $version),
'Please update to a more recent version.'
);
}

$unoconv = isset($binaries['unoconv_binary']) ? $binaries['unoconv_binary'] : $finder->find('unoconv');

$this->addRecommendation(
Expand All @@ -115,48 +99,6 @@ public function __construct($binaries = [])
);
}

$swfextract = isset($binaries['swf_extract_binary']) ? $binaries['swf_extract_binary'] : $finder->find('swfextract');

$this->addRecommendation(
null !== $swfextract && is_executable($swfextract),
'SWFTools (swfextract) are required for flash files support',
'Please install SWFTools (http://www.swftools.org/)'
);

if (null !== $swfextract) {
$output = null;
exec($swfextract . ' --version', $output);
$data = sscanf($output[0], 'swfextract - part of swftools %d.%d.%d');
$version = sprintf('%d.%d.%d', $data[0], $data[1], $data[2]);

$this->addRecommendation(
version_compare(static::SWFTOOLS_VERSION, $version, '<='),
sprintf('SWFTools (swfextract) version %s or higher is required (%s provided)', static::SWFTOOLS_VERSION, $version),
'Please update to a more recent version.'
);
}

$swfrender = isset($binaries['swf_render_binary']) ? $binaries['swf_render_binary'] : $finder->find('swfrender');

$this->addRecommendation(
null !== $swfrender && is_executable($swfrender),
'SWFTools (swfrender) are required for flash files support',
'Please install SWFTools (http://www.swftools.org/)'
);

if (null !== $swfrender) {
$output = null;
exec($swfrender . ' --version', $output);
$data = sscanf($output[0], 'swfrender - part of swftools %d.%d.%d');
$version = sprintf('%d.%d.%d', $data[0], $data[1], $data[2]);

$this->addRecommendation(
version_compare(static::SWFTOOLS_VERSION, $version, '<='),
sprintf('SWFTools (swfrender) version %s or higher is required (%s provided)', static::SWFTOOLS_VERSION, $version),
'Please update to a more recent version.'
);
}

$mp4box = isset($binaries['mp4box_binary']) ? $binaries['mp4box_binary'] : $finder->find('MP4Box');

$this->addRecommendation(
Expand Down
73 changes: 73 additions & 0 deletions lib/classes/patch/418PHRAS4067.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php

use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;

class patch_418PHRAS4067 implements patchInterface
{
/** @var string */
private $release = '4.1.8';

/** @var array */
private $concern = [base::APPLICATION_BOX];

/**
* {@inheritdoc}
*/
public function get_release()
{
return $this->release;
}

/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}

/**
* {@inheritdoc}
*/
public function require_all_upgrades()
{
return false;
}

/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}

/**
* {@inheritdoc}
*/
public function apply(base $base, Application $app)
{
if ($base->get_base_type() === base::DATA_BOX) {
$this->patch_databox($base, $app);
} elseif ($base->get_base_type() === base::APPLICATION_BOX) {
$this->patch_appbox($base, $app);
}

return true;
}

private function patch_databox(databox $databox, Application $app)
{
}

private function patch_appbox(base $appbox, Application $app)
{
/** @var PropertyAccess $conf */
$conf = $app['conf'];

$conf->remove(['main', 'binaries', 'pdf2swf_binary']);
$conf->remove(['main', 'binaries', 'swf_render_binary']);
$conf->remove(['main', 'binaries', 'swf_extract_binary']);
}
}
3 changes: 0 additions & 3 deletions lib/conf.d/configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ main:
binaries:
ghostscript_binary: null
php_binary: null
swf_extract_binary: null
pdf2swf_binary: null
swf_render_binary: null
unoconv_binary: null
ffmpeg_binary: null
ffprobe_binary: null
Expand Down
3 changes: 0 additions & 3 deletions resources/ansible/roles/app/templates/configuration.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ dbname: '{{ mariadb.appbox_db }}'
binaries:
ghostscript_binary: null
php_binary: null
swf_extract_binary: null
pdf2swf_binary: null
swf_render_binary: null
unoconv_binary: null
ffmpeg_binary: null
ffprobe_binary: null
Expand Down
3 changes: 0 additions & 3 deletions resources/vagrant/config/phraseanet/configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ main:
binaries:
ghostscript_binary: null
php_binary: null
swf_extract_binary: null
pdf2swf_binary: null
swf_render_binary: null
unoconv_binary: null
ffmpeg_binary: null
ffprobe_binary: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ main:
binaries:
ghostscript_binary: null
php_binary: null
swf_extract_binary: null
pdf2swf_binary: null
swf_render_binary: null
unoconv_binary: null
ffmpeg_binary: null
ffprobe_binary: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ main:
binaries:
ghostscript_binary: null
php_binary: null
swf_extract_binary: null
pdf2swf_binary: null
swf_render_binary: null
unoconv_binary: null
ffmpeg_binary: null
ffprobe_binary: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ main:
binaries:
ghostscript_binary: null
php_binary: null
swf_extract_binary: null
pdf2swf_binary: null
swf_render_binary: null
unoconv_binary: null
ffmpeg_binary: null
ffprobe_binary: null
Expand Down

0 comments on commit b878685

Please sign in to comment.