[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/news_admin/setup/ -> tables_update.inc.php (source)

   1  <?php
   2      /**************************************************************************\
   3      * eGroupWare - Webpage news admin                                          *
   4      * http://www.egroupware.org                                                *
   5      * --------------------------------------------                             *
   6      *  This program is free software; you can redistribute it and/or modify it *
   7      *  under the terms of the GNU General Public License as published by the   *
   8      *  Free Software Foundation; either version 2 of the License, or (at your  *
   9      *  option) any later version.                                              *
  10      * --------------------------------------------                             *
  11      * This program was sponsered by Golden Glair productions                   *
  12      * http://www.goldenglair.com                                               *
  13      \**************************************************************************/
  14  
  15      /* $Id: tables_update.inc.php 20295 2006-02-15 12:31:25Z  $ */
  16  
  17      $test[] = '0.0.1';
  18  	function news_admin_upgrade0_0_1()
  19      {
  20          return $setup_info['news_admin']['currentver'] = '0.8.1';
  21      }
  22  
  23      $test[] = '0.8.1';
  24  	function news_admin_upgrade0_8_1()
  25      {
  26          $GLOBALS['egw_setup']->oProc->RenameTable('webpage_news','phpgw_news');
  27  
  28          return $setup_info['news_admin']['currentver'] = '0.8.1.001';
  29      }
  30  
  31      $test[] = '0.8.1.001';
  32  	function news_admin_upgrade0_8_1_001()
  33      {
  34          $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_news','news_cat',array('type' => 'int','precision' => 4,'nullable' => True));
  35          $GLOBALS['egw_setup']->oProc->query("update phpgw_news set news_cat='0'",__LINE__,__FILE__);
  36  
  37          return $setup_info['news_admin']['currentver'] = '0.8.1.002';
  38      }
  39  
  40      $test[] = '0.8.1.002';
  41  	function news_admin_upgrade0_8_1_002()
  42      {
  43          $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_news','news_teaser',array(
  44              'type' => 'varchar',
  45              'precision' => '255',
  46              'nullable' => True
  47          ));
  48  
  49          return $GLOBALS['setup_info']['news_admin']['currentver'] = '0.9.14.500';
  50      }
  51  
  52      $test[] = '0.9.14.500';
  53  	function news_admin_upgrade0_9_14_500()
  54      {
  55          $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_news_export',array(
  56              'fd' => array(
  57                  'cat_id' => array('type' => 'int','precision' => '4','nullable' => False),
  58                  'export_type' => array('type' => 'int','precision' => '2','nullable' => True),
  59                  'export_itemsyntax' => array('type' => 'int','precision' => '2','nullable' => True),
  60                  'export_title' => array('type' => 'varchar','precision' => '255','nullable' => True),
  61                  'export_link' => array('type' => 'varchar','precision' => '255','nullable' => True),
  62                  'export_description' => array('type' => 'text', 'nullable' => True),
  63                  'export_img_title' => array('type' => 'varchar','precision' => '255','nullable' => True),
  64                  'export_img_url' => array('type' => 'varchar','precision' => '255','nullable' => True),
  65                  'export_img_link' => array('type' => 'varchar','precision' => '255','nullable' => True),
  66              ),
  67              'pk' => array('cat_id'),
  68              'fk' => array(),
  69              'ix' => array(),
  70              'uc' => array()
  71          ));
  72  
  73          return $GLOBALS['setup_info']['news_admin']['currentver'] = '0.9.14.501';
  74      }
  75  
  76      $test[] = '0.9.14.501';
  77  	function news_admin_upgrade0_9_14_501()
  78      {
  79          $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_news','news_begin',array(
  80              'type' => 'int','precision' => '4','nullable' => True
  81          ));
  82          $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_news','news_end',array(
  83              'type' => 'int','precision' => '4','nullable' => True
  84          ));
  85          $db2 = $GLOBALS['egw_setup']->db;
  86          $GLOBALS['egw_setup']->oProc->query('SELECT news_id,news_status FROM phpgw_news');
  87          while($GLOBALS['egw_setup']->oProc->next_record())
  88          {
  89              $unixtimestampmax = 2147483647;
  90              $db2->query('UPDATE phpgw_news SET news_begin=news_date,news_end=' . 
  91                  (($GLOBALS['egw_setup']->oProc->f('news_status') == 'Active') ? $unixtimestampmax : 'news_date') .
  92                  ' WHERE news_id=' . $GLOBALS['egw_setup']->oProc->f('news_id'));
  93          }
  94          $newtbldef = array(
  95              'fd' => array(
  96                  'news_id' => array('type' => 'auto','nullable' => False),
  97                  'news_date' => array('type' => 'int','precision' => '4','nullable' => True),
  98                  'news_subject' => array('type' => 'varchar','precision' => '255','nullable' => True),
  99                  'news_submittedby' => array('type' => 'varchar','precision' => '255','nullable' => True),
 100                  'news_content' => array('type' => 'blob','nullable' => True),
 101                  'news_begin' => array('type' => 'int','precision' => '4','nullable' => True),
 102                  'news_end' => array('type' => 'int','precision' => '4','nullable' => True),
 103                  'news_cat' => array('type' => 'int','precision' => '4','nullable' => True),
 104                  'news_teaser' => array('type' => 'varchar','precision' => '255','nullable' => True)
 105              ),
 106              'pk' => array('news_id'),
 107              'fk' => array(),
 108              'ix' => array('news_date','news_subject'),
 109              'uc' => array()
 110          );
 111          $GLOBALS['egw_setup']->oProc->DropColumn('phpgw_news',$newtbldef,'news_status');
 112  
 113          return $GLOBALS['setup_info']['news_admin']['currentver'] = '0.9.14.502';
 114      }
 115  
 116  
 117      $test[] = '0.9.14.502';
 118  	function news_admin_upgrade0_9_14_502()
 119      {
 120          $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_news','is_html',array(
 121              'type' => 'int',
 122              'precision' => '2',
 123              'nullable' => False,
 124              'default' => '0'
 125          ));
 126  
 127          return $GLOBALS['setup_info']['news_admin']['currentver'] = '0.9.14.503';
 128      }
 129  
 130  
 131      $test[] = '0.9.14.503';
 132  	function news_admin_upgrade0_9_14_503()
 133      {
 134          return $GLOBALS['setup_info']['news_admin']['currentver'] = '1.0.0';
 135      }
 136  
 137  
 138      $test[] = '1.0.0';
 139  	function news_admin_upgrade1_0_0()
 140      {
 141          $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_news','news_begin',array(
 142              'type' => 'int',
 143              'precision' => '4',
 144              'nullable' => False,
 145              'default' => '0',
 146          ));
 147  
 148          return $GLOBALS['setup_info']['news_admin']['currentver'] = '1.0.0.001';
 149      }
 150  
 151      $test[] = '1.0.0.001';
 152  	function news_admin_upgrade1_0_0_001()
 153      {
 154          $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_news','egw_news');
 155          // timestamps have to be 64bit=8byte
 156          $GLOBALS['egw_setup']->oProc->AlterColumn('egw_news','news_date',array(
 157              'type' => 'int',
 158              'precision' => '8',
 159          ));
 160          $GLOBALS['egw_setup']->oProc->AlterColumn('egw_news','news_begin',array(
 161              'type' => 'int',
 162              'precision' => '8',
 163              'nullable' => False,
 164              'default' => '0',
 165          ));
 166          $GLOBALS['egw_setup']->oProc->AlterColumn('egw_news','news_end',array(
 167              'type' => 'int',
 168              'precision' => '8',
 169          ));
 170          $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_news_export','egw_news_export');
 171  
 172          return $GLOBALS['setup_info']['news_admin']['currentver'] = '1.2';
 173      }


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7