[geeklog-cvs] Geeklog-1.x/plugins/polls functions.inc,1.85,1.86

Dirk Haun dhaun at qs1489.pair.com
Mon Mar 17 17:12:56 EDT 2008


Update of /cvsroot/geeklog/Geeklog-1.x/plugins/polls
In directory qs1489.pair.com:/tmp/cvs-serv17216/polls

Modified Files:
	functions.inc 
Log Message:
Plugins are updated by the install script, so we don't need to maintain the plugin's upgrade function


Index: functions.inc
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/plugins/polls/functions.inc,v
retrieving revision 1.85
retrieving revision 1.86
diff -C2 -d -r1.85 -r1.86
*** functions.inc	16 Mar 2008 09:33:23 -0000	1.85
--- functions.inc	17 Mar 2008 21:12:54 -0000	1.86
***************
*** 1107,1153 ****
  *
  */
! function plugin_upgrade_polls ()
  {
!     global $_TABLES, $_PO_CONF;
! 
!     // the plugin needs this function so complain when it doesn't exist
!     if (!function_exists ('SEC_getGroupDropdown')) {
          return 3002;
      }
  
!     $current_version = DB_getItem ($_TABLES['plugins'], 'pi_version',
!                                    "pi_name = 'polls'");
!     if ($current_version == '1.0') {
!         $sql = "ALTER TABLE {$_TABLES['pollanswers']} ADD remark VARCHAR(255) NULL AFTER votes;";
!         $result = DB_query ($sql);
!     } else if ($current_version == '1.1.0') {
!         $_SQL[] = "RENAME TABLE `{$_TABLES['pollquestions']}` TO `{$_TABLES['polltopics']}`;";
!         $_SQL[] = "ALTER TABLE `{$_TABLES['polltopics']}` CHANGE `question` `topic` VARCHAR( 255 )  NULL DEFAULT NULL";
!         $_SQL[] = "ALTER TABLE `{$_TABLES['polltopics']}` CHANGE `qid` `pid` VARCHAR( 20 ) NOT NULL";
!         $_SQL[] = "ALTER TABLE `{$_TABLES['polltopics']}` ADD questions int(11) NOT NULL AFTER voters";
!         $_SQL[] = "ALTER TABLE `{$_TABLES['polltopics']}` ADD open tinyint(1) NOT NULL default '1' AFTER display";
!         $_SQL[] = "ALTER TABLE `{$_TABLES['polltopics']}` ADD hideresults tinyint(1) NOT NULL default '0' AFTER open";
!         $_SQL[] = "ALTER TABLE `{$_TABLES['pollanswers']}` CHANGE `qid` `pid` VARCHAR( 20 ) NOT NULL";
!         $_SQL[] = "ALTER TABLE `{$_TABLES['pollanswers']}` ADD `qid` VARCHAR( 20 ) NOT NULL DEFAULT '0' AFTER `pid`;";
!         $_SQL[] = "ALTER TABLE `{$_TABLES['pollvoters']}` CHANGE `qid` `pid` VARCHAR( 20 ) NOT NULL";
!         $_SQL[] = "CREATE TABLE {$_TABLES['pollquestions']} (
!               qid mediumint(9) NOT NULL DEFAULT '0',
!               pid varchar(20) NOT NULL,
!               question varchar(255) NOT NULL,
!               PRIMARY KEY (qid)
!             ) TYPE=MyISAM
!             ";
! 
!         $_SQL[] = "INSERT INTO {$_TABLES['pollquestions']} (pid, question) SELECT pid, topic FROM {$_TABLES['polltopics']}";
! 
!         for ($i=0; $i<count($_SQL); $i++) {
!             $result = DB_query ($_SQL[$i]);
!         }
! 
!     }
! 
!     DB_query ("UPDATE {$_TABLES['plugins']} SET pi_version = '{$_PO_CONF['version']}', pi_gl_version = '" . VERSION . "' WHERE pi_name = 'polls'");
! 
!     return true;
  }
  
--- 1107,1121 ----
  *
  */
! 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')) {
          return 3002;
      }
  
!     // upgrades are done by the install script - return a generic error
!     COM_errorLog("Plugin upgrade function not implemented");
!     return 3001;
  }
  




More information about the geeklog-cvs mailing list