Revision 1923
Added by darkviper over 11 years ago
UpgradeHelper.php | ||
---|---|---|
34 | 34 |
*/ |
35 | 35 |
class UpgradeHelper { |
36 | 36 |
|
37 |
public static function existsAllTables(array $aPackage) |
|
37 |
/** |
|
38 |
* Compare available tables against a list of tables |
|
39 |
* @param array list of needed table names without TablePrefix |
|
40 |
* @return array list of missing tables |
|
41 |
*/ |
|
42 |
public static function existsAllTables(array $aTablesList) |
|
38 | 43 |
{ |
39 |
$aPackage = array_flip($aPackage);
|
|
44 |
$aTablesList = array_flip($aTablesList);
|
|
40 | 45 |
$oDb = WbDatabase::getInstance(); |
41 | 46 |
$sPattern = addcslashes ( $oDb->TablePrefix, '%_' ); |
42 | 47 |
if(($oTables = $oDb->query( 'SHOW TABLES LIKE "'.$sPattern.'%"'))) { |
43 | 48 |
while($aTable = $oTables->fetchRow(MYSQL_NUM)) { |
44 | 49 |
$sTable = preg_replace('/^'.preg_quote($oDb->TablePrefix, '/').'/s', '', $aTable[0]); |
45 |
if(isset($aPackage[$sTable])) {
|
|
46 |
unset($aPackage[$sTable]);
|
|
50 |
if(isset($aTablesList[$sTable])) {
|
|
51 |
unset($aTablesList[$sTable]);
|
|
47 | 52 |
} |
48 | 53 |
} |
49 | 54 |
} |
50 |
return array_flip($aPackage);
|
|
55 |
return array_flip($aTablesList);
|
|
51 | 56 |
} |
52 | 57 |
|
53 | 58 |
|
Also available in: Unified diff
syncronize project and some small typo corrections in /admin/