' . LB
. ' ' . LB
+ . ($missing_public_html || $missing_admin || $missing_autoinstall ? ' disabled="true"' : ' checked="checked"') . XHTML . '>' . LB
. ' ' . LB
. '' . LB
. ' '
@@ -448,71 +467,47 @@
case 2:
$error = 0;
-/*
foreach ($_POST['plugins'] as $plugin) {
// If the plugin was selected to be installed
if (isset($plugin['install']) && ($plugin['install'] == 'on')) {
-*/
- /**
- * Install the plugin by including & executing the database queries for each plugin
- * Start by looking for the database install file.
- */
-/*
- $plugin_sql = '';
- if (file_exists($_CONF['path'] . 'plugins/' . $plugin['name'] . '/sql/' . $_DB_dbms . '_install.php')) {
- $plugin_sql = $_CONF['path'] . 'plugins/' . $plugin['name'] . '/sql/' . $_DB_dbms . '_install.php';
-
- } else if (file_exists($_CONF['path'] . 'plugins/' . $plugin['name'] . '/sql/install.php')) {
-
- $plugin_sql = $_CONF['path'] . 'plugins/' . $plugin['name'] . '/sql/install.php';
-
- }
+ $pi_name = COM_applyFilter($plugin['name']);
+ $pi_name = COM_sanitizeFilename($pi_name);
- $plugin_func = $_CONF['path'] . 'plugins/' . $plugin['name'] . '/functions.inc';
+ $plugin_inst = $_CONF['path'] . 'plugins/' . $pi_name
+ . '/autoinstall.php';
+ if (file_exists($plugin_inst)) {
- if (file_exists($plugin_sql)) { // If database table and/or data exists for this plugin
+ require_once $plugin_inst;
- $plugin_conf = $_CONF['path'] . 'plugins/' . $plugin['name'] . '/config.php';
- if (file_exists($plugin_conf)) {
-
- require_once $plugin_conf;
-
+ $check_compatible = 'plugin_compatible_with_this_version_'
+ . $pi_name;
+ if (function_exists($check_compatible)) {
+ if (! $check_compatible($pi_name)) {
+ continue; // with next plugin
+ }
}
- $_SQL = array(); // Initialize for each plugin, otherwise the queries for the first plugin
- $_DATA = array(); // will execute twice if more than one plugin is being installed.
- require_once $plugin_sql; // Include $_SQL and $_DATA for each plugin,
- // these arrays contain the DB structures and data.
-
-
- foreach ($_SQL as $sql) {
-
- DB_query($sql); // Create the table structures, if necessary
- //sanity($sql);
-
+ $auto_install = 'plugin_autoinstall_' . $pi_name;
+ if (! function_exists($auto_install)) {
+ continue; // with next plugin
}
- foreach ($_DATA as $data) {
-
- DB_query($data); // Insert necessary data, if any
- //sanity($data);
-
+ $inst_parms = $auto_install($pi_name);
+ if (($inst_parms === false) || empty($inst_parms)) {
+ continue; // with next plugin
}
- // Enable the plugin in the plugins table
- // Todo: This should be checked for injection attempts or does DB_query() do that automatically?
- DB_query("INSERT INTO {$_TABLES['plugins']} (`pi_name`, `pi_version`, `pi_gl_version`, `pi_enabled`, `pi_homepage`) VALUES ( '{$plugin['name']}', '{$plugin['version']}', '" . VERSION . "', 1, '{$plugin['pi_url']}')");
-
- }
+ INST_pluginAutoinstall($pi_name, $inst_parms);
+ }
}
}
-*/
+
// Done!
-// $display .= 'Done doing stuff
' . LB;
+
header('Location: success.php?language=' . $language);
break;
diff -r 238b6a303d1a -r 027df4078405 public_html/admin/install/lib-install.php
--- a/public_html/admin/install/lib-install.php Wed Dec 24 14:50:25 2008 +0100
+++ b/public_html/admin/install/lib-install.php Thu Dec 25 12:34:00 2008 +0100
@@ -28,7 +28,6 @@
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
-//
/**
* The functionality of many of these functions already exists in other
@@ -73,9 +72,11 @@
}
$language = 'english';
-if (isset($_REQUEST['language'])) {
- $lng = $_REQUEST['language'];
-} else if (isset($_COOKIE['language'])) {
+if (isset($_POST['language'])) {
+ $lng = $_POST['language'];
+} elseif (isset($_GET['language'])) {
+ $lng = $_GET['language'];
+} elseif (isset($_COOKIE['language'])) {
// Okay, so the name of the language cookie is configurable, so it may not
// be named 'language' after all. Still worth a try ...
$lng = $_COOKIE['language'];
@@ -542,6 +543,7 @@
*/
function INST_urlExists($url)
{
+/*
$handle = curl_init($url);
if ($handle === false) {
return false;
@@ -553,6 +555,8 @@
$response = curl_exec($handle);
curl_close($handle);
return $response;
+*/
+ return true;
}
/**
@@ -757,4 +761,258 @@
fclose($siteconfig_file);
}
+function INST_getPluginInfo($plugin)
+{
+ global $_CONF;
+
+ $info = false;
+
+ $autoinstall = $_CONF['path'] . 'plugins/' . $plugin . '/autoinstall.php';
+ if (! file_exists($autoinstall)) {
+ return false;
+ }
+
+ include $autoinstall;
+
+ $fn = 'plugin_autoinstall_' . $plugin;
+ if (function_exists($fn)) {
+ $inst_info = $fn($plugin);
+ if (isset($inst_info['info']) &&
+ !empty($inst_info['info']['pi_name'])) {
+ $info = $inst_info['info'];
+ }
+ }
+
+ return $info;
+}
+
+/**
+* Do the actual plugin auto install
+*
+* @param string $plugin Plugin name
+* @param array $inst_parm Installation parameters for the plugin
+* @param boolean $verbose true: enable verbose logging
+* @return boolean true on success, false otherwise
+*
+*/
+function INST_pluginAutoinstall($plugin, $inst_parms, $verbose = true)
+{
+ global $_CONF, $_TABLES, $_USER, $_DB_dbms;
+
+ $fake_uid = false;
+ if (!isset($_USER['uid'])) {
+ $_USER['uid'] = 1;
+ $fake_uid = false;
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:08 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:08 -0500
Subject: [geeklog-cvs] geeklog: Got the auto install working for plugins
uploaded via t...
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/c26c11b34fd9
changeset: 6588:c26c11b34fd9
user: Dirk Haun
date: Thu Dec 25 22:11:00 2008 +0100
description:
Got the auto install working for plugins uploaded via the Plugins panel
diffstat:
1 file changed, 16 insertions(+), 4 deletions(-)
public_html/admin/plugins.php | 20 ++++++++++++++++----
diffs (65 lines):
diff -r 027df4078405 -r c26c11b34fd9 public_html/admin/plugins.php
--- a/public_html/admin/plugins.php Thu Dec 25 12:34:00 2008 +0100
+++ b/public_html/admin/plugins.php Thu Dec 25 22:11:00 2008 +0100
@@ -643,6 +643,10 @@
$pi_name = $dirname;
+ } elseif (empty($pi_name)) {
+
+ $pi_name = $dirname;
+
}
// Extract the uploaded archive to the plugins directory
@@ -667,7 +671,7 @@
}
if (file_exists($plg_path . 'admin')) {
rename($plg_path . 'admin',
- $_CONF['path_html'] . 'admin/plugins/' . $pi_name);
+ $_CONF['path_html'] . 'admin/plugins/' . $pi_name);
}
}
@@ -676,7 +680,7 @@
// if the plugin has an autoinstall.php, install it now
if (file_exists($plg_path . 'autoinstall.php')) {
- if (plugin_autoinstall($plugin)) {
+ if (plugin_autoinstall($pi_name)) {
$retval .= COM_refresh($_CONF['site_admin_url']
. '/plugins.php?msg=44');
} else {
@@ -787,7 +791,7 @@
*/
function plugin_do_autoinstall($plugin, $inst_parms, $verbose = true)
{
- global $_CONF, $_TABLES, $_USER, $_DB_dbms;
+ global $_CONF, $_TABLES, $_USER, $_DB_dbms, $_DB_table_prefix;
$base_path = $_CONF['path'] . 'plugins/' . $plugin . '/';
@@ -809,6 +813,14 @@
return false;
}
+ // add plugin tables, if any
+ if (! empty($inst_parms['tables'])) {
+ $tables = $inst_parms['tables'];
+ foreach ($tables as $table) {
+ $_TABLES[$table] = $_DB_table_prefix . $table;
+ }
+ }
+
// Create the plugin's group(s), if any
$groups = array();
$admin_group_id = 0;
@@ -816,7 +828,7 @@
$groups = $inst_parms['groups'];
foreach ($groups as $name => $desc) {
if ($verbose) {
- COM_errorLog("Attempting to create plugin '$name' group", 1);
+ COM_errorLog("Attempting to create '$name' group", 1);
}
$grp_name = addslashes($name);
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:11 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:11 -0500
Subject: [geeklog-cvs] geeklog: Pick up and install all autoinstall-able
plugins during...
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/86f08a6dd0ad
changeset: 6590:86f08a6dd0ad
user: Dirk Haun
date: Fri Dec 26 11:46:42 2008 +0100
description:
Pick up and install all autoinstall-able plugins during the default install
diffstat:
1 file changed, 53 insertions(+), 1 deletion(-)
public_html/admin/install/index.php | 54 ++++++++++++++++++++++++++++++++++-
diffs (71 lines):
diff -r ec370986aa11 -r 86f08a6dd0ad public_html/admin/install/index.php
--- a/public_html/admin/install/index.php Thu Dec 25 22:48:45 2008 +0100
+++ b/public_html/admin/install/index.php Fri Dec 26 11:46:42 2008 +0100
@@ -482,7 +482,13 @@
$config->set('language', $lng);
}
- // Installation is complete. Continue onto either plugin installation or success page
+ if (! $install_plugins) {
+ // do a default install of all available plugins
+ INST_defaultPluginInstall();
+ }
+
+ // Installation is complete. Continue onto either
+ // custom plugin installation page or success page
header('Location: ' . $next_link);
} else {
@@ -1474,6 +1480,52 @@
return $result;
}
+/**
+* Handle default install of available plugins
+*
+* Picks up and installs all plugins with an autoinstall.php.
+* Any errors are silently ignored ...
+*
+*/
+function INST_defaultPluginInstall()
+{
+ global $_CONF, $_TABLES;
+
+ if (! function_exists('COM_errorLog')) {
+ // "Emergency" version of COM_errorLog
+ function COM_errorLog($a, $b = '')
+ {
+ return '';
+ }
+ }
+
+ $plugins_dir = $_CONF['path'] . 'plugins/';
+ $fd = opendir($plugins_dir);
+ while (($plugin = @readdir($fd)) == TRUE) {
+
+ if (($plugin <> '.') && ($plugin <> '..') && ($plugin <> 'CVS') &&
+ (substr($plugin, 0, 1) <> '.') &&
+ (substr($plugin, 0, 1) <> '_') &&
+ is_dir($plugins_dir . $plugin)) {
+
+ clearstatcache ();
+ $plugin_dir = $plugins_dir . $plugin;
+
+ if (DB_count($_TABLES['plugins'], 'pi_name', $plugin) == 0) {
+
+ $info = INST_getPluginInfo($plugin);
+ if ($info !== false) {
+ $fn = 'plugin_autoinstall_' . $plugin;
+ $inst_parms = $fn($plugin);
+ INST_pluginAutoinstall($plugin, $inst_parms);
+ }
+
+ }
+
+ }
+ }
+}
+
// +---------------------------------------------------------------------------+
// | Main |
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:10 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:10 -0500
Subject: [geeklog-cvs] geeklog: Minor corrections, refinements, and cosmetics
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/ec370986aa11
changeset: 6589:ec370986aa11
user: Dirk Haun
date: Thu Dec 25 22:48:45 2008 +0100
description:
Minor corrections, refinements, and cosmetics
diffstat:
3 files changed, 28 insertions(+), 15 deletions(-)
plugins/calendar/autoinstall.php | 9 ++++++-
plugins/calendar/functions.inc | 2 -
public_html/admin/install/install-plugins.php | 32 ++++++++++++++-----------
diffs (106 lines):
diff -r c26c11b34fd9 -r ec370986aa11 plugins/calendar/autoinstall.php
--- a/plugins/calendar/autoinstall.php Thu Dec 25 22:11:00 2008 +0100
+++ b/plugins/calendar/autoinstall.php Thu Dec 25 22:48:45 2008 +0100
@@ -59,11 +59,18 @@
$pi_name . '.submit' => array($pi_admin)
);
+ $tables = array(
+ 'events',
+ 'eventsubmission',
+ 'personal_events'
+ );
+
$inst_parms = array(
'info' => $info,
'groups' => $groups,
'features' => $features,
- 'mappings' => $mappings
+ 'mappings' => $mappings,
+ 'tables' => $tables
);
return $inst_parms;
diff -r c26c11b34fd9 -r ec370986aa11 plugins/calendar/functions.inc
--- a/plugins/calendar/functions.inc Thu Dec 25 22:11:00 2008 +0100
+++ b/plugins/calendar/functions.inc Thu Dec 25 22:48:45 2008 +0100
@@ -57,7 +57,7 @@
$_CA_CONF = $ca_config->get_config('calendar');
}
-$_CA_CONF['version'] = '1.0.2';
+$_CA_CONF['version'] = '1.1.0';
// +---------------------------------------------------------------------------+
// | Geeklog Plugin API Implementations |
diff -r c26c11b34fd9 -r ec370986aa11 public_html/admin/install/install-plugins.php
--- a/public_html/admin/install/install-plugins.php Thu Dec 25 22:11:00 2008 +0100
+++ b/public_html/admin/install/install-plugins.php Thu Dec 25 22:48:45 2008 +0100
@@ -207,12 +207,18 @@
$upload_success = $archive->extract($_CONF['path'] . 'plugins/');
}
+
+ $plg_path = $_CONF['path'] . 'plugins/' . $pi_name . '/';
if ($upload_success) {
- if (file_exists($_CONF['path'] . 'plugins/' . $pi_name . '/public_html')) {
- rename($_CONF['path'] . 'plugins/' . $pi_name . '/public_html', $_CONF['path_html'] . $pi_name);
+ if (file_exists($plg_path . 'public_html')) {
+ rename($plg_path . 'public_html',
+ $_CONF['path_html'] . $pi_name);
}
- rename($_CONF['path'] . 'plugins/' . $pi_name . '/admin', $_CONF['path_html'] . 'admin/plugins/' . $pi_name);
+ if (file_exists($plg_path . 'admin')) {
+ rename($plg_path . 'admin', $_CONF['path_html']
+ . 'admin/plugins/' . $pi_name);
+ }
}
@@ -248,8 +254,10 @@
$fd = opendir($plugins_dir);
while (($plugin = @readdir($fd)) == TRUE) {
- if (is_dir ($plugins_dir . $plugin) && ($plugin != '.') && ($plugin != '..') &&
- ($plugin != 'CVS') && (substr ($plugin, 0 , 1) != '.')) {
+ if (($plugin <> '.') && ($plugin <> '..') && ($plugin <> 'CVS') &&
+ (substr($plugin, 0, 1) <> '.') &&
+ (substr($plugin, 0, 1) <> '_') &&
+ is_dir($plugins_dir . $plugin)) {
clearstatcache ();
@@ -287,8 +295,10 @@
$fd = opendir($plugins_dir);
while (($plugin = @readdir($fd)) == TRUE) {
- if (is_dir ($plugins_dir . $plugin) && ($plugin != '.') && ($plugin != '..') &&
- ($plugin != 'CVS') && (substr ($plugin, 0 , 1) != '.') && ($plugin != '__MACOSX')) {
+ if (($plugin <> '.') && ($plugin <> '..') &&
+ ($plugin <> 'CVS') && (substr($plugin, 0, 1) <> '.') &&
+ (substr($plugin, 0, 1) <> '_') &&
+ is_dir($plugins_dir . $plugin)) {
clearstatcache ();
$plugin_dir = $plugins_dir . $plugin;
@@ -423,17 +433,13 @@
$display .= '' . LB
. ' ' . LB
+ . ($missing_autoinstall ? ' disabled="disabled"' : ' checked="checked"') . XHTML . '>' . LB
. ' ' . LB
. '' . LB
. ' '
. ' '
. $pi_display_name . LB
- . ($missing_public_html || $missing_admin
- ? 'Warning: This plugin is not fully installed. Check that the plugin has been correctly installed to: '
- . ($missing_public_html ? '' . $_CONF['path_html'] . ' ' : '')
- . ($missing_admin ? '' . $admin_dir . ' ' : '') . '
'
- : '')
+ . ($missing_autoinstall ? 'Note: This plugin requires manual activation from the Plugins admin panel.
' : '')
. ' ' . LB
. ' '
. $pi_version
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:13 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:13 -0500
Subject: [geeklog-cvs] geeklog: Sync with admin/plugins.php (handle plugin
tables)
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/21181f35aea7
changeset: 6591:21181f35aea7
user: Dirk Haun
date: Fri Dec 26 11:56:01 2008 +0100
description:
Sync with admin/plugins.php (handle plugin tables)
diffstat:
1 file changed, 10 insertions(+), 2 deletions(-)
public_html/admin/install/lib-install.php | 12 ++++++++++--
diffs (36 lines):
diff -r 86f08a6dd0ad -r 21181f35aea7 public_html/admin/install/lib-install.php
--- a/public_html/admin/install/lib-install.php Fri Dec 26 11:46:42 2008 +0100
+++ b/public_html/admin/install/lib-install.php Fri Dec 26 11:56:01 2008 +0100
@@ -797,7 +797,7 @@
*/
function INST_pluginAutoinstall($plugin, $inst_parms, $verbose = true)
{
- global $_CONF, $_TABLES, $_USER, $_DB_dbms;
+ global $_CONF, $_TABLES, $_USER, $_DB_dbms, $_DB_table_prefix;
$fake_uid = false;
if (!isset($_USER['uid'])) {
@@ -825,6 +825,14 @@
return false;
}
+ // add plugin tables, if any
+ if (! empty($inst_parms['tables'])) {
+ $tables = $inst_parms['tables'];
+ foreach ($tables as $table) {
+ $_TABLES[$table] = $_DB_table_prefix . $table;
+ }
+ }
+
// Create the plugin's group(s), if any
$groups = array();
$admin_group_id = 0;
@@ -832,7 +840,7 @@
$groups = $inst_parms['groups'];
foreach ($groups as $name => $desc) {
if ($verbose) {
- COM_errorLog("Attempting to create plugin '$name' group", 1);
+ COM_errorLog("Attempting to create '$name' group", 1);
}
$grp_name = addslashes($name);
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:14 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:14 -0500
Subject: [geeklog-cvs] geeklog: Handle missing plugin name
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/e403a16fe4ca
changeset: 6592:e403a16fe4ca
user: Dirk Haun
date: Fri Dec 26 12:00:01 2008 +0100
description:
Handle missing plugin name
diffstat:
1 file changed, 4 insertions(+)
public_html/admin/install/install-plugins.php | 4 ++++
diffs (14 lines):
diff -r 21181f35aea7 -r e403a16fe4ca public_html/admin/install/install-plugins.php
--- a/public_html/admin/install/install-plugins.php Fri Dec 26 11:56:01 2008 +0100
+++ b/public_html/admin/install/install-plugins.php Fri Dec 26 12:00:01 2008 +0100
@@ -190,6 +190,10 @@
// Some plugins don't have $pi_name set in their install.php file,
// This means our regex won't work and we should just use $dirname
if (preg_match('/\<\?php/', $pi_name) || preg_match('/--/', $pi_name)) {
+
+ $pi_name = $dirname;
+
+ } elseif (empty($pi_name)) {
$pi_name = $dirname;
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:15 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:15 -0500
Subject: [geeklog-cvs] geeklog: This version will be called 1.6.0. Version
1.5.2 from b...
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/c4c31b02807d
changeset: 6593:c4c31b02807d
user: Dirk Haun
date: Fri Dec 26 12:21:20 2008 +0100
description:
This version will be called 1.6.0. Version 1.5.2 from branch to be added later
diffstat:
9 files changed, 95 insertions(+), 91 deletions(-)
public_html/admin/install/index.php | 8 ++++-
public_html/admin/install/lib-install.php | 2 -
public_html/siteconfig.php.dist | 2 -
sql/mssql_tableanddata.php | 2 -
sql/mysql_tableanddata.php | 2 -
sql/updates/mssql_1.5.1_to_1.5.2.php | 42 ----------------------------
sql/updates/mssql_1.5.1_to_1.6.0.php | 42 ++++++++++++++++++++++++++++
sql/updates/mysql_1.5.1_to_1.5.2.php | 43 -----------------------------
sql/updates/mysql_1.5.1_to_1.6.0.php | 43 +++++++++++++++++++++++++++++
diffs (266 lines):
diff -r e403a16fe4ca -r c4c31b02807d public_html/admin/install/index.php
--- a/public_html/admin/install/index.php Fri Dec 26 12:00:01 2008 +0100
+++ b/public_html/admin/install/index.php Fri Dec 26 12:21:20 2008 +0100
@@ -481,6 +481,9 @@
if (!empty($lng)) {
$config->set('language', $lng);
}
+
+ DB_change($_TABLES['vars'], 'value', VERSION,
+ 'name', 'database_version');
if (! $install_plugins) {
// do a default install of all available plugins
@@ -1375,7 +1378,8 @@
break;
case '1.5.1':
- require_once $_CONF['path'] . 'sql/updates/' . $_DB_dbms . '_1.5.1_to_1.5.2.php';
+ case '1.5.2': // TBD
+ require_once $_CONF['path'] . 'sql/updates/' . $_DB_dbms . '_1.5.1_to_1.6.0.php';
update_ConfValues();
@@ -1387,7 +1391,7 @@
}
}
- $current_gl_version = '1.5.2';
+ $current_gl_version = '1.6.0';
$_SQL = '';
break;
diff -r e403a16fe4ca -r c4c31b02807d public_html/admin/install/lib-install.php
--- a/public_html/admin/install/lib-install.php Fri Dec 26 12:00:01 2008 +0100
+++ b/public_html/admin/install/lib-install.php Fri Dec 26 12:21:20 2008 +0100
@@ -51,7 +51,7 @@
define('LB', "\n");
}
if (!defined('VERSION')) {
- define('VERSION', '1.5.2');
+ define('VERSION', '1.6.0');
}
if (!defined('XHTML')) {
define('XHTML', ' /');
diff -r e403a16fe4ca -r c4c31b02807d public_html/siteconfig.php.dist
--- a/public_html/siteconfig.php.dist Fri Dec 26 12:00:01 2008 +0100
+++ b/public_html/siteconfig.php.dist Fri Dec 26 12:21:20 2008 +0100
@@ -38,7 +38,7 @@
define('LB',"\n");
}
if (!defined('VERSION')) {
- define('VERSION', '1.5.2hg');
+ define('VERSION', '1.6.0hg');
}
?>
diff -r e403a16fe4ca -r c4c31b02807d sql/mssql_tableanddata.php
--- a/sql/mssql_tableanddata.php Fri Dec 26 12:00:01 2008 +0100
+++ b/sql/mssql_tableanddata.php Fri Dec 26 12:21:20 2008 +0100
@@ -1379,7 +1379,7 @@
$_SQL[] = "INSERT INTO {$_TABLES['vars']} (name, value) VALUES ('totalhits','0')";
$_SQL[] = "INSERT INTO {$_TABLES['vars']} (name, value) VALUES ('lastemailedstories','')";
$_SQL[] = "INSERT INTO {$_TABLES['vars']} (name, value) VALUES ('last_scheduled_run','')";
-$_SQL[] = "INSERT INTO {$_TABLES['vars']} (name, value) VALUES ('database_version','1.5.2')";
+$_SQL[] = "INSERT INTO {$_TABLES['vars']} (name, value) VALUES ('database_version','0.0.0')";
$_SQL[] = "INSERT INTO {$_TABLES['trackbackcodes']} (code, name) VALUES (0,'Trackback Enabled')";
$_SQL[] = "INSERT INTO {$_TABLES['trackbackcodes']} (code, name) VALUES (-1,'Trackback Disabled')";
diff -r e403a16fe4ca -r c4c31b02807d sql/mysql_tableanddata.php
--- a/sql/mysql_tableanddata.php Fri Dec 26 12:00:01 2008 +0100
+++ b/sql/mysql_tableanddata.php Fri Dec 26 12:21:20 2008 +0100
@@ -667,7 +667,7 @@
$_DATA[] = "INSERT INTO {$_TABLES['vars']} (name, value) VALUES ('totalhits','0') ";
$_DATA[] = "INSERT INTO {$_TABLES['vars']} (name, value) VALUES ('lastemailedstories','') ";
$_DATA[] = "INSERT INTO {$_TABLES['vars']} (name, value) VALUES ('last_scheduled_run','') ";
-$_DATA[] = "INSERT INTO {$_TABLES['vars']} (name, value) VALUES ('database_version','1.5.2') ";
+$_DATA[] = "INSERT INTO {$_TABLES['vars']} (name, value) VALUES ('database_version','0.0.0') ";
$_DATA[] = "INSERT INTO {$_TABLES['trackbackcodes']} (code, name) VALUES (0,'Trackback Enabled') ";
$_DATA[] = "INSERT INTO {$_TABLES['trackbackcodes']} (code, name) VALUES (-1,'Trackback Disabled') ";
diff -r e403a16fe4ca -r c4c31b02807d sql/updates/mssql_1.5.1_to_1.5.2.php
--- a/sql/updates/mssql_1.5.1_to_1.5.2.php Fri Dec 26 12:00:01 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-add('jpeg_quality',75,'text',5,23,NULL,1495,FALSE);
-
- if (INST_pluginExists('links')) {
- $c->add('new_window',false,'select',0,0,1,55,TRUE,'links');
- }
-
- return true;
-}
-
-function upgrade_PollsPluginId()
-{
- global $_TABLES;
-
- $P_SQL = array();
- $P_SQL[] = "ALTER TABLE {$_TABLES['pollanswers']} ALTER COLUMN [pid] VARCHARS(40)";
- $P_SQL[] = "ALTER TABLE {$_TABLES['pollquestions']} ALTER COLUMN [pid] VARCHARS(40)";
- $P_SQL[] = "ALTER TABLE {$_TABLES['polltopics']} ALTER COLUMN [pid] VARCHARS(40)";
- $P_SQL[] = "ALTER TABLE {$_TABLES['pollvoters']} ALTER COLUMN [pid] VARCHARS(40)";
-
- foreach ($P_SQL as $sql) {
- $rst = DB_query($sql);
- if (DB_error()) {
- echo "There was an error upgrading the polls, SQL: $sql ";
- return false;
- }
- }
-
- return true;
-}
-
-?>
diff -r e403a16fe4ca -r c4c31b02807d sql/updates/mssql_1.5.1_to_1.6.0.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sql/updates/mssql_1.5.1_to_1.6.0.php Fri Dec 26 12:21:20 2008 +0100
@@ -0,0 +1,42 @@
+add('jpeg_quality',75,'text',5,23,NULL,1495,FALSE);
+
+ if (INST_pluginExists('links')) {
+ $c->add('new_window',false,'select',0,0,1,55,TRUE,'links');
+ }
+
+ return true;
+}
+
+function upgrade_PollsPluginId()
+{
+ global $_TABLES;
+
+ $P_SQL = array();
+ $P_SQL[] = "ALTER TABLE {$_TABLES['pollanswers']} ALTER COLUMN [pid] VARCHARS(40)";
+ $P_SQL[] = "ALTER TABLE {$_TABLES['pollquestions']} ALTER COLUMN [pid] VARCHARS(40)";
+ $P_SQL[] = "ALTER TABLE {$_TABLES['polltopics']} ALTER COLUMN [pid] VARCHARS(40)";
+ $P_SQL[] = "ALTER TABLE {$_TABLES['pollvoters']} ALTER COLUMN [pid] VARCHARS(40)";
+
+ foreach ($P_SQL as $sql) {
+ $rst = DB_query($sql);
+ if (DB_error()) {
+ echo "There was an error upgrading the polls, SQL: $sql ";
+ return false;
+ }
+ }
+
+ return true;
+}
+
+?>
diff -r e403a16fe4ca -r c4c31b02807d sql/updates/mysql_1.5.1_to_1.5.2.php
--- a/sql/updates/mysql_1.5.1_to_1.5.2.php Fri Dec 26 12:00:01 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-add('jpeg_quality',75,'text',5,23,NULL,1495,FALSE);
-
- if (INST_pluginExists('links')) {
- $c->add('new_window',false,'select',0,0,1,55,TRUE,'links');
- }
-
- return true;
-}
-
-function upgrade_PollsPluginId()
-{
- global $_TABLES;
-
- $P_SQL = array();
- $P_SQL[] = "ALTER TABLE {$_TABLES['pollanswers']} CHANGE pid pid varchar(40) NOT NULL default ''";
- $P_SQL[] = "ALTER TABLE {$_TABLES['pollquestions']} CHANGE pid pid varchar(40) NOT NULL default ''";
- $P_SQL[] = "ALTER TABLE {$_TABLES['polltopics']} CHANGE pid pid varchar(40) NOT NULL default ''";
- $P_SQL[] = "ALTER TABLE {$_TABLES['pollvoters']} CHANGE pid pid varchar(40) NOT NULL default ''";
-
- $P_SQL = INST_checkInnodbUpgrade($P_SQL);
- foreach ($P_SQL as $sql) {
- $rst = DB_query($sql);
- if (DB_error()) {
- echo "There was an error upgrading the polls, SQL: $sql ";
- return false;
- }
- }
-
- return true;
-}
-
-?>
diff -r e403a16fe4ca -r c4c31b02807d sql/updates/mysql_1.5.1_to_1.6.0.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sql/updates/mysql_1.5.1_to_1.6.0.php Fri Dec 26 12:21:20 2008 +0100
@@ -0,0 +1,43 @@
+add('jpeg_quality',75,'text',5,23,NULL,1495,FALSE);
+
+ if (INST_pluginExists('links')) {
+ $c->add('new_window',false,'select',0,0,1,55,TRUE,'links');
+ }
+
+ return true;
+}
+
+function upgrade_PollsPluginId()
+{
+ global $_TABLES;
+
+ $P_SQL = array();
+ $P_SQL[] = "ALTER TABLE {$_TABLES['pollanswers']} CHANGE pid pid varchar(40) NOT NULL default ''";
+ $P_SQL[] = "ALTER TABLE {$_TABLES['pollquestions']} CHANGE pid pid varchar(40) NOT NULL default ''";
+ $P_SQL[] = "ALTER TABLE {$_TABLES['polltopics']} CHANGE pid pid varchar(40) NOT NULL default ''";
+ $P_SQL[] = "ALTER TABLE {$_TABLES['pollvoters']} CHANGE pid pid varchar(40) NOT NULL default ''";
+
+ $P_SQL = INST_checkInnodbUpgrade($P_SQL);
+ foreach ($P_SQL as $sql) {
+ $rst = DB_query($sql);
+ if (DB_error()) {
+ echo "There was an error upgrading the polls, SQL: $sql ";
+ return false;
+ }
+ }
+
+ return true;
+}
+
+?>
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:16 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:16 -0500
Subject: [geeklog-cvs] geeklog: First attempt to get the plugin upgrade
working
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/7fd9bfe6d53f
changeset: 6594:7fd9bfe6d53f
user: Dirk Haun
date: Fri Dec 26 15:58:22 2008 +0100
description:
First attempt to get the plugin upgrade working
diffstat:
3 files changed, 65 insertions(+), 1 deletion(-)
plugins/calendar/functions.inc | 9 +++++++++
public_html/admin/install/index.php | 29 ++++++++++++++++++++++++++++-
public_html/admin/install/lib-install.php | 28 ++++++++++++++++++++++++++++
diffs (110 lines):
diff -r c4c31b02807d -r 7fd9bfe6d53f plugins/calendar/functions.inc
--- a/plugins/calendar/functions.inc Fri Dec 26 12:21:20 2008 +0100
+++ b/plugins/calendar/functions.inc Fri Dec 26 15:58:22 2008 +0100
@@ -1432,6 +1432,15 @@
*/
function plugin_upgrade_calendar()
{
+ global $_TABLES, $_CA_CONF;
+
+ $version = DB_getItem($_TABLES['plugins'], 'pi_version',
+ "pi_name = 'calendar'");
+ if ($version == $_CA_CONF['version']) {
+ // nothing to do
+ return true;
+ }
+
// the plugin needs these function so complain when they don't exist
if (!function_exists('PLG_uninstall') ||
!function_exists('COM_createLink')) {
diff -r c4c31b02807d -r 7fd9bfe6d53f public_html/admin/install/index.php
--- a/public_html/admin/install/index.php Fri Dec 26 12:21:20 2008 +0100
+++ b/public_html/admin/install/index.php Fri Dec 26 15:58:22 2008 +0100
@@ -551,9 +551,17 @@
$config->set_default('default_photo', urldecode($site_url) . '/default.jpg');
}
+ // disable plugins for which we don't have the source files
INST_checkPlugins();
- // Installation is complete. Continue onto either plugin installation or success page
+ if (! $install_plugins) {
+ // extra step 4: upgrade plugins
+ $next_link = 'index.php?step=4&mode=' . $install_type
+ . '&language=' . $language;
+ }
+
+ // Installation is complete. Continue onto either plugin
+ // installation or success page
header('Location: ' . $next_link);
} else {
@@ -562,6 +570,19 @@
}
break;
}
+ break;
+
+ /**
+ * Extra Step 4 - Upgrade plugins
+ */
+ case 4:
+ INST_pluginUpgrades();
+
+ $next_link = 'success.php?type=' . $install_type
+ . '&language=' . $language;
+
+ header('Location: ' . $next_link);
+
break;
}
}
@@ -1883,6 +1904,12 @@
case 'install': // Deliberate fall-through, no "break"
case 'upgrade':
+ if (($mode == 'upgrade') && ($step == 4)) {
+ // for the plugin upgrade,
+ // we need lib-common.php in the global(!) namespace
+ require_once '../../lib-common.php';
+ }
+
// Run the installation function
INST_installEngine($mode, $step);
break;
diff -r c4c31b02807d -r 7fd9bfe6d53f public_html/admin/install/lib-install.php
--- a/public_html/admin/install/lib-install.php Fri Dec 26 12:21:20 2008 +0100
+++ b/public_html/admin/install/lib-install.php Fri Dec 26 15:58:22 2008 +0100
@@ -1023,4 +1023,32 @@
return true;
}
+/**
+* Upgrade any enabled plugins
+*
+* @note Needs a fully working Geeklog, so can only be done late in the upgrade
+* process!
+*
+*/
+function INST_pluginUpgrades()
+{
+ global $_CONF, $_TABLES;
+
+ $result = DB_query("SELECT pi_name, pi_version FROM {$_TABLES['plugins']} WHERE pi_enabled = 1");
+ $numPlugins = DB_numRows($result);
+
+ for ($i = 0; $i < $numPlugins; $i++) {
+ list($pi_name, $pi_version) = DB_fetchArray($result);
+
+ $code_version = PLG_chkVersion($pi_name);
+ if (! empty($code_version) && ($code_version != $pi_version)) {
+ if (PLG_upgrade($pi_name) !== true) {
+ // upgrade failed - disable plugin
+ DB_query("UPDATE {$_TABLES['plugins']} SET pi_enabled = 0 WHERE pi_name = '$pi_name'");
+ COM_errorLog("Upgrade for '$pi_name' plugin failed - plugin disabled");
+ }
+ }
+ }
+}
+
?>
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:19 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:19 -0500
Subject: [geeklog-cvs] geeklog: Handle plugin upgrade when adding new plugins
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/2a81ead43d9c
changeset: 6596:2a81ead43d9c
user: Dirk Haun
date: Sat Dec 27 10:47:14 2008 +0100
description:
Handle plugin upgrade when adding new plugins
diffstat:
1 file changed, 13 insertions(+), 8 deletions(-)
public_html/admin/install/index.php | 21 +++++++++++++--------
diffs (40 lines):
diff -r a0f2b65c1957 -r 2a81ead43d9c public_html/admin/install/index.php
--- a/public_html/admin/install/index.php Fri Dec 26 19:31:15 2008 +0100
+++ b/public_html/admin/install/index.php Sat Dec 27 10:47:14 2008 +0100
@@ -554,14 +554,13 @@
// disable plugins for which we don't have the source files
INST_checkPlugins();
- if (! $install_plugins) {
- // extra step 4: upgrade plugins
- $next_link = 'index.php?step=4&mode=' . $install_type
- . '&language=' . $language;
+ // extra step 4: upgrade plugins
+ $next_link = 'index.php?step=4&mode=' . $install_type
+ . '&language=' . $language;
+ if ($install_plugins) {
+ $next_link .= '&install_plugins=true';
}
- // Installation is complete. Continue onto either plugin
- // installation or success page
header('Location: ' . $next_link);
} else {
@@ -578,8 +577,14 @@
case 4:
INST_pluginUpgrades();
- $next_link = 'success.php?type=' . $install_type
- . '&language=' . $language;
+ $install_plugins = ((isset($_GET['install_plugins']) &&
+ !empty($_GET['install_plugins']))
+ ? true
+ : false);
+ $next_link = ($install_plugins
+ ? 'install-plugins.php?language=' . $language
+ : 'success.php?type=' . $install_type
+ . '&language=' . $language);
header('Location: ' . $next_link);
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:17 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:17 -0500
Subject: [geeklog-cvs] geeklog: Implemented Calendar upgrade
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/a0f2b65c1957
changeset: 6595:a0f2b65c1957
user: Dirk Haun
date: Fri Dec 26 19:31:15 2008 +0100
description:
Implemented Calendar upgrade
diffstat:
6 files changed, 131 insertions(+), 26 deletions(-)
plugins/calendar/autoinstall.php | 10 +++--
plugins/calendar/functions.inc | 57 ++++++++++++++++++++++++--------
plugins/calendar/sql/mssql_install.php | 9 ++---
plugins/calendar/sql/mssql_updates.php | 37 ++++++++++++++++++++
plugins/calendar/sql/mysql_install.php | 7 +--
plugins/calendar/sql/mysql_updates.php | 37 ++++++++++++++++++++
diffs (276 lines):
diff -r 7fd9bfe6d53f -r a0f2b65c1957 plugins/calendar/autoinstall.php
--- a/plugins/calendar/autoinstall.php Fri Dec 26 15:58:22 2008 +0100
+++ b/plugins/calendar/autoinstall.php Fri Dec 26 19:31:15 2008 +0100
@@ -2,7 +2,7 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Calendar plugin 1.1 for Geeklog |
+// | Calendar Plugin 1.1 |
// +---------------------------------------------------------------------------+
// | autoinstall.php |
// | |
@@ -100,12 +100,16 @@
// plugin on Geeklog 1.4.0 or older - sorry, but that won't work
return false;
}
-
+
if (!function_exists('MBYTE_strpos')) {
// the plugin requires the multi-byte functions
return false;
}
-
+
+ if (!function_exists('COM_createLink')) {
+ return false;
+ }
+
if (!function_exists('SEC_createToken')) {
return false;
}
diff -r 7fd9bfe6d53f -r a0f2b65c1957 plugins/calendar/functions.inc
--- a/plugins/calendar/functions.inc Fri Dec 26 15:58:22 2008 +0100
+++ b/plugins/calendar/functions.inc Fri Dec 26 19:31:15 2008 +0100
@@ -2,7 +2,7 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Calendar Plugin 1.0 |
+// | Calendar Plugin 1.1 |
// +---------------------------------------------------------------------------+
// | functions.inc |
// | |
@@ -57,7 +57,6 @@
$_CA_CONF = $ca_config->get_config('calendar');
}
-$_CA_CONF['version'] = '1.1.0';
// +---------------------------------------------------------------------------+
// | Geeklog Plugin API Implementations |
@@ -1419,9 +1418,13 @@
*/
function plugin_chkVersion_calendar()
{
- global $_CA_CONF;
+ global $_CONF;
- return $_CA_CONF['version'];
+ require_once $_CONF['path'] . 'plugins/calendar/autoinstall.php';
+
+ $inst_parms = plugin_autoinstall_calendar('calendar');
+
+ return $inst_parms['info']['pi_version'];
}
/**
@@ -1432,24 +1435,50 @@
*/
function plugin_upgrade_calendar()
{
- global $_TABLES, $_CA_CONF;
+ global $_CONF, $_TABLES, $_DB_dbms;
- $version = DB_getItem($_TABLES['plugins'], 'pi_version',
- "pi_name = 'calendar'");
- if ($version == $_CA_CONF['version']) {
+ $installed_version = DB_getItem($_TABLES['plugins'], 'pi_version',
+ "pi_name = 'calendar'");
+ $code_version = plugin_chkVersion_calendar();
+ if ($installed_version == $code_version) {
// nothing to do
return true;
}
- // the plugin needs these function so complain when they don't exist
- if (!function_exists('PLG_uninstall') ||
- !function_exists('COM_createLink')) {
+ require_once $_CONF['path'] . 'plugins/calendar/autoinstall.php';
+
+ if (! plugin_compatible_with_this_version_calendar('calendar')) {
return 3002;
}
- // upgrades are done by the install script - return a generic error
- COM_errorLog("Plugin upgrade function not implemented");
- return 3001;
+ $inst_parms = plugin_autoinstall_calendar('calendar');
+ $pi_gl_version = $inst_parms['info']['pi_gl_version'];
+
+ require_once $_CONF['path'] . 'plugins/calendar/sql/'
+ . $_DB_dbms . '_updates.php';
+
+ $current_version = $installed_version;
+ $done = false;
+ while (! $done) {
+ switch ($current_version) {
+ case '1.0.2':
+ if (isset($_UPDATES[$current_version])) {
+ $_SQL = $_UPDATES[$current_version];
+ foreach ($_SQL as $sql) {
+ DB_query($sql);
+ }
+ }
+ $current_version = '1.1.0';
+ break;
+
+ default:
+ $done = true;
+ }
+ }
+
+ DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '$code_version', pi_gl_version = '$pi_gl_version' WHERE pi_name = 'calendar'");
+
+ return true;
}
/**
diff -r 7fd9bfe6d53f -r a0f2b65c1957 plugins/calendar/sql/mssql_install.php
--- a/plugins/calendar/sql/mssql_install.php Fri Dec 26 15:58:22 2008 +0100
+++ b/plugins/calendar/sql/mssql_install.php Fri Dec 26 19:31:15 2008 +0100
@@ -2,9 +2,9 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Calendar Plugin 1.0 |
+// | Calendar Plugin 1.1 |
// +---------------------------------------------------------------------------+
-// | Installation SQL |
+// | mssql_install.php |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2000-2008 by the following authors: |
// | |
@@ -30,8 +30,6 @@
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
-//
-// $Id: mssql_install.php,v 1.6 2008/08/12 18:13:33 mjervis Exp $
$_SQL[] = "
CREATE TABLE [dbo].[{$_TABLES['events']}] (
@@ -58,7 +56,8 @@
[event_type] [varchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[location] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[timestart] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
- [timeend] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
+ [timeend] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
+ [in_transit] [tinyint] NULL
) ON [PRIMARY]
";
diff -r 7fd9bfe6d53f -r a0f2b65c1957 plugins/calendar/sql/mssql_updates.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/calendar/sql/mssql_updates.php Fri Dec 26 19:31:15 2008 +0100
@@ -0,0 +1,37 @@
+ array(
+ "ALTER TABLE {$_TABLES['events']} ADD in_transit tinyint NULL"
+ )
+
+);
+
+?>
diff -r 7fd9bfe6d53f -r a0f2b65c1957 plugins/calendar/sql/mysql_install.php
--- a/plugins/calendar/sql/mysql_install.php Fri Dec 26 15:58:22 2008 +0100
+++ b/plugins/calendar/sql/mysql_install.php Fri Dec 26 19:31:15 2008 +0100
@@ -2,9 +2,9 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Calendar Plugin 1.0 |
+// | Calendar Plugin 1.1 |
// +---------------------------------------------------------------------------+
-// | Installation SQL |
+// | mysql_install.php |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2000-2008 by the following authors: |
// | |
@@ -29,8 +29,6 @@
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
-//
-// $Id: mysql_install.php,v 1.3 2008/05/02 12:08:07 dhaun Exp $
$_SQL[] = "
CREATE TABLE {$_TABLES['events']} (
@@ -58,6 +56,7 @@
location varchar(128) default NULL,
timestart time default NULL,
timeend time default NULL,
+ in_transit tinyint(1) unsigned default '0',
INDEX events_eid(eid),
INDEX events_event_type(event_type),
INDEX events_datestart(datestart),
diff -r 7fd9bfe6d53f -r a0f2b65c1957 plugins/calendar/sql/mysql_updates.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/calendar/sql/mysql_updates.php Fri Dec 26 19:31:15 2008 +0100
@@ -0,0 +1,37 @@
+ array(
+ "ALTER TABLE {$_TABLES['events']} ADD in_transit tinyint(1) unsigned default '0' AFTER timeend"
+ )
+
+);
+
+?>
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:19 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:19 -0500
Subject: [geeklog-cvs] geeklog: Cosmetics: Try to display the plugin's
full/display name
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/e02ca493ee9a
changeset: 6597:e02ca493ee9a
user: Dirk Haun
date: Sat Dec 27 11:46:10 2008 +0100
description:
Cosmetics: Try to display the plugin's full/display name
diffstat:
3 files changed, 67 insertions(+), 16 deletions(-)
public_html/admin/plugins.php | 70 ++++++++++--
public_html/layout/professional/admin/plugins/editor.thtml | 2
system/lib-admin.php | 11 +
diffs (173 lines):
diff -r 2a81ead43d9c -r e02ca493ee9a public_html/admin/plugins.php
--- a/public_html/admin/plugins.php Sat Dec 27 10:47:14 2008 +0100
+++ b/public_html/admin/plugins.php Sat Dec 27 11:46:10 2008 +0100
@@ -32,8 +32,6 @@
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
-//
-// $Id: plugins.php,v 1.84 2008/09/18 19:09:38 dhaun Exp $
require_once '../lib-common.php';
require_once 'auth.inc.php';
@@ -73,11 +71,8 @@
$retval = '';
- if (strlen ($pi_name) == 0) {
- $retval .= COM_startBlock ($LANG32[13], '',
- COM_getBlockTemplate ('_msg_block', 'header'));
- $retval .= COM_errorLog ($LANG32[12]);
- $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+ if (strlen($pi_name) == 0) {
+ $retval .= COM_showMessageText($LANG32[12], $LANG32[13]);
return $retval;
}
@@ -108,13 +103,13 @@
$plg_templates->set_var('lang_save', $LANG_ADMIN['save']);
$plg_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
$plg_templates->set_var('lang_delete', $LANG_ADMIN['delete']);
- $plg_templates->set_var ('pi_icon', PLG_getIcon ($pi_name));
+ $plg_templates->set_var('pi_icon', PLG_getIcon($pi_name));
if (!empty($pi_name)) {
$plg_templates->set_var ('delete_option', ' ');
}
$plugin_code_version = PLG_chkVersion($pi_name);
- if (empty ($plugin_code_version)) {
+ if (empty($plugin_code_version)) {
$code_version = 'N/A';
} else {
$code_version = $plugin_code_version;
@@ -130,6 +125,7 @@
$plg_templates->set_var('confirmed', $confirmed);
$plg_templates->set_var('lang_pluginname', $LANG32[26]);
$plg_templates->set_var('pi_name', $pi_name);
+ $plg_templates->set_var('pi_display_name', plugin_get_pluginname($pi_name));
$plg_templates->set_var('lang_pluginhomepage', $LANG32[27]);
$plg_templates->set_var('pi_homepage', $A['pi_homepage']);
$plg_templates->set_var('lang_pluginversion', $LANG32[28]);
@@ -298,7 +294,7 @@
}
$url .= '&' . CSRF_TOKEN . '=' . $token;
$data_arr[] = array(
- 'pi_name' => $dir,
+ 'pi_name' => plugin_get_pluginname($dir),
'number' => $index,
'install_link' => COM_createLink($LANG32[22], $url)
);
@@ -441,7 +437,7 @@
);
// this is a dummy variable so we know the form has been used if all plugins
- // should be disabled in order to disable the last one.
+ // should be disabled in order to disable the last one.
$form_arr = array('bottom' => ' ');
$retval .= ADMIN_list('plugins', 'ADMIN_getListField_plugins', $header_arr,
@@ -1007,6 +1003,58 @@
return true;
}
+/**
+* See if we can figure out the plugin's real name
+*
+* @param string $plugin internal name / directory name
+* @return string real or beautified name
+*
+*/
+function plugin_get_pluginname($plugin)
+{
+ global $_CONF;
+
+ $retval = '';
+
+ $plugins_dir = $_CONF['path'] . 'plugins/';
+ $autoinstall = $plugins_dir . $plugin . '/autoinstall.php';
+
+ // for new plugins, get the name from the autoinstall.php
+ if (file_exists($autoinstall)) {
+
+ require_once $autoinstall;
+
+ $fn = 'plugin_autoinstall_' . $plugin;
+ if (function_exists($fn)) {
+ $info = $fn($plugin);
+ if (is_array($info) && isset($info['info']) &&
+ isset($info['info']['pi_display_name'])) {
+ $retval = $info['info']['pi_display_name'];
+ }
+ }
+
+ }
+
+ if (empty($retval)) {
+ // else try the 'getadminoption' function
+ // - may fail if we don't have the proper permissions
+ $fn = 'plugin_getadminoption_' . $plugin;
+ if (function_exists($fn)) {
+ $result = $fn();
+ if (is_array($result) && !empty($result[0])) {
+ $retval = $result[0];
+ }
+ }
+ }
+
+ if (empty($retval)) {
+ // give up and fake it
+ $retval = strtoupper($plugin{0}) . substr($plugin, 1);
+ }
+
+ return $retval;
+}
+
// MAIN
$display = '';
diff -r 2a81ead43d9c -r e02ca493ee9a public_html/layout/professional/admin/plugins/editor.thtml
--- a/public_html/layout/professional/admin/plugins/editor.thtml Sat Dec 27 10:47:14 2008 +0100
+++ b/public_html/layout/professional/admin/plugins/editor.thtml Sat Dec 27 11:46:10 2008 +0100
@@ -18,7 +18,7 @@
{lang_pluginname}:
- {pi_name}
+ {pi_display_name}
{lang_pluginhomepage}:
diff -r 2a81ead43d9c -r e02ca493ee9a system/lib-admin.php
--- a/system/lib-admin.php Sat Dec 27 10:47:14 2008 +0100
+++ b/system/lib-admin.php Sat Dec 27 11:46:10 2008 +0100
@@ -32,8 +32,6 @@
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
-//
-// $Id: lib-admin.php,v 1.136 2008/09/21 08:37:11 dhaun Exp $
if (strpos(strtolower($_SERVER['PHP_SELF']), 'lib-admin.php') !== false) {
die('This file can not be used on its own!');
@@ -957,14 +955,19 @@
return $retval;
}
-function ADMIN_getListField_plugins($fieldname, $fieldvalue, $A, $icon_arr, $token) {
+function ADMIN_getListField_plugins($fieldname, $fieldvalue, $A, $icon_arr, $token)
+{
global $_CONF, $LANG_ADMIN, $LANG32;
+
$retval = '';
switch($fieldname) {
- case "edit":
+ case 'edit':
$retval = COM_createLink($icon_arr['edit'],
"{$_CONF['site_admin_url']}/plugins.php?mode=edit&pi_name={$A['pi_name']}");
+ break;
+ case 'pi_name':
+ $retval = plugin_get_pluginname($A['pi_name']);
break;
case 'pi_version':
$plugin_code_version = PLG_chkVersion ($A['pi_name']);
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:22 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:22 -0500
Subject: [geeklog-cvs] geeklog: Implemented Links upgrade
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/1f6f00948537
changeset: 6599:1f6f00948537
user: Dirk Haun
date: Sat Dec 27 22:22:41 2008 +0100
description:
Implemented Links upgrade
diffstat:
3 files changed, 24 insertions(+), 14 deletions(-)
plugins/links/functions.inc | 30 ++++++++++++++++++++++++------
sql/updates/mssql_1.5.1_to_1.6.0.php | 4 ----
sql/updates/mysql_1.5.1_to_1.6.0.php | 4 ----
diffs (71 lines):
diff -r fb55acb618e1 -r 1f6f00948537 plugins/links/functions.inc
--- a/plugins/links/functions.inc Sat Dec 27 15:31:21 2008 +0100
+++ b/plugins/links/functions.inc Sat Dec 27 22:22:41 2008 +0100
@@ -713,15 +713,33 @@
*/
function plugin_upgrade_links()
{
- // the plugin needs these function so complain when they don't exist
- if (!function_exists('PLG_uninstall') ||
- !function_exists('COM_createLink')) {
+ global $_CONF, $_TABLES, $_LI_CONF;
+
+ $installed_version = DB_getItem($_TABLES['plugins'], 'pi_version',
+ "pi_name = 'links'");
+ $code_version = plugin_chkVersion_links();
+ if ($installed_version == $code_version) {
+ // nothing to do
+ return true;
+ }
+
+ require_once $_CONF['path'] . 'plugins/links/autoinstall.php';
+
+ if (! plugin_compatible_with_this_version_links('links')) {
return 3002;
}
- // upgrades are done by the install script - return a generic error
- COM_errorLog("Plugin upgrade function not implemented");
- return 3001;
+ $inst_parms = plugin_autoinstall_links('links');
+ $pi_gl_version = $inst_parms['info']['pi_gl_version'];
+
+ if (! isset($_LI_CONF['new_window'])) {
+ $c = config::get_instance();
+ $c->add('new_window',false,'select',0,0,1,55,TRUE,'links');
+ }
+
+ DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '$code_version', pi_gl_version = '$pi_gl_version' WHERE pi_name = 'links'");
+
+ return true;
}
/**
diff -r fb55acb618e1 -r 1f6f00948537 sql/updates/mssql_1.5.1_to_1.6.0.php
--- a/sql/updates/mssql_1.5.1_to_1.6.0.php Sat Dec 27 15:31:21 2008 +0100
+++ b/sql/updates/mssql_1.5.1_to_1.6.0.php Sat Dec 27 22:22:41 2008 +0100
@@ -10,10 +10,6 @@
// new option
$c->add('jpeg_quality',75,'text',5,23,NULL,1495,FALSE);
-
- if (INST_pluginExists('links')) {
- $c->add('new_window',false,'select',0,0,1,55,TRUE,'links');
- }
return true;
}
diff -r fb55acb618e1 -r 1f6f00948537 sql/updates/mysql_1.5.1_to_1.6.0.php
--- a/sql/updates/mysql_1.5.1_to_1.6.0.php Sat Dec 27 15:31:21 2008 +0100
+++ b/sql/updates/mysql_1.5.1_to_1.6.0.php Sat Dec 27 22:22:41 2008 +0100
@@ -10,10 +10,6 @@
// new option
$c->add('jpeg_quality',75,'text',5,23,NULL,1495,FALSE);
-
- if (INST_pluginExists('links')) {
- $c->add('new_window',false,'select',0,0,1,55,TRUE,'links');
- }
return true;
}
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:22 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:22 -0500
Subject: [geeklog-cvs] geeklog: Implemented Links autoinstall
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/fb55acb618e1
changeset: 6598:fb55acb618e1
user: Dirk Haun
date: Sat Dec 27 15:31:21 2008 +0100
description:
Implemented Links autoinstall
diffstat:
3 files changed, 160 insertions(+), 399 deletions(-)
plugins/links/autoinstall.php | 153 ++++++++++
plugins/links/functions.inc | 11
public_html/admin/plugins/links/install.php | 395 ---------------------------
diffs (truncated from 592 to 300 lines):
diff -r e02ca493ee9a -r fb55acb618e1 plugins/links/autoinstall.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/links/autoinstall.php Sat Dec 27 15:31:21 2008 +0100
@@ -0,0 +1,153 @@
+ $pi_name,
+ 'pi_display_name' => $pi_display_name,
+ 'pi_version' => '2.1.0',
+ 'pi_gl_version' => '1.6.0',
+ 'pi_homepage' => 'http://www.geeklog.net/'
+ );
+
+ $groups = array(
+ $pi_admin => 'Has full access to ' . $pi_display_name . ' features'
+ );
+
+ $features = array(
+ $pi_name . '.edit' => 'Access to links editor',
+ $pi_name . '.moderate' => 'Ability to moderate pending links',
+ $pi_name . '.submit' => 'May skip the links submission queue'
+ );
+
+ $mappings = array(
+ $pi_name . '.edit' => array($pi_admin),
+ $pi_name . '.moderate' => array($pi_admin),
+ $pi_name . '.submit' => array($pi_admin)
+ );
+
+ $tables = array(
+ 'linkcategories',
+ 'links',
+ 'linksubmission'
+ );
+
+ $inst_parms = array(
+ 'info' => $info,
+ 'groups' => $groups,
+ 'features' => $features,
+ 'mappings' => $mappings,
+ 'tables' => $tables
+ );
+
+ return $inst_parms;
+}
+
+function plugin_load_configuration_links($pi_name)
+{
+ global $_CONF, $base_path;
+
+ $base_path = $_CONF['path'] . 'plugins/' . $pi_name . '/';
+
+ require_once $_CONF['path_system'] . 'classes/config.class.php';
+ require_once $base_path . 'install_defaults.php';
+
+ return plugin_initconfig_links();
+}
+
+/**
+* Plugin postinstall
+*
+* We're inserting our default data here since it depends on other stuff that
+* has to happen first ...
+*
+* @return boolean true = proceed with install, false = an error occured
+*
+*/
+function plugin_postinstall_links($pi_name)
+{
+ global $_CONF, $_TABLES;
+
+ require_once $_CONF['path_system'] . 'classes/config.class.php';
+
+ $li_config = config::get_instance();
+ $_LI_CONF = $li_config->get_config('links');
+
+ $inst_parms = plugin_autoinstall_links($pi_name);
+ $pi_admin = key($inst_parms['groups']);
+
+ $admin_group_id = DB_getItem($_TABLES['groups'], 'grp_id',
+ "grp_name = '{$pi_admin}'");
+ $blockadmin_id = DB_getItem($_TABLES['groups'], 'grp_id',
+ "grp_name = 'Block Admin'");
+
+ $L_SQL = array();
+ $L_SQL[] = "INSERT INTO {$_TABLES['linkcategories']} (cid, pid, category, description, tid, created, modified, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('{$_LI_CONF['root']}', 'root', 'Root', 'Website root', '', NOW(), NOW(), #group#, 2, 3, 3, 2, 2)";
+
+ $L_SQL[] = "INSERT INTO {$_TABLES['linkcategories']} (cid, pid, category, description, tid, created, modified, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('geeklog-sites', '{$_LI_CONF['root']}', 'Geeklog Sites', 'Sites using or related to the Geeklog CMS', NULL, NOW(), NOW(), #group#, 2, 3, 3, 2, 2)";
+
+ $L_SQL[] = "INSERT INTO {$_TABLES['links']} (lid, cid, url, description, title, hits, date, owner_id, group_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('geeklog.net', 'geeklog-sites', 'http://www.geeklog.net/', 'Visit the Geeklog homepage for support, FAQs, updates, add-ons, and a great community.', 'Geeklog Project Homepage', 123, NOW(), 1, #group#, 3, 3, 2, 2);";
+
+ foreach ($L_SQL as $sql) {
+ $sql = str_replace('#group#', $admin_group_id, $sql);
+ DB_query($sql, 1);
+ if (DB_error()) {
+ COM_error("SQL error in Links plugin postinstall, SQL: " . $sql);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+function plugin_compatible_with_this_version_links($pi_name)
+{
+ if (!function_exists('COM_truncate') || !function_exists('MBYTE_strpos')) {
+ return false;
+ }
+
+ if (!function_exists('SEC_createToken')) {
+ return false;
+ }
+
+ if (!function_exists('COM_showMessageText')) {
+ return false;
+ }
+
+ return true;
+}
+
+?>
diff -r e02ca493ee9a -r fb55acb618e1 plugins/links/functions.inc
--- a/plugins/links/functions.inc Sat Dec 27 11:46:10 2008 +0100
+++ b/plugins/links/functions.inc Sat Dec 27 15:31:21 2008 +0100
@@ -2,7 +2,7 @@
// Reminder: always indent with 4 spaces (no tabs).
// +---------------------------------------------------------------------------+
-// | Links Plugin 2.0 |
+// | Links Plugin 2.1 |
// +---------------------------------------------------------------------------+
// | functions.inc |
// | |
@@ -59,7 +59,6 @@
$_LI_CONF = $li_config->get_config('links');
}
-$_LI_CONF['version'] = '2.0.0';
// +---------------------------------------------------------------------------+
// | Geeklog Plugin API Implementation |
@@ -207,9 +206,13 @@
*/
function plugin_chkVersion_links ()
{
- global $_LI_CONF;
+ global $_CONF;
- return $_LI_CONF['version'];
+ require_once $_CONF['path'] . 'plugins/links/autoinstall.php';
+
+ $inst_parms = plugin_autoinstall_links('links');
+
+ return $inst_parms['info']['pi_version'];
}
/**
diff -r e02ca493ee9a -r fb55acb618e1 public_html/admin/plugins/links/install.php
--- a/public_html/admin/plugins/links/install.php Sat Dec 27 11:46:10 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,395 +0,0 @@
-
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/35e3270f5456
changeset: 6600:35e3270f5456
user: Dirk Haun
date: Sun Dec 28 00:39:41 2008 +0100
description:
Implemented Spam-X autoinstall and upgrade
diffstat:
5 files changed, 143 insertions(+), 364 deletions(-)
plugins/spamx/autoinstall.php | 109 ++++++++
plugins/spamx/functions.inc | 37 ++
plugins/spamx/sql/mssql_install.php | 8
plugins/spamx/sql/mysql_install.php | 8
public_html/admin/plugins/spamx/install.php | 345 ---------------------------
diffs (truncated from 601 to 300 lines):
diff -r 1f6f00948537 -r 35e3270f5456 plugins/spamx/autoinstall.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/spamx/autoinstall.php Sun Dec 28 00:39:41 2008 +0100
@@ -0,0 +1,109 @@
+ $pi_name,
+ 'pi_display_name' => $pi_display_name,
+ 'pi_version' => '1.2.0',
+ 'pi_gl_version' => '1.6.0',
+ 'pi_homepage' => 'http://www.pigstye.net/gplugs/staticpages/index.php/spamx'
+ );
+
+ $groups = array(
+ $pi_admin => 'Users in this group can administer the '
+ . $pi_display_name . ' plugin'
+ );
+
+ $features = array(
+ $pi_name . '.admint' => 'Full access to ' . $pi_display_name
+ .' plugin'
+ );
+
+ $mappings = array(
+ $pi_name . '.admin' => array($pi_admin)
+ );
+
+ $tables = array(
+ 'spamx'
+ );
+
+ $inst_parms = array(
+ 'info' => $info,
+ 'groups' => $groups,
+ 'features' => $features,
+ 'mappings' => $mappings,
+ 'tables' => $tables
+ );
+
+ return $inst_parms;
+}
+
+function plugin_load_configuration_spamx($pi_name)
+{
+ global $_CONF;
+
+ $base_path = $_CONF['path'] . 'plugins/' . $pi_name . '/';
+
+ require_once $_CONF['path_system'] . 'classes/config.class.php';
+ require_once $base_path . 'install_defaults.php';
+
+ return plugin_initconfig_spamx();
+}
+
+function plugin_postinstall_spamx($pi_name)
+{
+ return true;
+}
+
+function plugin_compatible_with_this_version_spamx($pi_name)
+{
+ if (! function_exists('PLG_spamAction')) {
+ return false;
+ }
+
+ if (! function_exists('SEC_createToken')) {
+ return false;
+ }
+
+ if (! function_exists('COM_showMessageText')) {
+ return false;
+ }
+
+ return true;
+}
+
+?>
diff -r 1f6f00948537 -r 35e3270f5456 plugins/spamx/functions.inc
--- a/plugins/spamx/functions.inc Sat Dec 27 22:22:41 2008 +0100
+++ b/plugins/spamx/functions.inc Sun Dec 28 00:39:41 2008 +0100
@@ -10,7 +10,6 @@
*
* Licensed under GNU General Public License
*
- * $Id: functions.inc,v 1.37 2008/09/21 08:37:08 dhaun Exp $
*/
if (strpos(strtolower($_SERVER['PHP_SELF']), 'functions.inc') !== false) {
@@ -39,7 +38,6 @@
$_SPX_CONF = $spx_config->get_config('spamx');
}
-$_SPX_CONF['version'] = '1.1.1';
// +---------------------------------------------------------------------------+
// | Geeklog Plugin API Implementations |
@@ -146,11 +144,15 @@
*
* @return string plugin version
*/
-function plugin_chkVersion_spamx ()
+function plugin_chkVersion_spamx()
{
- global $_SPX_CONF;
+ global $_CONF;
- return $_SPX_CONF['version'];
+ require_once $_CONF['path'] . 'plugins/spamx/autoinstall.php';
+
+ $inst_parms = plugin_autoinstall_spamx('spamx');
+
+ return $inst_parms['info']['pi_version'];
}
/**
@@ -161,15 +163,28 @@
*/
function plugin_upgrade_spamx()
{
- // the plugin needs these function so complain when they don't exist
- if (!function_exists('PLG_uninstall') ||
- !function_exists('COM_createLink')) {
+ global $_CONF, $_TABLES;
+
+ $installed_version = DB_getItem($_TABLES['plugins'], 'pi_version',
+ "pi_name = 'spamx'");
+ $code_version = plugin_chkVersion_spamx();
+ if ($installed_version == $code_version) {
+ // nothing to do
+ return true;
+ }
+
+ require_once $_CONF['path'] . 'plugins/spamx/autoinstall.php';
+
+ if (! plugin_compatible_with_this_version_spamx('spamx')) {
return 3002;
}
- // upgrades are done by the install script - return a generic error
- COM_errorLog("Plugin upgrade function not implemented");
- return 3001;
+ $inst_parms = plugin_autoinstall_spamx('spamx');
+ $pi_gl_version = $inst_parms['info']['pi_gl_version'];
+
+ DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '$code_version', pi_gl_version = '$pi_gl_version' WHERE pi_name = 'spamx'");
+
+ return true;
}
/**
diff -r 1f6f00948537 -r 35e3270f5456 plugins/spamx/sql/mssql_install.php
--- a/plugins/spamx/sql/mssql_install.php Sat Dec 27 22:22:41 2008 +0100
+++ b/plugins/spamx/sql/mssql_install.php Sun Dec 28 00:39:41 2008 +0100
@@ -2,11 +2,11 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Spam-X Plugin 1.1 |
+// | Spam-X Plugin 1.2 |
// +---------------------------------------------------------------------------+
// | Installation SQL |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2004-2006 by the following authors: |
+// | Copyright (C) 2004-2008 by the following authors: |
// | |
// | Authors: Tom Willett - tomw AT pigstye DOT net |
// | Randy Kolenko - randy AT nextide DOT ca |
@@ -26,8 +26,6 @@
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
-//
-// $Id: mssql_install.php,v 1.1 2006/08/28 18:42:25 dhaun Exp $
$_SQL[] = "
CREATE TABLE [dbo].[{$_TABLES['spamx']}] (
@@ -36,4 +34,6 @@
) ON [PRIMARY]
";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['vars']} (name, value) VALUES ('spamx.counter', '0')";
+
?>
diff -r 1f6f00948537 -r 35e3270f5456 plugins/spamx/sql/mysql_install.php
--- a/plugins/spamx/sql/mysql_install.php Sat Dec 27 22:22:41 2008 +0100
+++ b/plugins/spamx/sql/mysql_install.php Sun Dec 28 00:39:41 2008 +0100
@@ -2,11 +2,11 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Spam-X Plugin 1.1 |
+// | Spam-X Plugin 1.2 |
// +---------------------------------------------------------------------------+
// | Installation SQL |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2004-2006 by the following authors: |
+// | Copyright (C) 2004-2008 by the following authors: |
// | |
// | Authors: Tom Willett - tomw AT pigstye DOT net |
// +---------------------------------------------------------------------------+
@@ -25,8 +25,6 @@
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
-//
-// $Id: mysql_install.php,v 1.1 2006/08/20 16:27:52 dhaun Exp $
$_SQL[] = "
CREATE TABLE {$_TABLES['spamx']} (
@@ -36,4 +34,6 @@
) TYPE=MyISAM
";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['vars']} (name, value) VALUES ('spamx.counter', '0')";
+
?>
diff -r 1f6f00948537 -r 35e3270f5456 public_html/admin/plugins/spamx/install.php
--- a/public_html/admin/plugins/spamx/install.php Sat Dec 27 22:22:41 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,345 +0,0 @@
-
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/5216b7b7a5ae
changeset: 6601:5216b7b7a5ae
user: Dirk Haun
date: Sun Dec 28 10:11:54 2008 +0100
description:
Implemented Static Pages autoinstall and upgrade
diffstat:
3 files changed, 142 insertions(+), 367 deletions(-)
plugins/staticpages/autoinstall.php | 116 ++++++
plugins/staticpages/functions.inc | 36 +-
public_html/admin/plugins/staticpages/install.php | 357 ---------------------
diffs (truncated from 552 to 300 lines):
diff -r 35e3270f5456 -r 5216b7b7a5ae plugins/staticpages/autoinstall.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/staticpages/autoinstall.php Sun Dec 28 10:11:54 2008 +0100
@@ -0,0 +1,116 @@
+ $pi_name,
+ 'pi_display_name' => $pi_display_name,
+ 'pi_version' => '1.6.0',
+ 'pi_gl_version' => '1.6.0',
+ 'pi_homepage' => 'http://www.geeklog.net/'
+ );
+
+ $groups = array(
+ $pi_admin => 'Users in this group can administer the '
+ . $pi_display_name . ' plugin'
+ );
+
+ $features = array(
+ $pi_name . '.edit' => 'Access to ' . $pi_display_name . ' editor',
+ $pi_name . '.delete' => 'Ability to delete static pages',
+ $pi_name . '.PHP' => 'Ability to use PHP in static pages'
+ );
+
+ $mappings = array(
+ $pi_name . '.edit' => array($pi_admin),
+ $pi_name . '.delete' => array($pi_admin)
+ // Note: 'staticpages.PHP' is not assigned to any group by default
+ );
+
+ $tables = array(
+ 'staticpage'
+ );
+
+ $inst_parms = array(
+ 'info' => $info,
+ 'groups' => $groups,
+ 'features' => $features,
+ 'mappings' => $mappings,
+ 'tables' => $tables
+ );
+
+ return $inst_parms;
+}
+
+function plugin_load_configuration_staticpages($pi_name)
+{
+ global $_CONF;
+
+ $base_path = $_CONF['path'] . 'plugins/' . $pi_name . '/';
+
+ require_once $_CONF['path_system'] . 'classes/config.class.php';
+ require_once $base_path . 'install_defaults.php';
+
+ return plugin_initconfig_staticpages();
+}
+
+function plugin_postinstall_staticpages($pi_name)
+{
+ return true;
+}
+
+function plugin_compatible_with_this_version_staticpages($pi_name)
+{
+ if (! function_exists('SEC_getGroupDropdown')) {
+ return false;
+ }
+
+ if (! function_exists('SEC_createToken')) {
+ return false;
+ }
+
+ if (! function_exists('COM_showMessageText')) {
+ return false;
+ }
+
+ if (! function_exists('COM_setLangIdAndAttribute')) {
+ return false;
+ }
+
+ return true;
+}
+
+?>
diff -r 35e3270f5456 -r 5216b7b7a5ae plugins/staticpages/functions.inc
--- a/plugins/staticpages/functions.inc Sun Dec 28 00:39:41 2008 +0100
+++ b/plugins/staticpages/functions.inc Sun Dec 28 10:11:54 2008 +0100
@@ -2,7 +2,7 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Static Pages Plugin 1.5 |
+// | Static Pages Plugin 1.6 |
// +---------------------------------------------------------------------------+
// | functions.inc |
// | |
@@ -57,7 +57,6 @@
$_SP_CONF = $sp_config->get_config('staticpages');
}
-$_SP_CONF['version'] = '1.5.0';
// +---------------------------------------------------------------------------+
// | Plugin API - Services |
@@ -986,9 +985,13 @@
*/
function plugin_chkVersion_staticpages()
{
- global $_SP_CONF;
+ global $_CONF;
- return $_SP_CONF['version'];
+ require_once $_CONF['path'] . 'plugins/staticpages/autoinstall.php';
+
+ $inst_parms = plugin_autoinstall_staticpages('staticpages');
+
+ return $inst_parms['info']['pi_version'];
}
/**
@@ -1053,15 +1056,28 @@
*/
function plugin_upgrade_staticpages()
{
- // the plugin needs these function so complain when they don't exist
- if (!function_exists('PLG_uninstall') ||
- !function_exists('COM_createLink')) {
+ global $_CONF, $_TABLES;
+
+ $installed_version = DB_getItem($_TABLES['plugins'], 'pi_version',
+ "pi_name = 'staticpages'");
+ $code_version = plugin_chkVersion_staticpages();
+ if ($installed_version == $code_version) {
+ // nothing to do
+ return true;
+ }
+
+ require_once $_CONF['path'] . 'plugins/staticpages/autoinstall.php';
+
+ if (! plugin_compatible_with_this_version_staticpages('staticpages')) {
return 3002;
}
- // upgrades are done by the install script - return a generic error
- COM_errorLog("Plugin upgrade function not implemented");
- return 3001;
+ $inst_parms = plugin_autoinstall_staticpages('staticpages');
+ $pi_gl_version = $inst_parms['info']['pi_gl_version'];
+
+ DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '$code_version', pi_gl_version = '$pi_gl_version' WHERE pi_name = 'staticpages'");
+
+ return true;
}
diff -r 35e3270f5456 -r 5216b7b7a5ae public_html/admin/plugins/staticpages/install.php
--- a/public_html/admin/plugins/staticpages/install.php Sun Dec 28 00:39:41 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,357 +0,0 @@
-
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/e85cfa6ea9fe
changeset: 6602:e85cfa6ea9fe
user: Dirk Haun
date: Sun Dec 28 10:13:44 2008 +0100
description:
Fixed global declaration
diffstat:
2 files changed, 2 insertions(+), 2 deletions(-)
plugins/calendar/autoinstall.php | 2 +-
plugins/links/autoinstall.php | 2 +-
diffs (24 lines):
diff -r 5216b7b7a5ae -r e85cfa6ea9fe plugins/calendar/autoinstall.php
--- a/plugins/calendar/autoinstall.php Sun Dec 28 10:11:54 2008 +0100
+++ b/plugins/calendar/autoinstall.php Sun Dec 28 10:13:44 2008 +0100
@@ -78,7 +78,7 @@
function plugin_load_configuration_calendar($pi_name)
{
- global $_CONF, $base_path;
+ global $_CONF;
$base_path = $_CONF['path'] . 'plugins/' . $pi_name . '/';
diff -r 5216b7b7a5ae -r e85cfa6ea9fe plugins/links/autoinstall.php
--- a/plugins/links/autoinstall.php Sun Dec 28 10:11:54 2008 +0100
+++ b/plugins/links/autoinstall.php Sun Dec 28 10:13:44 2008 +0100
@@ -78,7 +78,7 @@
function plugin_load_configuration_links($pi_name)
{
- global $_CONF, $base_path;
+ global $_CONF;
$base_path = $_CONF['path'] . 'plugins/' . $pi_name . '/';
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:32 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:32 -0500
Subject: [geeklog-cvs] geeklog: Implemented Polls upgrade
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/9a4f84840886
changeset: 6604:9a4f84840886
user: Dirk Haun
date: Sun Dec 28 20:00:25 2008 +0100
description:
Implemented Polls upgrade
diffstat:
6 files changed, 121 insertions(+), 57 deletions(-)
plugins/polls/functions.inc | 47 +++++++++++++++++++++++++++++-----
plugins/polls/sql/mssql_updates.php | 40 ++++++++++++++++++++++++++++
plugins/polls/sql/mysql_updates.php | 40 ++++++++++++++++++++++++++++
public_html/admin/install/index.php | 8 -----
sql/updates/mssql_1.5.1_to_1.6.0.php | 21 ---------------
sql/updates/mysql_1.5.1_to_1.6.0.php | 22 ---------------
diffs (225 lines):
diff -r 6bf615c55b68 -r 9a4f84840886 plugins/polls/functions.inc
--- a/plugins/polls/functions.inc Sun Dec 28 10:59:04 2008 +0100
+++ b/plugins/polls/functions.inc Sun Dec 28 20:00:25 2008 +0100
@@ -1111,15 +1111,50 @@
*/
function plugin_upgrade_polls()
{
- // the plugin needs these function so complain when they don't exist
- if (!function_exists('PLG_uninstall') ||
- !function_exists('COM_createLink')) {
+ global $_CONF, $_TABLES, $_DB_dbms;
+
+ $installed_version = DB_getItem($_TABLES['plugins'], 'pi_version',
+ "pi_name = 'polls'");
+ $code_version = plugin_chkVersion_polls();
+ if ($installed_version == $code_version) {
+ // nothing to do
+ return true;
+ }
+
+ require_once $_CONF['path'] . 'plugins/polls/autoinstall.php';
+
+ if (! plugin_compatible_with_this_version_polls('polls')) {
return 3002;
}
- // upgrades are done by the install script - return a generic error
- COM_errorLog("Plugin upgrade function not implemented");
- return 3001;
+ $inst_parms = plugin_autoinstall_polls('polls');
+ $pi_gl_version = $inst_parms['info']['pi_gl_version'];
+
+ require_once $_CONF['path'] . 'plugins/polls/sql/'
+ . $_DB_dbms . '_updates.php';
+
+ $current_version = $installed_version;
+ $done = false;
+ while (! $done) {
+ switch ($current_version) {
+ case '2.0.1':
+ if (isset($_UPDATES[$current_version])) {
+ $_SQL = $_UPDATES[$current_version];
+ foreach ($_SQL as $sql) {
+ DB_query($sql);
+ }
+ }
+ $current_version = '2.1.0';
+ break;
+
+ default:
+ $done = true;
+ }
+ }
+
+ DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '$code_version', pi_gl_version = '$pi_gl_version' WHERE pi_name = 'polls'");
+
+ return true;
}
/**
diff -r 6bf615c55b68 -r 9a4f84840886 plugins/polls/sql/mssql_updates.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/polls/sql/mssql_updates.php Sun Dec 28 20:00:25 2008 +0100
@@ -0,0 +1,40 @@
+ array(
+ "ALTER TABLE {$_TABLES['pollanswers']} ALTER COLUMN [pid] VARCHARS(40)",
+ "ALTER TABLE {$_TABLES['pollquestions']} ALTER COLUMN [pid] VARCHARS(40)",
+ "ALTER TABLE {$_TABLES['polltopics']} ALTER COLUMN [pid] VARCHARS(40)",
+ "ALTER TABLE {$_TABLES['pollvoters']} ALTER COLUMN [pid] VARCHARS(40)"
+ )
+
+);
+
+?>
diff -r 6bf615c55b68 -r 9a4f84840886 plugins/polls/sql/mysql_updates.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/polls/sql/mysql_updates.php Sun Dec 28 20:00:25 2008 +0100
@@ -0,0 +1,40 @@
+ array(
+ "ALTER TABLE {$_TABLES['pollanswers']} CHANGE pid pid varchar(40) NOT NULL default ''",
+ "ALTER TABLE {$_TABLES['pollquestions']} CHANGE pid pid varchar(40) NOT NULL default ''",
+ "ALTER TABLE {$_TABLES['polltopics']} CHANGE pid pid varchar(40) NOT NULL default ''",
+ "ALTER TABLE {$_TABLES['pollvoters']} CHANGE pid pid varchar(40) NOT NULL default ''"
+ )
+
+);
+
+?>
diff -r 6bf615c55b68 -r 9a4f84840886 public_html/admin/install/index.php
--- a/public_html/admin/install/index.php Sun Dec 28 10:59:04 2008 +0100
+++ b/public_html/admin/install/index.php Sun Dec 28 20:00:25 2008 +0100
@@ -1409,14 +1409,6 @@
update_ConfValues();
- if (INST_pluginExists('polls')) {
- $check = upgrade_PollsPluginId();
- if (!$check) {
- echo "Error updating the polls";
- return false;
- }
- }
-
$current_gl_version = '1.6.0';
$_SQL = '';
break;
diff -r 6bf615c55b68 -r 9a4f84840886 sql/updates/mssql_1.5.1_to_1.6.0.php
--- a/sql/updates/mssql_1.5.1_to_1.6.0.php Sun Dec 28 10:59:04 2008 +0100
+++ b/sql/updates/mssql_1.5.1_to_1.6.0.php Sun Dec 28 20:00:25 2008 +0100
@@ -14,25 +14,4 @@
return true;
}
-function upgrade_PollsPluginId()
-{
- global $_TABLES;
-
- $P_SQL = array();
- $P_SQL[] = "ALTER TABLE {$_TABLES['pollanswers']} ALTER COLUMN [pid] VARCHARS(40)";
- $P_SQL[] = "ALTER TABLE {$_TABLES['pollquestions']} ALTER COLUMN [pid] VARCHARS(40)";
- $P_SQL[] = "ALTER TABLE {$_TABLES['polltopics']} ALTER COLUMN [pid] VARCHARS(40)";
- $P_SQL[] = "ALTER TABLE {$_TABLES['pollvoters']} ALTER COLUMN [pid] VARCHARS(40)";
-
- foreach ($P_SQL as $sql) {
- $rst = DB_query($sql);
- if (DB_error()) {
- echo "There was an error upgrading the polls, SQL: $sql ";
- return false;
- }
- }
-
- return true;
-}
-
?>
diff -r 6bf615c55b68 -r 9a4f84840886 sql/updates/mysql_1.5.1_to_1.6.0.php
--- a/sql/updates/mysql_1.5.1_to_1.6.0.php Sun Dec 28 10:59:04 2008 +0100
+++ b/sql/updates/mysql_1.5.1_to_1.6.0.php Sun Dec 28 20:00:25 2008 +0100
@@ -14,26 +14,4 @@
return true;
}
-function upgrade_PollsPluginId()
-{
- global $_TABLES;
-
- $P_SQL = array();
- $P_SQL[] = "ALTER TABLE {$_TABLES['pollanswers']} CHANGE pid pid varchar(40) NOT NULL default ''";
- $P_SQL[] = "ALTER TABLE {$_TABLES['pollquestions']} CHANGE pid pid varchar(40) NOT NULL default ''";
- $P_SQL[] = "ALTER TABLE {$_TABLES['polltopics']} CHANGE pid pid varchar(40) NOT NULL default ''";
- $P_SQL[] = "ALTER TABLE {$_TABLES['pollvoters']} CHANGE pid pid varchar(40) NOT NULL default ''";
-
- $P_SQL = INST_checkInnodbUpgrade($P_SQL);
- foreach ($P_SQL as $sql) {
- $rst = DB_query($sql);
- if (DB_error()) {
- echo "There was an error upgrading the polls, SQL: $sql ";
- return false;
- }
- }
-
- return true;
-}
-
?>
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:36 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:36 -0500
Subject: [geeklog-cvs] geeklog: Added missing texts (not translated yet)
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/61917ffc519d
changeset: 6605:61917ffc519d
user: Dirk Haun
date: Sun Dec 28 20:06:56 2008 +0100
description:
Added missing texts (not translated yet)
diffstat:
4 files changed, 72 insertions(+), 4 deletions(-)
language/german.php | 19 ++++++++++++++++++-
language/german_formal.php | 19 ++++++++++++++++++-
language/german_formal_utf-8.php | 19 ++++++++++++++++++-
language/german_utf-8.php | 19 ++++++++++++++++++-
diffs (116 lines):
diff -r 9a4f84840886 -r 61917ffc519d language/german.php
--- a/language/german.php Sun Dec 28 20:00:25 2008 +0100
+++ b/language/german.php Sun Dec 28 20:06:56 2008 +0100
@@ -1028,7 +1028,24 @@
35 => '?ndern',
36 => 'Code',
37 => 'Aktuell',
- 38 => 'Bitte aktualisieren!'
+ 38 => 'Bitte aktualisieren!',
+ 39 => 'Upload a plugin',
+ 40 => 'You can upload a plugin archive (.tar.gz, .tgz, .zip) directly here:',
+ 41 => 'Upload',
+
+ // to match the PHP error constants,
+ // http://www.php.net/manual/en/features.file-upload.errors.php
+ // TBD: move to a separate $LANG array
+ 99 => 'An unknown error occured',
+ 100 => 'Ok.',
+ 101 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini.',
+ 102 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.',
+ 103 => 'The uploaded file was only partially uploaded.',
+ 104 => 'No file was uploaded.',
+ 105 => '(undefined error)',
+ 106 => 'Missing a temporary folder.',
+ 107 => 'Failed to write file to disk.',
+ 108 => 'File upload stopped by extension.'
);
###############################################################################
diff -r 9a4f84840886 -r 61917ffc519d language/german_formal.php
--- a/language/german_formal.php Sun Dec 28 20:00:25 2008 +0100
+++ b/language/german_formal.php Sun Dec 28 20:06:56 2008 +0100
@@ -1029,7 +1029,24 @@
35 => '?ndern',
36 => 'Code',
37 => 'Aktuell',
- 38 => 'Bitte aktualisieren!'
+ 38 => 'Bitte aktualisieren!',
+ 39 => 'Upload a plugin',
+ 40 => 'You can upload a plugin archive (.tar.gz, .tgz, .zip) directly here:',
+ 41 => 'Upload',
+
+ // to match the PHP error constants,
+ // http://www.php.net/manual/en/features.file-upload.errors.php
+ // TBD: move to a separate $LANG array
+ 99 => 'An unknown error occured',
+ 100 => 'Ok.',
+ 101 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini.',
+ 102 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.',
+ 103 => 'The uploaded file was only partially uploaded.',
+ 104 => 'No file was uploaded.',
+ 105 => '(undefined error)',
+ 106 => 'Missing a temporary folder.',
+ 107 => 'Failed to write file to disk.',
+ 108 => 'File upload stopped by extension.'
);
###############################################################################
diff -r 9a4f84840886 -r 61917ffc519d language/german_formal_utf-8.php
--- a/language/german_formal_utf-8.php Sun Dec 28 20:00:25 2008 +0100
+++ b/language/german_formal_utf-8.php Sun Dec 28 20:06:56 2008 +0100
@@ -1029,7 +1029,24 @@
35 => '??ndern',
36 => 'Code',
37 => 'Aktuell',
- 38 => 'Bitte aktualisieren!'
+ 38 => 'Bitte aktualisieren!',
+ 39 => 'Upload a plugin',
+ 40 => 'You can upload a plugin archive (.tar.gz, .tgz, .zip) directly here:',
+ 41 => 'Upload',
+
+ // to match the PHP error constants,
+ // http://www.php.net/manual/en/features.file-upload.errors.php
+ // TBD: move to a separate $LANG array
+ 99 => 'An unknown error occured',
+ 100 => 'Ok.',
+ 101 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini.',
+ 102 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.',
+ 103 => 'The uploaded file was only partially uploaded.',
+ 104 => 'No file was uploaded.',
+ 105 => '(undefined error)',
+ 106 => 'Missing a temporary folder.',
+ 107 => 'Failed to write file to disk.',
+ 108 => 'File upload stopped by extension.'
);
###############################################################################
diff -r 9a4f84840886 -r 61917ffc519d language/german_utf-8.php
--- a/language/german_utf-8.php Sun Dec 28 20:00:25 2008 +0100
+++ b/language/german_utf-8.php Sun Dec 28 20:06:56 2008 +0100
@@ -1028,7 +1028,24 @@
35 => '??ndern',
36 => 'Code',
37 => 'Aktuell',
- 38 => 'Bitte aktualisieren!'
+ 38 => 'Bitte aktualisieren!',
+ 39 => 'Upload a plugin',
+ 40 => 'You can upload a plugin archive (.tar.gz, .tgz, .zip) directly here:',
+ 41 => 'Upload',
+
+ // to match the PHP error constants,
+ // http://www.php.net/manual/en/features.file-upload.errors.php
+ // TBD: move to a separate $LANG array
+ 99 => 'An unknown error occured',
+ 100 => 'Ok.',
+ 101 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini.',
+ 102 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.',
+ 103 => 'The uploaded file was only partially uploaded.',
+ 104 => 'No file was uploaded.',
+ 105 => '(undefined error)',
+ 106 => 'Missing a temporary folder.',
+ 107 => 'Failed to write file to disk.',
+ 108 => 'File upload stopped by extension.'
);
###############################################################################
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:37 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:37 -0500
Subject: [geeklog-cvs] geeklog: Cosmetics - better fake
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/83b0e1e24d5b
changeset: 6606:83b0e1e24d5b
user: Dirk Haun
date: Sun Dec 28 20:12:04 2008 +0100
description:
Cosmetics - better fake
diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
public_html/admin/plugins.php | 4 ++--
diffs (21 lines):
diff -r 61917ffc519d -r 83b0e1e24d5b public_html/admin/plugins.php
--- a/public_html/admin/plugins.php Sun Dec 28 20:06:56 2008 +0100
+++ b/public_html/admin/plugins.php Sun Dec 28 20:12:04 2008 +0100
@@ -2,7 +2,7 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Geeklog 1.5 |
+// | Geeklog 1.6 |
// +---------------------------------------------------------------------------+
// | plugins.php |
// | |
@@ -1049,7 +1049,7 @@
if (empty($retval)) {
// give up and fake it
- $retval = strtoupper($plugin{0}) . substr($plugin, 1);
+ $retval = ucwords(str_replace('_', ' ', $plugin));
}
return $retval;
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:32 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:32 -0500
Subject: [geeklog-cvs] geeklog: Implemented Polls autoinstall
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/6bf615c55b68
changeset: 6603:6bf615c55b68
user: Dirk Haun
date: Sun Dec 28 10:59:04 2008 +0100
description:
Implemented Polls autoinstall
diffstat:
5 files changed, 165 insertions(+), 427 deletions(-)
plugins/polls/autoinstall.php | 116 ++++++++
plugins/polls/functions.inc | 11
plugins/polls/sql/mssql_install.php | 39 +-
plugins/polls/sql/mysql_install.php | 39 +-
public_html/admin/plugins/polls/install.php | 387 ---------------------------
diffs (truncated from 679 to 300 lines):
diff -r e85cfa6ea9fe -r 6bf615c55b68 plugins/polls/autoinstall.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/polls/autoinstall.php Sun Dec 28 10:59:04 2008 +0100
@@ -0,0 +1,116 @@
+ $pi_name,
+ 'pi_display_name' => $pi_display_name,
+ 'pi_version' => '2.1.0',
+ 'pi_gl_version' => '1.6.0',
+ 'pi_homepage' => 'http://www.geeklog.net/'
+ );
+
+ $groups = array(
+ $pi_admin => 'Has full access to ' . $pi_display_name . ' features'
+ );
+
+ $features = array(
+ $pi_name . '.edit' => 'Access to ' . $pi_name . ' editor'
+ );
+
+ $mappings = array(
+ $pi_name . '.edit' => array($pi_admin)
+ );
+
+ $tables = array(
+ 'pollanswers',
+ 'pollquestions',
+ 'polltopics',
+ 'pollvoters'
+ );
+
+ $inst_parms = array(
+ 'info' => $info,
+ 'groups' => $groups,
+ 'features' => $features,
+ 'mappings' => $mappings,
+ 'tables' => $tables
+ );
+
+ return $inst_parms;
+}
+
+function plugin_load_configuration_polls($pi_name)
+{
+ global $_CONF;
+
+ $base_path = $_CONF['path'] . 'plugins/' . $pi_name . '/';
+
+ require_once $_CONF['path_system'] . 'classes/config.class.php';
+ require_once $base_path . 'install_defaults.php';
+
+ return plugin_initconfig_polls();
+}
+
+function plugin_postinstall_polls($pi_name)
+{
+ return true;
+}
+
+function plugin_compatible_with_this_version_polls($pi_name)
+{
+ if (function_exists('COM_showPoll') || function_exists('COM_pollVote')) {
+ // if these functions exist, then someone's trying to install the
+ // plugin on Geeklog 1.3.11 or older - sorry, but that won't work
+ return false;
+ }
+
+ if (! function_exists('SEC_getGroupDropdown')) {
+ return false;
+ }
+
+ if (! function_exists('SEC_createToken')) {
+ return false;
+ }
+
+ if (! function_exists('COM_showMessageText')) {
+ return false;
+ }
+
+ return true;
+}
+
+?>
diff -r e85cfa6ea9fe -r 6bf615c55b68 plugins/polls/functions.inc
--- a/plugins/polls/functions.inc Sun Dec 28 10:13:44 2008 +0100
+++ b/plugins/polls/functions.inc Sun Dec 28 10:59:04 2008 +0100
@@ -2,7 +2,7 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Polls Plugin 2.0 |
+// | Polls Plugin 2.1 |
// +---------------------------------------------------------------------------+
// | functions.inc |
// | |
@@ -57,7 +57,6 @@
$_PO_CONF = $po_config->get_config('polls');
}
-$_PO_CONF['version'] = '2.0.1';
// +---------------------------------------------------------------------------+
// | Geeklog Plugin API Implementations |
@@ -360,9 +359,13 @@
*/
function plugin_chkVersion_polls()
{
- global $_PO_CONF;
+ global $_CONF;
- return $_PO_CONF['version'];
+ require_once $_CONF['path'] . 'plugins/polls/autoinstall.php';
+
+ $inst_parms = plugin_autoinstall_polls('polls');
+
+ return $inst_parms['info']['pi_version'];
}
/**
diff -r e85cfa6ea9fe -r 6bf615c55b68 plugins/polls/sql/mssql_install.php
--- a/plugins/polls/sql/mssql_install.php Sun Dec 28 10:13:44 2008 +0100
+++ b/plugins/polls/sql/mssql_install.php Sun Dec 28 10:59:04 2008 +0100
@@ -2,9 +2,9 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Polls Plugin 2.0 |
+// | Polls Plugin 2.1 |
// +---------------------------------------------------------------------------+
-// | Installation SQL |
+// | mssql_install.php |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2000-2008 by the following authors: |
// | |
@@ -30,8 +30,6 @@
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
-//
-// $Id: mssql_install.php,v 1.6 2008/08/12 18:13:34 mjervis Exp $
$_SQL[] = "
CREATE TABLE [dbo].[{$_TABLES['pollanswers']}] (
@@ -111,22 +109,27 @@
) ON [PRIMARY]
";
-// Note: The 'pollquestion' entry for the above answers is in the install script
-
$_SQL[] = "INSERT INTO {$_TABLES['blocks']} (is_enabled, name, type, title, tid, blockorder, content, onleft, phpblockfn, owner_id, group_id, perm_owner, perm_group) VALUES (1,'polls_block','phpblock','Poll','all',30,'',0,'phpblock_polls',{$_USER['uid']},#group#,3,3)";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 1, 'MS SQL support', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 2, 'Multi-language support', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 3, 'Calendar as a plugin', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 4, 'SLV spam protection', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 5, 'Mass-delete users', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 6, 'Other', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 1, 'Story-Images', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 2, 'User-Rights handling', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 3, 'The Support', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 4, 'Plugin Availability', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollquestions']} (qid, pid, question) VALUES (0, 'geeklogfeaturepoll', 'What is the best new feature of Geeklog?');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollquestions']} (qid, pid, question) VALUES (1, 'geeklogfeaturepoll', 'What is the all-time best feature of Geeklog?');";
+// default poll
+
+$DEFVALUES[] = "INSERT INTO {$_TABLES['polltopics']} (pid, topic, voters, questions, date, display, is_open, hideresults, commentcode, statuscode, owner_id, group_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('geeklogfeaturepoll', 'Tell us your opinion about Geeklog', 0, 2, NOW(), 1, 1, 1, 0, 0, {$_USER['uid']}, #group#, 3, 2, 2, 2);";
+
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollquestions']} (qid, pid, question) VALUES (0, 'geeklogfeaturepoll', 'What is the best new feature of Geeklog?');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollquestions']} (qid, pid, question) VALUES (1, 'geeklogfeaturepoll', 'What is the all-time best feature of Geeklog?');";
+
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 1, 'MS SQL support', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 2, 'Multi-language support', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 3, 'Calendar as a plugin', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 4, 'SLV spam protection', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 5, 'Mass-delete users', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 6, 'Other', 0, '');";
+
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 1, 'Permissions Handling', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 2, 'Spam Protection', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 3, 'Focus on Security', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 4, 'Plugin Availability', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 5, 'The Community', 0, '');";
?>
diff -r e85cfa6ea9fe -r 6bf615c55b68 plugins/polls/sql/mysql_install.php
--- a/plugins/polls/sql/mysql_install.php Sun Dec 28 10:13:44 2008 +0100
+++ b/plugins/polls/sql/mysql_install.php Sun Dec 28 10:59:04 2008 +0100
@@ -2,9 +2,9 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Polls Plugin 2.0 |
+// | Polls Plugin 2.1 |
// +---------------------------------------------------------------------------+
-// | Installation SQL |
+// | mysql_install.php |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2000-2008 by the following authors: |
// | |
@@ -29,8 +29,6 @@
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
-//
-// $Id: mysql_install.php,v 1.11 2008/05/13 18:50:42 mwest Exp $
$_SQL[] = "
CREATE TABLE {$_TABLES['pollanswers']} (
@@ -90,22 +88,27 @@
) TYPE=MyISAM
";
-// Note: The 'pollquestion' entry for the above answers is in the install script
-
$_SQL[] = "INSERT INTO {$_TABLES['blocks']} (is_enabled, name, type, title, tid, blockorder, content, onleft, phpblockfn, owner_id, group_id, perm_owner, perm_group) VALUES (1,'polls_block','phpblock','Poll','all',30,'',0,'phpblock_polls',{$_USER['uid']},#group#,3,3)";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 1, 'MS SQL support', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 2, 'Multi-language support', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 3, 'Calendar as a plugin', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 4, 'SLV spam protection', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 5, 'Mass-delete users', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 6, 'Other', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 1, 'Story-Images', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 2, 'User-Rights handling', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 3, 'The Support', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 4, 'Plugin Availability', 0, '');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollquestions']} (qid, pid, question) VALUES (0, 'geeklogfeaturepoll', 'What is the best new feature of Geeklog?');";
-$_SQL[] = "INSERT INTO {$_TABLES['pollquestions']} (qid, pid, question) VALUES (1, 'geeklogfeaturepoll', 'What is the all-time best feature of Geeklog?');";
+// default poll
+
+$DEFVALUES[] = "INSERT INTO {$_TABLES['polltopics']} (pid, topic, voters, questions, date, display, is_open, hideresults, commentcode, statuscode, owner_id, group_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('geeklogfeaturepoll', 'Tell us your opinion about Geeklog', 0, 2, NOW(), 1, 1, 1, 0, 0, {$_USER['uid']}, #group#, 3, 2, 2, 2);";
+
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollquestions']} (qid, pid, question) VALUES (0, 'geeklogfeaturepoll', 'What is the best new feature of Geeklog?');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollquestions']} (qid, pid, question) VALUES (1, 'geeklogfeaturepoll', 'What is the all-time best feature of Geeklog?');";
+
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 1, 'MS SQL support', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 2, 'Multi-language support', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 3, 'Calendar as a plugin', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 4, 'SLV spam protection', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 5, 'Mass-delete users', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 0, 6, 'Other', 0, '');";
+
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 1, 'Permissions Handling', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 2, 'Spam Protection', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 3, 'Focus on Security', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 4, 'Plugin Availability', 0, '');";
+$DEFVALUES[] = "INSERT INTO {$_TABLES['pollanswers']} (pid, qid, aid, answer, votes, remark) VALUES ('geeklogfeaturepoll', 1, 5, 'The Community', 0, '');";
?>
diff -r e85cfa6ea9fe -r 6bf615c55b68 public_html/admin/plugins/polls/install.php
--- a/public_html/admin/plugins/polls/install.php Sun Dec 28 10:13:44 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,387 +0,0 @@
-
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/8a7add14f603
changeset: 6607:8a7add14f603
user: Dirk Haun
date: Mon Dec 29 19:11:16 2008 +0100
description:
Fix paths and URLs during an upgrade, so we can install database backups elsewhere, e.g. locally
diffstat:
2 files changed, 81 insertions(+), 6 deletions(-)
public_html/admin/install/index.php | 14 +++--
public_html/admin/install/lib-install.php | 73 ++++++++++++++++++++++++++++-
diffs (141 lines):
diff -r 83b0e1e24d5b -r 8a7add14f603 public_html/admin/install/index.php
--- a/public_html/admin/install/index.php Sun Dec 28 20:12:04 2008 +0100
+++ b/public_html/admin/install/index.php Mon Dec 29 19:11:16 2008 +0100
@@ -2,7 +2,7 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Geeklog 1.5 |
+// | Geeklog 1.6 |
// +---------------------------------------------------------------------------+
// | index.php |
// | |
@@ -36,10 +36,8 @@
// | You don't need to change anything in this file. |
// | Please read docs/install.html which describes how to install Geeklog. |
// +---------------------------------------------------------------------------+
-//
-// $Id: index.php,v 1.47 2008/06/15 06:41:26 mwest Exp $
-require_once "lib-install.php";
+require_once 'lib-install.php';
/*
@@ -48,7 +46,7 @@
* The guts of the installation and upgrade package.
*
* @param string $install_type 'install' or 'upgrade'
- * @param int $install_step 1 - 3
+ * @param int $install_step 1 - 4
*/
function INST_installEngine($install_type, $install_step)
{
@@ -549,6 +547,12 @@
$config->set('site_mail', urldecode($site_mail));
$config->set('noreply_mail', urldecode($noreply_mail));
$config->set_default('default_photo', urldecode($site_url) . '/default.jpg');
+ } else {
+ $site_url = isset($_POST['site_url']) ? $_POST['site_url'] : (isset($_GET['site_url']) ? $_GET['site_url'] : '') ;
+ $site_admin_url = isset($_POST['site_admin_url']) ? $_POST['site_admin_url'] : (isset($_GET['site_admin_url']) ? $_GET['site_admin_url'] : '') ;
+
+ INST_fixPathsAndUrls($_CONF['path'], $html_path,
+ urldecode($site_url), urldecode($site_admin_url));
}
// disable plugins for which we don't have the source files
diff -r 83b0e1e24d5b -r 8a7add14f603 public_html/admin/install/lib-install.php
--- a/public_html/admin/install/lib-install.php Sun Dec 28 20:12:04 2008 +0100
+++ b/public_html/admin/install/lib-install.php Mon Dec 29 19:11:16 2008 +0100
@@ -2,7 +2,7 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Geeklog 1.5 |
+// | Geeklog 1.6 |
// +---------------------------------------------------------------------------+
// | lib-install.php |
// | |
@@ -11,6 +11,7 @@
// | Copyright (C) 2008 by the following authors: |
// | |
// | Authors: Matt West - matt.danger.west AT gmail DOT com |
+// | Dirk Haun - dirk AT haun-online DOT de |
// +---------------------------------------------------------------------------+
// | |
// | This program is free software; you can redistribute it and/or |
@@ -1051,4 +1052,74 @@
}
}
+/**
+* Do a sanity check on the paths and URLs
+*
+* This is somewhat speculative but should provide the user with a working
+* site even if, for example, a site backup was installed elsewhere.
+*
+* @param string $path proper /path/to/Geeklog
+* @param string $path_html path to public_html
+* @param string $site_url The site's URL
+* @param string $site_admin_url URL to the admin directory
+*
+*/
+function INST_fixPathsAndUrls($path, $path_html, $site_url, $site_admin_url)
+{
+ // no global $_CONF here!
+
+ require_once $path . 'system/classes/config.class.php';
+
+ $config = config::get_instance();
+ $config->set_configfile($path . 'db-config.php');
+ $config->load_baseconfig();
+ $config->initConfig();
+ $_CONF = $config->get_config('Core');
+
+ if (! file_exists($_CONF['path_log'] . 'error.log')) {
+ $config->set('path_log', $path . 'logs/');
+ }
+ if (! file_exists($_CONF['path_language'] . $_CONF['language'] . '.php')) {
+ $config->set('path_language', $path . 'language/');
+ }
+ if (! file_exists($_CONF['backup_path'])) {
+ $config->set('backup_path', $path . 'backups/');
+ }
+ if (! file_exists($_CONF['path_data'])) {
+ $config->set('path_data', $path . 'data/');
+ }
+ if ((! $_CONF['have_pear']) &&
+ (! file_exists($_CONF['path_pear'] . 'PEAR.php'))) {
+ $config->set('path_pear', $path . 'system/pear/');
+ }
+
+ if (! file_exists($_CONF['path_html'] . 'lib-common.php')) {
+ $config->set('path_html', $path_html);
+ }
+ if (! file_exists($_CONF['path_themes'] . $_CONF['theme']
+ . '/header.thtml')) {
+ $config->set('path_themes', $path_html . 'layout/');
+ }
+ if (! file_exists($_CONF['path_images'] . 'articles')) {
+ $config->set('path_images', $path_html . 'images/');
+ }
+ if (substr($_CONF['rdf_file'], strlen($path_html)) != $path_html) {
+ // this may not be correct but neither was the old value apparently ...
+ $config->set('rdf_file', $path_html . 'backend/geeklog.rss');
+ }
+
+ if (! empty($site_url) && ($_CONF['site_url'] != $site_url)) {
+ $config->set('site_url', $site_url);
+
+ // if we had to fix the site's URL, chances are that cookie domain
+ // and path are also wrong and the user won't be able to log in
+ $config->set('cookiedomain', '');
+ $config->set('cookie_path', '/');
+ }
+ if (! empty($site_admin_url) &&
+ ($_CONF['site_admin_url'] != $site_admin_url)) {
+ $config->set('site_admin_url', $site_admin_url);
+ }
+}
+
?>
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:39 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:39 -0500
Subject: [geeklog-cvs] geeklog: Read SQL dump line by line (or we may run
into memory l...
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/ee69c79e8aa5
changeset: 6608:ee69c79e8aa5
user: Dirk Haun
date: Mon Dec 29 21:40:27 2008 +0100
description:
Read SQL dump line by line (or we may run into memory limits); reset cookie domain and path
diffstat:
1 file changed, 29 insertions(+), 12 deletions(-)
public_html/admin/install/migrate.php | 41 +++++++++++++++++++++++----------
diffs (89 lines):
diff -r 8a7add14f603 -r ee69c79e8aa5 public_html/admin/install/migrate.php
--- a/public_html/admin/install/migrate.php Mon Dec 29 19:11:16 2008 +0100
+++ b/public_html/admin/install/migrate.php Mon Dec 29 21:40:27 2008 +0100
@@ -2,7 +2,7 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Geeklog 1.5 |
+// | Geeklog 1.6 |
// +---------------------------------------------------------------------------+
// | migrate.php |
// | |
@@ -31,10 +31,10 @@
// | You don't need to change anything in this file. |
// | Please read docs/install.html which describes how to install Geeklog. |
// +---------------------------------------------------------------------------+
-//
-require_once "lib-install.php";
+require_once 'lib-install.php';
require_once '../../siteconfig.php';
+
// +---------------------------------------------------------------------------+
// | Main |
@@ -44,7 +44,7 @@
$html_path = str_replace('admin/install/migrate.php', '', str_replace('admin\install\migrate.php', '', str_replace('\\', '/', __FILE__)));
$siteconfig_path = '../../siteconfig.php';
-if ($_CONF['path'] == '/path/to/Geeklog/') { // If the Geeklog path has not been?defined.
+if ($_CONF['path'] == '/path/to/Geeklog/') { // If the Geeklog path has not been defined.
// Attempt to locate Geeklog's path
$gl_path = strtr(__FILE__, '\\', '/'); // replace all '\' with '/'
@@ -406,16 +406,29 @@
}
// Parse the .sql file to grab the table prefix
+ $has_config = false;
+
$sql_file = fopen($backup_dir . $backup_file, 'r');
- $sql_data = fread($sql_file, filesize($backup_dir . $backup_file));
+ while (! feof($sql_file)) {
+ $line = @fgets($sql_file);
+ if (! empty($line)) {
+ if (preg_match('/CREATE TABLE/i', $line)) {
+ $line = trim($line);
+ if (strpos($line, 'access`') !== false) {
+ $DB['table_prefix'] = preg_replace('/^.*`/', '', preg_replace('/access`.*$/', '', $line));
+ } elseif (strpos($line, 'conf_values') !== false) {
+ $has_config = true;
+ break;
+ } elseif (strpos($line, 'featurecodes') !== false) {
+ // assume there's no conf_values table in this db dump
+ break;
+ }
+ }
+ }
+ }
fclose($sql_file);
- $sql_data = preg_replace('/\n/', '', $sql_data);
- $DB['table_prefix'] = preg_replace('/^.*`/', '', preg_replace('/access`.*$/', '', $sql_data));
- // Check if the backup file is version 1.5 or newer
-// if (preg_match('/conf_values/', $sql_data)) {
-if(1){
-
+ if ($has_config) {
// Update db-config.php with the table prefix from the backup file.
if (!INST_writeConfig($_REQUEST['dbconfig_path'], $DB)) {
exit($LANG_INSTALL[26] . ' ' . $dbconfig_path . $LANG_INSTALL[58]);
@@ -465,6 +478,10 @@
$config->set('path_themes', $html_path . 'layout/');
$config->set('rdf_file', $html_path . 'backend/geeklog.rss');
$config->set('path_pear', $_CONF['path_system'] . 'pear/');
+
+ // reset cookie domain and path as wrong values may prevent login
+ $config->set('cookiedomain', '');
+ $config->set('cookie_path', '/');
/**
* Check for missing plugins
@@ -634,4 +651,4 @@
echo $display;
-?>
\ No newline at end of file
+?>
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:40 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:40 -0500
Subject: [geeklog-cvs] geeklog: Don't change existing texts - added a new
entry instead
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/1f658d7e55a2
changeset: 6609:1f658d7e55a2
user: Dirk Haun
date: Tue Dec 30 10:30:26 2008 +0100
description:
Don't change existing texts - added a new entry instead
diffstat:
2 files changed, 5 insertions(+), 6 deletions(-)
public_html/admin/install/index.php | 2 +-
public_html/admin/install/language/english.php | 9 ++++-----
diffs (52 lines):
diff -r ee69c79e8aa5 -r 1f658d7e55a2 public_html/admin/install/index.php
--- a/public_html/admin/install/index.php Mon Dec 29 21:40:27 2008 +0100
+++ b/public_html/admin/install/index.php Tue Dec 30 10:30:26 2008 +0100
@@ -1777,7 +1777,7 @@
if ($num_wrong) {
// If any files have incorrect permissions.
- $display .= INST_printTab(2) . '' . 'Step' . ' ' . $display_step . ' - ' . $LANG_INSTALL[14] . ' ' . LB;
+ $display .= INST_printTab(2) . '' . 'Step' . ' ' . $display_step . ' - ' . $LANG_INSTALL[97] . ' ' . LB;
$display_step++;
if (isset($_GET['install_type'])) {
diff -r ee69c79e8aa5 -r 1f658d7e55a2 public_html/admin/install/language/english.php
--- a/public_html/admin/install/language/english.php Mon Dec 29 21:40:27 2008 +0100
+++ b/public_html/admin/install/language/english.php Tue Dec 30 10:30:26 2008 +0100
@@ -2,7 +2,7 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Geeklog 1.5 |
+// | Geeklog 1.6 |
// +---------------------------------------------------------------------------+
// | english.php |
// | |
@@ -33,8 +33,6 @@
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
-//
-// $Id: english.php,v 1.11 2008/05/01 21:08:31 dhaun Exp $
// +---------------------------------------------------------------------------+
@@ -65,7 +63,7 @@
11 => 'Permissions',
12 => 'Change to',
13 => 'Currently',
- 14 => 'Set File Permissions',
+ 14 => '',
15 => 'Export of Geeklog headlines is switched off. The backend directory was not tested',
17 => 'User photos are disabled. The userphotos directory was not tested',
18 => 'Images in articles are disabled. The articles directory was not tested',
@@ -146,7 +144,8 @@
93 => 'Success',
94 => 'Here are some hints to find the correct path:',
95 => 'The complete path to this file (the install script) is:',
- 96 => 'The installer was looking for %s in:'
+ 96 => 'The installer was looking for %s in:',
+ 97 => 'Set File Permissions'
);
// +---------------------------------------------------------------------------+
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:44 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:44 -0500
Subject: [geeklog-cvs] geeklog: Moved hard-coded text strings to the
language file
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/05fc48ded7de
changeset: 6610:05fc48ded7de
user: Dirk Haun
date: Tue Dec 30 10:45:19 2008 +0100
description:
Moved hard-coded text strings to the language file
diffstat:
2 files changed, 10 insertions(+), 7 deletions(-)
public_html/admin/install/index.php | 12 ++++++------
public_html/admin/install/language/english.php | 5 ++++-
diffs (51 lines):
diff -r 1f658d7e55a2 -r 05fc48ded7de public_html/admin/install/index.php
--- a/public_html/admin/install/index.php Tue Dec 30 10:30:26 2008 +0100
+++ b/public_html/admin/install/index.php Tue Dec 30 10:45:19 2008 +0100
@@ -1794,8 +1794,8 @@
// Also, list the auto-generated chmod command for advanced users
$display .= INST_printTab(3) . '' . LB
. $display_permissions . INST_printTab(3) . '
' . LB
- . INST_printTab(3) . '' . 'Advanced Users' . ' ' . LB
- . INST_printTab(3) . '' . 'If you have command line (SSH) access to your web server then you can simple copy and paste the following command into your shell: ' . '
' . LB
+ . INST_printTab(3) . '' . $LANG_INSTALL[98] . ' ' . LB
+ . INST_printTab(3) . '' . $LANG_INSTALL[99] . '
' . LB
. INST_printTab(3) . '
' . $chmod_string . LB
. INST_printTab(3) . '
' . LB;
$step++;
@@ -1893,8 +1893,8 @@
. '&display_step=' . $_REQUEST['display_step']);
break;
default:
- $display .= 'Invalid mode specified
' . LB;
-
+ $display .= '' . $LANG_INSTALL[100] . '
' . LB;
+ break;
}
break;
@@ -1905,8 +1905,8 @@
case 'install': // Deliberate fall-through, no "break"
case 'upgrade':
- if (($mode == 'upgrade') && ($step == 4)) {
- // for the plugin upgrade,
+ if ($step == 4) {
+ // for the plugin install and upgrade,
// we need lib-common.php in the global(!) namespace
require_once '../../lib-common.php';
}
diff -r 1f658d7e55a2 -r 05fc48ded7de public_html/admin/install/language/english.php
--- a/public_html/admin/install/language/english.php Tue Dec 30 10:30:26 2008 +0100
+++ b/public_html/admin/install/language/english.php Tue Dec 30 10:45:19 2008 +0100
@@ -145,7 +145,10 @@
94 => 'Here are some hints to find the correct path:',
95 => 'The complete path to this file (the install script) is:',
96 => 'The installer was looking for %s in:',
- 97 => 'Set File Permissions'
+ 97 => 'Set File Permissions',
+ 98 => 'Advanced Users',
+ 99 => 'If you have command line (SSH) access to your web server then you can simple copy and paste the following command into your shell:',
+ 100 => 'Invalid mode specified'
);
// +---------------------------------------------------------------------------+
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:44 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:44 -0500
Subject: [geeklog-cvs] geeklog: Allow import from compressed database backups
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/f9452c50d580
changeset: 6611:f9452c50d580
user: Dirk Haun
date: Tue Dec 30 19:06:49 2008 +0100
description:
Allow import from compressed database backups
diffstat:
2 files changed, 143 insertions(+), 41 deletions(-)
public_html/admin/install/language/english.php | 2
public_html/admin/install/migrate.php | 182 ++++++++++++++++++------
diffs (246 lines):
diff -r 05fc48ded7de -r f9452c50d580 public_html/admin/install/language/english.php
--- a/public_html/admin/install/language/english.php Tue Dec 30 10:45:19 2008 +0100
+++ b/public_html/admin/install/language/english.php Tue Dec 30 19:06:49 2008 +0100
@@ -218,7 +218,7 @@
11 => 'No backup files found.',
12 => 'The upload limit for this server is ',
13 => '. If your backup file is larger than ',
- 14 => ' or if you experience a timeout, then you should upload he file to Geeklog\'s backups directory via FTP.',
+ 14 => ' or if you experience a timeout, then you should upload the file to Geeklog\'s backups directory via FTP.',
15 => 'Your backups directory is not writable by the web server. Permissions need to be 777.',
16 => 'Migrate',
17 => 'Migrate From Backup',
diff -r 05fc48ded7de -r f9452c50d580 public_html/admin/install/migrate.php
--- a/public_html/admin/install/migrate.php Tue Dec 30 10:45:19 2008 +0100
+++ b/public_html/admin/install/migrate.php Tue Dec 30 19:06:49 2008 +0100
@@ -28,13 +28,99 @@
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
-// | You don't need to change anything in this file. |
-// | Please read docs/install.html which describes how to install Geeklog. |
-// +---------------------------------------------------------------------------+
require_once 'lib-install.php';
require_once '../../siteconfig.php';
+
+/**
+* Unpack a db backup file, if necessary
+*
+* Note: This requires a minimal PEAR setup (incl. Tar and Zip classes) and a
+* way to set the PEAR include path. But if that doesn't work on your
+* setup, then chances are you won't get Geeklog up and running anyway ...
+*
+* @param string $backup_path path to the "backups" directory
+* @param string $backup_file backup file name
+* @param ref $display reference to HTML string (for error msg)
+* @return mixed file name of unpacked file or false: error
+*
+*/
+function INST_unpackFile($backup_path, $backup_file, &$display)
+{
+ global $_CONF;
+
+ $unpacked_file = $backup_file;
+
+ $type = '';
+ if (preg_match('/\.zip$/i', $backup_file)) {
+ $type = 'zip';
+ } elseif (preg_match('/\.tar.gz$/i', $backup_file) ||
+ preg_match('/\.tgz$/i', $backup_file)) {
+ $type = 'tar';
+ }
+
+ if (empty($type)) {
+ // not packed
+ return $backup_file;
+ }
+
+ $include_path = @ini_get('include_path');
+ if (@ini_set('include_path', $_CONF['path'] . 'system/pear/'
+ . PATH_SEPARATOR . $include_path) === false) {
+
+
+ $display .= INST_getAlertMsg("Failed to set PEAR include path. Sorry, can't handle compressed database backups without PEAR.");
+ return false;
+ }
+
+ if ($type == 'zip') {
+
+ require_once 'Archive/Zip.php';
+
+ $archive = new Archive_Zip($backup_path . $backup_file);
+
+ } else {
+
+ require_once 'Archive/Tar.php';
+
+ $archive = new Archive_Tar($backup_path . $backup_file);
+
+ }
+
+ $files = $archive->listContent();
+ $dirname = preg_replace('/\/.*$/', '', $files[0]['filename']);
+ if ($dirname == $files[0]['filename']) {
+ $dirname = ''; // no directory
+ }
+ $success = false;
+ if ($type == 'zip') {
+ $result = $archive->extract(array('add_path' => $backup_path,
+ 'remove_path' => $dirname));
+ if (is_array($result)) {
+ $success = true;
+ }
+ } else {
+ $result = $archive->extractList(array($files[0]['filename']),
+ $backup_path, $dirname);
+ $success = $result;
+ }
+
+ if (empty($dirname)) {
+ $unpacked_file = $files[0]['filename'];
+ } else {
+ $unpacked_file = substr($files[0]['filename'], strlen($dirname) + 1);
+ }
+
+ if ((! $success) || (! file_exists($backup_path . $unpacked_file))) {
+ $display .= INST_getAlertMsg(sprintf("Error extracting database backup '%s' from compressed backup file.", $unpacked_file));
+ return false;
+ }
+
+ unset($archive);
+
+ return $unpacked_file;
+}
// +---------------------------------------------------------------------------+
// | Main |
@@ -127,7 +213,13 @@
. INST_printTab(3) . '' . $LANG_INSTALL[45] . ' ' . INST_helpLink('site_url') . ' ' . $LANG_INSTALL[46] . '
' . LB
. INST_printTab(3) . '' . $LANG_INSTALL[47] . ' ' . INST_helpLink('site_admin_url') . ' ' . $LANG_INSTALL[46] . '
' . LB;
- rsort($backup_files = glob($backup_dir . '*.sql')); // Identify the backup files in backups/ and order them newest to oldest
+ //rsort($backup_files = glob($backup_dir . '*.sql')); // Identify the backup files in backups/ and order them newest to oldest
+ $sql_files = glob($backup_dir . '*.sql');
+ $tar_files = glob($backup_dir . '*.tar.gz');
+ $tgz_files = glob($backup_dir . '*.tgz');
+ $zip_files = glob($backup_dir . '*.zip');
+ $backup_files = array_merge($sql_files, $tar_files, $tgz_files, $zip_files);
+ rsort($backup_files); // Identify the backup files in backups/ and order them newest to oldest
$display .= INST_printTab(3) . '' . $LANG_MIGRATE[6] . ' ' . INST_helpLink('migrate_file') . ' ' . LB
. INST_printTab(4) . '' . LB
@@ -338,7 +430,7 @@
// Ask the user if they want to overwrite the original
// but for now save the file as a copy so it won't need
// to be uploaded again.
- $backup_file_copy = str_replace('.sql', '_copy.sql', $backup_file['name']);
+ $backup_file_copy = str_replace('.sql', '_uploaded.sql', $backup_file['name']);
if (!move_uploaded_file($backup_file['tmp_name'], $backup_dir . $backup_file_copy)) { // If able to save the file
$display .= $LANG_MIGRATE[19] . $backup_file_copy . $LANG_MIGRATE[20] . $backup_dir . '.' . LB;
@@ -387,7 +479,7 @@
/**
* Page 3 - Gets the database table prefix from the database file.
- * Overwrites the an existing database file if requested by the user.
+ * Overwrites an existing database file if requested by the user.
* Sends the database filename (and a few other variables)
* to bigdump.php, which performs the import.
*
@@ -401,50 +493,60 @@
if (isset($_REQUEST['overwrite_file'])) {
// Overwrite the old file with the new file.
- rename($backup_dir . str_replace('.sql', '_copy.sql', $backup_file), $backup_dir . $backup_file);
+ rename($backup_dir . str_replace('.sql', '_uploaded.sql', $backup_file), $backup_dir . $backup_file);
}
- // Parse the .sql file to grab the table prefix
- $has_config = false;
+ $unpacked_file = INST_unpackFile($backup_dir, $backup_file, $display);
+ if ($unpacked_file !== false) {
- $sql_file = fopen($backup_dir . $backup_file, 'r');
- while (! feof($sql_file)) {
- $line = @fgets($sql_file);
- if (! empty($line)) {
- if (preg_match('/CREATE TABLE/i', $line)) {
- $line = trim($line);
- if (strpos($line, 'access`') !== false) {
- $DB['table_prefix'] = preg_replace('/^.*`/', '', preg_replace('/access`.*$/', '', $line));
- } elseif (strpos($line, 'conf_values') !== false) {
- $has_config = true;
- break;
- } elseif (strpos($line, 'featurecodes') !== false) {
- // assume there's no conf_values table in this db dump
- break;
+ $backup_file = $unpacked_file;
+
+ // Parse the .sql file to grab the table prefix
+ $has_config = false;
+
+ $sql_file = @fopen($backup_dir . $backup_file, 'r');
+ if (! $sql_file) {
+ exit(sprintf("Backup file '%s' just vanished ...", $backup_dir . $backup_file));
+ }
+ while (! feof($sql_file)) {
+ $line = @fgets($sql_file);
+ if (! empty($line)) {
+ if (preg_match('/CREATE TABLE/i', $line)) {
+ $line = trim($line);
+ if (strpos($line, 'access`') !== false) {
+ $DB['table_prefix'] = preg_replace('/^.*`/', '', preg_replace('/access`.*$/', '', $line));
+ } elseif (strpos($line, 'conf_values') !== false) {
+ $has_config = true;
+ break;
+ } elseif (strpos($line, 'featurecodes') !== false) {
+ // assume there's no conf_values table in here
+ break;
+ }
}
}
}
- }
- fclose($sql_file);
+ fclose($sql_file);
- if ($has_config) {
- // Update db-config.php with the table prefix from the backup file.
- if (!INST_writeConfig($_REQUEST['dbconfig_path'], $DB)) {
- exit($LANG_INSTALL[26] . ' ' . $dbconfig_path . $LANG_INSTALL[58]);
+ if ($has_config) {
+ // Update db-config.php with the table prefix from the backup file.
+ if (!INST_writeConfig($_REQUEST['dbconfig_path'], $DB)) {
+ exit($LANG_INSTALL[26] . ' ' . $dbconfig_path . $LANG_INSTALL[58]);
+ }
+
+ // Send file to bigdump.php script to do the import.
+ header('Location: bigdump.php?start=1&foffset=0&totalqueries=0'
+ . '&language=' . $language
+ . '&fn=' . urlencode($backup_dir . $backup_file)
+ . '&site_url=' . urlencode($_REQUEST['site_url'])
+ . '&site_admin_url=' . urlencode($_REQUEST['site_admin_url']));
+
+ } else {
+
+ $display .= INST_getAlertMsg($LANG_MIGRATE[25]);
+
}
-
- // Send file to bigdump.php script to do the import.
- header('Location: bigdump.php?start=1&foffset=0&totalqueries=0'
- . '&language=' . $language
- . '&fn=' . urlencode($backup_dir . $backup_file)
- . '&site_url=' . urlencode($_REQUEST['site_url'])
- . '&site_admin_url=' . urlencode($_REQUEST['site_admin_url']));
- } else {
-
- $display .= INST_getAlertMsg($LANG_MIGRATE[25]);
-
}
break;
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:46 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:46 -0500
Subject: [geeklog-cvs] geeklog: Fixed ZIP file extract (really this time)
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/3019482cbae4
changeset: 6613:3019482cbae4
user: Dirk Haun
date: Tue Dec 30 21:33:11 2008 +0100
description:
Fixed ZIP file extract (really this time)
diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
public_html/admin/install/migrate.php | 2 +-
diffs (12 lines):
diff -r c31c0e58857f -r 3019482cbae4 public_html/admin/install/migrate.php
--- a/public_html/admin/install/migrate.php Tue Dec 30 21:21:33 2008 +0100
+++ b/public_html/admin/install/migrate.php Tue Dec 30 21:33:11 2008 +0100
@@ -116,7 +116,7 @@
$success = false;
if ($type == 'zip') {
$result = $archive->extract(array('add_path' => $backup_path,
- 'by_name' => $unpacked_file,
+ 'by_name' => array($file['filename']),
'remove_path' => $dirname));
if (is_array($result)) {
$success = true;
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:45 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:45 -0500
Subject: [geeklog-cvs] geeklog: Fixed ZIP file extract and improved
detection of non-SQ...
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/c31c0e58857f
changeset: 6612:c31c0e58857f
user: Dirk Haun
date: Tue Dec 30 21:21:33 2008 +0100
description:
Fixed ZIP file extract and improved detection of non-SQL dumps and archives
diffstat:
1 file changed, 34 insertions(+), 12 deletions(-)
public_html/admin/install/migrate.php | 46 ++++++++++++++++++++++++---------
diffs (105 lines):
diff -r f9452c50d580 -r c31c0e58857f public_html/admin/install/migrate.php
--- a/public_html/admin/install/migrate.php Tue Dec 30 19:06:49 2008 +0100
+++ b/public_html/admin/install/migrate.php Tue Dec 30 21:21:33 2008 +0100
@@ -69,7 +69,6 @@
if (@ini_set('include_path', $_CONF['path'] . 'system/pear/'
. PATH_SEPARATOR . $include_path) === false) {
-
$display .= INST_getAlertMsg("Failed to set PEAR include path. Sorry, can't handle compressed database backups without PEAR.");
return false;
}
@@ -88,29 +87,45 @@
}
+ $found_sql_file = false;
$files = $archive->listContent();
- $dirname = preg_replace('/\/.*$/', '', $files[0]['filename']);
- if ($dirname == $files[0]['filename']) {
+ foreach ($files as $file) {
+ if (! $file['folder']) {
+ if (preg_match('/\.sql$/', $file['filename'])) {
+ $dirname = preg_replace('/\/.*$/', '', $file['filename']);
+ $found_sql_file = true;
+ break;
+ }
+ }
+ }
+
+ if (! $found_sql_file) {
+ $display .= INST_getAlertMsg(sprintf("The archive '%s' does not appear to contain any SQL files.", $backup_file));
+ return false;
+ }
+
+ if ($dirname == $file['filename']) {
$dirname = ''; // no directory
}
+ if (empty($dirname)) {
+ $unpacked_file = $file['filename'];
+ } else {
+ $unpacked_file = substr($file['filename'], strlen($dirname) + 1);
+ }
+
$success = false;
if ($type == 'zip') {
$result = $archive->extract(array('add_path' => $backup_path,
+ 'by_name' => $unpacked_file,
'remove_path' => $dirname));
if (is_array($result)) {
$success = true;
}
} else {
- $result = $archive->extractList(array($files[0]['filename']),
+ $result = $archive->extractList(array($file['filename']),
$backup_path, $dirname);
$success = $result;
}
-
- if (empty($dirname)) {
- $unpacked_file = $files[0]['filename'];
- } else {
- $unpacked_file = substr($files[0]['filename'], strlen($dirname) + 1);
- }
if ((! $success) || (! file_exists($backup_path . $unpacked_file))) {
$display .= INST_getAlertMsg(sprintf("Error extracting database backup '%s' from compressed backup file.", $unpacked_file));
@@ -504,6 +519,7 @@
// Parse the .sql file to grab the table prefix
$has_config = false;
+ $num_create = 0;
$sql_file = @fopen($backup_dir . $backup_file, 'r');
if (! $sql_file) {
@@ -513,6 +529,7 @@
$line = @fgets($sql_file);
if (! empty($line)) {
if (preg_match('/CREATE TABLE/i', $line)) {
+ $num_create++;
$line = trim($line);
if (strpos($line, 'access`') !== false) {
$DB['table_prefix'] = preg_replace('/^.*`/', '', preg_replace('/access`.*$/', '', $line));
@@ -528,7 +545,12 @@
}
fclose($sql_file);
- if ($has_config) {
+ if ($num_create <= 1) {
+
+ // this doesn't look like an SQL dump ...
+ $display .= INST_getAlertMsg(sprintf("Import aborted: The file '%s' does not appear to be an SQL dump.", $backup_file));
+
+ } elseif ($has_config) {
// Update db-config.php with the table prefix from the backup file.
if (!INST_writeConfig($_REQUEST['dbconfig_path'], $DB)) {
exit($LANG_INSTALL[26] . ' ' . $dbconfig_path . $LANG_INSTALL[58]);
@@ -543,7 +565,7 @@
} else {
- $display .= INST_getAlertMsg($LANG_MIGRATE[25]);
+ $display .= INST_getAlertMsg($LANG_MIGRATE[25]);
}
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:49 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:49 -0500
Subject: [geeklog-cvs] geeklog: Filter out MySQL-specific /*!... "commands
in comments"...
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/5ae4a81df4b2
changeset: 6616:5ae4a81df4b2
user: Dirk Haun
date: Wed Dec 31 15:13:02 2008 +0100
description:
Filter out MySQL-specific /*!... "commands in comments" for now
diffstat:
1 file changed, 3 insertions(+), 4 deletions(-)
public_html/admin/install/bigdump.php | 7 +++----
diffs (36 lines):
diff -r 33002d96c8e2 -r 5ae4a81df4b2 public_html/admin/install/bigdump.php
--- a/public_html/admin/install/bigdump.php Wed Dec 31 13:49:45 2008 +0100
+++ b/public_html/admin/install/bigdump.php Wed Dec 31 15:13:02 2008 +0100
@@ -2,7 +2,7 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Geeklog 1.5 |
+// | Geeklog 1.6 |
// +---------------------------------------------------------------------------+
// | bigdump.php |
// | |
@@ -29,7 +29,6 @@
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
-//
//
// BigDump ver. 0.29b from 2008-01-19
@@ -68,7 +67,7 @@
$comment[]='-- ';
// $comment[]='---'; // Uncomment this line if using proprietary dump created by outdated mysqldump
// $comment[]='CREATE DATABASE'; // Uncomment this line if your dump contains create database queries in order to ignore them
-// $comment[]='/*!'; // Or add your own string to leave out other proprietary things
+$comment[]='/*!'; // Or add your own string to leave out other proprietary things
// Connection character set should be the same as the dump file character set (utf8, latin1, cp1251, koi8r etc.)
// See http://dev.mysql.com/doc/refman/5.0/en/charset-charsets.html for the full list
@@ -392,4 +391,4 @@
echo INST_getFooter();
-?>
\ No newline at end of file
+?>
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:48 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:48 -0500
Subject: [geeklog-cvs] geeklog: Report failed plugin upgrades and prepare
for nicer err...
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/33002d96c8e2
changeset: 6615:33002d96c8e2
user: Dirk Haun
date: Wed Dec 31 13:49:45 2008 +0100
description:
Report failed plugin upgrades and prepare for nicer error messages
diffstat:
3 files changed, 40 insertions(+), 7 deletions(-)
public_html/admin/install/lib-install.php | 3 --
public_html/admin/install/lib-upgrade.php | 6 ++++
public_html/admin/install/migrate.php | 38 +++++++++++++++++++++++++----
diffs (129 lines):
diff -r b82e1a0538e0 -r 33002d96c8e2 public_html/admin/install/lib-install.php
--- a/public_html/admin/install/lib-install.php Wed Dec 31 12:02:54 2008 +0100
+++ b/public_html/admin/install/lib-install.php Wed Dec 31 13:49:45 2008 +0100
@@ -46,8 +46,7 @@
if (function_exists('ini_set')) {
ini_set('display_errors', '1');
}
-//error_reporting(E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR | E_NOTICE);
-error_reporting(E_ALL);
+error_reporting(E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR | E_NOTICE);
if (!defined('LB')) {
define('LB', "\n");
diff -r b82e1a0538e0 -r 33002d96c8e2 public_html/admin/install/lib-upgrade.php
--- a/public_html/admin/install/lib-upgrade.php Wed Dec 31 12:02:54 2008 +0100
+++ b/public_html/admin/install/lib-upgrade.php Wed Dec 31 13:49:45 2008 +0100
@@ -718,11 +718,14 @@
*
* @note Needs a fully working Geeklog, so can only be done late in the upgrade
* process!
+* @return int number of failed plugin updates (0 = everything's fine)
*
*/
function INST_pluginUpgrades()
{
global $_CONF, $_TABLES;
+
+ $failed = 0;
$result = DB_query("SELECT pi_name, pi_version FROM {$_TABLES['plugins']} WHERE pi_enabled = 1");
$numPlugins = DB_numRows($result);
@@ -736,9 +739,12 @@
// upgrade failed - disable plugin
DB_query("UPDATE {$_TABLES['plugins']} SET pi_enabled = 0 WHERE pi_name = '$pi_name'");
COM_errorLog("Upgrade for '$pi_name' plugin failed - plugin disabled");
+ $failed++;
}
}
}
+
+ return $failed;
}
?>
diff -r b82e1a0538e0 -r 33002d96c8e2 public_html/admin/install/migrate.php
--- a/public_html/admin/install/migrate.php Wed Dec 31 12:02:54 2008 +0100
+++ b/public_html/admin/install/migrate.php Wed Dec 31 13:49:45 2008 +0100
@@ -583,11 +583,20 @@
require_once $_CONF['path_system'] . 'lib-database.php';
require_once 'lib-upgrade.php';
+ $upgrade_error = false;
+
$version = INST_identifyGeeklogVersion();
if ($version == 'empty') {
- exit("Fatal: Database import seems to have failed?!");
+
+ // "This shouldn't happen"
+ $display .= INST_getAlertMsg("Fatal error: Database import seems to have failed. Don't know how to continue.");
+ $upgrade_error = true;
+
} elseif (empty($version)) {
- exit("Could not identify version. Please perform a manual update.");
+
+ $display .= INST_getAlertMsg("Could not identify database version. Please perform a manual update.");
+ $upgrade_error = true;
+
} elseif ($version != VERSION) {
$use_innodb = false;
@@ -598,8 +607,19 @@
}
if (! INST_doDatabaseUpgrades($version)) {
- exit("Database upgrade from version $version to version " . VERSION . " failed!");
+
+ $display .= INST_getAlertMsg("Database upgrade from version $version to version " . VERSION . " failed.");
+ $upgrade_error = true;
+
}
+
+ }
+
+ if ($upgrade_error) {
+
+ $display .= INST_getFooter();
+ echo $display;
+ exit;
}
@@ -671,12 +691,13 @@
}
+ $disabled_plugins = 0;
if ($version != VERSION) {
// We did a database upgrade above. Now that any missing plugins
// have been disabled and we've loaded lib-common.php, perform
// upgrades for the remaining plugins.
- INST_pluginUpgrades();
+ $disabled_plugins = INST_pluginUpgrades();
}
@@ -749,7 +770,8 @@
*/
// Check if there are any missing files or plugins
- if ($missing_images || ($missing_plugins > 0)) {
+ if ($missing_images || ($missing_plugins > 0) ||
+ ($disabled_plugins > 0)) {
$display .= '' . $LANG_MIGRATE[37] . ' ' . LB
. '' . $LANG_MIGRATE[38] . '
' . LB;
@@ -758,6 +780,12 @@
if ($missing_plugins > 0) {
$display .= INST_getAlertMsg($LANG_MIGRATE[32] . ' ' . $_CONF['path'] . 'plugins/ ' . $LANG_MIGRATE[33], 'notice');
+
+ }
+
+ if ($disabled_plugins > 0) {
+
+ $display .= INST_getAlertMsg("One or more plugins could not be updated and had to be disabled.");
}
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:47 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:47 -0500
Subject: [geeklog-cvs] geeklog: Migration can now also update the database
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/b82e1a0538e0
changeset: 6614:b82e1a0538e0
user: Dirk Haun
date: Wed Dec 31 12:02:54 2008 +0100
description:
Migration can now also update the database
diffstat:
5 files changed, 798 insertions(+), 747 deletions(-)
public_html/admin/install/index.php | 648 -------------------------
public_html/admin/install/install.php | 37 -
public_html/admin/install/lib-install.php | 68 --
public_html/admin/install/lib-upgrade.php | 744 +++++++++++++++++++++++++++++
public_html/admin/install/migrate.php | 48 +
diffs (truncated from 1698 to 300 lines):
diff -r 3019482cbae4 -r b82e1a0538e0 public_html/admin/install/index.php
--- a/public_html/admin/install/index.php Tue Dec 30 21:33:11 2008 +0100
+++ b/public_html/admin/install/index.php Wed Dec 31 12:02:54 2008 +0100
@@ -38,9 +38,10 @@
// +---------------------------------------------------------------------------+
require_once 'lib-install.php';
+require_once 'lib-upgrade.php';
-/*
+/**
* Installer engine
*
* The guts of the installation and upgrade package.
@@ -323,7 +324,7 @@
case 'upgrade':
// Try and find out what the current version of GL is
- $curv = INST_identifyGeeklogVersion ();
+ $curv = INST_identifyGeeklogVersion();
if ($curv == VERSION) {
// If current version is the newest version
// then there's no need to update.
@@ -528,7 +529,7 @@
}
}
- if (INST_doDatabaseUpgrades($version, $use_innodb)) {
+ if (INST_doDatabaseUpgrades($version)) {
if (version_compare($version, '1.5.0') == -1) {
// After updating the database we'll want to update some of the information from the form.
$site_name = isset($_POST['site_name']) ? $_POST['site_name'] : (isset($_GET['site_name']) ? $_GET['site_name'] : '') ;
@@ -695,143 +696,6 @@
';
return $display;
-}
-
-
-/**
- * Get the current installed version of Geeklog
- *
- * @return Geeklog version in x.x.x format
- *
- */
-function INST_identifyGeeklogVersion ()
-{
- global $_TABLES, $_DB, $_DB_dbms, $dbconfig_path, $siteconfig_path;
-
- $_DB->setDisplayError(true);
-
- // simple tests for the version of the database:
- // "DESCRIBE sometable somefield", ''
- // => just test that the field exists
- // "DESCRIBE sometable somefield", 'somefield,sometype'
- // => test that the field exists and is of the given type
- //
- // Should always include a test for the current version so that we can
- // warn the user if they try to run the update again.
-
-
- switch ($_DB_dbms) {
-
- case 'mysql':
- $test = array(
- '1.5.1' => array("SELECT name FROM {$_TABLES['vars']} WHERE name = 'database_version'", 'database_version'),
- '1.5.0' => array("DESCRIBE {$_TABLES['storysubmission']} bodytext",''),
- '1.4.1' => array("SELECT ft_name FROM {$_TABLES['features']} WHERE ft_name = 'syndication.edit'", 'syndication.edit'),
- '1.4.0' => array("DESCRIBE {$_TABLES['users']} remoteusername",''),
- '1.3.11' => array("DESCRIBE {$_TABLES['comments']} sid", 'sid,varchar(40)'),
- '1.3.10' => array("DESCRIBE {$_TABLES['comments']} lft",''),
- '1.3.9' => array("DESCRIBE {$_TABLES['syndication']} fid",''),
- '1.3.8' => array("DESCRIBE {$_TABLES['userprefs']} showonline",'')
- // It's hard to (reliably) test for 1.3.7 - let's just hope
- // nobody uses such an old version any more ...
- );
- $firstCheck = "DESCRIBE {$_TABLES['access']} acc_ft_id";
- $result = DB_query($firstCheck, 1);
- if ($result === false) {
- // A check for the first field in the first table failed?
- // Sounds suspiciously like an empty table ...
- return 'empty';
- }
- break;
-
- case 'mssql':
- $test = array(
- '1.5.1' => array("SELECT name FROM {$_TABLES['vars']} WHERE name = 'database_version'", 'database_version'),
- '1.5.0' => array("SELECT c.name FROM syscolumns c JOIN sysobjects o ON o.id = c.id WHERE c.name='bodytext' AND o.name='{$_TABLES['storysubmission']}'",'bodytext'),
- '1.4.1' => array("SELECT ft_name FROM {$_TABLES['features']} WHERE ft_name = 'syndication.edit'", 'syndication.edit')
- // 1.4.1 was the first version with MS SQL support
- );
- $firstCheck = "SELECT 1 FROM sysobjects WHERE name='{$_TABLES['access']}'";
- $result = DB_query($firstCheck, 1);
- if (($result === false) || (DB_numRows($result) < 1)) {
- // a check for the first table returned nothing.
- // empty database?
- return 'empty';
- }
- break;
-
- }
-
- $version = '';
-
- foreach ($test as $v => $qarray) {
- $result = DB_query($qarray[0], 1);
- if ($result === false) {
- // error - continue with next test
-
- } else if (DB_numRows($result) > 0) {
- $A = DB_fetchArray($result);
- if (empty($qarray[1])) {
- // test only for existence of field - succeeded
- $version = $v;
- break;
- } else {
- if (substr($qarray[0], 0, 6) == 'SELECT') {
- // text for a certain value
- if ($A[0] == $qarray[1]) {
- $version = $v;
- break;
- }
- } else {
- // test for certain type of field
- $tst = explode(',', $qarray[1]);
- if (($A['Field'] == $tst[0]) && ($A['Type'] == $tst[1])) {
- $version = $v;
- break;
- }
- }
- }
- }
- }
-
- return $version;
-}
-
-
-/**
-* Checks for Static Pages Version
-*
-* @return 0 = not installed, 1 = original plugin, 2 = plugin by Phill or Tom, 3 = v1.3 (center block, etc.), 4 = 1.4 ('in block' flag)
-*
-* Note: Needed for upgrades from old versions - don't remove.
-*
-*/
-function get_SP_ver()
-{
- global $_TABLES;
-
- $retval = 0;
-
- if (DB_count ($_TABLES['plugins'], 'pi_name', 'staticpages') > 0) {
- $result = DB_query ("DESCRIBE {$_TABLES['staticpage']}");
- $numrows = DB_numRows ($result);
-
- $retval = 1; // assume v1.1 for now ...
-
- for ($i = 0; $i < $numrows; $i++) {
- $A = DB_fetchArray ($result, true);
- if ($A[0] == 'sp_nf') {
- $retval = 3; // v1.3
- } elseif ($A[0] == 'sp_pos') {
- $retval = 2; // v1.2
- } elseif ($A[0] == 'sp_inblock') {
- $retval = 4; // v1.4
- break;
- }
- }
- }
-
- return $retval;
}
@@ -968,510 +832,6 @@
}
}
-
-/**
- * Check InnoDB Upgrade
- *
- * @param array $_SQL List of SQL queries
- * @return array InnoDB table style if chosen
- *
- */
-function INST_checkInnodbUpgrade($_SQL)
-{
- global $use_innodb;
-
- if ($use_innodb) {
- $statements = count($_SQL);
- for ($i = 0; $i < $statements; $i++) {
- $_SQL[$i] = str_replace('MyISAM', 'InnoDB', $_SQL[$i]);
- }
- }
-
- return $_SQL;
-}
-
-/**
- * Perform database upgrades
- *
- * @param string $current_gl_version Current Geeklog version
- * @param boolean $use_innodb Whether or not to use InnoDB support with MySQL
- * @return boolean True if successful
- *
- */
-function INST_doDatabaseUpgrades($current_gl_version, $use_innodb = false)
-{
- global $_TABLES, $_CONF, $_SP_CONF, $_DB, $_DB_dbms, $_DB_table_prefix,
- $dbconfig_path, $siteconfig_path, $html_path;
-
- $_DB->setDisplayError (true);
-
- // Because the upgrade sql syntax can vary from dbms-to-dbms we are
- // leaving that up to each Geeklog database driver
-
- $done = false;
- $progress = '';
- while ($done == false) {
- switch ($current_gl_version) {
- case '1.2.5-1':
- // Get DMBS-specific update sql
- require_once($_CONF['path'] . 'sql/updates/' . $_DB_dbms . '_1.2.5-1_to_1.3.php');
- INST_updateDB($_SQL);
-
- // OK, now we need to add all users except anonymous to the All Users group and Logged in users group
- // I can hard-code these group numbers because the group table was JUST created with these numbers
- $result = DB_query("SELECT uid FROM {$_TABLES['users']} WHERE uid <> 1");
- $nrows = DB_numRows($result);
- for ($i = 1; $i <= $nrows; $i++) {
- $U = DB_fetchArray($result);
- DB_query("INSERT INTO {$_TABLES['group_assignments']} VALUES (2, {$U['uid']}, NULL)");
- DB_query("INSERT INTO {$_TABLES['group_assignments']} VALUES (13, {$U['uid']}, NULL)");
- }
- // Now take care of any orphans off the user table...and let me curse MySQL lack for supporting foreign
- // keys at this time ;-)
- $result = DB_query("SELECT MAX(uid) FROM {$_TABLES['users']}");
- $ITEM = DB_fetchArray($result);
- $max_uid = $ITEM[0];
- if (!empty($max_uid) AND $max_uid <> 0) {
- DB_query("DELETE FROM {$_TABLES['userindex']} WHERE uid > $max_uid");
- DB_query("DELETE FROM {$_TABLES['userinfo']} WHERE uid > $max_uid");
- DB_query("DELETE FROM {$_TABLES['userprefs']} WHERE uid > $max_uid");
- DB_query("DELETE FROM {$_TABLES['usercomment']} WHERE uid > $max_uid");
- }
- $current_gl_version = '1.3';
- $_SQL = '';
- break;
- case '1.3':
- require_once($_CONF['path'] . 'sql/updates/' . $_DB_dbms . '_1.3_to_1.3.1.php');
- INST_updateDB($_SQL);
- $current_gl_version = '1.3.1';
- $_SQL = '';
- break;
- case '1.3.1':
- require_once($_CONF['path'] . 'sql/updates/' . $_DB_dbms . '_1.3.1_to_1.3.2.php');
- INST_updateDB($_SQL);
- $current_gl_version = '1.3.2-1';
- $_SQL = '';
- break;
- case '1.3.2':
- case '1.3.2-1':
- require_once($_CONF['path'] . 'sql/updates/' . $_DB_dbms . '_1.3.2-1_to_1.3.3.php');
- INST_updateDB($_SQL);
- // Now we need to switch how user blocks are stored. Right now we only store the blocks the
- // user wants. This will switch it to store the ones they don't want which allows us to add
- // new blocks and ensure they are shown to the user.
- $result = DB_query("SELECT {$_TABLES['users']}.uid,boxes FROM {$_TABLES['users']},{$_TABLES['userindex']} WHERE boxes IS NOT NULL AND boxes <> '' AND {$_TABLES['users']}.uid = {$_TABLES['userindex']}.uid");
- $nrows = DB_numRows($result);
- for ($i = 1; $i <= $nrows; $i++) {
- $row = DB_fetchArray($result);
- $ublocks = str_replace(' ',',',$row['boxes']);
- $result2 = DB_query("SELECT bid,name FROM {$_TABLES['blocks']} WHERE bid NOT IN ($ublocks)");
- $newblocks = '';
- for ($x = 1; $x <= DB_numRows($result2); $x++) {
- $curblock = DB_fetchArray($result2);
- if ($curblock['name'] <> 'user_block' AND $curblock['name'] <> 'admin_block' AND $curblock['name'] <> 'section_block') {
- $newblocks .= $curblock['bid'];
- if ($x <> DB_numRows($result2)) {
- $newblocks .= ' ';
- }
- }
- }
- DB_query("UPDATE {$_TABLES['userindex']} SET boxes = '$newblocks' WHERE uid = {$row['uid']}");
- }
- $current_gl_version = '1.3.3';
- $_SQL = '';
- break;
- case '1.3.3':
- require_once($_CONF['path'] . 'sql/updates/' . $_DB_dbms . '_1.3.3_to_1.3.4.php');
- INST_updateDB($_SQL);
- $current_gl_version = '1.3.4';
- $_SQL = '';
- break;
- case '1.3.4':
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:53 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:53 -0500
Subject: [geeklog-cvs] geeklog: Don't initialize the plugin configuration -
the plugins...
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/bfbef11defcf
changeset: 6618:bfbef11defcf
user: Dirk Haun
date: Wed Dec 31 17:34:40 2008 +0100
description:
Don't initialize the plugin configuration - the plugins are doing that themselves now
diffstat:
1 file changed, 1 insertion(+), 22 deletions(-)
public_html/admin/install/config-install.php | 23 +----------------------
diffs (47 lines):
diff -r 22eff903b537 -r bfbef11defcf public_html/admin/install/config-install.php
--- a/public_html/admin/install/config-install.php Wed Dec 31 16:42:40 2008 +0100
+++ b/public_html/admin/install/config-install.php Wed Dec 31 17:34:40 2008 +0100
@@ -2,7 +2,7 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Geeklog 1.5 |
+// | Geeklog 1.6 |
// +---------------------------------------------------------------------------+
// | config-install.php |
// | |
@@ -28,8 +28,6 @@
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
-//
-// $Id: config-install.php,v 1.33 2008/09/21 08:37:09 dhaun Exp $
if (strpos(strtolower($_SERVER['PHP_SELF']), 'config-install.php') !== false) {
die('This file can not be used on its own!');
@@ -332,25 +330,6 @@
$c->add('disable_webservices', 0, 'select', 7, 40, 0, 1840, TRUE);
$c->add('restrict_webservices', 0, 'select', 7, 40, 0, 1850, TRUE);
$c->add('atom_max_stories', 10, 'text', 7, 40, 0, 1860, TRUE);
-
-
- // Add the configuration records for the default installed plugins
- $plugin_path = $_CONF['path'] . 'plugins/';
-
- require_once $plugin_path . 'calendar/install_defaults.php';
- plugin_initconfig_calendar();
-
- require_once $plugin_path . 'links/install_defaults.php';
- plugin_initconfig_links();
-
- require_once $plugin_path . 'polls/install_defaults.php';
- plugin_initconfig_polls();
-
- require_once $plugin_path . 'spamx/install_defaults.php';
- plugin_initconfig_spamx();
-
- require_once $plugin_path . 'staticpages/install_defaults.php';
- plugin_initconfig_staticpages();
}
?>
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:50 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:50 -0500
Subject: [geeklog-cvs] geeklog: Moved hard-coded text strings to the
language file
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/22eff903b537
changeset: 6617:22eff903b537
user: Dirk Haun
date: Wed Dec 31 16:42:40 2008 +0100
description:
Moved hard-coded text strings to the language file
diffstat:
4 files changed, 183 insertions(+), 28 deletions(-)
public_html/admin/install/install-plugins.php | 40 +++---
public_html/admin/install/language/english.php | 28 ++++
public_html/admin/install/language/german.php | 141 ++++++++++++++++++++++--
public_html/admin/install/migrate.php | 2
diffs (truncated from 360 to 300 lines):
diff -r 5ae4a81df4b2 -r 22eff903b537 public_html/admin/install/install-plugins.php
--- a/public_html/admin/install/install-plugins.php Wed Dec 31 15:13:02 2008 +0100
+++ b/public_html/admin/install/install-plugins.php Wed Dec 31 16:42:40 2008 +0100
@@ -67,7 +67,7 @@
$step = (isset($_REQUEST['step'])) ? $_REQUEST['step'] : 1;
// $display holds all the outputted HTML and content
-$display = INST_getHeader('Step' . ' 3 - Plugin Installation'); // Grab the beginning HTML for the installer theme.
+$display = INST_getHeader($LANG_PLUGINS[2] . ' 3 - ' . $LANG_PLUGINS[1]); // Grab the beginning HTML for the installer theme.
// Make sure the version of PHP is supported.
if (INST_phpOutOfDate()) {
@@ -95,9 +95,9 @@
? true
: false;
- $display .= 'Geeklog plugins are addon components that provide new functionality and leverage the internal services of Geeklog. Plugins are different then blocks which normally do not use any of the internal Geeklog services. By default, Geeklog includes a few useful plugins that you may want to install. '
- . ($upload_enabled ? 'You can also choose to upload additional plugins.' : '')
- . '
' . LB;
+ $display .= '' . $LANG_PLUGINS[3]
+ . ($upload_enabled ? ' ' . $LANG_PLUGINS[4] : '')
+ . '
' . LB;
// Check if a plugin file was uploaded
$upload_success = false;
@@ -130,11 +130,11 @@
if (empty($dirname)) { // If $dirname is blank it's probably because the user uploaded a non Tarball file.
- $display .= '' . $LANG_INSTALL[38] . ' The file you uploaded was not a GZip compressed plugin file.
' . LB;
+ $display .= '' . $LANG_INSTALL[38] . ' ' . $LANG_PLUGINS[5] . '
' . LB;
} else if (file_exists($_CONF['path'] . 'plugins/' . $dirname)) { // If plugin directory already exists
- $display .= '' . $LANG_INSTALL[38] . ' The plugin you uploaded already exists!
' . LB;
+ $display .= '' . $LANG_INSTALL[38] . ' ' . $LANG_PLUGINS[6] . '
' . LB;
} else {
@@ -240,14 +240,14 @@
// Show the upload form
$display .= ' ' . LB
. (($upload_success)
- ? 'Success! The ' . $pi_name . ' plugin was uploaded successfully.
'
+ ? '' . $LANG_PLUGINS[7] . ' ' . sprintf($LANG_PLUGINS[8], $pi_name) . '
'
: '') . LB
- . 'Upload a plugin ' . LB
+ . '' . $LANG_PLUGINS[9] . ' ' . LB
. '' . LB;
}
@@ -277,7 +277,7 @@
}
- $display .= 'Select which plugins to install ' . LB;
+ $display .= '' . $LANG_PLUGINS[12] . ' ' . LB;
// If there are new plugins
if ($new_plugins > 0) {
@@ -288,9 +288,9 @@
. ' ' . LB
. '' . LB
. '' . LB
- . 'Install? ' . LB
- . 'Plugin ' . LB
- . 'Version ' . LB
+ . '' . $LANG_PLUGINS[13] . ' ' . LB
+ . '' . $LANG_PLUGINS[14] . ' ' . LB
+ . '' . $LANG_PLUGINS[15] . ' ' . LB
. ' ' . LB;
/**
@@ -313,8 +313,8 @@
$pi_name = '';
$pi_display_name = '';
- $pi_version = 'Unknown';
- $gl_version = 'Unknown';
+ $pi_version = $LANG_PLUGINS[16];
+ $gl_version = $LANG_PLUGINS[16];
$pi_url = '';
/**
@@ -443,7 +443,7 @@
. ' '
. ' '
. $pi_display_name . LB
- . ($missing_autoinstall ? 'Note: This plugin requires manual activation from the Plugins admin panel.
' : '')
+ . ($missing_autoinstall ? '' . $LANG_PLUGINS[17] . ': ' . $LANG_PLUGINS[18] . '
' : '')
. '' . LB
. ' '
. $pi_version
@@ -456,15 +456,15 @@
// Form footer
$display .= '
' . LB
- . ' ' . LB
+ . ' ' . LB
. ' ' . LB
. '
' . LB;
} else {
- $display .= 'There are no new plugins to install.
' . LB
+ $display .= '' . $LANG_PLUGINS[20] . '
' . LB
. '' . LB;
}
diff -r 5ae4a81df4b2 -r 22eff903b537 public_html/admin/install/language/english.php
--- a/public_html/admin/install/language/english.php Wed Dec 31 15:13:02 2008 +0100
+++ b/public_html/admin/install/language/english.php Wed Dec 31 16:42:40 2008 +0100
@@ -40,7 +40,7 @@
// +---------------------------------------------------------------------------+
// | Array Format: |
-// | $LANG_NAME[XX]: $LANG - variable name |
+// | $LANG_NAME[XX]: $LANG - variable name |
// | NAME - where array is used |
// | XX - phrase id number |
// +---------------------------------------------------------------------------+
@@ -246,6 +246,32 @@
);
// +---------------------------------------------------------------------------+
+// install-plugins.php
+
+$LANG_PLUGINS = array(
+ 1 => 'Plugin Installation',
+ 2 => 'Step',
+ 3 => 'Geeklog plugins are addon components that provide new functionality and leverage the internal services of Geeklog. By default, Geeklog includes a few useful plugins that you may want to install.',
+ 4 => 'You can also choose to upload additional plugins.',
+ 5 => 'The file you uploaded was not a GZip compressed plugin file.',
+ 6 => 'The plugin you uploaded already exists!',
+ 7 => 'Success!',
+ 8 => 'The %s plugin was uploaded successfully.',
+ 9 => 'Upload a plugin',
+ 10 => 'Select plugin file',
+ 11 => 'Upload',
+ 12 => 'Select which plugins to install',
+ 13 => 'Install?',
+ 14 => 'Plugin',
+ 15 => 'Version',
+ 16 => 'Unknown',
+ 17 => 'Note',
+ 18 => 'This plugin requires manual activation from the Plugins admin panel.',
+ 19 => 'Refresh',
+ 20 => 'There are no new plugins to install.'
+);
+
+// +---------------------------------------------------------------------------+
// bigdump.php
$LANG_BIGDUMP = array(
diff -r 5ae4a81df4b2 -r 22eff903b537 public_html/admin/install/language/german.php
--- a/public_html/admin/install/language/german.php Wed Dec 31 15:13:02 2008 +0100
+++ b/public_html/admin/install/language/german.php Wed Dec 31 16:42:40 2008 +0100
@@ -2,7 +2,7 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Geeklog 1.5 |
+// | Geeklog 1.6 |
// +---------------------------------------------------------------------------+
// | german.php |
// | |
@@ -33,8 +33,6 @@
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
-//
-// $Id: german.php,v 1.9 2008/05/28 18:46:52 dhaun Exp $
// +---------------------------------------------------------------------------+
@@ -42,7 +40,7 @@
// +---------------------------------------------------------------------------+
// | Array Format: |
-// | $LANG_NAME[XX]: $LANG - variable name |
+// | $LANG_NAME[XX]: $LANG - variable name |
// | NAME - where array is used |
// | XX - phrase id number |
// +---------------------------------------------------------------------------+
@@ -146,7 +144,11 @@
93 => 'Success',
94 => 'Hier sind einige Hinweise, um den richtigen Pfad zu ermitteln:',
95 => 'Der komplette Pfad zu dieser Datei (dem Installations-Skript) ist:',
- 96 => 'Das Installations-Skript hat nach %s in diesem Verzeichnis gesucht:'
+ 96 => 'Das Installations-Skript hat nach %s in diesem Verzeichnis gesucht:',
+ 97 => 'Set File Permissions',
+ 98 => 'Advanced Users',
+ 99 => 'If you have command line (SSH) access to your web server then you can simple copy and paste the following command into your shell:',
+ 100 => 'Invalid mode specified'
);
// +---------------------------------------------------------------------------+
@@ -174,7 +176,8 @@
18 => 'zur?cksetzen auf',
19 => 'Note: Because the security model has been changed, we have created a new account with the rights you need to administer your new site. The username for this new account is NewAdmin and the password is password ',
20 => 'installiert',
- 21 => 'aktualisiert'
+ 21 => 'aktualisiert',
+ 22 => 'migriert'
);
// +---------------------------------------------------------------------------+
@@ -197,4 +200,130 @@
13 => 'Indicate whether to use UTF-8 as the default character set for your site. Recommended especially for multi-lingual setups.'
);
+// +---------------------------------------------------------------------------+
+// migrate.php
+
+$LANG_MIGRATE = array(
+ 0 => 'The migration process will overwrite any existing database information.',
+ 1 => 'Before Proceding',
+ 2 => 'Be sure any previously installed plugins have been copied to your new server.',
+ 3 => 'Be sure any images from public_html/images/articles/, public_html/images/topics/, and public_html/images/userphotos/, have been copied to your new server.',
+ 4 => 'If you\'re upgrading to a new Geeklog version, then run the install script in upgrade mode first.',
+ 5 => 'If you\'re upgrading to a new Geeklog version, then don\'t upload your theme just yet. Use the included default theme until you can be sure your migrated site works properly.',
+ 6 => 'Select an existing backup',
+ 7 => 'Choose file...',
+ 8 => 'From the server\'s backups directory',
+ 9 => 'From your computer',
+ 10 => 'Choose file...',
+ 11 => 'No backup files found.',
+ 12 => 'The upload limit for this server is ',
+ 13 => '. If your backup file is larger than ',
+ 14 => ' or if you experience a timeout, then you should upload the file to Geeklog\'s backups directory via FTP.',
+ 15 => 'Your backups directory is not writable by the web server. Permissions need to be 777.',
+ 16 => 'Migrate',
+ 17 => 'Migrate From Backup',
+ 18 => 'No backup file was selected',
+ 19 => 'Could not save ',
+ 20 => ' to ',
+ 21 => 'The file',
+ 22 => 'already exists. Would you like to replace it?',
+ 23 => 'Yes',
+ 24 => 'No',
+ 25 => 'The version of Geeklog you chose to migrate from is out of date.',
+ 26 => 'Migration notice: ',
+ 27 => 'The "',
+ 28 => '" plugin is missing and has been disabled. You can install and reactivate it at any time from the administration section.',
+ 29 => 'The image "',
+ 30 => '" listed in the "',
+ 31 => '" table could not be found in ',
+ 32 => 'The database file contained information for one or more plugins that the migration script could not locate in your',
+ 33 => 'directory. The plugins have been deactivated. You can install and reactivate them at any time from the administration section.',
+ 34 => 'The database file contained information for one or more files that the migration script could not locate in your',
+ 35 => 'directory. Check error.log for more details.',
+ 36 => 'You can correct these any time.',
+ 37 => 'Migration Complete',
+ 38 => 'The migration process has completed. However, the installation script found the following issues:'
+);
+
+// +---------------------------------------------------------------------------+
+// install-plugins.php
+
+$LANG_PLUGINS = array(
+ 1 => 'Plugin Installation',
+ 2 => 'Step',
+ 3 => 'Geeklog plugins are addon components that provide new functionality and leverage the internal services of Geeklog. By default, Geeklog includes a few useful plugins that you may want to install.',
+ 4 => 'You can also choose to upload additional plugins.',
+ 5 => 'The file you uploaded was not a GZip compressed plugin file.',
+ 6 => 'The plugin you uploaded already exists!',
+ 7 => 'Success!',
+ 8 => 'The %s plugin was uploaded successfully.',
+ 9 => 'Upload a plugin',
+ 10 => 'Select plugin file',
+ 11 => 'Upload',
+ 12 => 'Select which plugins to install',
+ 13 => 'Install?',
+ 14 => 'Plugin',
+ 15 => 'Version',
+ 16 => 'Unknown',
+ 17 => 'Note',
+ 18 => 'This plugin requires manual activation from the Plugins admin panel.',
+ 19 => 'Refresh',
+ 20 => 'There are no new plugins to install.'
+);
+
+// +---------------------------------------------------------------------------+
+// bigdump.php
+
+$LANG_BIGDUMP = array(
+ 0 => 'Start Import',
+ 1 => ' from ',
+ 2 => ' into ',
+ 3 => ' at ',
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:55 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:55 -0500
Subject: [geeklog-cvs] geeklog: Make the database input fields behave like
they do for ...
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/1aceb360b6ea
changeset: 6620:1aceb360b6ea
user: Dirk Haun
date: Wed Dec 31 19:56:03 2008 +0100
description:
Make the database input fields behave like they do for a fresh install and upgrade
diffstat:
1 file changed, 8 insertions(+)
public_html/admin/install/migrate.php | 8 ++++++++
diffs (18 lines):
diff -r f6cceb986985 -r 1aceb360b6ea public_html/admin/install/migrate.php
--- a/public_html/admin/install/migrate.php Wed Dec 31 19:05:40 2008 +0100
+++ b/public_html/admin/install/migrate.php Wed Dec 31 19:56:03 2008 +0100
@@ -211,6 +211,14 @@
'user' => 'username',
'pass' => '',
'prefix' => 'gl_' );
+ if (file_exists($dbconfig_path)) {
+ require_once $dbconfig_path;
+
+ $_FORM['host'] = ($_DB_host != 'localhost' ? '' : $_DB_host);
+ $_FORM['name'] = ($_DB_name != 'geeklog' ? '' : $_DB_name);
+ $_FORM['user'] = ($_DB_user != 'username' ? '' : $_DB_user);
+ $_FORM['prefix'] = $_DB_table_prefix;
+ }
// Set up the URL and admin URL paths.
$site_url = isset($_REQUEST['site_url']) ? $_REQUEST['site_url'] : 'http://' . $_SERVER['HTTP_HOST'] . preg_replace('/\/admin.*/', '', $_SERVER['PHP_SELF']) ;
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:54 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:54 -0500
Subject: [geeklog-cvs] geeklog: Don't rename plugin config.php during
upgrades (from pr...
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/f6cceb986985
changeset: 6619:f6cceb986985
user: Dirk Haun
date: Wed Dec 31 19:05:40 2008 +0100
description:
Don't rename plugin config.php during upgrades (from pre-1.5.0 versions) any more. It's not needed and will only cause inconveniences when having to run the upgrade again.
diffstat:
2 files changed, 60 deletions(-)
sql/updates/mssql_1.4.1_to_1.5.0.php | 30 ------------------------------
sql/updates/mysql_1.4.1_to_1.5.0.php | 30 ------------------------------
diffs (136 lines):
diff -r bfbef11defcf -r f6cceb986985 sql/updates/mssql_1.4.1_to_1.5.0.php
--- a/sql/updates/mssql_1.4.1_to_1.5.0.php Wed Dec 31 17:34:40 2008 +0100
+++ b/sql/updates/mssql_1.4.1_to_1.5.0.php Wed Dec 31 19:05:40 2008 +0100
@@ -459,12 +459,6 @@
}
}
- if (file_exists($plugin_path . 'config.php')) {
- // Rename the existing config.php as it's not needed any more
- $ren = @rename($plugin_path . 'config.php',
- $plugin_path . 'config-pre1.5.0.php');
- }
-
return true;
}
@@ -501,12 +495,6 @@
echo "There was an error upgrading the Static Pages plugin, SQL: $sql ";
return false;
}
- }
-
- if (file_exists($plugin_path . 'config.php')) {
- // Rename the existing config.php as it's not needed any more
- $ren = @rename($plugin_path . 'config.php',
- $plugin_path . 'config-pre1.5.0.php');
}
return true;
@@ -558,12 +546,6 @@
}
}
- if (file_exists($plugin_path . 'config.php')) {
- // Rename the existing config.php as it's not needed any more
- $ren = @rename($plugin_path . 'config.php',
- $plugin_path . 'config-pre1.5.0.php');
- }
-
return true;
}
@@ -593,12 +575,6 @@
if (DB_error()) {
echo "There was an error upgrading the Spam-X plugin";
return false;
- }
-
- if (file_exists($plugin_path . 'config.php')) {
- // Rename the existing config.php as it's not needed any more
- $ren = @rename($plugin_path . 'config.php',
- $plugin_path . 'config-pre1.5.0.php');
}
return true;
@@ -698,12 +674,6 @@
}
}
- if (file_exists($plugin_path . 'config.php')) {
- // Rename the existing config.php as it's not needed any more
- $ren = @rename($plugin_path . 'config.php',
- $plugin_path . 'config-pre1.5.0.php');
- }
-
return true;
}
diff -r bfbef11defcf -r f6cceb986985 sql/updates/mysql_1.4.1_to_1.5.0.php
--- a/sql/updates/mysql_1.4.1_to_1.5.0.php Wed Dec 31 17:34:40 2008 +0100
+++ b/sql/updates/mysql_1.4.1_to_1.5.0.php Wed Dec 31 19:05:40 2008 +0100
@@ -422,12 +422,6 @@
}
}
- if (file_exists($plugin_path . 'config.php')) {
- // Rename the existing config.php as it's not needed any more
- $ren = @rename($plugin_path . 'config.php',
- $plugin_path . 'config-pre1.5.0.php');
- }
-
return true;
}
@@ -464,12 +458,6 @@
echo "There was an error upgrading the Static Pages plugin, SQL: $sql ";
return false;
}
- }
-
- if (file_exists($plugin_path . 'config.php')) {
- // Rename the existing config.php as it's not needed any more
- $ren = @rename($plugin_path . 'config.php',
- $plugin_path . 'config-pre1.5.0.php');
}
return true;
@@ -521,12 +509,6 @@
}
}
- if (file_exists($plugin_path . 'config.php')) {
- // Rename the existing config.php as it's not needed any more
- $ren = @rename($plugin_path . 'config.php',
- $plugin_path . 'config-pre1.5.0.php');
- }
-
return true;
}
@@ -556,12 +538,6 @@
if (DB_error()) {
echo "There was an error upgrading the Spam-X plugin";
return false;
- }
-
- if (file_exists($plugin_path . 'config.php')) {
- // Rename the existing config.php as it's not needed any more
- $ren = @rename($plugin_path . 'config.php',
- $plugin_path . 'config-pre1.5.0.php');
}
return true;
@@ -657,12 +633,6 @@
}
}
- if (file_exists($plugin_path . 'config.php')) {
- // Rename the existing config.php as it's not needed any more
- $ren = @rename($plugin_path . 'config.php',
- $plugin_path . 'config-pre1.5.0.php');
- }
-
return true;
}
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:59 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:59 -0500
Subject: [geeklog-cvs] geeklog: Fixed "migrate + update" when an old
config.php is invo...
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/1ba00656781c
changeset: 6622:1ba00656781c
user: Dirk Haun
date: Thu Jan 01 12:15:36 2009 +0100
description:
Fixed "migrate + update" when an old config.php is involved
diffstat:
1 file changed, 28 insertions(+), 4 deletions(-)
public_html/admin/install/migrate.php | 32 ++++++++++++++++++++++++++++----
diffs (64 lines):
diff -r 591bc2b8c55d -r 1ba00656781c public_html/admin/install/migrate.php
--- a/public_html/admin/install/migrate.php Thu Jan 01 11:15:21 2009 +0100
+++ b/public_html/admin/install/migrate.php Thu Jan 01 12:15:36 2009 +0100
@@ -603,6 +603,8 @@
} elseif (empty($version)) {
$display .= INST_getAlertMsg("Could not identify database version. Please perform a manual update.");
+ // TBD: add a link back to the install script, preferrably a direct
+ // link to the upgrade screen
$upgrade_error = true;
} elseif ($version != VERSION) {
@@ -635,6 +637,10 @@
* Let's assume that the paths that were imported from the backup are
* incorrect and update them with the current paths.
*
+ * Note: When updating the config settings in the database, we also
+ * need to fix the $_CONF values. We can _not_ simply reload
+ * them via get_config('Core') here yet.
+ *
*/
require_once $_CONF['path_system'] . 'classes/config.class.php';
$config = config::get_instance();
@@ -643,18 +649,36 @@
$config->set('site_url', urldecode($_REQUEST['site_url']));
$config->set('site_admin_url', urldecode($_REQUEST['site_admin_url']));
$config->set('path_html', $html_path);
- $config->set('path_log', $gl_path . '/logs/');
- $config->set('path_language', $gl_path . '/language/');
+ $_CONF['path_html'] = $html_path;
+ $config->set('path_log', $gl_path . 'logs/');
+ $_CONF['path_log'] = $gl_path . 'logs/';
+ $config->set('path_language', $gl_path . 'language/');
+ $_CONF['path_language'] = $gl_path . 'language/';
$config->set('backup_path', $backup_dir);
- $config->set('path_data', $gl_path . '/data/');
- $config->set('path_images', $html_path . '/images/');
+ $_CONF['backup_path'] = $backup_dir;
+ $config->set('path_data', $gl_path . 'data/');
+ $_CONF['path_data'] = $gl_path . 'data/';
+ $config->set('path_images', $html_path . 'images/');
+ $_CONF['path_images'] = $html_path . 'images/';
$config->set('path_themes', $html_path . 'layout/');
+ $_CONF['path_themes'] = $html_path . 'layout/';
$config->set('rdf_file', $html_path . 'backend/geeklog.rss');
+ $_CONF['rdf_file'] = $html_path . 'backend/geeklog.rss';
$config->set('path_pear', $_CONF['path_system'] . 'pear/');
+ $_CONF['path_pear'] = $_CONF['path_system'] . 'pear/';
// reset cookie domain and path as wrong values may prevent login
$config->set('cookiedomain', '');
+ $_CONF['cookiedomain'] = '';
$config->set('cookie_path', '/');
+ $_CONF['cookie_path'] = '/';
+
+ // check the default theme
+ if (! file_exists($_CONF['path_themes'] . $_CONF['theme']
+ . '/header.thtml')) {
+ $config->set('theme', 'professional');
+ $_CONF['theme'] = 'professional';
+ }
/**
* Check for missing plugins
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:55 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:55 -0500
Subject: [geeklog-cvs] geeklog: Fixed upgrade issues when taking settings
from an old c...
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/591bc2b8c55d
changeset: 6621:591bc2b8c55d
user: Dirk Haun
date: Thu Jan 01 11:15:21 2009 +0100
description:
Fixed upgrade issues when taking settings from an old config.php
diffstat:
3 files changed, 44 insertions(+), 60 deletions(-)
public_html/admin/install/index.php | 37 +----------------------------
public_html/admin/install/lib-install.php | 33 ++++++-------------------
public_html/admin/install/lib-upgrade.php | 34 ++++++++++++++++++++++++++
diffs (165 lines):
diff -r 1aceb360b6ea -r 591bc2b8c55d public_html/admin/install/index.php
--- a/public_html/admin/install/index.php Wed Dec 31 19:56:03 2008 +0100
+++ b/public_html/admin/install/index.php Thu Jan 01 11:15:21 2009 +0100
@@ -551,10 +551,10 @@
} else {
$site_url = isset($_POST['site_url']) ? $_POST['site_url'] : (isset($_GET['site_url']) ? $_GET['site_url'] : '') ;
$site_admin_url = isset($_POST['site_admin_url']) ? $_POST['site_admin_url'] : (isset($_GET['site_admin_url']) ? $_GET['site_admin_url'] : '') ;
+ }
- INST_fixPathsAndUrls($_CONF['path'], $html_path,
+ INST_fixPathsAndUrls($_CONF['path'], $html_path,
urldecode($site_url), urldecode($site_admin_url));
- }
// disable plugins for which we don't have the source files
INST_checkPlugins();
@@ -832,39 +832,6 @@
}
}
-
-/**
-* Change default character set to UTF-8
-*
-* @param string $siteconfig_path complete path to siteconfig.php
-* @param string $charset default character set to use
-* @return boolean true: success; false: an error occured
-* @note Yes, this means that we need to patch siteconfig.php a second time.
-*
-*/
-function INST_setDefaultCharset($siteconfig_path, $charset)
-{
- $result = true;
-
- $siteconfig_file = fopen($siteconfig_path, 'r');
- $siteconfig_data = fread($siteconfig_file, filesize($siteconfig_path));
- fclose($siteconfig_file);
-
- $siteconfig_data = preg_replace
- (
- '/\$_CONF\[\'default_charset\'\] = \'[^\']*\';/',
- "\$_CONF['default_charset'] = '" . $charset . "';",
- $siteconfig_data
- );
-
- $siteconfig_file = fopen($siteconfig_path, 'w');
- if (!fwrite($siteconfig_file, $siteconfig_data)) {
- $result = false;
- }
- @fclose($siteconfig_file);
-
- return $result;
-}
/**
* Handle default install of available plugins
diff -r 1aceb360b6ea -r 591bc2b8c55d public_html/admin/install/lib-install.php
--- a/public_html/admin/install/lib-install.php Wed Dec 31 19:56:03 2008 +0100
+++ b/public_html/admin/install/lib-install.php Thu Jan 01 11:15:21 2009 +0100
@@ -457,28 +457,6 @@
}
/**
- * Import a Geeklog database from a backup file
- *
- * @param string $file Path to backup file on the server
- * @return bool True if successful, false if not
- *
- */
-/*
-function INST_importDBFromBackup($file)
-{
- global $_DB, $_DB_name, $display, $_TABLES;
-
- // Make sure the database is clean
- if (!DB_query('drop database ' . $_DB_name))
- die('unable to drop database ' . $_DB_name);
- if (!DB_query('create database ' . $_DB_name))
- die('unable to create database ' . $_DB_name);
-
- return true;
-}
-*/
-
-/**
* Can the install script connect to the database?
*
* @param array $db Database information
@@ -792,7 +770,7 @@
COM_errorLog("Attempting to install the '$plugin' plugin", 1);
}
- // sanity checks in $inst_parms
+ // sanity checks for $inst_parms
if (isset($inst_parms['info'])) {
$pi_name = $inst_parms['info']['pi_name'];
$pi_version = $inst_parms['info']['pi_version'];
@@ -1019,7 +997,7 @@
*/
function INST_fixPathsAndUrls($path, $path_html, $site_url, $site_admin_url)
{
- // no global $_CONF here!
+ // no "global $_CONF" here!
require_once $path . 'system/classes/config.class.php';
@@ -1050,8 +1028,13 @@
$config->set('path_html', $path_html);
}
if (! file_exists($_CONF['path_themes'] . $_CONF['theme']
- . '/header.thtml')) {
+ . '/header.thtml')) {
$config->set('path_themes', $path_html . 'layout/');
+
+ if (! file_exists($path_html . 'layout/' . $_CONF['theme']
+ . '/header.thtml')) {
+ $config->set('theme', 'professional');
+ }
}
if (! file_exists($_CONF['path_images'] . 'articles')) {
$config->set('path_images', $path_html . 'images/');
diff -r 1aceb360b6ea -r 591bc2b8c55d public_html/admin/install/lib-upgrade.php
--- a/public_html/admin/install/lib-upgrade.php Wed Dec 31 19:56:03 2008 +0100
+++ b/public_html/admin/install/lib-upgrade.php Thu Jan 01 11:15:21 2009 +0100
@@ -579,6 +579,40 @@
/**
+* Change default character set to UTF-8
+*
+* @param string $siteconfig_path complete path to siteconfig.php
+* @param string $charset default character set to use
+* @return boolean true: success; false: an error occured
+* @note Yes, this means that we need to patch siteconfig.php a second time.
+*
+*/
+function INST_setDefaultCharset($siteconfig_path, $charset)
+{
+ $result = true;
+
+ $siteconfig_file = fopen($siteconfig_path, 'r');
+ $siteconfig_data = fread($siteconfig_file, filesize($siteconfig_path));
+ fclose($siteconfig_file);
+
+ $siteconfig_data = preg_replace
+ (
+ '/\$_CONF\[\'default_charset\'\] = \'[^\']*\';/',
+ "\$_CONF['default_charset'] = '" . $charset . "';",
+ $siteconfig_data
+ );
+
+ $siteconfig_file = fopen($siteconfig_path, 'w');
+ if (!fwrite($siteconfig_file, $siteconfig_data)) {
+ $result = false;
+ }
+ @fclose($siteconfig_file);
+
+ return $result;
+}
+
+
+/**
* Set VERSION constant in siteconfig.php after successful upgrade
*
* @param string $siteconfig_path path to siteconfig.php
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:06:59 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:06:59 -0500
Subject: [geeklog-cvs] geeklog: Removed old script to add indexes to some
tables
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/d9f30084e9c5
changeset: 6623:d9f30084e9c5
user: Dirk Haun
date: Thu Jan 01 13:37:41 2009 +0100
description:
Removed old script to add indexes to some tables
diffstat:
1 file changed, 145 deletions(-)
public_html/admin/install/addindex.php | 145 --------------------------------
diffs (149 lines):
diff -r 1ba00656781c -r d9f30084e9c5 public_html/admin/install/addindex.php
--- a/public_html/admin/install/addindex.php Thu Jan 01 12:15:36 2009 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-
-// Initial version
-// 2002-11-24 0.2 Dirk Haun
-// Added key names for the indexes, added authentication check
-
-require_once('../../lib-common.php');
-
-if (!SEC_inGroup ('Root')) {
- COM_errorLog ("Access denied to {$PHP_SELF} for user {$_USER['username']}, IP=" . $_SERVER['REMOTE_ADDR']);
- $display = COM_siteHeader('menu');
- $display .= COM_startBlock($LANG20[1]);
- $display .= $LANG20[6];
- $display .= COM_endBlock();
- $display .= COM_siteFooter();
- echo $display;
- exit;
-}
-
-// $_DEBUG = 1;
-
-// list according to Jeff's post on geeklog-devel (2002-10-14)
-// plus stories.hits (Rob Griffiths) plus group_assignments.ug_uid
-//
-
-$index['comments'] = "cid,type,sid,date,uid";
-$index['stories'] = "sid,tid,date,uid,frontpage,featured,hits";
-$index['blocks'] = "bid,is_enabled,tid,type";
-$index['events'] = "eid,datestart,dateend,event_type";
-$index['links'] = "lid,category,date";
-$index['pollquestions'] = "qid,date,display,commentcode,statuscode";
-$index['staticpage'] = "sp_id,sp_uid,sp_date,sp_onmenu";
-$index['userindex'] = "uid,noboxes,maxstories";
-$index['group_assignments'] = "ug_main_grp_id,ug_uid";
-
-
-echo COM_siteHeader('menu');
-echo COM_startBlock("Updating indexes ...");
-
-foreach ($index as $table=>$fields) {
-
- $idx = explode (",", $fields);
-
- echo "Table: {$_TABLES[$table]}
";
-
- if ($_DEBUG) {
- echo "Wanted: ";
- foreach ($idx as $id) {
- echo "$id, ";
- }
- echo "
";
- }
-
- $result = DB_query ("show index from {$_TABLES[$table]}");
- $nrows = DB_numRows ($result);
- $exidx = array ();
- for ($i = 0; $i < $nrows; $i++) {
- $A = DB_fetchArray ($result);
- $exidx[] = $A['Column_name'];
- }
- $newidx = array_diff ($idx, $exidx);
-
- if ($_DEBUG) {
- echo "Existing: ";
- foreach ($exidx as $ex) {
- echo "$ex, ";
- }
- echo "
";
- }
-
- if ($_DEBUG) {
- echo "Need to add: ";
- foreach ($newidx as $ne) {
- echo "$ne, ";
- }
- echo "
";
- }
-
- if (sizeof ($newidx) > 0) {
- echo "Adding indexes ... ";
- foreach ($newidx as $ne) {
- $idxname = $table . '_' . $ne;
- echo "Adding index \"$idxname\"";
- flush ();
-
- $idxtimer = new timerobject ();
- $idxtimer->setPercision (4);
- $idxtimer->startTimer ();
-
- DB_query("ALTER TABLE {$_TABLES[$table]} ADD INDEX $idxname ($ne)");
-
- $idxtime = $idxtimer->stopTimer ();
- $idxtimer->setPercision (4);
- echo " in $idxtime seconds ";
- }
- echo "Done!
";
- } else {
- echo "No index to add for table {$_TABLES[$table]}
";
- }
-
- echo " ";
-}
-
-echo COM_endBlock();
-echo COM_siteFooter();
-
-?>
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:07:04 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:07:04 -0500
Subject: [geeklog-cvs] geeklog: Set noreply_mail when updating from an old
version
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/4b7cb04f5988
changeset: 6625:4b7cb04f5988
user: Dirk Haun
date: Thu Jan 01 14:06:24 2009 +0100
description:
Set noreply_mail when updating from an old version
diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
public_html/admin/install/migrate.php | 8 +++++++-
diffs (25 lines):
diff -r c12f857524eb -r 4b7cb04f5988 public_html/admin/install/migrate.php
--- a/public_html/admin/install/migrate.php Thu Jan 01 13:50:40 2009 +0100
+++ b/public_html/admin/install/migrate.php Thu Jan 01 14:06:24 2009 +0100
@@ -8,7 +8,7 @@
// | |
// | Install Geeklog from a backup. |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2008 by the following authors: |
+// | Copyright (C) 2008-2009 by the following authors: |
// | |
// | Authors: Matt West - matt AT mattdanger DOT net |
// | Dirk Haun - dirk AT haun-online DOT de |
@@ -680,6 +680,12 @@
$_CONF['theme'] = 'professional';
}
+ // set noreply_mail when updating from an old version
+ if (empty($_CONF['noreply_mail']) && (! empty($_CONF['site_mail']))) {
+ $_CONF['noreply_mail'] = $_CONF['site_mail'];
+ $config->set('noreply_mail', $_CONF['noreply_mail']);
+ }
+
/**
* Check for missing plugins
*/
From geeklog-cvs at lists.geeklog.net Mon Jan 5 05:07:04 2009
From: geeklog-cvs at lists.geeklog.net (geeklog-cvs at lists.geeklog.net)
Date: Mon, 05 Jan 2009 05:07:04 -0500
Subject: [geeklog-cvs] geeklog: Fixed description of debug_image_upload
option
Message-ID:
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/0002d085bfd2
changeset: 6626:0002d085bfd2
user: Dirk Haun
date: Thu Jan 01 14:30:50 2009 +0100
description:
Fixed description of debug_image_upload option
diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
public_html/docs/config.html | 10 +++++-----
diffs (20 lines):
diff -r 4b7cb04f5988 -r 0002d085bfd2 public_html/docs/config.html
--- a/public_html/docs/config.html Thu Jan 01 14:06:24 2009 +0100
+++ b/public_html/docs/config.html Thu Jan 01 14:30:50 2009 +0100
@@ -939,11 +939,11 @@
images.
debug_image_upload
- (disabled)
- When enabled and set to true, this option
- enables debugging output to be written into Geeklog's error.log
- file during the upload of an image. This is useful to track down problems
- with the image upload.
+ false
+ When set to true, this option enables debugging
+ output to be written into Geeklog's error.log file during the
+ upload of an image. This is useful to track down problems with the image
+ upload.