add debug output

This commit is contained in:
Jörn Friedrich Dreyer 2013-04-29 12:25:27 +02:00
parent 1b68c0c0cd
commit eceb3c8ed5
6 changed files with 30 additions and 15 deletions

View File

@ -173,8 +173,11 @@ class OC_App{
} }
$apps=array('files'); $apps=array('files');
$query = OC_DB::prepare( 'SELECT `appid` FROM `*PREFIX*appconfig`' $query = OC_DB::prepare( 'SELECT `appid` FROM `*PREFIX*appconfig`'
.' WHERE `configkey` = \'enabled\' AND `configvalue`=\'yes\'' ); .' WHERE `configkey` = \'enabled\' AND to_char(`configvalue`)=\'yes\'' );
$result=$query->execute(); $result=$query->execute();
if( \OC_DB::isError($result)) {
throw new DatabaseException($result->getMessage(), $query);
}
while($row=$result->fetchRow()) { while($row=$result->fetchRow()) {
if(array_search($row['appid'], $apps)===false) { if(array_search($row['appid'], $apps)===false) {
$apps[]=$row['appid']; $apps[]=$row['appid'];

View File

@ -276,15 +276,10 @@ class OC_DB {
'phptype' => 'oci8', 'phptype' => 'oci8',
'username' => $user, 'username' => $user,
'password' => $pass, 'password' => $pass,
'service' => $name,
'hostspec' => $host,
'charset' => 'AL32UTF8', 'charset' => 'AL32UTF8',
); );
if ($host != '') {
$dsn['hostspec'] = $host;
$dsn['database'] = $name;
} else { // use dbname for hostspec
$dsn['hostspec'] = $name;
$dsn['database'] = $user;
}
break; break;
case 'mssql': case 'mssql':
$dsn = array( $dsn = array(

View File

@ -145,8 +145,11 @@ class Cache {
if ($fileId > -1) { if ($fileId > -1) {
$query = \OC_DB::prepare( $query = \OC_DB::prepare(
'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag` 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`
FROM `*PREFIX*filecache` WHERE parent = ? ORDER BY `name` ASC'); FROM `*PREFIX*filecache` WHERE `parent` = ? ORDER BY `name` ASC');
$result = $query->execute(array($fileId)); $result = $query->execute(array($fileId));
if (\OC_DB::isError($result)) {
\OCP\Util::writeLog('cache', 'getFolderContents failed: '.$result->getMessage(), \OCP\Util::ERROR);
}
$files = $result->fetchAll(); $files = $result->fetchAll();
foreach ($files as &$file) { foreach ($files as &$file) {
$file['mimetype'] = $this->getMimetype($file['mimetype']); $file['mimetype'] = $this->getMimetype($file['mimetype']);
@ -201,7 +204,7 @@ class Cache {
. ' VALUES(' . implode(', ', $valuesPlaceholder) . ')'); . ' VALUES(' . implode(', ', $valuesPlaceholder) . ')');
$result = $query->execute($params); $result = $query->execute($params);
if (\OC_DB::isError($result)) { if (\OC_DB::isError($result)) {
\OCP\Util::writeLog('cache', 'Insert to cache failed: ' . $result, \OCP\Util::ERROR); \OCP\Util::writeLog('cache', 'Insert to cache failed: ' . $result->getMessage(), \OCP\Util::ERROR);
} }
return (int)\OC_DB::insertid('*PREFIX*filecache'); return (int)\OC_DB::insertid('*PREFIX*filecache');
@ -372,6 +375,9 @@ class Cache {
$pathHash = md5($file); $pathHash = md5($file);
$query = \OC_DB::prepare('SELECT `size` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path_hash` = ?'); $query = \OC_DB::prepare('SELECT `size` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path_hash` = ?');
$result = $query->execute(array($this->getNumericStorageId(), $pathHash)); $result = $query->execute(array($this->getNumericStorageId(), $pathHash));
if( \OC_DB::isError($result)) {
\OCP\Util::writeLog('cache', 'get status failed: '.$result->getMessage(), \OCP\Util::ERROR);
}
if ($row = $result->fetchRow()) { if ($row = $result->fetchRow()) {
if ((int)$row['size'] === -1) { if ((int)$row['size'] === -1) {
return self::SHALLOW; return self::SHALLOW;
@ -509,8 +515,11 @@ class Cache {
*/ */
public function getIncomplete() { public function getIncomplete() {
$query = \OC_DB::prepare('SELECT `path` FROM `*PREFIX*filecache`' $query = \OC_DB::prepare('SELECT `path` FROM `*PREFIX*filecache`'
. ' WHERE `storage` = ? AND `size` = -1 ORDER BY `fileid` DESC LIMIT 1'); . ' WHERE `storage` = ? AND `size` = -1 ORDER BY `fileid` DESC',1);
$result = $query->execute(array($this->getNumericStorageId())); $result = $query->execute(array($this->getNumericStorageId()));
if (\OC_DB::isError($result)) {
\OCP\Util::writeLog('cache', 'getIncomplete failed: '.$result->getMessage(), \OCP\Util::ERROR);
}
if ($row = $result->fetchRow()) { if ($row = $result->fetchRow()) {
return $row['path']; return $row['path'];
} else { } else {

View File

@ -152,8 +152,12 @@ class OC_Setup {
self::setupOCIDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $dbtablespace, $username); self::setupOCIDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $dbtablespace, $username);
} catch (Exception $e) { } catch (Exception $e) {
$error[] = array( $error[] = array(
'error' => $l->t('Oracle username and/or password not valid'), 'error' => $l->t('Oracle connection could not be established'),
'hint' => $l->t('You need to enter either an existing account or the administrator.') 'hint' => $e->getMessage().' Check environment: ORACLE_HOME='.getenv('ORACLE_HOME')
.' ORACLE_SID='.getenv('ORACLE_SID')
.' LD_LIBRARY_PATH='.getenv('LD_LIBRARY_PATH')
.' NLS_LANG='.getenv('NLS_LANG')
.' tnsnames.ora is '.(is_readable(getenv('ORACLE_HOME').'/network/admin/tnsnames.ora')?'':'not ').'readable'
); );
return $error; return $error;
} }
@ -452,9 +456,13 @@ class OC_Setup {
} else { } else {
$easy_connect_string = '//'.$e_host.'/'.$e_dbname; $easy_connect_string = '//'.$e_host.'/'.$e_dbname;
} }
\OC_Log::write('setup oracle', 'connect string: '.$easy_connect_string, \OC_Log::DEBUG);
$connection = @oci_connect($dbuser, $dbpass, $easy_connect_string); $connection = @oci_connect($dbuser, $dbpass, $easy_connect_string);
if(!$connection) { if(!$connection) {
$e = oci_error(); $e = oci_error();
if (is_array ($e) && isset ($e['message'])) {
throw new Exception($e['message']);
}
throw new Exception($l->t('Oracle username and/or password not valid')); throw new Exception($l->t('Oracle username and/or password not valid'));
} }
//check for roles creation rights in oracle //check for roles creation rights in oracle

View File

@ -609,7 +609,7 @@ class OC_User {
*/ */
public static function isEnabled($userid) { public static function isEnabled($userid) {
$sql = 'SELECT `userid` FROM `*PREFIX*preferences`' $sql = 'SELECT `userid` FROM `*PREFIX*preferences`'
.' WHERE `userid` = ? AND `appid` = ? AND `configkey` = ? AND `configvalue` = ?'; .' WHERE `userid` = ? AND `appid` = ? AND `configkey` = ? AND to_char(`configvalue`) = ?';
$stmt = OC_DB::prepare($sql); $stmt = OC_DB::prepare($sql);
if ( ! OC_DB::isError($stmt) ) { if ( ! OC_DB::isError($stmt) ) {
$result = $stmt->execute(array($userid, 'core', 'enabled', 'false')); $result = $stmt->execute(array($userid, 'core', 'enabled', 'false'));

View File

@ -136,7 +136,7 @@ class OC_User_Database extends OC_User_Backend {
*/ */
public function getDisplayName($uid) { public function getDisplayName($uid) {
if( $this->userExists($uid) ) { if( $this->userExists($uid) ) {
$query = OC_DB::prepare( 'SELECT displayname FROM `*PREFIX*users` WHERE `uid` = ?' ); $query = OC_DB::prepare( 'SELECT `displayname` FROM `*PREFIX*users` WHERE `uid` = ?' );
$result = $query->execute( array( $uid ))->fetchAll(); $result = $query->execute( array( $uid ))->fetchAll();
$displayName = trim($result[0]['displayname'], ' '); $displayName = trim($result[0]['displayname'], ' ');
if ( !empty($displayName) ) { if ( !empty($displayName) ) {