diff --git a/inc/config.php b/inc/config.php
index bddb9e4c..fe771358 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -418,16 +418,17 @@
$config['thumb_keep_animation_frames'] = 1;
// Thumbnailing method:
- // - 'gd' PHP GD (default). Only handles the most basic image formats (GIF, JPEG, PNG).
- // This is a prerequisite for Tinyboard no matter what method you choose.
- // - 'imagick' PHP's ImageMagick bindings. Fast and efficient, supporting many image formats.
- // A few minor bugs. http://pecl.php.net/package/imagick
- // - 'convert' The command line version of ImageMagick (`convert`). Fixes most of the bugs in
- // PHP Imagick.
- // - 'convert+gifsicle' Same as above, with the exception of using `gifsicle` (command line application)
- // instead of `convert` for resizing gifs. It's faster and resulting animated gifs
- // have less artifacts than if resized with ImageMagick.
+ // - 'gd' PHP GD (default). Only handles the most basic image formats (GIF, JPEG, PNG).
+ // This is a prerequisite for Tinyboard no matter what method you choose.
+ // - 'imagick' PHP's ImageMagick bindings. Fast and efficient, supporting many image formats.
+ // A few minor bugs. http://pecl.php.net/package/imagick
+ // - 'convert' The command line version of ImageMagick (`convert`). Fixes most of the bugs in
+ // PHP Imagick. `convert` produces the best still thumbnails and is highly recommended.
+ // - 'convert+gifsicle' Same as above, with the exception of using `gifsicle` (command line application)
+ // instead of `convert` for resizing GIFs. It's faster and resulting animated thumbnails
+ // have less artifacts than if resized with ImageMagick.
$config['thumb_method'] = 'gd';
+ // $config['thumb_method'] = 'convert';
// Strip EXIF metadata from JPEG files
$config['strip_exif'] = false;
diff --git a/install.php b/install.php
index 6bb161dc..fa41ad2d 100644
--- a/install.php
+++ b/install.php
@@ -388,53 +388,156 @@ if ($step == 0) {
} elseif ($step == 1) {
$page['title'] = 'Pre-installation test';
- $page['body'] = '
';
+ $can_exec = true;
+ if (!function_exists('shell_exec'))
+ $can_exec = false;
+ elseif (in_array('shell_exec', array_map('trim', explode(', ', ini_get('disable_functions')))))
+ $can_exec = false;
+ elseif (ini_get('safe_mode'))
+ $can_exec = false;
+ elseif (trim(shell_exec('echo "TEST"')) !== 'TEST')
+ $can_exec = false;
- function rheader($item) {
- global $page, $config;
-
- $page['body'] .= '' . $item . ' |
';
+ if (!defined('PHP_VERSION_ID')) {
+ $version = explode('.', PHP_VERSION);
+ define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
}
- function row($item, $result) {
- global $page, $config, $__is_error;
- if (!$result)
- $__is_error = true;
- $page['body'] .= '' . $item . ' | |
';
- }
-
-
// Required extensions
- rheader('PHP extensions');
- row('PDO', extension_loaded('pdo'));
- row('GD', extension_loaded('gd'));
+ $extensions = array(
+ 'PDO' => array(
+ 'installed' => extension_loaded('pdo'),
+ 'required' => true
+ ),
+ 'PDO' => array(
+ 'installed' => extension_loaded('gd'),
+ 'required' => true
+ ),
+ 'Imagick' => array(
+ 'installed' => extension_loaded('imagick'),
+ 'required' => false
+ )
+ );
- // GD tests
- rheader('GD tests');
- row('JPEG', function_exists('imagecreatefromjpeg'));
- row('PNG', function_exists('imagecreatefrompng'));
- row('GIF', function_exists('imagecreatefromgif'));
+ $tests = array(
+ array(
+ 'category' => 'PHP',
+ 'name' => 'PHP ≥ 5.2.5',
+ 'result' => PHP_VERSION_ID >= 50205,
+ 'required' => true,
+ 'message' => 'Tinyboard requires PHP 5.2.5 or better.',
+ ),
+ array(
+ 'category' => 'PHP',
+ 'name' => 'PHP ≥ 5.3',
+ 'result' => PHP_VERSION_ID >= 50300,
+ 'required' => false,
+ 'message' => 'PHP ≥ 5.3, though not required, is recommended to make the most out of Tinyboard configuration files.',
+ ),
+ array(
+ 'category' => 'PHP',
+ 'name' => 'mbstring extension installed',
+ 'result' => extension_loaded('mbstring'),
+ 'required' => true,
+ 'message' => 'You must install the PHP mbstring extension.',
+ ),
+ array(
+ 'category' => 'Database',
+ 'name' => 'PDO extension installed',
+ 'result' => extension_loaded('pdo'),
+ 'required' => true,
+ 'message' => 'You must install the PHP PDO extension.',
+ ),
+ array(
+ 'category' => 'Database',
+ 'name' => 'MySQL PDO driver installed',
+ 'result' => extension_loaded('pdo') && in_array('mysql1', PDO::getAvailableDrivers()),
+ 'required' => true,
+ 'message' => 'The required PDO MySQL driver is not installed.',
+ ),
+ array(
+ 'category' => 'Image processing',
+ 'name' => 'GD extension installed',
+ 'result' => extension_loaded('gd'),
+ 'required' => true,
+ 'message' => 'You must install the PHP GD extension. GD is a requirement even if you have chosen another image processor for thumbnailing.',
+ ),
+ array(
+ 'category' => 'Image processing',
+ 'name' => 'GD: JPEG',
+ 'result' => function_exists('imagecreatefromjpeg'),
+ 'required' => true,
+ 'message' => 'imagecreatefromjpeg() does not exist. This is a problem.',
+ ),
+ array(
+ 'category' => 'Image processing',
+ 'name' => 'GD: PNG',
+ 'result' => function_exists('imagecreatefrompng'),
+ 'required' => true,
+ 'message' => 'imagecreatefrompng() does not exist. This is a problem.',
+ ),
+ array(
+ 'category' => 'Image processing',
+ 'name' => 'GD: GIF',
+ 'result' => function_exists('imagecreatefromgif'),
+ 'required' => true,
+ 'message' => 'imagecreatefromgif() does not exist. This is a problem.',
+ ),
+ array(
+ 'category' => 'Image processing',
+ 'name' => 'Imagick extension installed',
+ 'result' => extension_loaded('imagick1'),
+ 'required' => false,
+ 'message' => '(Optional) The PHP Imagick (ImageMagick) extension is not installed. You may not use Imagick for better (and faster) image processing.',
+ ),
+ array(
+ 'category' => 'Image processing',
+ 'name' => '`convert` (command-line ImageMagick)',
+ 'result' => $can_exec && shell_exec('which convert'),
+ 'required' => false,
+ 'message' => '(Optional) `convert` was not found or executable; command-line ImageMagick image processing cannot be enabled.',
+ ),
+ array(
+ 'category' => 'Image processing',
+ 'name' => '`identify` (command-line ImageMagick)',
+ 'result' => $can_exec && shell_exec('which identify'),
+ 'required' => false,
+ 'message' => '(Optional) `identify` was not found or executable; command-line ImageMagick image processing cannot be enabled.',
+ ),
+ array(
+ 'category' => 'Image processing',
+ 'name' => '`gifsicle` (command-line animted GIF thumbnailing)',
+ 'result' => $can_exec && shell_exec('which gifsicle1'),
+ 'required' => false,
+ 'message' => '(Optional) `gifsicle` was not found or executable; you may not use `convert+gifsicle` for better animated GIF thumbnailing.',
+ ),
+ array(
+ 'category' => 'File permissions',
+ 'name' => getcwd(),
+ 'result' => is_writable('.'),
+ 'required' => true,
+ 'message' => 'Tinyboard does not have permission to create directories (boards) here. You will need to chmod
(or operating system equivalent) appropriately.'
+ ),
+ array(
+ 'category' => 'File permissions',
+ 'name' => getcwd() . '/inc/instance-config.php',
+ 'result' => is_writable('inc/instance-config.php'),
+ 'required' => false,
+ 'message' => 'Tinyboard does not have permission to make changes to inc/instance-config.php. To complete the installation, you will be asked to manually copy and paste code into the file instead.'
+ )
+ );
- // Database drivers
- $drivers = PDO::getAvailableDrivers();
+ $config['font_awesome'] = true;
- rheader('PDO drivers (currently installed drivers)');
- foreach ($drivers as &$driver) {
- row($driver, true);
- }
-
- // Permissions
- rheader('File permissions');
- row('root directory (' . getcwd() . ')', is_writable('.'));
-
- $page['body'] .= '
-
- Continue' . (isset($__is_error) ? ' anyway' : '') . '
-
';
-
- echo Element('page.html', $page);
+ echo Element('page.html', array(
+ 'body' => Element('installer/check-requirements.html', array(
+ 'extensions' => $extensions,
+ 'tests' => $tests,
+ 'config' => $config
+ )),
+ 'title' => 'Checking environment',
+ 'config' => $config
+ ));
} elseif ($step == 2) {
// Basic config
$page['title'] = 'Configuration';
diff --git a/templates/installer/check-requirements.html b/templates/installer/check-requirements.html
new file mode 100644
index 00000000..fea6fed8
--- /dev/null
+++ b/templates/installer/check-requirements.html
@@ -0,0 +1,54 @@
+
+
Pre-installation tests
+
+
+ Category |
+ Test |
+ Result |
+
+ {% set errors = 0 %}
+ {% set warnings = 0 %}
+ {% for test in tests %}
+
+ {{ test.category }} |
+ {{ test.name }} |
+
+ {% if test.result %}
+
+ {% else %}
+ {% if test.required %}
+ {% set errors = errors + 1 %}
+
+ {% else %}
+ {% set warnings = warnings + 1 %}
+
+ {% endif %}
+ {% endif %}
+ |
+
+ {% endfor %}
+
+ {% if errors or warnings %}
+
There were {{ errors }} error(s) and {{ warnings }} warning(s).
+
+ {% for test in tests if not test.result%}
+ -
+ {% if test.required %}
+ Error:
+ {% else %}
+ Warning:
+ {% endif %}
+ {{ test.message }}
+
+ {% endfor %}
+
+ {% if errors %}
+
Clik here to ignore errors and attempt installing anyway (not recommended).
+ {% else %}
+
Clik here to proceed with installation.
+ {% endif %}
+ {% else %}
+
There were no errors or warnings. Good!
+
Clik here to proceed with installation.
+ {% endif %}
+