R54228 - in /branches/14.2/phpgwapi/setup: setup.inc.php tables_current.inc.php tables_update.inc.php

Author: ralfbecker
New Revision: 54228

URL: http://svn.stylite.de/viewvc/egroupware?rev=54228&view=rev
Log:
Change egw_sqlfs_props.prop_value back to utf-8/varchar, as it can contain user content eg. our comments, replace non-ascii chars in contact_pubkey, before converting to ascii

Modified:
branches/14.2/phpgwapi/setup/setup.inc.php
branches/14.2/phpgwapi/setup/tables_current.inc.php
branches/14.2/phpgwapi/setup/tables_update.inc.php

Modified: branches/14.2/phpgwapi/setup/setup.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/branches/14.2/phpgwapi/setup/setup.inc.php?rev=54228&r1=54227&r2=54228&view=diff

— branches/14.2/phpgwapi/setup/setup.inc.php (original)
+++ branches/14.2/phpgwapi/setup/setup.inc.php Tue Nov 10 12:22:30 2015
@@ -12,7 +12,7 @@
/* Basic information about this app */
$setup_info[‘phpgwapi’][‘name’] = ‘phpgwapi’;
$setup_info[‘phpgwapi’][‘title’] = ‘EGroupware API’;
-$setup_info[‘phpgwapi’][‘version’] = ‘14.3.006’;
+$setup_info[‘phpgwapi’][‘version’] = ‘14.3.007’;
$setup_info[‘phpgwapi’][‘versions’][‘current_header’] = ‘1.29’;
$setup_info[‘phpgwapi’][‘enable’] = 3;
$setup_info[‘phpgwapi’][‘app_order’] = 1;

Modified: branches/14.2/phpgwapi/setup/tables_current.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/branches/14.2/phpgwapi/setup/tables_current.inc.php?rev=54228&r1=54227&r2=54228&view=diff

— branches/14.2/phpgwapi/setup/tables_current.inc.php (original)
+++ branches/14.2/phpgwapi/setup/tables_current.inc.php Tue Nov 10 12:22:30 2015
@@ -427,7 +427,7 @@
‘fs_id’ => array(‘type’ => ‘int’,‘precision’ => ‘4’,‘nullable’ => False),
‘prop_namespace’ => array(‘type’ => ‘ascii’,‘precision’ => ‘64’,‘nullable’ => False),
‘prop_name’ => array(‘type’ => ‘ascii’,‘precision’ => ‘64’,‘nullable’ => False),

  •   	'prop_value' => array('type' => 'ascii','precision' => '16384'),
    
  •   	'prop_value' => array('type' => 'varchar','precision' => '16384'),
      	'prop_id' => array('type' => 'auto','nullable' => False)
      ),
      'pk' => array('prop_id'),
    

Modified: branches/14.2/phpgwapi/setup/tables_update.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/branches/14.2/phpgwapi/setup/tables_update.inc.php?rev=54228&r1=54227&r2=54228&view=diff

— branches/14.2/phpgwapi/setup/tables_update.inc.php (original)
+++ branches/14.2/phpgwapi/setup/tables_update.inc.php Tue Nov 10 12:22:30 2015
@@ -525,11 +525,24 @@
‘precision’ => ‘32’,
‘comment’ => ‘currently not used’
));

  • $GLOBALS[‘egw_setup’]->oProc->AlterColumn(‘egw_addressbook’,‘contact_pubkey’,array(
  •   'type' => 'ascii',
    
  •   'precision' => '8192',
    
  •   'comment' => 'public key'
    
  • ));
  • // remove non-ascii chars from contact_pubkey for MySQL, before converting it to ascii to avoid SQL error
  • if ($GLOBALS[‘egw_setup’]->db->Type == ‘mysql’)
  • {
  •   $GLOBALS['egw_setup']->db->query("UPDATE egw_addressbook
    

+SET contact_pubkey=CONVERT(contact_pubkey USING ASCII)
+WHERE contact_pubkey IS NOT NULL", LINE, FILE);

  • }
  • // only shorten pubkey to varchar(16384), if it does NOT contain longer input and it can be stored as varchar
  • $max_pubkey_length = $GLOBALS[‘egw’]->db->query(‘SELECT MAX(LENGTH(contact_pubkey)) FROM egw_addressbook’)->fetchColumn();
  • // returns NULL, if there are no rows!
  • if ((int)$max_pubkey_length <= 16384 && $GLOBALS[‘egw_setup’]->oProc->max_varchar_length >= 16384)
  • {
  •   $GLOBALS['egw_setup']->oProc->AlterColumn('egw_addressbook','contact_pubkey',array(
    
  •   	'type' => 'ascii',
    
  •   	'precision' => '16384',
    
  •   	'comment' => 'public key'
    
  •   ));
    
  • }
    $GLOBALS[‘egw_setup’]->oProc->AlterColumn(‘egw_addressbook’,‘contact_uid’,array(
    ‘type’ => ‘ascii’,
    ‘precision’ => ‘128’,
    @@ -695,7 +708,7 @@
    ‘fs_id’ => array(‘type’ => ‘int’,‘precision’ => ‘4’,‘nullable’ => False),
    ‘prop_namespace’ => array(‘type’ => ‘ascii’,‘precision’ => ‘64’,‘nullable’ => False),
    ‘prop_name’ => array(‘type’ => ‘ascii’,‘precision’ => ‘64’,‘nullable’ => False),
  •   	'prop_value' => array('type' => 'ascii','precision' => '16384'),
    
  •   	'prop_value' => array('type' => 'varchar','precision' => '16384'),
      	'prop_id' => array('type' => 'auto','nullable' => False)
      ),
      'pk' => array('prop_id'),
    

@@ -895,3 +908,21 @@

return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '14.3.006';

}
+
+/**

    • Change egw_sqlfs_props.prop_value back to utf-8/varchar, as it can contain user content eg. our comments
    • @return string
  • */
    +function phpgwapi_upgrade14_3_006()
    +{
  • $GLOBALS[‘run-from-upgrade14_3_006’] = true;
  • $GLOBALS[‘egw_setup’]->oProc->AlterColumn(‘egw_sqlfs_props’,‘prop_value’,array(
  •   'type' => 'varchar',
    
  •   'precision' => '16384'
    
  • ));
  • return $GLOBALS[‘setup_info’][‘phpgwapi’][‘currentver’] = ‘14.3.007’;
    +}


eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs