Update of /cvsroot/php-blog/serendipity/include/admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13909/include/admin
Modified Files:
installer.inc.php upgrader.inc.php
Log Message:
1. Move serendipity_ini_bool / ini_bytesize to a central function place.
Upgrader and others may need this, so this does not belong to the
Admin page.
2. Make upgrader check at least the file permissions. Future unification
with the diagnosis for the installer is recommended, I am waiting
for a proposal from Tom as he disliked mine. :)
3. Put in template notices. Upgrading users need to know about this
bc-breaking change of the author realname in -alpha12.
Index: upgrader.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/upgrader.inc.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- upgrader.inc.php 9 Feb 2005 19:55:21 -0000 1.15
+++ upgrader.inc.php 27 Feb 2005 14:49:59 -0000 1.16
@@ -4,6 +4,27 @@
require_once(S9Y_INCLUDE_PATH . 'include/functions_installer.inc.php');
+define('S9Y_U_ERROR', -1);
+define('S9Y_U_WARNING', 0);
+define('S9Y_U_SUCCESS', 1);
+
+function serendipity_upgraderResultDiagnose($result, $s) {
+ global $errorCount;
+
+ if ( $result === S9Y_U_SUCCESS ) {
+ return '<span style="color: green; font-weight: bold">'. $s .'</span>';
+ }
+
+ if ( $result === S9Y_U_WARNING ) {
+ return '<span style="color: orange; font-weight: bold">'. $s .'</span>';
+ }
+
+ if ( $result === S9Y_U_ERROR ) {
+ $errorCount++;
+ return '<span style="color: red; font-weight: bold">'. $s .'</span>';
+ }
+}
+
// Setting this value to 'FALSE' is recommended only for SHARED BLOG INSTALLATIONS. This enforces all shared blogs with a common
// codebase to only allow upgrading, no bypassing and thus causing instabilities.
// This variable can also be set as $serendipity['UpgraderShowAbort'] inside serendipity_config_local.inc.php to prevent
@@ -126,6 +147,16 @@
'function' => 'serendipity_installFiles',
'title' => 'Update of .htaccess file',
'desc' => 'In order to implement URL rewrite improvement, changes were made to the .htaccess file, you need to regenerate it'),
+
+ array('version' => '0.8-alpha12',
+ 'type' => 'TEMPLATE_NOTICE',
+ 'function' => '',
+ 'title' => '<b>TEMPLATE_NOTICE:</b> The template file "entries.tpl" has changed.',
+ 'desc' => 'Authors can now have longer real names instead of only their loginnames. Those new fields need to be displayed in your Template, if you manually created one. Following variables were changes:
+ <b>{$entry.username}</b> => <b>{$entry.author}</b>
+ <b>{$entry.link_username}</b> => <b>{$entry.link_author}</b>
+ Those variables have been replaced in all bundled templates and those in our additional_themes repository.
+ ' . serendipity_upgraderResultDiagnose(S9Y_U_WARNING, 'Manual user interaction is required! This can NOT be done automatically!')),
);
/* Fetch SQL files which needs to be run */
@@ -175,7 +206,7 @@
/* Call functions */
foreach ($tasks as $task) {
- if (version_compare($serendipity['versionInstalled'], $task['version'], '<') ) {
+ if (!empty($task['function']) && version_compare($serendipity['versionInstalled'], $task['version'], '<') ) {
if (is_callable($task['function'])) {
echo sprintf('Calling %s ...<br />', (is_array($task['function']) ? $task['function'][0] . '::'. $task['function'][1] : $task['function']));;
@@ -230,48 +261,113 @@
$_SESSION['serendipityAuthedUser'] = false;
@session_destroy();
} else {
- echo SERENDIPITY_UPGRADER_WELCOME . '<br />';
+ echo '<h2>' . SERENDIPITY_UPGRADER_WELCOME . '</h2>';
printf(SERENDIPITY_UPGRADER_PURPOSE . '<br />', $serendipity['versionInstalled']);
- printf(SERENDIPITY_UPGRADER_WHY, $serendipity['version']);
+ printf(SERENDIPITY_UPGRADER_WHY . '.', $serendipity['version']);
+ echo '<br />' . FIRST_WE_TAKE_A_LOOK . '.';
+?>
+<br /><br />
+<div align="center"><?php printf(ERRORS_ARE_DISPLAYED_IN, serendipity_upgraderResultDiagnose(S9Y_U_ERROR, RED), serendipity_upgraderResultDiagnose(S9Y_U_WARNING, YELLOW), serendipity_upgraderResultDiagnose(S9Y_U_SUCCESS, GREEN)); ?>.<br />
+<?php
+ $errorCount = 0;
+ $showWritableNote = false;
+ $basedir = $serendipity['serendipityPath'];
+?>
+<div align="center">
+<table class="serendipity_admin_list_item serendipity_admin_list_item_even" width="90%" align="center">
+ <tr>
+ <td colspan="2" style="font-weight: bold"><?php echo PERMISSIONS ?></td>
+ </tr>
+ <tr>
+ <td><?php echo $basedir ?></td>
+ <td width="200"><?php
+ if ( is_writable($basedir) ) {
+ echo serendipity_upgraderResultDiagnose(S9Y_U_SUCCESS, WRITABLE);
+ } else {
+ echo serendipity_upgraderResultDiagnose(S9Y_U_ERROR, NOT_WRITABLE);
+ $showWritableNote = true;
+ }
+ ?></td>
+ </tr>
+ <tr>
+ <td><?php echo $basedir . PATH_SMARTY_COMPILE?></td>
+ <td width="200"><?php
+ if ( is_writable($basedir . PATH_SMARTY_COMPILE) ) {
+ echo serendipity_upgraderResultDiagnose(S9Y_U_SUCCESS, WRITABLE);
+ } else {
+ echo serendipity_upgraderResultDiagnose(S9Y_U_ERROR, NOT_WRITABLE);
+ $showWritableNote = true;
+ }
+ ?></td>
+ </tr>
+<?php if (is_dir($basedir . $serendipity['uploadHTTPPath'])) { ?>
+ <tr>
+ <td><?php echo $basedir . $serendipity['uploadHTTPPath']; ?></td>
+ <td width="200"><?php
+ if (is_writable($basedir . $serendipity['uploadHTTPPath'])) {
+ echo serendipity_upgraderResultDiagnose(S9Y_U_SUCCESS, WRITABLE);
+ } else {
+ echo serendipity_upgraderResultDiagnose(S9Y_U_ERROR, NOT_WRITABLE);
+ $showWritableNote = true;
+ }
+ ?></td>
+ </tr>
+<?php } ?>
+</table>
+</div>
+<?php if ($showWritableNote === true) { ?>
+ <div class="serendipityAdminMsgNote"><?php echo sprintf(PROBLEM_PERMISSIONS_HOWTO, 'chmod 0777') ?></div>
+<?php }
- if (sizeof($sqlfiles) > 0) {
+ if ($errorCount > 0) { ?>
+ <div align="center">
+ <div class="serendipityAdminMsgError"><?php echo PROBLEM_DIAGNOSTIC ?></div>
+ <h2><a href="serendipity_admin.php"><?php echo RECHECK_INSTALLATION ?></a></h2>
+ </div>
+<?php }
?>
-<br />
-<h3><?php printf(SERENDIPITY_UPGRADER_DATABASE_UPDATES, $serendipity['dbType']) ?>:</h3>
+</div>
+
+<?php
+ if ($errorCount < 1) {
+ if (sizeof($sqlfiles) > 0) { ?>
+ <br />
+ <h3><?php printf(SERENDIPITY_UPGRADER_DATABASE_UPDATES, $serendipity['dbType']) ?>:</h3>
<?php echo SERENDIPITY_UPGRADER_FOUND_SQL_FILES ?>:<br />
<?php
- foreach ($sqlfiles as $sqlfile) {
- echo '<div style="padding-left: 5px"><strong>'. $sqlfile .'</strong></div>';
+ foreach ($sqlfiles as $sqlfile) {
+ echo '<div style="padding-left: 5px"><strong>'. $sqlfile .'</strong></div>';
+ }
}
- }
?>
-<br />
+ <br />
-<h3><?php echo SERENDIPITY_UPGRADER_VERSION_SPECIFIC ?>:</h3>
+ <h3><?php echo SERENDIPITY_UPGRADER_VERSION_SPECIFIC ?>:</h3>
<?php
- $taskCount = 0;
+ $taskCount = 0;
- foreach ( $tasks as $task ) {
- if (version_compare($serendipity['versionInstalled'], $task['version'], '<')) {
- echo '<div><strong>'. $task['version'] .' - '. $task['title'] .'</strong></div>';
- echo '<div style="padding-left: 5px">'. nl2br($task['desc']) .'</div><br />';
- $taskCount++;
+ foreach ( $tasks as $task ) {
+ if (version_compare($serendipity['versionInstalled'], $task['version'], '<')) {
+ echo '<div><strong>'. $task['version'] .' - '. $task['title'] .'</strong></div>';
+ echo '<div style="padding-left: 5px">'. nl2br($task['desc']) .'</div><br />';
+ $taskCount++;
+ }
}
- }
- if ($taskCount == 0) {
- echo SERENDIPITY_UPGRADER_NO_VERSION_SPECIFIC;
- }
+ if ($taskCount == 0) {
+ echo SERENDIPITY_UPGRADER_NO_VERSION_SPECIFIC;
+ }
?>
-<br /><br />
-<hr noshade="noshade">
+ <br /><br />
+ <hr noshade="noshade">
<?php if ($taskCount > 0 || sizeof($sqlfiles) > 0) { ?>
- <strong><?php echo SERENDIPITY_UPGRADER_PROCEED_QUESTION ?></strong>
- <br /><input type="button" value="<?php echo SERENDIPITY_UPGRADER_PROCEED_DOIT ?>" onclick="location.href='<?php echo $upgradeLoc ?>'" class="serendipityPrettyButton"> <?php if ($showAbort) { ?><input type="button" value="<?php echo SERENDIPITY_UPGRADER_PROCEED_ABORT ?>" onclick="location.href='<?php echo $abortLoc ?>'" class="serendipityPrettyButton"> <?php } ?>
+ <strong><?php echo SERENDIPITY_UPGRADER_PROCEED_QUESTION ?></strong>
+ <br /><input type="button" value="<?php echo SERENDIPITY_UPGRADER_PROCEED_DOIT ?>" onclick="location.href='<?php echo $upgradeLoc ?>'" class="serendipityPrettyButton"> <?php if ($showAbort) { ?><input type="button" value="<?php echo SERENDIPITY_UPGRADER_PROCEED_ABORT ?>" onclick="location.href='<?php echo $abortLoc ?>'" class="serendipityPrettyButton"> <?php } ?>
<?php } else { ?>
- <strong><?php echo SERENDIPITY_UPGRADER_NO_UPGRADES ?></strong>
- <br /><input type="button" value="<?php echo SERENDIPITY_UPGRADER_CONSIDER_DONE ?>" onclick="location.href='<?php echo $abortLoc ?>'" class="serendipityPrettyButton">
+ <strong><?php echo SERENDIPITY_UPGRADER_NO_UPGRADES ?></strong>
+ <br /><input type="button" value="<?php echo SERENDIPITY_UPGRADER_CONSIDER_DONE ?>" onclick="location.href='<?php echo $abortLoc ?>'" class="serendipityPrettyButton">
<?php }
+ }
}
?>
Index: installer.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/installer.inc.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- installer.inc.php 24 Feb 2005 20:14:23 -0000 1.25
+++ installer.inc.php 27 Feb 2005 14:49:59 -0000 1.26
@@ -25,28 +25,6 @@
}
}
-function serendipity_ini_bool($var) {
- return ($var === 'on' || $var == '1');
-}
-
-function serendipity_ini_bytesize($val) {
- if ( $val == '' )
- return 0;
-
- switch(substr($val, -1)) {
- case 'k':
- case 'K':
- return (int) $val * 1024;
- break;
- case 'm':
- case 'M':
- return (int) $val * 1048576;
- break;
- default:
- return $val;
- }
-}
-
/* From configuration to install */
if ( sizeof($_POST) > 1 && $serendipity['GET']['step'] == 3 ) {
/* One problem, if the user chose to do an easy install, not all config vars has been transfered
@@ -86,7 +64,7 @@
<?php $errorCount = 0 ?>
-<div>
+<div align="center">
<table class="serendipity_admin_list_item serendipity_admin_list_item_even" width="90%" align="center">
<tr>
<td colspan="2" style="font-weight: bold"><?php echo PHP_INSTALLATION ?></td>
|