Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30800
Modified Files:
INSTALL README compat.php serendipity_admin_upgrader.inc.php
serendipity_config.inc.php serendipity_lang.inc.php
Log Message:
Made Tom's upgrader a bit more verbose and adapted to 0.6 version. Improved version and language detection.
Guys, this is important. PLEASE TEST!!!
Index: INSTALL
===================================================================
RCS file: /cvsroot/php-blog/serendipity/INSTALL,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- INSTALL 25 Feb 2004 08:41:24 -0000 1.9
+++ INSTALL 15 Mar 2004 10:12:46 -0000 1.10
@@ -21,11 +21,7 @@
# UPGRADE #
###############################################################################
-1. Download the latest release from s9y.org
-2. Extract all files into your serendipity directory, overwriting old files.
-3. Run db_upgrade0.2-0.3.sql (example) using phpMyAdmin or a similar tool
-4. Go to Admin->Configuration and configure any new settings since last version
-5. Done!
+See README file for detailed actions.
###############################################################################
# REQUIREMENTS #
Index: README
===================================================================
RCS file: /cvsroot/php-blog/serendipity/README,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- README 3 Mar 2004 13:39:48 -0000 1.2
+++ README 15 Mar 2004 10:12:47 -0000 1.3
@@ -9,15 +9,48 @@
###############################################################################
The automatic update script should find and execute any necessary changes to the
-database layout made in different s9y versions.
+database layout made in different s9y versions beginning from 0.5.
+
+Usually all DB schema upgrades in previous versions will be used. So when you upgrade
+from 0.5 to 0.7 you will get upgrades from 0.5 -> 0.6 and 0.6 -> 0.7.
However, you are always advised to look at the corresponding
SQL update file in sql/db_update* to see which changes were made.
+Please bear in mind that the automatic update script is executable by any user
+visiting your blog at the time of updating. You should modify your .htaccess file
+before upgradding and include this directives:
+
+---- .htaccess
+AuthType Basic
+AuthName "Authorisation: Serendipity Upgrade IN PROGRESS"
+AuthUserFile /absolute/path/to/your/s9y/.htpasswd
+require valid-user
+----
+
+Then create a file .htpasswd using a simple 'username:md5password' combination.
+Look at http://www.advancehost.com/htpasswd.html for an online generator for
+.htpasswd files.
+
+---- .htpasswd
+s9y:s9QXoc9dcFOT2
+----
+
+This would create a user "s9y" with password "s9y" with which you'd have to log into your
+blog.
+
+A proper backup of BOTH the file system and your database is suggested. Whenever
+you made changes to the distributed files (or to the files like xml.gif or the
+smilies) you have to make sure to copy them over the distributed files after updating.
+
###############################################################################
-# NOTES ON UPDATING FROM 0.5 -> 0.5.1 #
+# NOTES ON UPDATING FROM 0.5/0.5.1 -> 0.6 #
###############################################################################
+* [The 0.5.1 release was renamed to 0.6, but there will still be DB layout changes
+ applied which are labelled as 0.5.1 - just ignore it. It's only to easy migration
+ to CVS-Snapshot users using the 0.5.1-version]
+
* The structure of the content_rewrite plugin has changed. It will get rewritten
automatically by the update script, but if you had output on your sidebar
before, you need to do this:
@@ -26,6 +59,23 @@
- Configure the 'serendipity_plugin_eventwrapper' and set it to use your
existing 'serendpity_event_contentrewrite' plugin.
+* Smilies and the XML-button where moved from the '/pixel' subdirectory into
+ per-template 'img/' subdirectories. If you modified the original files, you need
+ to copy your versions inside the 'templates/default/img/' directory.
+
+###############################################################################
+# NOTES ON UPDATING FROM 0.4 -> 0.5 #
+###############################################################################
+
+No changes where made to the database scheme in this version.
+
+###############################################################################
+# NOTES ON UPDATING FROM 0.3 -> 0.4 #
+###############################################################################
+
+Run the file 'sql/db_update_0.3_0.4_mysql.sql' or ''sql/db_update_0.3_0.4_pgsql.sql' to update
+your database. Apart from that, just copy over the new files of the distribution.
+
###############################################################################
# THE 'embed' CONFIGURATION DIRECTIVE #
###############################################################################
Index: compat.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/compat.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- compat.php 21 Jan 2004 18:28:25 -0000 1.11
+++ compat.php 15 Mar 2004 10:12:47 -0000 1.12
@@ -94,6 +94,10 @@
}
}
+function serendipity_version($version) {
+ return preg_replace('@\-.+$@', '', $version);
+}
+
/*
* Some defaults for our config vars.
* They are likely to be overwritten later in the code
Index: serendipity_admin_upgrader.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_upgrader.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- serendipity_admin_upgrader.inc.php 4 Mar 2004 12:46:16 -0000 1.2
+++ serendipity_admin_upgrader.inc.php 15 Mar 2004 10:12:47 -0000 1.3
@@ -1,93 +1,95 @@
<?php
+/*
+ TODO
+
+ * 0.5.1-CVS in 0.6 umbenennen: 0.5.1-CVS als 'versionInstalled' soll keine Aktionen von 0.5 ausfuehren.
+ * Von 0.5 sollen Updates auf 0.5.1 und 0.6 ausgefuehrt werden.
+ * 0.5.1 auf 0.6 kein Update
+*/
- require_once('serendipity_functions_installer.inc.php');
+require_once('serendipity_functions_installer.inc.php');
- $abortLoc = $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php?serendipity[action]=ignore';
- $upgradeLoc = $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php?serendipity[action]=upgrade';
+$abortLoc = $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php?serendipity[action]=ignore';
+$upgradeLoc = $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php?serendipity[action]=upgrade';
- /* Functions which needs to be run if installed version is equal or lower */
- $tasks = array('0.5.1' => 'serendipity_syncThumbs');
+/* Functions which needs to be run if installed version is equal or lower */
+$tasks = array('0.5.1' => 'serendipity_syncThumbs');
- /* Fetch SQL files which needs to be run */
- $dir = opendir($serendipity['serendipityPath'] .'sql/');
- while ( ($file = readdir($dir)) !== false ) {
- if ( preg_match('@db_update_(.*)_(.*)_'. $serendipity['dbType'] .'.sql@', $file, $res) ) {
- if ( version_compare($res[1], $serendipity['versionInstalled']) >= 0) {
- $sqlfiles[] = $file;
- }
+/* Fetch SQL files which needs to be run */
+$dir = opendir($serendipity['serendipityPath'] .'sql/');
+while (($file = readdir($dir)) !== false ) {
+ if (preg_match('@db_update_(.*)_(.*)_'. $serendipity['dbType'] .'.sql@', $file, $res)) {
+ if (version_compare($res[1], serendipity_version($serendipity['versionInstalled'])) >= 0) {
+ $sqlfiles[] = $file;
}
}
+}
+if ($serendipity['GET']['action'] == 'ignore') {
+ /* Todo: Don't know what to put here? */
+} elseif ($serendipity['GET']['action'] == 'upgrade') {
-
-
- if ( $serendipity['GET']['action'] == 'ignore' ) {
- /* Todo: Don't know what to put here? */
-
- } elseif ( $serendipity['GET']['action'] == 'upgrade' ) {
-
- /* Install SQL files */
- foreach ($sqlfiles as $sqlfile) {
- $sql = file_get_contents($serendipity['serendipityPath'] .'sql/'. $sqlfile);
- $sql = str_replace('{PREFIX}', $serendipity['dbPrefix'], $sql);
- preg_match_all("@(.*);@iUs", $sql, $res);
- foreach ( $res[0] as $sql) {
- $r = serendipity_db_query($sql);
- if ( is_string($r) ) {
- $errors[] = $r;
- }
- }
+ /* Install SQL files */
+ foreach ($sqlfiles as $sqlfile) {
+ $sql = file_get_contents($serendipity['serendipityPath'] .'sql/'. $sqlfile);
+ $sql = str_replace('{PREFIX}', $serendipity['dbPrefix'], $sql);
+ preg_match_all("@(.*);@iUs", $sql, $res);
+ foreach ($res[0] as $sql) {
+ $r = serendipity_db_query($sql);
+ if (is_string($r)) {
+ $errors[] = $r;
+ }
}
+ }
- /* Call functions */
- foreach ( $tasks as $version => $function ) {
- if ( version_compare($serendipity['version'], $version, '<=') ) {
- if ( is_callable($function) ) {
- call_user_func($function);
- } else {
- $errors[] = 'Unable to call '. $function;
- }
+ /* Call functions */
+ foreach ($tasks as $version => $function) {
+ if (version_compare(serendipity_version($serendipity['versionInstalled']), $version, '<=') ) {
+ if (is_callable($function)) {
+ call_user_func($function);
+ } else {
+ $errors[] = 'Unable to call '. $function;
}
}
-
- if ( is_array($errors) ) {
- echo DIAGNOSTIC_ERROR . '<br /><br />';
- echo '<span style="color: #FF0000">- ' . implode('<br />', $errors) . '</span><br /><br />';
- }
-
+ }
+
+ if (is_array($errors)) {
+ echo DIAGNOSTIC_ERROR . '<br /><br />';
+ echo '<span style="color: #FF0000">- ' . implode('<br />', $errors) . '</span><br /><br />';
}
- if ( $serendipity['GET']['action'] == 'ignore' || $serendipity['GET']['action'] == 'upgrade' ) {
- $r = serendipity_updateLocalConfig($serendipity['dbName'], $serendipity['dbPrefix'], $serendipity['dbHost'], $serendipity['dbUser'], $serendipity['dbPass'], $serendipity['dbType']);
- if ( $serendipity['GET']['action'] == 'ignore' ) {
- echo SERENDIPITY_UPGRADER_YOU_HAVE_IGNORED;
- } elseif ( $serendipity['GET']['action'] == 'upgrade' ) {
- echo sprintf(SERENDIPITY_UPGRADER_NOW_UPGRADED, $serendipity['version']);
- }
- echo sprintf(SERENDIPITY_UPGRADER_RETURN_HERE, '<a href="'. $serendipity['serendipityHTTPPath'] .'">', '</a>');
- } else {
-
-?>
-
-<?php echo SERENDIPITY_UPGRADER_WELCOME ?>
-<br /><?php echo SERENDIPITY_UPGRADER_PURPOSE ?>
-<br /><?php echo sprintf(SERENDIPITY_UPGRADER_WHY, $serendipity['version']) ?>
+}
+if ($serendipity['GET']['action'] == 'ignore' || $serendipity['GET']['action'] == 'upgrade') {
+ $r = serendipity_updateLocalConfig($serendipity['dbName'], $serendipity['dbPrefix'], $serendipity['dbHost'], $serendipity['dbUser'], $serendipity['dbPass'], $serendipity['dbType']);
+ if ($serendipity['GET']['action'] == 'ignore') {
+ echo SERENDIPITY_UPGRADER_YOU_HAVE_IGNORED;
+ } elseif ($serendipity['GET']['action'] == 'upgrade') {
+ printf(SERENDIPITY_UPGRADER_NOW_UPGRADED, $serendipity['version']);
+ }
+ printf(SERENDIPITY_UPGRADER_RETURN_HERE, '<a href="'. $serendipity['serendipityHTTPPath'] .'">', '</a>');
+} else {
+ echo SERENDIPITY_UPGRADER_WELCOME . '<br />';
+ printf(SERENDIPITY_UPGRADER_PURPOSE . '<br />', $serendipity['versionInstalled']);
+ printf(SERENDIPITY_UPGRADER_WHY, $serendipity['version']);
-<?php if ( sizeof($sqlfiles) > 0 ) { ?>
+ if (sizeof($sqlfiles) > 0) {
+?>
<br />
-<h3><?php echo sprintf(SERENDIPITY_UPGRADER_DATABASE_UPDATES, $serendipity['dbType']) ?>:</h3>
+<h3><?php printf(SERENDIPITY_UPGRADER_DATABASE_UPDATES, $serendipity['dbType']) ?>:</h3>
<?php echo SERENDIPITY_UPGRADER_FOUND_SQL_FILES ?>:
<br />
<?php
- foreach ( $sqlfiles as $sqlfile ) {
- echo '<strong>- '. $sqlfile .'</strong><br />';
+ foreach ($sqlfiles as $sqlfile) {
+ echo '<strong>- '. $sqlfile .'</strong><br />';
+ }
+?>
+<?php
}
?>
-<?php } ?>
<br />
@@ -95,38 +97,42 @@
<?php
$taskCount = 0;
- if ( version_compare($serendipity['version'], '0.5.1', '<=') ) {
- echo '<strong>0.5.1 - Image sync</strong>';
+ if (version_compare(serendipity_version($serendipity['versionInstalled']), '0.5.1', '<')) {
+ echo '<br /><strong>0.5.1 - Image sync</strong>';
echo '<br />Version 0.5.1 introduces image sync with the database.';
- echo '<br />With your permission I would like to perform the image sync.';
+ echo '<br />With your permission I would like to perform the image sync.<br />';
$taskCount++;
}
+ if (version_compare(serendipity_version($serendipity['versionInstalled']), '0.6', '<')) {
+ echo '<br /><strong>0.6 - Move images</strong>';
+ echo '<br />[INFO] Smilies and XML-Buttons were moved from pixel/ to template/default/img<br />';
+ }
+
/*
Add more versions here using:
- if ( [version_compare] ) {
+ if ([version_compare]) {
[Desc]
$taskCount++;
}
*/
- if ( $taskCount == 0 ) {
+ if ($taskCount == 0) {
echo SERENDIPITY_UPGRADER_NO_VERSION_SPECIFIC;
}
-
?>
-
<br /><br />
-<hr noshade>
-<?php if ( $taskCount > 0 || sizeof($sqlfiles) > 0 ) { ?>
+<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_ABORT ?>" onClick="location.href='<?php echo $abortLoc ?>'"> <input type="button" value="<?php echo SERENDIPITY_UPGRADER_PROCEED_DOIT ?>" onClick="location.href='<?php echo $upgradeLoc ?>'">
<?php } else { ?>
<strong><?php echo SERENDIPITY_UPGRADER_NO_UPGRADES ?></strong>
- <br /><input type="button" value="<?php echo SERENDIPITY_UPGRADER_CONSIDER_CONE ?>" onClick="location.href='<?php echo $abortLoc ?>'">
-<?php } ?>
-<?php } ?>
+ <br /><input type="button" value="<?php echo SERENDIPITY_UPGRADER_CONSIDER_DONE ?>" onClick="location.href='<?php echo $abortLoc ?>'">
+<?php }
+}
+?>
\ No newline at end of file
Index: serendipity_config.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_config.inc.php,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- serendipity_config.inc.php 3 Mar 2004 08:17:59 -0000 1.56
+++ serendipity_config.inc.php 15 Mar 2004 10:12:47 -0000 1.57
@@ -11,7 +11,7 @@
include_once('compat.php');
ini_set('session.use_trans_sid', 0);
-$serendipity['version'] = '0.5.1-CVS';
+$serendipity['version'] = '0.6-CVS';
$serendipity['production'] = 1;
$serendipity['rewrite'] = 'none';
$serendipity['messagestack'] = array();
@@ -51,17 +51,6 @@
*/
include_once("{$serendipity['serendipityPath']}serendipity_config_local.inc.php");
-
-/*
- * Check if the installed version is highter than the version of the config
- */
-define('IS_up2date', version_compare($serendipity['version'], $serendipity['versionInstalled'], '<='));
-
-if ( IS_up2date === false && $serendipity['production'] && !defined('IN_upgrader') ) {
- die(sprintf(SERENDIPITY_NEEDS_UPGRADE, $serendipity['versionInstalled'], $serendipity['version'], 'serendipity_admin.php'));
-}
-
-
/*
* Include main functions
*/
@@ -124,6 +113,15 @@
$serendipity['baseURL'] = 'http://' . $_SERVER['HTTP_HOST'] . $serendipity['serendipityHTTPPath'];
}
+/*
+ * Check if the installed version is highter than the version of the config
+ */
+define('IS_up2date', version_compare(serendipity_version($serendipity['version']), serendipity_version($serendipity['versionInstalled']), '<='));
+
+if ( IS_up2date === false && $serendipity['production'] && !defined('IN_upgrader') ) {
+ die(sprintf(SERENDIPITY_NEEDS_UPGRADE, $serendipity['versionInstalled'], $serendipity['version'], 'serendipity_admin.php'));
+}
+
// We don't care who tells us what to do
if (!isset($serendipity['GET']['action'])) {
$serendipity['GET']['action'] = (isset($serendipity['POST']['action']) ? $serendipity['POST']['action'] : '');
Index: serendipity_lang.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_lang.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- serendipity_lang.inc.php 29 Feb 2004 01:40:57 -0000 1.8
+++ serendipity_lang.inc.php 15 Mar 2004 10:12:47 -0000 1.9
@@ -5,16 +5,14 @@
if ( @include($serendipity['serendipityPath'] .'lang/serendipity_lang_'. $serendipity['lang'] .'.inc.php') ) {
// Only here can we truely say the language is loaded
define('serendipity_LANG_LOADED', true);
-
-
- } elseif ( IS_installed === false ) { /* -- Auto-Guess -- */
+ } elseif ( IS_installed === false || IS_up2date === false ) { /* -- Auto-Guess -- */
// If no config file is loaded, language includes are not available.
// Now include one. Try to auto-guess the language by looking up the HTTP_ACCEPT_LANGUAGE.
$supported_languages = array('en', 'da', 'de', 'es');
$possible_languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
if (is_array($possible_languages)) {
foreach($possible_languages as $index => $lang) {
- $preferred_language = preg_replace('|^([^\-_]*)|msU', '\1', $lang);
+ $preferred_language = preg_replace('@^([^\-_;]*)_?.*$@', '\1', $lang);
if (in_array($preferred_language, $supported_languages)) {
@include_once($serendipity['serendipityPath'] . 'lang/serendipity_lang_' . $preferred_language . '.inc.php');
break;
@@ -22,10 +20,9 @@
} // endforeach
} // endif
} //endif
-
-
+
// Do fallback to english
- if ( (defined('serendipity_LANG_LOADED') && serendipity_LANG_LOADED === true) || IS_installed === false) {
+ if ( (defined('serendipity_LANG_LOADED') && serendipity_LANG_LOADED === true) || IS_installed === false || IS_up2date === false) {
@include_once($serendipity['serendipityPath'] .'lang/serendipity_lang_en.inc.php');
}
}
|