mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
some fixes for sqlfs fsck: caseinsensitive GROUP BY for MySQL, deleting files direct in DB, as self::unlink() fails if fs_active=0, and some more
This commit is contained in:
parent
fd19c672c8
commit
2553ad1bcc
@ -173,7 +173,7 @@ class admin_prefs_sidebox_hooks
|
|||||||
|
|
||||||
$content .= html::form('<p>'.($check_only&&is_array($msgs)?html::submit_button('fix', lang('Fix reported problems')):'').
|
$content .= html::form('<p>'.($check_only&&is_array($msgs)?html::submit_button('fix', lang('Fix reported problems')):'').
|
||||||
html::submit_button('cancel', lang('Cancel'), "window.location.href='".egw::link('/admin/index.php')."'; return false;").'</p>',
|
html::submit_button('cancel', lang('Cancel'), "window.location.href='".egw::link('/admin/index.php')."'; return false;").'</p>',
|
||||||
'',egw::link('/index.php',array('menuaction'=>'admin.admin_prefs_sidebox_hooks.fsck')));
|
'','/index.php',array('menuaction'=>'admin.admin_prefs_sidebox_hooks.fsck'));
|
||||||
|
|
||||||
$GLOBALS['egw']->framework->render($content, lang('Admin').' - '.lang('Check virtual filesystem'), true);
|
$GLOBALS['egw']->framework->render($content, lang('Admin').' - '.lang('Check virtual filesystem'), true);
|
||||||
}
|
}
|
||||||
|
@ -1540,7 +1540,7 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper
|
|||||||
return $stat;
|
return $stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static $pdo_type;
|
public static $pdo_type;
|
||||||
/**
|
/**
|
||||||
* Case sensitive comparison operator, for mysql we use ' COLLATE utf8_bin ='
|
* Case sensitive comparison operator, for mysql we use ' COLLATE utf8_bin ='
|
||||||
*
|
*
|
||||||
|
@ -127,14 +127,21 @@ class sqlfs_utils extends sqlfs_stream_wrapper
|
|||||||
{
|
{
|
||||||
if (!file_exists($phy_path=self::_fs_path($row['fs_id'])))
|
if (!file_exists($phy_path=self::_fs_path($row['fs_id'])))
|
||||||
{
|
{
|
||||||
egw_vfs::$is_root = true;
|
|
||||||
$path = self::id2path($row['fs_id']);
|
$path = self::id2path($row['fs_id']);
|
||||||
if ($check_only)
|
if ($check_only)
|
||||||
{
|
{
|
||||||
$msgs[] = lang('File %1 has no content in physical filesystem %2!',
|
$msgs[] = lang('File %1 has no content in physical filesystem %2!',
|
||||||
$path.' (#'.$row['fs_id'].')',$phy_path);
|
$path.' (#'.$row['fs_id'].')',$phy_path);
|
||||||
}
|
}
|
||||||
elseif (self::unlink($path.'?storage=db')) // storage=db to not try to delete not existing phy. file
|
else
|
||||||
|
{
|
||||||
|
if (!isset($stmt))
|
||||||
|
{
|
||||||
|
$stmt = self::$pdo->prepare('DELETE FROM '.self::TABLE.' WHERE fs_id=:fs_id');
|
||||||
|
$stmt_props = self::$pdo->prepare('DELETE FROM '.self::PROPS_TABLE.' WHERE fs_id=:fs_id');
|
||||||
|
}
|
||||||
|
if ($stmt->execute(array('fs_id' => $row['fs_id'])) &&
|
||||||
|
$stmt_props->execute(array('fs_id' => $row['fs_id'])))
|
||||||
{
|
{
|
||||||
$msgs[] = lang('File %1 has no content in physical filesystem %2 --> file removed!',$path,$phy_path);
|
$msgs[] = lang('File %1 has no content in physical filesystem %2 --> file removed!',$path,$phy_path);
|
||||||
}
|
}
|
||||||
@ -143,7 +150,7 @@ class sqlfs_utils extends sqlfs_stream_wrapper
|
|||||||
$msgs[] = lang('File %1 has no content in physical filesystem %2 --> failed to remove file!',
|
$msgs[] = lang('File %1 has no content in physical filesystem %2 --> failed to remove file!',
|
||||||
$path.' (#'.$row['fs_id'].')',$phy_path);
|
$path.' (#'.$row['fs_id'].')',$phy_path);
|
||||||
}
|
}
|
||||||
egw_vfs::$is_root = false;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($check_only && $msgs)
|
if ($check_only && $msgs)
|
||||||
@ -226,7 +233,6 @@ class sqlfs_utils extends sqlfs_stream_wrapper
|
|||||||
if ($check_only && $msgs)
|
if ($check_only && $msgs)
|
||||||
{
|
{
|
||||||
$msgs[] = lang('Unconnected nodes will be moved to %1.',self::LOST_N_FOUND);
|
$msgs[] = lang('Unconnected nodes will be moved to %1.',self::LOST_N_FOUND);
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
return $msgs;
|
return $msgs;
|
||||||
}
|
}
|
||||||
@ -242,7 +248,7 @@ class sqlfs_utils extends sqlfs_stream_wrapper
|
|||||||
$msgs = array();
|
$msgs = array();
|
||||||
foreach(self::$pdo->query('SELECT fs_dir,fs_name,COUNT(*) FROM '.self::TABLE.
|
foreach(self::$pdo->query('SELECT fs_dir,fs_name,COUNT(*) FROM '.self::TABLE.
|
||||||
' WHERE fs_active='.self::_pdo_boolean(true).
|
' WHERE fs_active='.self::_pdo_boolean(true).
|
||||||
' GROUP BY fs_dir,fs_name'.
|
' GROUP BY fs_dir,'.(self::$pdo_type == 'mysql' ? 'BINARY ' : '').'fs_name'. // fs_name is casesensitive!
|
||||||
' HAVING COUNT(*) > 1') as $row)
|
' HAVING COUNT(*) > 1') as $row)
|
||||||
{
|
{
|
||||||
if (!isset($stmt))
|
if (!isset($stmt))
|
||||||
|
Loading…
Reference in New Issue
Block a user