*/ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__)).'/'); if(!defined('DOKU_CONF')) define('DOKU_CONF',DOKU_INC.'conf/'); if(!defined('DOKU_LOCAL')) define('DOKU_LOCAL',DOKU_INC.'conf/'); if(!defined('DEBUG')) define('DEBUG', false); // ------------------------------------------------------------------------------------ // important settings ... // installation dependent local config file list $config_files = array( 'local' => DOKU_LOCAL.'local.php', 'users' => DOKU_LOCAL.'users.auth.php', 'auth' => DOKU_LOCAL.'acl.auth.php' ); // other installation dir/file permission requirements $install_permissions = array( 'data' => 'data', 'pages' => 'data/pages', 'attic' => 'data/attic', 'media' => 'data/media', 'meta' => 'data/meta', 'cache' => 'data/cache', 'locks' => 'data/locks', 'changelog' => 'data/changes.log' ); // array use to verify unchanged dokuwiki.php files, 'version' => 'md5 hash' $dokuwiki_php = DOKU_CONF.'dokuwiki.php'; $dokuwiki_hash = array( '2005-09-22' => 'e33223e957b0b0a130d0520db08f8fb7', '2006-03-05' => '51295727f79ab9af309a2fd9e0b61acc', '2006-03-09' => '51295727f79ab9af309a2fd9e0b61acc', ); // language strings // ------------------------------------------------------------------------------------ // initialise variables ... $msg = array(); $error = array(); $debug = array(); $process_form = false; // form variables with default values $title = ""; $location = true; $data = "./data"; $changeslog = true; $acl = true; $superuser = ""; $fullname = ""; $email = ""; // check for dokuwiki // (for now assume included with Dokuwiki install & resident in dokuwiki root folder) // ------------------------------------------------------------------------------------ // check for virgin dokuwiki installation $virgin_install = true; // $config_files mustn't exist foreach ($config_files as $file) { if (@file_exists($file)) { $virgin_install = false; $file = str_replace($_SERVER['DOCUMENT_ROOT'],'{DOCUMENT_ROOT}', $file); $msg[] = "$file exists"; } } // main dokuwiki config file (conf/dokuwiki.php) must not have been modified $installation_hash = md5(@file_get_contents($dokuwiki_php)); if (!in_array($installation_hash, $dokuwiki_hash)) { $virgin_install = false; $msg[] = "unrecognised or modified dokuwiki.php -- hash=$installation_hash"; } // ------------------------------------------------------------------------------------ // check for other basic installation & configuration details (to be nice) $changeslog_exists = @file_exists(DOKU_INC.'data/changes.log'); if (!is_writable(DOKU_CONF)) { $file = str_replace($_SERVER['DOCUMENT_ROOT'],'{DOCUMENT_ROOT}', DOKU_CONF); $error[] = "$file must be writable by the web server."; } //------------------------------------------------------------------------------------- // utility functions /** * remove magic quotes recursivly * * @author Andreas Gohr */ function remove_magic_quotes(&$array) { foreach (array_keys($array) as $key) { if (is_array($array[$key])) { remove_magic_quotes($array[$key]); }else { $array[$key] = stripslashes($array[$key]); } } } function cleanText($var, $default, $regex, $msg) { global $error; $value = isset($_REQUEST[$var]) ? $_REQUEST[$var] : $default; if ($regex) { if (!preg_match($regex, $value)) { $error[] = "$var - illegal/unrecognised value"; } } return $value; } function fileWrite($name, $filename, $data) { global $error; if (($fp = @fopen($filename, 'wb')) === false) { $filename = str_replace($_SERVER['DOCUMENT_ROOT'],'{DOCUMENT_ROOT}', $filename); $error[] = "Unable to create $name ($filename). You will need to check directory/file permissions and create the file manually."; return false; } if (!empty($data)) { fwrite($fp, $data); } fclose($fp); return true; } // ------------------------------------------------------------------------------------ // form processing ... if (isset($_REQUEST['submit'])) { if (!$virgin_install) { $msg[] = "unable to apply updates, installation already modified"; } else { // apply updates per form instructions $process_form = true; if (get_magic_quotes_gpc()) { if (!empty($_REQUEST)) remove_magic_quotes($_REQUEST); } $title = cleanText('title', '', ''); $location = isset($_REQUEST['location']); $data = cleanText('data', '', ''); $changeslog = isset($_REQUEST['changeslog']); $acl = isset($_REQUEST['acl']); $superuser = cleanText('superuser','','/\S+/'); $password = cleanText('password','','/\S+/'); $confirm = cleanText('confirm','','/^'.preg_quote($password,'/').'$/'); $fullname = cleanText('fullname','',''); $email = cleanText('email','',''); $debug = compact('title','location','data','changeslog','acl','superuser','password','confirm'); if (empty($error)) { // all incoming data is ok ... lets do ... // create changes.log if (!$changeslog_exists) { $filename = realpath((empty($data) || ($data{0} != "/")) ? DOKU_INC.$data : $data).'/changes.log'; fileWrite('changeslog',$filename, ''); } // create local.php $output = ""; if (!empty($title)) $output .= '$conf[\'title\'] = \''.addslashes($title)."';\n"; if (!empty($data)) $output .= '$conf[\'data\'] = \''.$data."';\n"; if ($acl) $output .= '$conf[\'useacl\'] = 1'.";\n"; if (!empty($superuser)) $output .= '$conf[\'superuser\'] = \''.$superuser."';\n"; if (!empty($output)) { $output = '<'.'?php /* * Dokuwiki\'s Main Configuration File - Local Settings * Auto-generated by install script * Date: '.date('r').' */'."\n".$output; fileWrite('local configuration settings file',DOKU_LOCAL.'local.php',$output); } if ($acl) { // create users.auth.php // --- user:MD5password:Real Name:email:groups,comma,seperated $output = (!empty($superuser)) ? join(":",array($superuser, md5($password), $fullname, $email, 'users')) : ""; $output = @file_get_contents(DOKU_CONF.'users.auth.php.dist')."\n$output\n"; fileWrite('acl user file', DOKU_LOCAL.'users.auth.php', $output); // create acl.auth.php $output = @file_get_contents(DOKU_CONF.'acl.auth.php.dist'); fileWrite('acl authorisations file', DOKU_LOCAL.'acl.auth.php', $output); } } } } //------------------------------------------------------------------------------------- $show_form = !$process_form && $virgin_install && empty($error); ?> Dokuwiki Installer

