[geeklog-cvs] geeklog: Fresh installs of the static pages plugin in Geeklog 1....

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Oct 3 08:51:23 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/1185208e854a
changeset: 7345:1185208e854a
user:      Dirk Haun <dirk at haun-online.de>
date:      Sat Oct 03 14:50:24 2009 +0200
description:
Fresh installs of the static pages plugin in Geeklog 1.6.1 accidentally used a wrong name for the plugin's admin group. Silently fix that during the upgrade.

diffstat:

 plugins/staticpages/autoinstall.php       |   8 ++++++--
 plugins/staticpages/functions.inc         |   4 +++-
 plugins/staticpages/sql/mssql_updates.php |  20 +++++++++++++++++++-
 plugins/staticpages/sql/mysql_updates.php |  20 +++++++++++++++++++-
 public_html/docs/history                  |   5 ++++-
 5 files changed, 51 insertions(+), 6 deletions(-)

diffs (134 lines):

diff -r 3e03947c0624 -r 1185208e854a plugins/staticpages/autoinstall.php
--- a/plugins/staticpages/autoinstall.php	Sat Oct 03 11:46:54 2009 +0200
+++ b/plugins/staticpages/autoinstall.php	Sat Oct 03 14:50:24 2009 +0200
@@ -46,13 +46,13 @@
 {
     $pi_name         = 'staticpages';
     $pi_display_name = 'Static Pages';
-    $pi_admin        = $pi_display_name . ' Admin';
+    $pi_admin        = 'Static Page Admin'; // "Page"(!), not "Pages"
 
     $info = array(
         'pi_name'         => $pi_name,
         'pi_display_name' => $pi_display_name,
         'pi_version'      => '1.6.1',
-        'pi_gl_version'   => '1.6.0',
+        'pi_gl_version'   => '1.6.1',
         'pi_homepage'     => 'http://www.geeklog.net/'
     );
 
@@ -142,6 +142,10 @@
         return false;
     }
 
+    if (! isset($_CONF['meta_tags'])) {
+        return false;
+    }
+
     return true;
 }
 
diff -r 3e03947c0624 -r 1185208e854a plugins/staticpages/functions.inc
--- a/plugins/staticpages/functions.inc	Sat Oct 03 11:46:54 2009 +0200
+++ b/plugins/staticpages/functions.inc	Sat Oct 03 14:50:24 2009 +0200
@@ -1085,7 +1085,9 @@
         /* give the name of the tables, without $_TABLES[] */
         'tables' => array('staticpage'),
         /* give the full name of the group, as in the db */
-        'groups' => array('Static Page Admin'),
+        'groups' => array('Static Page Admin', // correct Admin group name
+                          'Static Pages Admin' // typo in Geeklog 1.6.0
+                         ),
         /* give the full name of the feature, as in the db */
         'features' => array('staticpages.edit', 'staticpages.delete', 'staticpages.PHP'),
         /* give the full name of the block, including 'phpblock_', etc */
