[geeklog-cvs] geeklog: Use constants to define the minimum PHP and MySQL versions

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sun Sep 6 05:01:44 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/5f9005f9c657
changeset: 7286:5f9005f9c657
user:      Dirk Haun <dirk at haun-online.de>
date:      Sun Sep 06 11:00:27 2009 +0200
description:
Use constants to define the minimum PHP and MySQL versions

diffstat:

 public_html/admin/install/index.php                              |  10 +++--
 public_html/admin/install/install-plugins.php                    |   4 +-
 public_html/admin/install/language/chinese_simplified_utf-8.php  |   8 ++--
 public_html/admin/install/language/chinese_traditional_utf-8.php |   8 ++--
 public_html/admin/install/language/english.php                   |   8 ++--
 public_html/admin/install/language/german.php                    |   8 ++--
 public_html/admin/install/language/hebrew_utf-8.php              |   8 ++--
 public_html/admin/install/language/japanese_utf-8.php            |   8 ++--
 public_html/admin/install/language/polish.php                    |   8 ++--
 public_html/admin/install/lib-install.php                        |  15 ++++++-
 public_html/admin/install/migrate.php                            |   7 ++-
 11 files changed, 52 insertions(+), 40 deletions(-)

diffs (277 lines):

diff -r 0021451d31d4 -r 5f9005f9c657 public_html/admin/install/index.php
--- a/public_html/admin/install/index.php	Sun Sep 06 10:23:14 2009 +0200
+++ b/public_html/admin/install/index.php	Sun Sep 06 11:00:27 2009 +0200
@@ -227,8 +227,10 @@
         // Check if the user's version of MySQL is out of date
         } else if (INST_mysqlOutOfDate($DB)) { 
 
-            $display .= '<h1>' . $LANG_INSTALL[51] . '</h1>' . LB;
-            $display .= '<p>' . $LANG_INSTALL[52]
+            $myv = mysql_v($DB['host'], $DB['user'], $DB['pass']);
+            $display .= '<h1>' . sprintf($LANG_INSTALL[51], SUPPORTED_MYSQL_VER)
+                     . '</h1>' . LB;
+            $display .= '<p>' . sprintf($LANG_INSTALL[52], SUPPORTED_MYSQL_VER)
                      . $myv[0] . '.' . $myv[1] . '.' . $myv[2]
                      . $LANG_INSTALL[53] . '</p>' . LB;
 
@@ -952,8 +954,8 @@
 if (INST_phpOutOfDate()) {
 
     // If their version of PHP is not supported, print an error:
-    $display .= '<h1 class="heading">' . str_replace('4.1.0', SUPPORTED_PHP_VER, $LANG_INSTALL[4]) . '</h1>' . LB;
-    $display .= '<p>' . str_replace('4.1.0', SUPPORTED_PHP_VER, $LANG_INSTALL[5]) . phpversion() . $LANG_INSTALL[6] . '</p>' . LB;
+    $display .= '<h1 class="heading">' . sprintf($LANG_INSTALL[4], SUPPORTED_PHP_VER) . '</h1>' . LB;
+    $display .= '<p>' . sprintf($LANG_INSTALL[5], SUPPORTED_PHP_VER) . phpversion() . $LANG_INSTALL[6] . '</p>' . LB;
 
 } else {
 
diff -r 0021451d31d4 -r 5f9005f9c657 public_html/admin/install/install-plugins.php
--- a/public_html/admin/install/install-plugins.php	Sun Sep 06 10:23:14 2009 +0200
+++ b/public_html/admin/install/install-plugins.php	Sun Sep 06 11:00:27 2009 +0200
@@ -74,8 +74,8 @@
 if (INST_phpOutOfDate()) {
 
     // If their version of PHP is not supported, print an error:
-    $display .= '<h1>' . $LANG_INSTALL[4] . '</h1>' . LB;
-    $display .= '<p>' . $LANG_INSTALL[5] . $phpv[0] . '.' . $phpv[1] . '.' . (int) $phpv[2] . $LANG_INSTALL[6] . '</p>' . LB;
+    $display .= '<h1>' . sprintf($LANG_INSTALL[4], SUPPORTED_PHP_VER) . '</h1>' . LB;
+    $display .= '<p>' . sprintf($LANG_INSTALL[5], SUPPORTED_PHP_VER) . $phpv[0] . '.' . $phpv[1] . '.' . (int) $phpv[2] . $LANG_INSTALL[6] . '</p>' . LB;
 
 } else {
 
diff -r 0021451d31d4 -r 5f9005f9c657 public_html/admin/install/language/chinese_simplified_utf-8.php
--- a/public_html/admin/install/language/chinese_simplified_utf-8.php	Sun Sep 06 10:23:14 2009 +0200
+++ b/public_html/admin/install/language/chinese_simplified_utf-8.php	Sun Sep 06 11:00:27 2009 +0200
@@ -54,8 +54,8 @@
     1 => '安è£
支助',
     2 => '终极网志系统',
     3 => '志乐安è£
',
-    4 => '需要PHP 4.3.0',
-    5 => '抱歉, 志乐要求最少 PHP 4.3.0 来操作(你有的是',
+    4 => '需要PHP %s',
+    5 => '抱歉, 志乐要求最少 PHP %s 来操作(你有的是',
     6 => '). 请 <a href="http://www.php.net/downloads.php">升级PHP</a> 安è£
 或请你的网站服务员帮你安è£
.',
     7 => '找不到志乐档案',
     8 => '安è£
系统无法找到å
³é”®çš„志乐档案. 也许你将它们搬移过. 请指定所需档案和目录的路径:',
@@ -101,8 +101,8 @@
     48 => '网站电邮',
     49 => '网站的 不可回信的电邮',
     50 => '安è£
',
-    51 => '需要 MySQL 3.23.2',
-    52 => '抱歉, 志乐需要最少 MySQL 3.23.2 来操作 (你有的是 ',
+    51 => '需要 MySQL %s',
+    52 => '抱歉, 志乐需要最少 MySQL %s 来操作 (你有的是 ',
     53 => '). 请 <a href="http://dev.mysql.com/downloads/mysql/">升级你的MySQL</a> 安è£
 或请你的网站主机服务员帮你升级.',
     54 => '错误的数据库资料',
     55 => '抱歉, 数据库资料好像不准确. 请回去再试一次.',
diff -r 0021451d31d4 -r 5f9005f9c657 public_html/admin/install/language/chinese_traditional_utf-8.php
--- a/public_html/admin/install/language/chinese_traditional_utf-8.php	Sun Sep 06 10:23:14 2009 +0200
+++ b/public_html/admin/install/language/chinese_traditional_utf-8.php	Sun Sep 06 11:00:27 2009 +0200
@@ -54,8 +54,8 @@
     1 => '安裝支助',
     2 => '終極網志系統',
     3 => '志樂安裝',
-    4 => '需要PHP 4.3.0',
-    5 => '抱歉, 志樂要求最少 PHP 4.3.0 來操作(你有的是',
+    4 => '需要PHP %s',
+    5 => '抱歉, 志樂要求最少 PHP %s 來操作(你有的是',
     6 => '). 請 <a href="http://www.php.net/downloads.php">升級PHP</a> 安裝 或請你的網站服務員幫你安裝.',
     7 => '找不到志樂檔案',
     8 => '安裝系統無法找到關鍵的志樂檔案. 也許你將它們搬移過. 請指定所需檔案和目錄的路徑:',
@@ -101,8 +101,8 @@
     48 => '網站電郵',
     49 => '網站的 不可回信的電郵',
     50 => '安裝',
-    51 => '需要 MySQL 3.23.2',
-    52 => '抱歉, 志樂需要最少 MySQL 3.23.2 來操作 (你有的是 ',
+    51 => '需要 MySQL %s',
+    52 => '抱歉, 志樂需要最少 MySQL %s 來操作 (你有的是 ',
     53 => '). 請 <a href="http://dev.mysql.com/downloads/mysql/">升級你的MySQL</a> 安裝 或請你的網站主機服務員幫你升級.',
     54 => '錯誤的資料庫資料',
     55 => '抱歉, 資料庫資料好像不準確. 請回去再試一次.',
diff -r 0021451d31d4 -r 5f9005f9c657 public_html/admin/install/language/english.php
--- a/public_html/admin/install/language/english.php	Sun Sep 06 10:23:14 2009 +0200
+++ b/public_html/admin/install/language/english.php	Sun Sep 06 11:00:27 2009 +0200
@@ -53,8 +53,8 @@
     1 => 'Installation Support',
     2 => 'The Ultimate Weblog System',
     3 => 'Geeklog Installation',
-    4 => 'PHP 4.3.0 required',
-    5 => 'Sorry, but Geeklog requires at least PHP 4.3.0 to run (you have version ',
+    4 => 'PHP %s required',
+    5 => 'Sorry, but Geeklog requires at least PHP %s to run (you have version ',
     6 => '). Please <a href="http://www.php.net/downloads.php">upgrade your PHP</a> install or ask your hosting service to do it for you.',
     7 => 'Unable to locate Geeklog files',
     8 => 'The installer was unable to locate critical Geeklog files. This is probably because you have moved them from their default location. Please specify the paths to the files and directories below:',
@@ -100,8 +100,8 @@
     48 => 'Site Email',
     49 => 'Site No-Reply Email',
     50 => 'Install',
-    51 => 'MySQL 3.23.2 or newer required',
-    52 => 'Sorry, but Geeklog requires at least MySQL 3.23.2 to run (you have version ',
+    51 => 'MySQL %s or newer required',
+    52 => 'Sorry, but Geeklog requires at least MySQL %s to run (you have version ',
     53 => '). Please <a href="http://dev.mysql.com/downloads/mysql/">upgrade your MySQL</a> install or ask your hosting service to do it for you.',
     54 => 'Incorrect database information',
     55 => 'Sorry, but the database information you entered does not appear to be correct. Please go back and try again.',
diff -r 0021451d31d4 -r 5f9005f9c657 public_html/admin/install/language/german.php
--- a/public_html/admin/install/language/german.php	Sun Sep 06 10:23:14 2009 +0200
+++ b/public_html/admin/install/language/german.php	Sun Sep 06 11:00:27 2009 +0200
@@ -53,8 +53,8 @@
     1 => 'Hilfe zur Installation',
     2 => 'Zuverlässigkeit eingebaut',
     3 => 'Geeklog-Installation',
-    4 => 'PHP 4.3.0 benötigt',
-    5 => 'Sorry, Geeklog benötigt mindestens PHP 4.3.0 (Du hast Version ',
+    4 => 'PHP %s benötigt',
+    5 => 'Sorry, Geeklog benötigt mindestens PHP %s (Du hast Version ',
     6 => '). Bitte <a href="http://www.php.net/downloads.php">aktualisiere Deine PHP-Installation</a> oder bitte Deinen Hosting-Provider darum.',
     7 => 'Geeklog-Dateien nicht gefunden',
     8 => 'Das Installations-Skript hat einige wichtige Geeklog-Dateien nicht gefunden. Wahrscheinlich hast Du diese in andere Verzeichnisse verschoben. Bitte gib hier die Pfade zu den Dateien und Verzeichnissen an:',
@@ -100,8 +100,8 @@
     48 => 'Website-Email-Adresse',
     49 => '"No Reply"-Email-Adresse',
     50 => 'Installieren',
-    51 => 'MySQL 3.23.2 benötigt',
-    52 => 'Sorry, aber Geeklog setzt mindestens MySQL 3.23.2 voraus (Du hast Version ',
+    51 => 'MySQL %s benötigt',
+    52 => 'Sorry, aber Geeklog setzt mindestens MySQL %s voraus (Du hast Version ',
     53 => '). Bitte <a href="http://dev.mysql.com/downloads/mysql/">aktualisiere Deine MySQL-Version</a> oder bitte Deinen Website-Hoster, es für Dich zu erledigen.',
     54 => 'Datenbank-Informationen unvollständig oder nicht korrekt.',
     55 => 'Sorry, aber die Datenbank-Informationen, die Du eingegeben hast, scheinen nicht korrekt zu sein. Bitte klicke auf "Zurück" und versuche es noch einmal.',
diff -r 0021451d31d4 -r 5f9005f9c657 public_html/admin/install/language/hebrew_utf-8.php
--- a/public_html/admin/install/language/hebrew_utf-8.php	Sun Sep 06 10:23:14 2009 +0200
+++ b/public_html/admin/install/language/hebrew_utf-8.php	Sun Sep 06 11:00:27 2009 +0200
@@ -49,8 +49,8 @@
     1 => 'תמיכת התקנה',
     2 => 'The Ultimate Weblog System',
     3 => 'התקנת Geeklog',
-    4 => 'דרוש PHP 4.3.0',
-    5 => 'מצטערים, אבל Geeklog דורש לפחות PHP 4.3.0 בשביל לרוץ (לכם יש גירסה ',
+    4 => 'דרוש PHP %s',
+    5 => 'מצטערים, אבל Geeklog דורש לפחות PHP %s בשביל לרוץ (לכם יש גירסה ',
     6 => '). אנא <a href="http://www.php.net/downloads.php">שדרגו את גירסת ה-PHP שלכם</a> או בקשו ממארחי השרת שלכם לעשות זאת בשבילכם.',
     7 => 'לא אותרו הקבצים של Geeklog',
     8 => 'ההתקנה לא הצליחה לאתר את הקבצים החשובים של Geeklog. זה כנראה מפני שהיזזתם אותם ממיקום ברירת המחדל שלהם. אנא ציינו את הנתיבים לקבצים ולספריות להלן:',
@@ -96,8 +96,8 @@
     48 => 'כתובת האימייל של האתר',
     49 => 'כתובת האימייל של No-Reply',
     50 => 'התקנה',
-    51 => 'נדרש MySQL 3.23.2 או יותר חדש',
-    52 => 'מצטערים, אך Geeklog דורש לפחות MySQL 3.23.2 כדי לרוץ (לכם יש גירסה ',
+    51 => 'נדרש MySQL %s או יותר חדש',
+    52 => 'מצטערים, אך Geeklog דורש לפחות MySQL %s כדי לרוץ (לכם יש גירסה ',
     53 => '). אנא <a href="http://dev.mysql.com/downloads/mysql/">שדרגו את גירסת ה-MySQL שלכם</a> או בקשו ממארחי השרת שלכם לעשות זאת בשבילכם.',
     54 => 'מידע מאגר המידע אינו נכון',
     55 => 'מצטערים, אך מידע מאגר המידע שציינתם נראה שגוי. אנא חיזרו ונסו שוב.',
diff -r 0021451d31d4 -r 5f9005f9c657 public_html/admin/install/language/japanese_utf-8.php
--- a/public_html/admin/install/language/japanese_utf-8.php	Sun Sep 06 10:23:14 2009 +0200
+++ b/public_html/admin/install/language/japanese_utf-8.php	Sun Sep 06 11:00:27 2009 +0200
@@ -55,8 +55,8 @@
     1 => 'インストールで困ったら、こちらのサイトへ',
     2 => 'The Ultimate Weblog System',
     3 => 'Geeklogをインストールする',
-    4 => 'PHP 4.3.0以上がå¿
要です',
-    5 => '残念ながらGeeklogをインストールするには最低でもPHP 4.3.0がå¿
要です(現在のバージョンは ',
+    4 => 'PHP %s以上がå¿
要です',
+    5 => '残念ながらGeeklogをインストールするには最低でもPHP %sがå¿
要です(現在のバージョンは ',
     6 => ')。自分で<a href="http://www.php.net/downloads.php">PHPをバージョンアップする</a>か、ホスティング会社に依頼してください。',
     7 => 'Geeklogファイルが見つかりません',
     8 => 'Geeklogの重要なファイルが見つかりません。デフォルトの位置から移動させていると思われます。下のテキストボックスにファイルのパスをå
¥åŠ›ã—てください。:',
@@ -102,8 +102,8 @@
     48 => 'サイトのEmail',
     49 => 'サイトのNo-Reply Email',
     50 => 'インストール',
-    51 => '少なくともMySQL 3.23.2がå¿
要です',
-    52 => '残念ながらGeeklogをインストールするには最低でもMySQL 3.23.2がå¿
要です(現在のバージョンは ',
+    51 => '少なくともMySQL %sがå¿
要です',
+    52 => '残念ながらGeeklogをインストールするには最低でもMySQL %sがå¿
要です(現在のバージョンは ',
     53 => ')。自分で<a href="http://dev.mysql.com/downloads/mysql/">MySQLをアップグレードする</a>か、ホスティング会社に依頼してください。',
     54 => 'データベースæƒ
報が不正確です',
     55 => '残念ながらå
¥åŠ›ã—たデータベースæƒ
報が不正確です。戻ってやり直してください。',
diff -r 0021451d31d4 -r 5f9005f9c657 public_html/admin/install/language/polish.php
--- a/public_html/admin/install/language/polish.php	Sun Sep 06 10:23:14 2009 +0200
+++ b/public_html/admin/install/language/polish.php	Sun Sep 06 11:00:27 2009 +0200
@@ -53,8 +53,8 @@
     1 => 'Instalacja Pomoc',
     2 => 'The Ultimate Weblog System',
     3 => 'Geeklog - Instalacja',
-    4 => 'Wymagane PHP 4.3.0',
-    5 => 'Sorry, ale Geeklog wymaga do uruchomienia co najmniej PHP 4.3.0 (wersja zainstalowana to ',
+    4 => 'Wymagane PHP %s',
+    5 => 'Sorry, ale Geeklog wymaga do uruchomienia co najmniej PHP %s (wersja zainstalowana to ',
     6 => '). Proszê <a href="http://www.php.net/downloads.php">uaktualniæ wersjê PHP</a> lub zg³osiæ to do swojego providera hostingu.',
     7 => 'Nie mo¿na zlokalizowaæ plików Geeklog-a',
     8 => 'The installation script was unable to locate critical Geeklog files. This is probably because you have moved them from their default location. Please specify the paths to the files and directories below:',
@@ -100,8 +100,8 @@
     48 => 'Adres email strony',
     49 => 'Bezzwrotny adres email strony',
     50 => 'Instaluj',
-    51 => 'Wymagana baza MySQL 3.23.2',
-    52 => 'Sorry, but Geeklog requires at least MySQL 3.23.2 to run (you have version ',
+    51 => 'Wymagana baza MySQL %s',
+    52 => 'Sorry, but Geeklog requires at least MySQL %s to run (you have version ',
     53 => '). Please <a href="http://dev.mysql.com/downloads/mysql/">upgrade your MySQL</a> install or ask your hosting service to do it for you.',
     54 => 'Ba³êdne informacje o bazie danych',
     55 => 'Sorry, but the database information you entered does not appear to be correct. Please go back and try again.',
diff -r 0021451d31d4 -r 5f9005f9c657 public_html/admin/install/lib-install.php
--- a/public_html/admin/install/lib-install.php	Sun Sep 06 10:23:14 2009 +0200
+++ b/public_html/admin/install/lib-install.php	Sun Sep 06 11:00:27 2009 +0200
@@ -64,6 +64,9 @@
 if (!defined('SUPPORTED_PHP_VER')) {
     define('SUPPORTED_PHP_VER', '4.3.0');
 }
+if (!defined('SUPPORTED_MYSQL_VER')) {
+    define('SUPPORTED_MYSQL_VER', '3.23.2');
+}
 
 $_REQUEST = array_merge($_GET, $_POST);
 
@@ -273,14 +276,20 @@
  */
 function INST_mysqlOutOfDate($db)
 {
+    $minv = explode('.', SUPPORTED_MYSQL_VER);
+
     if ($db['type'] == 'mysql' || $db['type'] == 'mysql-innodb') {
         $myv = mysql_v($db['host'], $db['user'], $db['pass']);
-        if (($myv[0] < 3) || (($myv[0] == 3) && ($myv[1] < 23)) ||
-                (($myv[0] == 3) && ($myv[1] == 23) && ($myv[2] < 2))) {
+
+        if (($myv[0] <  $minv[0]) ||
+           (($myv[0] == $minv[0]) && ($myv[1] <  $minv[1])) ||
+           (($myv[0] == $minv[0]) && ($myv[1] == $minv[1]) && ($myv[2] < $minv[2]))) {
+
             return true;
         }
-        return false;
     }
+
+    return false;
 }
 
 /**
diff -r 0021451d31d4 -r 5f9005f9c657 public_html/admin/install/migrate.php
--- a/public_html/admin/install/migrate.php	Sun Sep 06 10:23:14 2009 +0200
+++ b/public_html/admin/install/migrate.php	Sun Sep 06 11:00:27 2009 +0200
@@ -258,8 +258,8 @@
 if (INST_phpOutOfDate()) {
 
     // If their version of PHP is not supported, print an error:
-    $display .= '<h1>' . $LANG_INSTALL[4] . '</h1>' . LB;
-    $display .= '<p>' . $LANG_INSTALL[5] . $phpv[0] . '.' . $phpv[1] . '.' . (int) $phpv[2] . $LANG_INSTALL[6] . '</p>' . LB;
+    $display .= '<h1>' . sprintf($LANG_INSTALL[4], SUPPORTED_PHP_VER) . '</h1>' . LB;
+    $display .= '<p>' . sprintf($LANG_INSTALL[5], SUPPORTED_PHP_VER) . $phpv[0] . '.' . $phpv[1] . '.' . (int) $phpv[2] . $LANG_INSTALL[6] . '</p>' . LB;
 
 } else {
 
@@ -483,7 +483,8 @@
             // (needs to connect to MySQL in order to check)
             if (INST_mysqlOutOfDate($DB)) {
 
-                $display .= INST_getAlertMsg($LANG_INSTALL[51]);
+                $display .= INST_getAlertMsg(sprintf($LANG_INSTALL[51],
+                                                     SUPPORTED_MYSQL_VER));
                 $import_errors++;
 
             } 



More information about the geeklog-cvs mailing list