[geeklog-cvs] geeklog: Implemented Links upgrade

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Mon Jan 5 05:06:22 EST 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/1f6f00948537
changeset: 6599:1f6f00948537
user:      Dirk Haun <dirk at haun-online.de>
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;
 }



More information about the geeklog-cvs mailing list