R53481 - in /branches/14.2/phpgwapi: ./ inc/class.db_backup.inc.php inc/class.schema_proc.inc.php

ImportTimoutError: THIS MESSAGE WAS NOT PARSED BY THE IMPORTER!!
Return-Path: egroupware-cvs-bounces@lists.sourceforge.net
X-Original-To: lists+1266706073828-308044@n3.nabble.com
Delivered-To: lists+1266706073828-308044@n3.nabble.com
Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88])
by mbob.nabble.com (Postfix) with ESMTP id 790EF1408A11
for lists+1266706073828-308044@n3.nabble.com; Wed, 26 Aug 2015 05:49:20 -0700 (PDT)
Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com)
by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76)
(envelope-from egroupware-cvs-bounces@lists.sourceforge.net)
id 1ZUaB0-00031x-Uf; Wed, 26 Aug 2015 12:51:38 +0000
Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192]
helo=mx.sourceforge.net)
by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76)
(envelope-from ralfbecker@users.sourceforge.net)
id 1ZUaB0-00031s-NP for egroupware-cvs@lists.sourceforge.net;
Wed, 26 Aug 2015 12:51:38 +0000
X-ACL-Warn:
Received: from dovecot.stylite.de ([213.183.76.200])
by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256)
(Exim 4.76) id 1ZUaAo-0007nA-Tj
for egroupware-cvs@lists.sourceforge.net;
Wed, 26 Aug 2015 12:51:38 +0000
Received: from localhost.localdomain (svn [10.40.8.12])
by dovecot.stylite.de (Postfix) with ESMTP id EBA26E9
for egroupware-cvs@lists.sf.net;
Wed, 26 Aug 2015 14:51:20 +0200 (CEST)
MIME-Version: 1.0
Date: Wed, 26 Aug 2015 12:51:20 -0000
To: egroupware-cvs@lists.sf.net
From: ralfbecker@users.sourceforge.net
X-Mailer: svnmailer-1.0.8
X-Spam-Score: 1.0 (+)
X-Spam-Report: Spam Filtering performed by mx.sourceforge.net.
See http://spamassassin.org/tag/ for more details.
1.0 MISSING_MID Missing Message-Id: header
X-Headers-End: 1ZUaAo-0007nA-Tj
Subject: [eGroupWare-svn] r53481 - in /branches/14.2/phpgwapi: ./
inc/class.db_backup.inc.php inc/class.schema_proc.inc.php
X-BeenThere: egroupware-cvs@lists.sourceforge.net
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: “SVN commits (automaticaly generated)”
<egroupware-cvs.lists.sourceforge.net>
List-Unsubscribe: https://lists.sourceforge.net/lists/listinfo/egroupware-cvs,
mailto:egroupware-cvs-request@lists.sourceforge.net?subject=unsubscribe
List-Archive: http://sourceforge.net/mailarchive/forum.php?forum_name=egroupware-cvs
List-Post: mailto:egroupware-cvs@lists.sourceforge.net
List-Help: mailto:egroupware-cvs-request@lists.sourceforge.net?subject=help
List-Subscribe: https://lists.sourceforge.net/lists/listinfo/egroupware-cvs,
mailto:egroupware-cvs-request@lists.sourceforge.net?subject=subscribe
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: egroupware-cvs-bounces@lists.sourceforge.net
Message-Id: E1ZUaB0-00031x-Uf@sfs-ml-1.v29.ch3.sourceforge.com

Author: ralfbecker
Date: Wed Aug 26 14:51:20 2015
New Revision: 53481

URL: http://svn.stylite.de/viewvc/egroupware?rev=53481&view=rev
Log:

  • Backup: backup ascii columns as such, allways check and if necessary fix indexes on restore

Modified:
branches/14.2/phpgwapi/ (props changed)
branches/14.2/phpgwapi/inc/class.db_backup.inc.php
branches/14.2/phpgwapi/inc/class.schema_proc.inc.php

Propchange: branches/14.2/phpgwapi/

— svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 26 14:51:20 2015
@@ -1,1 +1,1 @@
-/trunk/phpgwapi:51366,51376,51397,51419,51437,51453-51454,51479,51503,51512,51518,51521-51522,51526-51528,51530,51539,51556,51562,51577,51579,51588-51589,51612,51626,51701,51716-51717,51721,51758,51762-51763,51768,51775,51779,51785,51800,51810,51812,51817,51824,51839,51855,51870,51881-51882,51886,51905,51909,51918,51973,51975,51977,51988,52007,52016,52054,52057,52059,52062,52088,52099,52107-52108,52132,52147,52149,52165,52177,52179,52199,52220,52238,52241,52252,52268,52274,52283,52288-52289,52296,52301,52310,52312,52314,52316,52322-52323,52327,52332,52334,52341,52368-52372,52375,52399,52428,52457,52494,52497,52501,52517-52518,52532,52534,52575,52579,52588,52596,52598,52604,52608,52619,52621,52653,52684,52686,52706,52732,52752,52787,52797,52820,52846,52900,52905,52908,52912,52958,52961,53008,53011,53021-53022,53024,53047,53051,53067,53080-53081,53085,53087,53095,53097,53101,53112,53116,53145-53147,53173,53185,53187,53192,53200,53205,53215,53244,53252,53254,53264,53270,53277,53285,532
87,53290,53293,53295,53299,53321-53322,53326,53329-53330,53333,53336,53360-53361,53364,53374,53382-53383,53400,53409,53411,53416,53434,53447,53451,53455,53457,53474,53477
+/trunk/phpgwapi:51366,51376,51397,51419,51437,51453-51454,51479,51503,51512,51518,51521-51522,51526-51528,51530,51539,51556,51562,51577,51579,51588-51589,51612,51626,51701,51716-51717,51721,51758,51762-51763,51768,51775,51779,51785,51800,51810,51812,51817,51824,51839,51855,51870,51881-51882,51886,51905,51909,51918,51973,51975,51977,51988,52007,52016,52054,52057,52059,52062,52088,52099,52107-52108,52132,52147,52149,52165,52177,52179,52199,52220,52238,52241,52252,52268,52274,52283,52288-52289,52296,52301,52310,52312,52314,52316,52322-52323,52327,52332,52334,52341,52368-52372,52375,52399,52428,52457,52494,52497,52501,52517-52518,52532,52534,52575,52579,52588,52596,52598,52604,52608,52619,52621,52653,52684,52686,52706,52732,52752,52787,52797,52820,52846,52900,52905,52908,52912,52958,52961,53008,53011,53021-53022,53024,53047,53051,53067,53080-53081,53085,53087,53095,53097,53101,53112,53116,53145-53147,53173,53185,53187,53192,53200,53205,53215,53244,53252,53254,53264,53270,53277,53285,532
87,53290,53293,53295,53299,53321-53322,53326,53329-53330,53333,53336,53360-53361,53364,53374,53382-53383,53400,53409,53411,53416,53434,53447,53451,53455,53457,53474,53477,53480

Modified: branches/14.2/phpgwapi/inc/class.db_backup.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/branches/14.2/phpgwapi/inc/class.db_backup.inc.php?rev=53481&r1=53480&r2=53481&view=diff

— branches/14.2/phpgwapi/inc/class.db_backup.inc.php (original)
+++ branches/14.2/phpgwapi/inc/class.db_backup.inc.php Wed Aug 26 14:51:20 2015
@@ -688,6 +688,10 @@
}
}
}
+

  •   // check if backup contained all indexes and create missing ones
    
  •   $this->schema_proc->CheckCreateIndexes();
    
  •   return $n;
    
    }

Modified: branches/14.2/phpgwapi/inc/class.schema_proc.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/branches/14.2/phpgwapi/inc/class.schema_proc.inc.php?rev=53481&r1=53480&r2=53481&view=diff

— branches/14.2/phpgwapi/inc/class.schema_proc.inc.php (original)
+++ branches/14.2/phpgwapi/inc/class.schema_proc.inc.php Wed Aug 26 14:51:20 2015
@@ -149,16 +149,18 @@
/**
* Check if the given $columns exist as index in the index array $indexes
*

    • @param string/array $columns column-name as string or array of column-names plus optional options key
    • @param string|array $columns column-name as string or array of column-names plus optional options key
    • @param array $indexs array of indexes (column-name as string or array of column-names plus optional options key)
    • @param boolean $ignore_length_limit =false should we take lenght-limits of indexes into account or not
    • @return boolean true if index over $columns exist in the $indexes array
      */
  • function _in_index($columns,$indexs)
  • function _in_index($columns, $indexs, $ignore_length_limit=false)
    {
    if (is_array($columns))
    {
    unset($columns[‘options’]);
    $columns = implode(’-’,$columns);
  •   	if ($ignore_length_limit) $columns = preg_replace('/\(\d+\)/', '', $columns);
      }
      foreach($indexs as $index)
      {
    

@@ -167,6 +169,7 @@
unset($index[‘options’]);
$index = implode(’-’,$index);
}

  •   	if ($ignore_length_limit) $index = preg_replace('/\(\d+\)/', '', $index);
      	if ($columns == $index) return true;
      }
      return false;
    

@@ -549,13 +552,13 @@

	$aSql = $this->dict->CreateIndexSQL($sIdxName,$sTableName,$aColumnNames,$options);
  •   return $this->ExecuteSQLArray($aSql,2,'CreateIndexSQL(%1,%2,%3,%4) sql=%5',False,$name,$sTableName,$aColumnNames,$options,$aSql);
    
  •   return $this->ExecuteSQLArray($aSql,2,'CreateIndexSQL(%1,%2,%3,%4) sql=%5',False,$sTableName,$aColumnNames,$options,$sIdxName,$aSql);
    

    }

    /**

    • Drop an Index
    • @param string $sTablename table-name
    • @param string $sTableName table-name
    • @param array/string $aColumnNames columns of the index or the name of the index
    • @return int 2: no error, 1: errors, but continued, 0: errors aborted
      */
      @@ -1246,7 +1249,9 @@
      }
      break;
      case ‘C’: case ‘C2’:
  •   			$definition['fd'][$name]['type'] = 'varchar';
    
  •   			// ascii columns are reported as varchar
    
  •   			$definition['fd'][$name]['type'] = $this->m_odb->get_column_attribute($name, $sTableName, true, 'type') === 'ascii' ?
    
  •   				'ascii' : 'varchar';
      			$definition['fd'][$name]['precision'] = $column->max_length;
      			break;
      		case 'B':
    

@@ -1368,7 +1373,7 @@
if (method_exists($this->dict,‘MetaIndexes’) &&
is_array($indexes = $this->dict->MetaIndexes($sTableName)) && count($indexes))
{

  •   	foreach($indexes as $index_name => $index)
    
  •   	foreach($indexes as $index)
      	{
      		if($this->capabilities['name_case'] == 'upper')
      		{
    

@@ -1381,11 +1386,53 @@
}
$kind = $index[‘unique’] ? ‘uc’ : ‘ix’;

  •   		$definition[$kind][$index_name] = count($index['columns']) > 1 ? $index['columns'] : $index['columns'][0];
    
  •   		$definition[$kind][] = count($index['columns']) > 1 ? $index['columns'] : $index['columns'][0];
      	}
      	if ($this->debug > 2) $this->debug_message("schema_proc::GetTableDefintion: MetaIndexes(%1) = %2",False,$sTableName,$indexes);
      }
      return $definition;
    
  • }

  • /**

    • Check if all indexes exist and create them if not
    • Does not check index-type of length!
  • */

  • function CheckCreateIndexes()

  • {

  •   foreach($this->adodb->MetaTables('TABLES') as $table)
    
  •   {
    
  •   	if (!($table_def = $this->m_odb->get_table_definitions(true, $table))) continue;
    
  •   	$definition = array();
    
  •   	$this->GetIndexes($table, $definition);
    
  •   	// iterate though indexes we should have according to tables_current
    
  •   	foreach(array('uc', 'ix') as $type)
    
  •   	{
    
  •   		foreach($table_def[$type] as $columns)
    
  •   		{
    
  •   			// sometimes primary key is listed as (unique) index too --> ignore it
    
  •   			if ($this->_in_index($columns, array($table_def['pk']), true)) continue;
    
  •   			// check if they exist in real table and create them if not
    
  •   			if (!$this->_in_index($columns, $definition[$type]) &&
    
  •   				// sometimes index is listed as unique index too --> ignore that
    
  •   				($type == 'uc' || !$this->_in_index($columns, $definition['uc'], true)))
    
  •   			{
    
  •   				// check if index may exists, but without limit in column-name
    
  •   				if ($this->_in_index($columns, $definition[$type], true))
    
  •   				{
    
  •   					// for PostgreSQL we dont use length-limited indexes --> nothing to do
    
  •   					if ($this->m_odb->Type == 'pgsql') continue;
    
  •   					// for MySQL we drop current index and create it with correct length
    
  •   					$this->DropIndex($table, $definition);
    
  •   				}
    
  •   				$this->CreateIndex($table, $columns, $type == 'uc');
    
  •   			}
    
  •   		}
    
  •   	}
    
  •   }
    

    }

    /**



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