[geeklog-cvs] Geeklog-1.x/plugins/staticpages functions.inc, 1.103, 1.104

Blaine Lang blaine at qs1489.pair.com
Sun Dec 30 11:34:39 EST 2007


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

Modified Files:
	functions.inc 
Log Message:
Updated lib-plugins autouninstall function to also support removing the config table data

Update the staticpages plugin to now include an upgrade function that will set the default online config data to the current config.php settings for the plugin and then renames the config.php as it's no longer needed.

Still need to update the staticpages installer.

Index: functions.inc
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/plugins/staticpages/functions.inc,v
retrieving revision 1.103
retrieving revision 1.104
diff -C2 -d -r1.103 -r1.104
*** functions.inc	29 Dec 2007 15:26:53 -0000	1.103
--- functions.inc	30 Dec 2007 16:34:37 -0000	1.104
***************
*** 50,54 ****
  }
  
! include $plugin_path . 'config.php';
  
  // +---------------------------------------------------------------------------+
--- 50,67 ----
  }
  
! if (file_exists("{$plugin_path}config.php")) {
!    include $plugin_path . 'config.php';
!    $_SP_CONF['version'] = '1.5';
! } else {
!     require_once $_CONF['path_system'] . 'classes/config.class.php';
!     $sp_config = config::get_instance();
!     $sp_config->initConfig();
! 
!     $LANG_configsubgroups['staticpages'][0] = 'Main Settings';
!     $LANG_fs['staticpages'][0] = 'Main Settings';
! 
!     $_SP_CONF = $sp_config->get_config('staticpages');
! }
! 
  
  // +---------------------------------------------------------------------------+
***************
*** 1006,1010 ****
  function plugin_upgrade_staticpages ()
  {
!     global $_TABLES, $_SP_CONF;
  
      // the plugin needs this function so complain when it doesn't exist
--- 1019,1023 ----
  function plugin_upgrade_staticpages ()
  {
!     global $_CONF,$_TABLES, $_SP_CONF, $plugin_path;
  
      // the plugin needs this function so complain when it doesn't exist
***************
*** 1013,1018 ****
      }
  
!     // no db changes - just update the version number
!     DB_query ("UPDATE {$_TABLES['plugins']} SET pi_version = '{$_SP_CONF['version']}' WHERE pi_name = 'staticpages'");
  
      return true;
--- 1026,1060 ----
      }
  
!     $pi_version = DB_getItem($_TABLES['plugins'],'pi_version',"pi_name='staticpages'");
! 
!     if ($pi_version == '1.4.3') {  // Need to initialize the config table - GL 1.5+ feature
!         require_once $_CONF['path_system'] . 'classes/config.class.php';
!         $sp_config = config::get_instance();
!         $sp_config->initConfig();
!         if(! $sp_config->group_exists('staticpages')){
!             $sp_config->add('version', '1.5', 'text', 0, 0, null, 0, true, 'staticpages');
! 
!             $sp_config->add('allow_php', $_SP_CONF['allow_php'], 'text', 0, 0, null, 0, true, 'staticpages');
!             $sp_config->add('sort_by', $_SP_CONF['sort_by'],  'text', 0, 0, null, 0, true, 'staticpages');
!             $sp_config->add('sort_menu_by', $_SP_CONF['sort_menu_by'], 'text', 0, 0, null, 0, true, 'staticpages');
!             $sp_config->add('delete_pages', $_SP_CONF['delete_pages'] , 'text', 0, 0, null, 0, true, 'staticpages');
!             $sp_config->add('in_block', $_SP_CONF['in_block'], 'text', 0, 0, null, 0, true, 'staticpages');
!             $sp_config->add('show_hits', $_SP_CONF['show_hits'], 'text', 0, 0, null, 0, true, 'staticpages');
!             $sp_config->add('show_date', $_SP_CONF['show_date'], 'text', 0, 0, null, 0, true, 'staticpages');
!             $sp_config->add('filter_html', $_SP_CONF['filter_html'], 'text', 0, 0, null, 0, true, 'staticpages');
!             $sp_config->add('censor', $_SP_CONF['censor'], 'text', 0, 0, null, 0, true, 'staticpages');
!             $sp_config->add('default_permissions', $_SP_CONF['default_permissions'], '@text', 0, 0, null, 0, true, 'staticpages');
! 
!             //$sp_config->add('aftersave', 'item', 'text', 0, 0, null, 0, true, 'staticpages');
!             //$sp_config->add('atom_max_items', 10, 'text', 0, 0, null, 0, true, 'staticpages');
!             if($sp_config->group_exists('staticpages')){
!                 DB_query ("UPDATE {$_TABLES['plugins']} SET pi_version = '1.5' WHERE pi_name = 'staticpages'");
!             }
! 
!             // Rename the existing config.php as it's not needed now
!             @rename ("{$plugin_path}config.php","{$plugin_path}config-pre1.4.3.php");
!         }
! 
!     }
  
      return true;
***************
*** 1044,1049 ****
          'php_blocks' => array('phpblock_calendar'),
          /* give all vars with their name */
!         'vars'=> array()
      );
      return $out;
  }
--- 1086,1094 ----
          'php_blocks' => array('phpblock_calendar'),
          /* give all vars with their name */
!         'vars'=> array(),
!         /* give the full name of the plugins config data to be removed from the config table */
!         'config_data' => array('staticpages')
      );
+ 
      return $out;
  }




More information about the geeklog-cvs mailing list