[geeklog-cvs] geeklog: Always set version number from the install script. The ...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Fri May 1 10:03:09 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/0c7d10cbc6bf
changeset: 7008:0c7d10cbc6bf
user:      Dirk Haun <dirk at haun-online.de>
date:      Fri May 01 15:57:50 2009 +0200
description:
Always set version number from the install script. The constant in lib-install.php now defines the Geeklog version number.

diffstat:

4 files changed, 47 insertions(+), 35 deletions(-)
public_html/admin/install/index.php       |    3 -
public_html/admin/install/lib-install.php |   46 ++++++++++++++++++++++++++++-
public_html/admin/install/lib-upgrade.php |   31 -------------------
public_html/siteconfig.php.dist           |    2 -

diffs (134 lines):

diff -r 8682136933a3 -r 0c7d10cbc6bf public_html/admin/install/index.php
--- a/public_html/admin/install/index.php	Fri May 01 14:38:59 2009 +0200
+++ b/public_html/admin/install/index.php	Fri May 01 15:57:50 2009 +0200
@@ -485,8 +485,7 @@
                             $config->set('language', $lng);
                         }
 
-                        DB_change($_TABLES['vars'], 'value', VERSION,
-                                                    'name', 'database_version');
+                        INST_setVersion($siteconfig_path);
 
                         if (! $install_plugins) {
                             // do a default install of all available plugins
diff -r 8682136933a3 -r 0c7d10cbc6bf public_html/admin/install/lib-install.php
--- a/public_html/admin/install/lib-install.php	Fri May 01 14:38:59 2009 +0200
+++ b/public_html/admin/install/lib-install.php	Fri May 01 15:57:50 2009 +0200
@@ -52,7 +52,11 @@
     define('LB', "\n");
 }
 if (!defined('VERSION')) {
-    define('VERSION', '1.6.0');
+    /**
+    * This constant defines Geeklog's version number. It will be written to
+    * siteconfig.php and the database (in the latter case minus any suffix).
+    */
+    define('VERSION', '1.6.0b1');
 }
 if (!defined('XHTML')) {
     define('XHTML', ' /');
@@ -1105,4 +1109,44 @@
     return $language;
 }
 
+/**
+* Set Geeklog version number in siteconfig.php and in the database
+*
+* @param   string  $siteconfig_path    path to siteconfig.php
+* @return  void
+*
+*/
+function INST_setVersion($siteconfig_path)
+{
+    global $_TABLES, $LANG_INSTALL;
+
+    $siteconfig_file = fopen($siteconfig_path, 'r');
+    $siteconfig_data = fread($siteconfig_file, filesize($siteconfig_path));
+    fclose($siteconfig_file);
+
+    $siteconfig_data = preg_replace
+            (
+             '/define\s*\(\'VERSION\',[^;]*;/',
+             "define('VERSION', '" . VERSION . "');",
+             $siteconfig_data
+            );
+
+    $siteconfig_file = @fopen($siteconfig_path, 'w');
+    if (! fwrite($siteconfig_file, $siteconfig_data)) {
+        exit($LANG_INSTALL[26] . ' ' . $LANG_INSTALL[28]);
+    }
+    fclose($siteconfig_file);
+
+    // for the database version, get rid of any appendices ('sr1' etc.)
+    $version = VERSION;
+    $v = explode('.', VERSION);
+    if (count($v) == 3) {
+        $v[2] = (int) $v[2];
+        $version = implode('.', $v);
+    }
+    $version = addslashes($version);
+
+    DB_change($_TABLES['vars'], 'value', $version, 'name', 'database_version');
+}
+
 ?>
diff -r 8682136933a3 -r 0c7d10cbc6bf public_html/admin/install/lib-upgrade.php
--- a/public_html/admin/install/lib-upgrade.php	Fri May 01 14:38:59 2009 +0200
+++ b/public_html/admin/install/lib-upgrade.php	Fri May 01 15:57:50 2009 +0200
@@ -485,8 +485,6 @@
     // to run admin/sectest.php again
     DB_delete($_TABLES['vars'], 'name', 'security_check');
 
-    DB_change($_TABLES['vars'], 'value', VERSION, 'name', 'database_version');
-
     return true;
 }
 
@@ -641,35 +639,6 @@
     return $result;
 }
 
-
-/**
- * Set VERSION constant in siteconfig.php after successful upgrade
- *
- * @param   string  $siteconfig_path    path to siteconfig.php
- * @return  void
- *
- */
-function INST_setVersion($siteconfig_path)
-{
-    global $LANG_INSTALL;
-
-    $siteconfig_file = fopen($siteconfig_path, 'r');
-    $siteconfig_data = fread($siteconfig_file, filesize($siteconfig_path));
-    fclose($siteconfig_file);
-
-    $siteconfig_data = preg_replace
-            (
-             '/define\s*\(\'VERSION\',[^;]*;/',
-             "define('VERSION', '" . VERSION . "');",
-             $siteconfig_data
-            );
-
-    $siteconfig_file = fopen($siteconfig_path, 'w');
-    if (!fwrite($siteconfig_file, $siteconfig_data)) {
-        exit($LANG_INSTALL[26] . ' ' . $LANG_INSTALL[28]);
-    }
-    fclose($siteconfig_file);
-}
 
 
 /**
diff -r 8682136933a3 -r 0c7d10cbc6bf public_html/siteconfig.php.dist
--- a/public_html/siteconfig.php.dist	Fri May 01 14:38:59 2009 +0200
+++ b/public_html/siteconfig.php.dist	Fri May 01 15:57:50 2009 +0200
@@ -38,7 +38,7 @@
   define('LB',"\n");
 }
 if (!defined('VERSION')) {
-  define('VERSION', '1.6.0hg');
+  define('VERSION', '1.6.0');
 }
 
 ?>



More information about the geeklog-cvs mailing list