I pretty much got it. Except the config values are not being populated in the database, and when i try to load the blog i get the following error:
Code: Select all
Warning: Smarty error: unable to read resource: "" in /usr/local/lib/s9y/bundled-libs/Smarty/libs/Smarty.class.php on line 1088
I've got to be missing something. The script i'm using is below:
Code: Select all
define('IN_installer', true);
define('IN_upgrader', true);
define('IN_serendipity', true);
define('IN_serendipity_admin', true);
define('IS_installed', false);
define('S9Y_INCLUDE_PATH', '/usr/local/lib/s9y/');
$serendipity['dbType'] = 'mysql';
require_once('/usr/local/lib/s9y/include/functions.inc.php');
require_once('/usr/local/lib/s9y/serendipity_config.inc.php');
$serendipity['dbType'] = 'mysql';
$serendipity['dbHost'] = 'localhost';
$serendipity['dbUser'] = $dbInfo[1];
$serendipity['dbPass'] = $dbInfo[2];
$serendipity['dbName'] = $dbInfo[0];
$serendipity['dbPrefix'] = 'serendipity_';
$serendipity['dbPersistent'] = false;
$serendipity['version'] = $app->getVersion();
$serendipity['serendipityPath'] = "/home/".$_SESSION['username']."/".$domain->getDomain()."/docs/$dirName";
$serendipityPath = "/home/".$_SESSION['username']."/".$domain->getDomain()."/docs/$dirName";
/*
* Attempt to connect to the database
*/
if (!serendipity_db_connect()) {
serendipity_die(DATABASE_ERROR);
}
echo CHECK_DATABASE_EXISTS .'...';
echo "SELECT * FROM {$serendipity['dbPrefix']}authors";
$t = serendipity_db_query("SELECT * FROM {$serendipity['dbPrefix']}authors", false, 'both', false, false, false, true);
if ( is_array($t) ) {
echo ' <strong>'. THEY_DO .'</strong>, '. WONT_INSTALL_DB_AGAIN;
echo '<br />';
echo '<br />';
} else {
echo ' <strong>'. THEY_DONT .'</strong>';
echo '<br />';
echo CREATE_DATABASE;
serendipity_installDatabase();
echo ' <strong>' . DONE . '</strong><br />';
echo sprintf(CREATING_PRIMARY_AUTHOR, $_POST['user']) .'...';
$authorid = serendipity_addAuthor($_POST['user'], $_POST['pass'], $_POST['realname'],$_POST['email'], USERLEVEL_ADMIN);
$mail_comments = (serendipity_db_bool($_POST['want_mail']) ? 1 : 0);
serendipity_set_user_var('mail_comments', $mail_comments, $authorid);
serendipity_set_user_var('mail_trackbacks', $mail_comments, $authorid);
serendipity_set_user_var('right_publish', 1, $authorid);
serendipity_addDefaultGroup('USERLEVEL_EDITOR_DESC', USERLEVEL_EDITOR);
serendipity_addDefaultGroup('USERLEVEL_CHIEF_DESC', USERLEVEL_CHIEF);
serendipity_addDefaultGroup('USERLEVEL_ADMIN_DESC', USERLEVEL_ADMIN);
echo ' <strong>' . DONE . '</strong><br />';
echo SETTING_DEFAULT_TEMPLATE .'... ';
serendipity_set_config_var('template', $serendipity['defaultTemplate']);
echo ' <strong>' . DONE . '</strong><br />';
echo INSTALLING_DEFAULT_PLUGINS .'... ';
include_once S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php';
serendipity_plugin_api::register_default_plugins();
echo ' <strong>' . DONE . '</strong><br />';
}
$errors = serendipity_installFiles($basedir);
if ( $errors === true ) {
echo ' <strong>' . DONE . '</strong><br />';
} else {
echo ' <strong>' . FAILED . '</strong><br />';
foreach ( $errors as $error ) {
echo '<div class="serendipityAdminMsgError">'. $error .'</div>';
}
}
// This can't actuall write the file, but it appears to popular the config options
if ( serendipity_updateConfiguration() ) {
echo '<div class="serendipityAdminMsgSuccess">'. SERENDIPITY_INSTALLED .'</div>';
echo '<div align="center">'. THANK_YOU_FOR_CHOOSING .'</div>';
} else {
echo '<div class="serendipityAdminMsgSuccess">'. ERROR_DETECTED_IN_INSTALL .'</div>';
}
// Write .htaccess file
$s9y->writeHtaccess($serendipityPath,$dirName);
// Call function to write config
$s9y->writeConfig($serendipity['dbName'],$serendipity['dbPrefix'],$serendipity['dbHost'],
$serendipity['dbUser'],$serendipity['dbPass'],$serendipity['dbType'],$serendipity['dbPersistent'],
$serendipity['version'],$serendipityPath);
PHP is running under cgi, so the script doesnt actually have premissions to write the files, so that is why I called the two functions i created at the bottom to create the files with the proper permissions