diff -r 3e03947c0624 -r 1185208e854a plugins/staticpages/sql/mssql_updates.php
--- a/plugins/staticpages/sql/mssql_updates.php	Sat Oct 03 11:46:54 2009 +0200
+++ b/plugins/staticpages/sql/mssql_updates.php	Sat Oct 03 14:50:24 2009 +0200
@@ -46,7 +46,7 @@
 */
 function update_ConfValues_1_6_0()
 {
-    global $_CONF, $_SP_DEFAULT;
+    global $_CONF, $_TABLES, $_SP_DEFAULT;
 
     require_once $_CONF['path_system'] . 'classes/config.class.php';
 
@@ -55,6 +55,24 @@
     // meta tag config options.
     $c->add('meta_tags', $_SP_DEFAULT['meta_tags'], 'select', 0, 0, 0, 120, true, 'staticpages');
 
+    // check for wrong Admin group name
+    $wrong_id = DB_getItem($_TABLES['groups'], 'grp_id',
+                           "grp_name = 'Static Pages Admin'"); // wrong name
+    if (! empty($wrong_id)) {
+        $grp_id = DB_getItem($_TABLES['groups'], 'grp_id',
+                             "grp_name = 'Static Page Admin'"); // correct name
+        if (empty($grp_id)) {
+            // correct name not found - probably a fresh install: rename
+            DB_query("UPDATE {$_TABLES['groups']} SET grp_name = 'Static Page Admin' WHERE grp_name = 'Static Pages Admin'");
+        } else {
+            // both names exist: delete wrong group & assignments
+            DB_delete($_TABLES['access'], 'acc_grp_id', $wrong_id);
+            DB_delete($_TABLES['group_assignments'], 'ug_grp_id', $wrong_id);
+            DB_delete($_TABLES['group_assignments'], 'ug_main_grp_id', $wrong_id);
+            DB_delete($_TABLES['groups'], 'grp_name', 'Static Pages Admin');
+        }
+    }
+
     return true;
 }
 
diff -r 3e03947c0624 -r 1185208e854a plugins/staticpages/sql/mysql_updates.php
--- a/plugins/staticpages/sql/mysql_updates.php	Sat Oct 03 11:46:54 2009 +0200
+++ b/plugins/staticpages/sql/mysql_updates.php	Sat Oct 03 14:50:24 2009 +0200
@@ -47,7 +47,7 @@
 */
 function update_ConfValues_1_6_0()
 {
-    global $_CONF, $_SP_DEFAULT;
+    global $_CONF, $_TABLES, $_SP_DEFAULT;
 
     require_once $_CONF['path_system'] . 'classes/config.class.php';
 
@@ -56,6 +56,24 @@
     // meta tag config options.
     $c->add('meta_tags', $_SP_DEFAULT['meta_tags'], 'select', 0, 0, 0, 120, true, 'staticpages');
 
+    // check for wrong Admin group name
+    $wrong_id = DB_getItem($_TABLES['groups'], 'grp_id',
+                           "grp_name = 'Static Pages Admin'"); // wrong name
+    if (! empty($wrong_id)) {
+        $grp_id = DB_getItem($_TABLES['groups'], 'grp_id',
+                             "grp_name = 'Static Page Admin'"); // correct name
+        if (empty($grp_id)) {
+            // correct name not found - probably a fresh install: rename
+            DB_query("UPDATE {$_TABLES['groups']} SET grp_name = 'Static Page Admin' WHERE grp_name = 'Static Pages Admin'");
+        } else {
+            // both names exist: delete wrong group & assignments
+            DB_delete($_TABLES['access'], 'acc_grp_id', $wrong_id);
+            DB_delete($_TABLES['group_assignments'], 'ug_grp_id', $wrong_id);
+            DB_delete($_TABLES['group_assignments'], 'ug_main_grp_id', $wrong_id);
+            DB_delete($_TABLES['groups'], 'grp_name', 'Static Pages Admin');
+        }
+    }
+
     return true;
 }
 
diff -r 3e03947c0624 -r 1185208e854a public_html/docs/history
--- a/public_html/docs/history	Sat Oct 03 11:46:54 2009 +0200
+++ b/public_html/docs/history	Sat Oct 03 14:50:24 2009 +0200
@@ -87,8 +87,10 @@
 - Introduced [poll:], [poll_vote:], and [poll_result:] autotags, allowing to
   embed polls where autotags are allowed, provided by Tom Homer
 
-Static Pages Plugin
--------------------
+Static Pages Plugin 1.6.1
+-------------------
+- Fresh installs of the plugin in Geeklog 1.6.1 accidentally used a wrong name
+  for the plugin's admin group. Silently fix that during the upgrade [Dirk]
 - Made the list of pages sortable by author (feature request #0000978) [Dirk]
 - List available autotags in the static pages editor [Dirk]
 - Added support for meta tags and meta keywords, provided by Tom Homer



More information about the geeklog-cvs mailing list