/** * This sets up all the required PL/SQL functions for the database. * * @param boolean Install only backup related functions * @return mixed True on success, PEAR_Error otherwise. */ static function createFunctions($onlyBackup = false) { $oDbh = OA_DB::singleton(); if (PEAR::isError($oDbh)) { return $oDbh; } $functionsFile = MAX_PATH . '/etc/core.' . strtolower($oDbh->dbsyntax) . '.php'; if (is_readable($functionsFile)) { if ($oDbh->dsn['phptype'] == 'pgsql') { $result = OA_DB::_createLanguage(); if (PEAR::isError($result)) { return $result; } } include $functionsFile; OA_DB::disconnectAll(); $oDbh = OA_DB::singleton(); $aFunctions = $onlyBackup ? $aBackupFunctions : $aCustomFunctions; foreach ($aFunctions as $customFunction) { $rows = $oDbh->exec($customFunction); if (PEAR::isError($rows)) { return $rows; } } } return true; }