Anthony`

  • Posts: 53
Maintenance Task Hangs
« on November 7th, 2012, 12:41 AM »
When I try to run the "Check all files against current versions" task, the page is blank and nothing happens. No errors anywhere.

I went through the source code and I believe it is the exec() function call in the media_handler::testImageMagick() method which is hanging PHP. I don't have ImageMagick installed on my system, so I'm assuming that's why it hangs.

This is the code in Subs-Admin.php which allows this to happen due to some logic error,
Code: [Select]
// ImageMagick?
if (in_array('imagick', $checkFor))
{
$data = array();
if (media_handler::testIMagick())
{
$data['imagick'] = true;
$imagick = new Imagick;
$data['imagick_ver'] = $imagick->getVersion();
$imv = $data['imagick_ver']['versionString'];
}
if (media_handler::testMW())
{
$data['mw'] = true;
$data['mw_ver'] = MagickGetVersion();
$imv = $data['mw_ver'][0];
}
if ($im_ver = media_handler::testImageMagick())
$imv = $im_ver;
if (isset($imv))
$versions['imagick'] = array(
'title' => $txt['support_imagemagick'],
'version' => $tick . ' (' . $imv . ')</em><br>
  ' . $txt['support_imagick'] . ': <em>' . (isset($data['imagick']) ? $tick . ' ' . $txt['support_available'] : $untick . ' ' . $txt['support_not_available']) . '</em><br>
  ' . $txt['support_MW'] . ': <em>' . (isset($data['mw']) ? $tick . ' ' . $txt['support_available'] : $untick . ' ' . $txt['support_not_available']), // don't end the /em tag! The template already does that...
);
else
$versions['imagick'] = array('title' => $txt['support_imagemagick'], 'version' => $untick . ' ' . $txt['support_not_available']);
}

If the check for ImageMagick fails in the first if block, why would it later "test" ImageMagick regardless?


After adjusting the code, the page loads fine.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Maintenance Task Hangs
« Reply #1, on November 7th, 2012, 12:51 AM »
Because there are multiple different ways ImageMagick can be configured - there are something like 3 separate and different bridges to PHP, which may all have different version numbers...
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Anthony`

  • Posts: 53

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278