fixed since 1.7.002 not working update from 1.4:

- fs_link column is queried by sqlfs, but get created in 1.7.002
- pdo does not throw exception on sql errors, it silently ignores them
  --> told it now in constructor to also throw exceptions
- egw_vfs::find() was not always honoring the url option
This commit is contained in:
Ralf Becker 2009-07-01 15:17:36 +00:00
parent 15f7e3a1db
commit 944bb3073c
3 changed files with 24 additions and 4 deletions

View File

@ -568,7 +568,15 @@ class egw_vfs extends vfs_stream_wrapper
{
$type = $options['type']; // 'd' or 'f'
if (!($stat = self::url_stat($path,STREAM_URL_STAT_LINK)))
if ($options['url'])
{
$stat = lstat($path);
}
else
{
$stat = self::url_stat($path,STREAM_URL_STAT_LINK);
}
if (!$stat)
{
return; // not found, should not happen
}

View File

@ -156,6 +156,15 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper
*/
protected $opened_dir;
/**
* Extra columns added since the intitial introduction of sqlfs
*
* Can be set to empty, so get queries running on old versions of sqlfs, eg. for schema updates
*
* @var string;
*/
static public $extra_columns = '';//',fs_link';
/**
* This method is called immediately after your stream object is created.
*
@ -901,7 +910,7 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper
return false;
}
$this->opened_dir = array();
$query = 'SELECT fs_id,fs_name,fs_mode,fs_uid,fs_gid,fs_size,fs_mime,fs_created,fs_modified,fs_link'.
$query = 'SELECT fs_id,fs_name,fs_mode,fs_uid,fs_gid,fs_size,fs_mime,fs_created,fs_modified'.self::$extra_columns.
' FROM '.self::TABLE." WHERE fs_dir=? ORDER BY fs_mime='httpd/unix-directory' DESC, fs_name ASC";
//if (self::LOG_LEVEL > 2) $query = '/* '.__METHOD__.': '.__LINE__.' */ '.$query;
if (self::LOG_LEVEL > 2) $query = '/* '.__METHOD__."($url,$options)".' */ '.$query;
@ -970,7 +979,7 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper
{
self::_pdo();
}
$base_query = 'SELECT fs_id,fs_name,fs_mode,fs_uid,fs_gid,fs_size,fs_mime,fs_created,fs_modified,fs_link'.
$base_query = 'SELECT fs_id,fs_name,fs_mode,fs_uid,fs_gid,fs_size,fs_mime,fs_created,fs_modified'.self::$extra_columns.
' FROM '.self::TABLE.' WHERE fs_name'.self::$case_sensitive_equal.'? AND fs_dir=';
$parts = explode('/',$path);
@ -1479,7 +1488,9 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper
$pdo_available = true;
}
try {
self::$pdo = new PDO($dsn,$egw_db->User,$egw_db->Password);
self::$pdo = new PDO($dsn,$egw_db->User,$egw_db->Password,array(
PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION,
));
} catch(Exception $e) {
// Exception reveals password, so we ignore the exception and connect again without pw, to get the right exception without pw

View File

@ -434,6 +434,7 @@ function phpgwapi_upgrade1_5_011()
if ($GLOBALS['DEBUG'] && isset($_SERVER['HTTP_HOST'])) echo "<pre style='text-align: left;'>\n";
egw_vfs::$is_root = true;
egw_vfs::load_wrapper('sqlfs');
sqlfs_stream_wrapper::$extra_columns = ''; // no fs_link column, as it gets created in 1.7.002
egw_vfs::find('sqlfs://default/',array(
'url' => true,
'depth' => true,