update installer
This commit is contained in:
parent
a42256b296
commit
8dac72e924
101
install.php
101
install.php
@ -581,6 +581,25 @@ if (file_exists($config['has_installed'])) {
|
|||||||
die(Element('page.html', $page));
|
die(Element('page.html', $page));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function create_config_from_array(&$instance_config, &$array, $prefix = '') {
|
||||||
|
foreach ($array as $name => $value) {
|
||||||
|
if (is_array($value)) {
|
||||||
|
$instance_config .= "\n";
|
||||||
|
create_config_from_array($instance_config, $value, $prefix . '[\'' . addslashes($name) . '\']');
|
||||||
|
$instance_config .= "\n";
|
||||||
|
} else {
|
||||||
|
$instance_config .= ' $config' . $prefix . '[\'' . addslashes($name) . '\'] = ';
|
||||||
|
|
||||||
|
if (is_numeric($value))
|
||||||
|
$instance_config .= $value;
|
||||||
|
else
|
||||||
|
$instance_config .= "'" . addslashes($value) . "'";
|
||||||
|
|
||||||
|
$instance_config .= ";\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($step == 0) {
|
if ($step == 0) {
|
||||||
// Agreeement
|
// Agreeement
|
||||||
$page['body'] = '
|
$page['body'] = '
|
||||||
@ -614,7 +633,7 @@ if ($step == 0) {
|
|||||||
'installed' => extension_loaded('pdo'),
|
'installed' => extension_loaded('pdo'),
|
||||||
'required' => true
|
'required' => true
|
||||||
),
|
),
|
||||||
'PDO' => array(
|
'GD' => array(
|
||||||
'installed' => extension_loaded('gd'),
|
'installed' => extension_loaded('gd'),
|
||||||
'required' => true
|
'required' => true
|
||||||
),
|
),
|
||||||
@ -627,17 +646,17 @@ if ($step == 0) {
|
|||||||
$tests = array(
|
$tests = array(
|
||||||
array(
|
array(
|
||||||
'category' => 'PHP',
|
'category' => 'PHP',
|
||||||
'name' => 'PHP ≥ 5.3',
|
'name' => 'PHP ≥ 5.4',
|
||||||
'result' => PHP_VERSION_ID >= 50300,
|
'result' => PHP_VERSION_ID >= 50400,
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'message' => 'vichan requires PHP 5.3 or better.',
|
'message' => 'vichan requires PHP 5.4 or better.',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'category' => 'PHP',
|
'category' => 'PHP',
|
||||||
'name' => 'PHP ≥ 5.4',
|
'name' => 'PHP ≥ 5.6',
|
||||||
'result' => PHP_VERSION_ID >= 50400,
|
'result' => PHP_VERSION_ID >= 50600,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'message' => 'vichan works best on PHP 5.4 or better.',
|
'message' => 'vichan works best on PHP 5.6 or better.',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'category' => 'PHP',
|
'category' => 'PHP',
|
||||||
@ -694,6 +713,7 @@ if ($step == 0) {
|
|||||||
'result' => $can_exec && shell_exec('which convert'),
|
'result' => $can_exec && shell_exec('which convert'),
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'message' => '(Optional) `convert` was not found or executable; command-line ImageMagick image processing cannot be enabled.',
|
'message' => '(Optional) `convert` was not found or executable; command-line ImageMagick image processing cannot be enabled.',
|
||||||
|
'effect' => function (&$config) { $config['thumb_method'] = 'convert'; },
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'category' => 'Image processing',
|
'category' => 'Image processing',
|
||||||
@ -708,6 +728,7 @@ if ($step == 0) {
|
|||||||
'result' => $can_exec && shell_exec('which gm'),
|
'result' => $can_exec && shell_exec('which gm'),
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'message' => '(Optional) `gm` was not found or executable; command-line GraphicsMagick (faster than ImageMagick) cannot be enabled.',
|
'message' => '(Optional) `gm` was not found or executable; command-line GraphicsMagick (faster than ImageMagick) cannot be enabled.',
|
||||||
|
'effect' => function (&$config) { $config['thumb_method'] = 'gm'; },
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'category' => 'Image processing',
|
'category' => 'Image processing',
|
||||||
@ -715,13 +736,25 @@ if ($step == 0) {
|
|||||||
'result' => $can_exec && shell_exec('which gifsicle'),
|
'result' => $can_exec && shell_exec('which gifsicle'),
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'message' => '(Optional) `gifsicle` was not found or executable; you may not use `convert+gifsicle` for better animated GIF thumbnailing.',
|
'message' => '(Optional) `gifsicle` was not found or executable; you may not use `convert+gifsicle` for better animated GIF thumbnailing.',
|
||||||
|
'effect' => function (&$config) { if ($config['thumb_method'] == 'gm') $config['thumb_method'] = 'gm+gifsicle';
|
||||||
|
if ($config['thumb_method'] == 'convert') $config['thumb_method'] = 'convert+gifsicle'; },
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'category' => 'Image processing',
|
'category' => 'Image processing',
|
||||||
'name' => '`md5sum` (quick file hashing)',
|
'name' => '`md5sum` (quick file hashing on GNU/Linux)',
|
||||||
|
'prereq' => '',
|
||||||
'result' => $can_exec && shell_exec('echo "vichan" | md5sum') == "141225c362da02b5c359c45b665168de -\n",
|
'result' => $can_exec && shell_exec('echo "vichan" | md5sum') == "141225c362da02b5c359c45b665168de -\n",
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'message' => '(Optional) `md5sum` was not found or executable; file hashing for multiple images will be slower.',
|
'message' => '(Optional) `md5sum` was not found or executable; file hashing for multiple images will be slower. Ignore if not using Linux.',
|
||||||
|
'effect' => function (&$config) { $config['gnu_md5'] = true; },
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'category' => 'Image processing',
|
||||||
|
'name' => '`/sbin/md5` (quick file hashing on BSDs)',
|
||||||
|
'result' => $can_exec && shell_exec('echo "vichan" | /sbin/md5 -r') == "141225c362da02b5c359c45b665168de\n",
|
||||||
|
'required' => false,
|
||||||
|
'message' => '(Optional) `/sbin/md5` was not found or executable; file hashing for multiple images will be slower. Ignore if not using BSD.',
|
||||||
|
'effect' => function (&$config) { $config['bsd_md5'] = true; },
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'category' => 'File permissions',
|
'category' => 'File permissions',
|
||||||
@ -739,6 +772,13 @@ if ($step == 0) {
|
|||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'category' => 'File permissions',
|
'category' => 'File permissions',
|
||||||
|
'name' => getcwd() . '/tmp/cache',
|
||||||
|
'result' => is_dir('tmp/cache') && is_writable('tmp/cache'),
|
||||||
|
'required' => true,
|
||||||
|
'message' => 'You must give vichan permission to write to the <code>tmp/cache</code> directory.'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'category' => 'File permissions',
|
||||||
'name' => getcwd() . '/inc/instance-config.php',
|
'name' => getcwd() . '/inc/instance-config.php',
|
||||||
'result' => is_writable('inc/instance-config.php'),
|
'result' => is_writable('inc/instance-config.php'),
|
||||||
'required' => false,
|
'required' => false,
|
||||||
@ -763,14 +803,24 @@ if ($step == 0) {
|
|||||||
|
|
||||||
$config['font_awesome'] = true;
|
$config['font_awesome'] = true;
|
||||||
|
|
||||||
|
$additional_config = array();
|
||||||
|
foreach ($tests as $test) {
|
||||||
|
if ($test['result'] && $test['effect']) {
|
||||||
|
$test['effect']($additional_config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$more = '';
|
||||||
|
create_config_from_array($more, $additional_config);
|
||||||
|
$_SESSION['more'] = $more;
|
||||||
|
|
||||||
echo Element('page.html', array(
|
echo Element('page.html', array(
|
||||||
'body' => Element('installer/check-requirements.html', array(
|
'body' => Element('installer/check-requirements.html', array(
|
||||||
'extensions' => $extensions,
|
'extensions' => $extensions,
|
||||||
'tests' => $tests,
|
'tests' => $tests,
|
||||||
'config' => $config
|
'config' => $config,
|
||||||
)),
|
)),
|
||||||
'title' => 'Checking environment',
|
'title' => 'Checking environment',
|
||||||
'config' => $config
|
'config' => $config,
|
||||||
));
|
));
|
||||||
} elseif ($step == 2) {
|
} elseif ($step == 2) {
|
||||||
// Basic config
|
// Basic config
|
||||||
@ -781,14 +831,18 @@ if ($step == 0) {
|
|||||||
|
|
||||||
echo Element('page.html', array(
|
echo Element('page.html', array(
|
||||||
'body' => Element('installer/config.html', array(
|
'body' => Element('installer/config.html', array(
|
||||||
'config' => $config
|
'config' => $config,
|
||||||
|
'more' => $more,
|
||||||
)),
|
)),
|
||||||
'title' => 'Configuration',
|
'title' => 'Configuration',
|
||||||
'config' => $config
|
'config' => $config
|
||||||
));
|
));
|
||||||
} elseif ($step == 3) {
|
} elseif ($step == 3) {
|
||||||
|
$more = $_POST['more'];
|
||||||
|
unset($_POST['more']);
|
||||||
|
|
||||||
$instance_config =
|
$instance_config =
|
||||||
'<?php
|
'<'.'?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Instance Configuration
|
* Instance Configuration
|
||||||
@ -800,28 +854,11 @@ if ($step == 0) {
|
|||||||
|
|
||||||
';
|
';
|
||||||
|
|
||||||
function create_config_from_array(&$instance_config, &$array, $prefix = '') {
|
|
||||||
foreach ($array as $name => $value) {
|
|
||||||
if (is_array($value)) {
|
|
||||||
$instance_config .= "\n";
|
|
||||||
create_config_from_array($instance_config, $value, $prefix . '[\'' . addslashes($name) . '\']');
|
|
||||||
$instance_config .= "\n";
|
|
||||||
} else {
|
|
||||||
$instance_config .= ' $config' . $prefix . '[\'' . addslashes($name) . '\'] = ';
|
|
||||||
|
|
||||||
if (is_numeric($value))
|
|
||||||
$instance_config .= $value;
|
|
||||||
else
|
|
||||||
$instance_config .= "'" . addslashes($value) . "'";
|
|
||||||
|
|
||||||
$instance_config .= ";\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
create_config_from_array($instance_config, $_POST);
|
create_config_from_array($instance_config, $_POST);
|
||||||
|
|
||||||
$instance_config .= "\n";
|
$instance_config .= "\n";
|
||||||
|
$instance_config .= $more;
|
||||||
|
$instance_config .= "\n";
|
||||||
|
|
||||||
if (@file_put_contents('inc/instance-config.php', $instance_config)) {
|
if (@file_put_contents('inc/instance-config.php', $instance_config)) {
|
||||||
header('Location: ?step=4', true, $config['redirect_http']);
|
header('Location: ?step=4', true, $config['redirect_http']);
|
||||||
|
@ -87,6 +87,9 @@
|
|||||||
<legend>Miscellaneous</legend>
|
<legend>Miscellaneous</legend>
|
||||||
<label for="secure_trip_salt">Secure trip (##) salt:</label>
|
<label for="secure_trip_salt">Secure trip (##) salt:</label>
|
||||||
<input type="text" id="secure_trip_salt" name="secure_trip_salt" value="{{ config.secure_trip_salt }}" size="40">
|
<input type="text" id="secure_trip_salt" name="secure_trip_salt" value="{{ config.secure_trip_salt }}" size="40">
|
||||||
|
|
||||||
|
<label for="more">Additional configuration:</label>
|
||||||
|
<textarea id="more" name="more">{{ more }}</textarea>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<p style="text-align:center">
|
<p style="text-align:center">
|
||||||
|
Loading…
Reference in New Issue
Block a user