Dokuwiki Installer

This page assists in the installation and configuration of Dokuwiki.

Dokuwiki uses ordinary files for the storage of wiki pages and other information associated with those pages (e.g. images, search indexes, old revisions, etc). In order to operate successfully Dokuwiki must have write access to the directories that hold those files. This installer is not capable of setting up directory permissions, that normally needs to be done directly or if you are using hosting, through your hosting control panel (e.g. cPanel).

This installer will setup your Dokuwiki configuration for ACL, which in turn allows administrator login and access to Dokuwiki's admin menu for installing plugins, managing users, managing access to wiki pages and alteration of configuration settings. It isn't required for Dokuwiki to operate, however it will make Dokuwiki easier to administer.

Use these links for details concerning installation instructions and configuration settings.

Modified installation detected.

For security reasons this script will only work with a new & unmodified Dokuwiki installation. You should either re-extract the files from the downloaded package or consult the complete Dokuwiki installation instructions

One or more incorrect directory/file permissions were found.

In order to complete this installation the above directories and files need to have their permissions altered as indicated. Please correct the above problems before trying again.

Configuration updated successfully.

Now that your initial dokuwiki configuration has been set you should delete this file to prevent its further use which may damage your dokuwiki installation and/or configuration.

Use this link to visit your new wiki

The following errors were encountered ...

return to installation form