[ Index ]
 

Code source de GeekLog 1.4.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/sql/updates/ -> mysql_1.4.0_to_1.4.1.php (source)

   1  <?php
   2  
   3  // new 'syndication.edit' feature
   4  $_SQL[] = "INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('syndication.edit', 'Access to Content Syndication', 1)";
   5  
   6  // add the 'Syndication Admin' group
   7  $_SQL[] = "INSERT INTO {$_TABLES['groups']} (grp_name, grp_descr, grp_gl_core) VALUES ('Syndication Admin', 'Can create and modify web feeds for the site',1) ";
   8  
   9  // update plugin version numbers
  10  $_SQL[] = "UPDATE {$_TABLES['plugins']} SET pi_version = '1.0.1', pi_gl_version = '1.4.1' WHERE pi_name = 'links'";
  11  $_SQL[] = "UPDATE {$_TABLES['plugins']} SET pi_version = '1.1.0', pi_gl_version = '1.4.1' WHERE pi_name = 'polls'";
  12  $_SQL[] = "UPDATE {$_TABLES['plugins']} SET pi_version = '1.1.0', pi_gl_version = '1.4.1' WHERE pi_name = 'spamx'";
  13  $_SQL[] = "UPDATE {$_TABLES['plugins']} SET pi_version = '1.4.3', pi_gl_version = '1.4.1' WHERE pi_name = 'staticpages'";
  14  
  15  // Calendar plugin
  16  $_SQL[] = "INSERT INTO {$_TABLES['plugins']} (pi_name, pi_version, pi_gl_version, pi_enabled, pi_homepage) VALUES ('calendar', '1.0.0', '1.4.1', 1, 'http://www.geeklog.net/')";
  17  $_SQL[] = "UPDATE {$_TABLES['features']} SET ft_name = 'calendar.edit', ft_gl_core = '0' WHERE ft_name = 'event.edit'";
  18  $_SQL[] = "UPDATE {$_TABLES['features']} SET ft_name = 'calendar.moderate', ft_gl_core = '0' WHERE ft_name = 'event.moderate'";
  19  $_SQL[] = "UPDATE {$_TABLES['features']} SET ft_name = 'calendar.submit', ft_gl_core = '0' WHERE ft_name = 'event.submit'";
  20  $_SQL[] = "UPDATE {$_TABLES['groups']} SET grp_name = 'Calendar Admin', grp_gl_core = '0' WHERE grp_name = 'Event Admin'";
  21  $_SQL[] = "UPDATE {$_TABLES['blocks']} SET type = 'phpblock', phpblockfn ='phpblock_calendar' WHERE name = 'events_block'";
  22  
  23  // add new field to the stories table to indicate story was created or last updated using the advanced editor
  24  $_SQL[] = "ALTER TABLE {$_TABLES['stories']} ADD advanced_editor_mode tinyint(1) unsigned default '0' AFTER postmode";
  25  
  26  // add new field to enable/disable use of autotags in "normal" blocks
  27  $_SQL[] = "ALTER TABLE {$_TABLES['blocks']} ADD allow_autotags tinyint(1) unsigned NOT NULL DEFAULT '0' AFTER content";
  28  
  29  // allow up to 255 characters for the help URL
  30  $_SQL[] = "ALTER TABLE {$_TABLES['blocks']} CHANGE help help varchar(255) default ''";
  31  
  32  // set regdate to a valid date for users in a really old (pre-1.3) database
  33  $_SQL[] = "UPDATE {$_TABLES['users']} SET regdate = '2001-12-17 00:00:00' WHERE regdate = '0000-00-00 00:00:00'";
  34  
  35  // add the new 'syndication.edit' feature and the 'Syndication Admin' group
  36  function upgrade_addSyndicationFeature ()
  37  {
  38      global $_TABLES;
  39  
  40      $ft_id = DB_getItem ($_TABLES['features'], 'ft_id',
  41                           "ft_name = 'syndication.edit'");
  42      $grp_id = DB_getItem ($_TABLES['groups'], 'grp_id',
  43                            "grp_name = 'Syndication Admin'");
  44      $rootgrp = DB_getItem ($_TABLES['groups'], 'grp_id',
  45                             "grp_name = 'Root'");
  46  
  47      if(($grp_id > 0) && ($ft_id > 0)) {
  48          // add 'syndication.edit' feature to 'Syndication Admin' group
  49          DB_query ("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ($ft_id, $grp_id)");
  50  
  51          // make 'Root' members a member of 'Syndication Admin'
  52          if($rootgrp > 0) {
  53              DB_query ("INSERT INTO {$_TABLES['group_assignments']} (ug_main_grp_id, ug_uid, ug_grp_id) VALUES ($grp_id, NULL, $rootgrp)");
  54          }
  55      }
  56  }
  57  
  58  // The 'last_scheduled_run' entry was introduced in Geeklog 1.4.0 but was
  59  // missing from the upgrade, i.e. it exists only on fresh 1.4.0 installs.
  60  function upgrade_ensureLastScheduledRunFlag ()
  61  {
  62      global $_TABLES;
  63  
  64      $val = DB_getItem ($_TABLES['vars'], 'value',
  65                         "name = 'last_scheduled_run'");
  66      if (empty ($val)) {
  67          DB_save ($_TABLES['vars'], 'name,value', "'last_scheduled_run',''");
  68      }
  69  }
  70  
  71  // update plugins if they're installed (disabled or not)
  72  function upgrade_plugins_141 ()
  73  {
  74      global $_TABLES;
  75  
  76      // add remarks-field to polls
  77      if (DB_count ($_TABLES['plugins'], 'pi_name', 'polls') == 1) {
  78          DB_query ("ALTER TABLE {$_TABLES['pollanswers']} ADD remark varchar(255) NULL AFTER votes");
  79      }
  80  
  81      if (DB_count ($_TABLES['plugins'], 'pi_name', 'spamx') == 1) {
  82          // delete MT-Blacklist entries from Spam-X plugin
  83          DB_query ("DELETE FROM {$_TABLES['spamx']} WHERE name = 'MTBlacklist'");
  84  
  85          // the count of deleted spams was introduced in 1.4.0 but not added
  86          // when upgrading from an older database, so add it now if it's missing
  87          $val = DB_getItem ($_TABLES['vars'], 'value', "name = 'spamx.counter'");
  88          if (empty ($val)) {
  89              DB_save ($_TABLES['vars'], 'name,value', "'spamx.counter','0'");
  90          }
  91      }
  92  
  93      // add field to support advanced editor and a help link in staticpages
  94      if (DB_count ($_TABLES['plugins'], 'pi_name', 'staticpages') == 1) {
  95          DB_query ("ALTER TABLE {$_TABLES['staticpage']} ADD postmode varchar(16) DEFAULT 'html' NOT NULL AFTER sp_inblock");
  96          DB_query ("ALTER TABLE {$_TABLES['staticpage']} ADD sp_help varchar(255) default '' AFTER sp_centerblock");
  97      }
  98  }
  99  
 100  ?>


Généré le : Wed Nov 21 12:27:40 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics