zikula/core — pull request #1603 by espaan (2014-02-13 08:31:14+00:00)
Title: [release-1.3] Updated DBUtil to 1.3 branch

| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | Tested several modules in 1.3.6 that use DBUtil
| Fixed tickets | -
| Refs tickets | https://github.com/rallek/1.3.6patch/issues/8
| License | MIT
| Doc PR | -

This updates the DBUtil in the release-1.3 branch to reflect all the updates @rgasch did to DBUtil in the 1.3 branch. It's not a one2one copy since some calls are different in 1.3.7/1.4.0 vs 1.3.5/6

These updates are needed for zwebstore and do solve several bugs.
I have tested a bit with News 3.1, Content 4.1 and ZWebstore 1.3.2 that all use DBUtil. That is all ok. If people can test this DBUtil, please do. It should work.

See the list below for the diff between 1.3 and release-1.3
```
16a17,18
> *
> * @deprecated
45c47
< self::$cache_enabled = ServiceUtil::getManager()->getArgument('dbcache.enable');
---
> self::$cache_enabled = ServiceUtil::getManager()->getParameter('dbcache.enable');
63c65
< $databases = ServiceUtil::getManager()->getArgument('databases');
---
> $databases = ServiceUtil::getManager()->getParameter('databases');
66c68
< $cacheDriver = ServiceUtil::getManager()->getService('doctrine.cachedriver');
---
> $cacheDriver = ServiceUtil::getManager()->get('doctrine.cachedriver');
87c89
< $databases = ServiceUtil::getManager()->getArgument('databases');
---
> $databases = ServiceUtil::getManager()->getParameter('databases');
90c92
< $cacheDriver = ServiceUtil::getManager()->getService('doctrine.cachedriver');
---
> $cacheDriver = ServiceUtil::getManager()->get('doctrine.cachedriver');
105c107
< $databases = ServiceUtil::getManager()->getArgument('databases');
---
> $databases = ServiceUtil::getManager()->getParameter('databases');
108c110
< $cacheDriver = ServiceUtil::getManager()->getService('doctrine.cachedriver');
---
> $cacheDriver = ServiceUtil::getManager()->get('doctrine.cachedriver');
188c190
< return ServiceUtil::getManager()->getArgument('dbtables');
---
> return ServiceUtil::getManager()->getParameter('dbtables');
283c285
< //$stmt->setHydrationMode(Doctrine::HYDRATE_RECORD);
---
> //$stmt->setHydrationMode(Doctrine_Core::HYDRATE_RECORD);
301,305c303,304
< if (System::isLegacyMode()) {
< return new Zikula_Adapter_AdodbStatement($result);
< } else {
< return $result;
< }
---
>
> return $result;
999c998
< ModUtil::available('Categories')) {
---
> ModUtil::available('ZikulaCategoriesModule')) {
1207a1207,1210
> if ($table == 'categories_mapobj') {
> // table no longer exists >= 1.3.6
> return true;
> }
1242c1245
< ModUtil::available('Categories')) {
---
> ModUtil::available('ZikulaCategoriesModule')) {
1545c1548
< $resultRows = $result->fetchAll(Doctrine::FETCH_NUM);
---
> $resultRows = $result->fetchAll(Doctrine_Core::FETCH_NUM);
1595c1598
< $resultRows = $result->fetchAll(Doctrine::FETCH_ASSOC);
---
> $resultRows = $result->fetchAll(Doctrine_Core::FETCH_ASSOC);
1945c1948
< if (!ModUtil::dbInfoLoad('Categories')) {
---
> if (!ModUtil::dbInfoLoad('ZikulaCategoriesModule')) {
2382c2385
< $res = $res->fetchAll(Doctrine::FETCH_COLUMN); // RNG: Should this really be fetchAll() ??
---
> $res = $res->fetchAll(Doctrine_Core::FETCH_COLUMN); // RNG: Should this really be fetchAll() ??
2782c2785
< $res = $res->fetchAll(Doctrine::FETCH_COLUMN);
---
> $res = $res->fetchAll(Doctrine_Core::FETCH_COLUMN);
2904c2907
< if (($enableAllServices || (isset($tables["{$table}_db_extra_enable_categorization"]) && $tables["{$table}_db_extra_enable_categorization"])) && System::getVar('Z_CONFIG_USE_OBJECT_CATEGORIZATION') && strcmp($table, 'categories_') !== 0 && strcmp($table, 'objectdata_attributes') !== 0 && strcmp($table, 'objectdata_log') !== 0 && ModUtil::available('Categories')) {
---
> if (($enableAllServices || (isset($tables["{$table}_db_extra_enable_categorization"]) && $tables["{$table}_db_extra_enable_categorization"])) && System::getVar('Z_CONFIG_USE_OBJECT_CATEGORIZATION') && strcmp($table, 'categories_') !== 0 && strcmp($table, 'objectdata_attributes') !== 0 && strcmp($table, 'objectdata_log') !== 0 && ModUtil::available('ZikulaCategoriesModule')) {
3914c3917
< return z_exit(__f('%1$s: unable to limit tablename [%2$s] because database prefix is too long for Oracle, please shorten it (recommended length is 4 chars)', array(
---
> throw new \Exception(__f('%1$s: unable to limit tablename [%2$s] because database prefix is too long for Oracle, please shorten it (recommended length is 4 chars)', array(
4006c4009
< }
---
> }
\ No newline at end of file

```