From db2d1f6822fbb3c34a5834dda10c7ce57c0153cc Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Fri, 26 Oct 2012 15:54:16 +0000 Subject: [PATCH 1/3] Fix migration problems for postgresql with MDB2 fix owncloud/apps#21 Ref of MDB2 bug is 19676 --- 3rdparty/MDB2/Driver/Manager/pgsql.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/3rdparty/MDB2/Driver/Manager/pgsql.php b/3rdparty/MDB2/Driver/Manager/pgsql.php index f2c2137dc8..3e70f3a3b2 100644 --- a/3rdparty/MDB2/Driver/Manager/pgsql.php +++ b/3rdparty/MDB2/Driver/Manager/pgsql.php @@ -363,6 +363,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common return MDB2_OK; } + $unquoted_name = $name; $name = $db->quoteIdentifier($name, true); if (!empty($changes['remove']) && is_array($changes['remove'])) { @@ -398,6 +399,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common if (!empty($changes['change']) && is_array($changes['change'])) { foreach ($changes['change'] as $field_name => $field) { + $unquoted_field_name = $field_name; $field_name = $db->quoteIdentifier($field_name, true); if (!empty($field['definition']['type'])) { $server_info = $db->getServerVersion(); @@ -419,7 +421,14 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common return $result; } } - if (array_key_exists('default', $field['definition'])) { + if (array_key_exists('autoincrement', $field['definition'])) { + $query = "ALTER $field_name SET DEFAULT nextval(".$db->quote($unquoted_name.'_'.$unquoted_field_name.'_seq', 'text').")"; + $result = $db->exec("ALTER TABLE $name $query"); + if (PEAR::isError($result)) { + return $result; + } + } + elseif (array_key_exists('default', $field['definition'])) { $query = "ALTER $field_name SET DEFAULT ".$db->quote($field['definition']['default'], $field['definition']['type']); $result = $db->exec("ALTER TABLE $name $query"); if (PEAR::isError($result)) { From f477fda78530fc74c8f9103c638da5615048e562 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Fri, 26 Oct 2012 18:11:12 +0200 Subject: [PATCH 2/3] separate buttons for new file and upload --- apps/files/css/files.css | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/files/css/files.css b/apps/files/css/files.css index 57c7eb4d9a..0b886fc3fa 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -10,18 +10,18 @@ .file_upload_form, #file_newfolder_form { display:inline; float: left; margin-left:0; } #fileSelector, #file_upload_submit, #file_newfolder_submit { display:none; } .file_upload_wrapper, #file_newfolder_name { background-repeat:no-repeat; background-position:.5em .5em; padding-left:2em; } -.file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:block; float:left; padding-left:0; overflow:hidden; position:relative; margin:0;} +.file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:block; float:left; padding-left:0; overflow:hidden; position:relative; margin:0; margin-left:2px; } .file_upload_wrapper .file_upload_button_wrapper { position:absolute; top:0; left:0; width:100%; height:100%; cursor:pointer; z-index:1000; } -#new { background-color:#5bb75b; float:left; border-top-right-radius:0; border-bottom-right-radius:0; margin:0 0 0 1em; border-right:none; z-index:1010; height:1.3em; } +#new { background-color:#5bb75b; float:left; margin:0 0 0 1em; border-right:none; z-index:1010; height:1.3em; } #new:hover, a.file_upload_button_wrapper:hover + button.file_upload_filename { background-color:#4b964b; } -#new.active { border-bottom-left-radius:0; border-bottom:none; } +#new.active { border-bottom-left-radius:0; border-bottom-right-radius:0; border-bottom:none; } #new>a { padding:.5em 1.2em .3em; color:#fff; text-shadow:0 1px 0 #51a351; } #new>ul { display:none; position:fixed; text-align:left; padding:.5em; background:#f8f8f8; margin-top:0.075em; border:1px solid #ddd; min-width:7em; margin-left:-.5em; z-index:-1; } #new>ul>li { margin:.3em; padding-left:2em; background-repeat:no-repeat; cursor:pointer; padding-bottom:0.1em } #new>ul>li>p { cursor:pointer; } #new>ul>li>input { padding:0.3em; margin:-0.3em; } #new, .file_upload_filename { border:1px solid; border-color:#51a351 #419341 #387038; -moz-box-shadow:0 1px 1px #f8f8f8, 1px 1px 1px #ada inset; -webkit-box-shadow:0 1px 1px #f8f8f8, 1px 1px 1px #ada inset; box-shadow:0 1px 1px #f8f8f8, 1px 1px 1px #ada inset; } -#new .popup { border-top-left-radius:0; } +#new .popup { border-top-left-radius:0; z-index:10; } #file_newfolder_name { background-image:url('%webroot%/core/img/places/folder.svg'); font-weight:normal; width:7em; } .file_upload_start, .file_upload_filename { font-size:1em; } @@ -29,8 +29,7 @@ .file_upload_target { display:none; } .file_upload_start { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter:alpha(opacity=0); opacity:0; z-index:1; position:absolute; left:0; top:0; width:100%; cursor:pointer;} -.file_upload_filename.active { border-bottom-right-radius:0 } -.file_upload_filename { background-color:#5bb75b; z-index:100; cursor:pointer; border-top-left-radius:0; border-bottom-left-radius:0; background-image: url('%webroot%/core/img/actions/upload-white.svg'); background-repeat: no-repeat; background-position: center; height: 2.29em; width: 2.5em; } +.file_upload_filename { background-color:#5bb75b; z-index:100; cursor:pointer; background-image: url('%webroot%/core/img/actions/upload-white.svg'); background-repeat: no-repeat; background-position: center; height: 2.29em; width: 2.5em; } #upload { position:absolute; right:13.5em; top:0em; } #upload #uploadprogressbar { position:relative; display:inline-block; width:10em; height:1.5em; top:.4em; } From ad720c4c17867df24de0dc55453efd0eea8b9a17 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 26 Oct 2012 18:17:43 +0200 Subject: [PATCH 3/3] possible fix for bombarding the server with the htaccess test during setup --- lib/util.php | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/util.php b/lib/util.php index 72b5e4d260..4ca84ba75a 100755 --- a/lib/util.php +++ b/lib/util.php @@ -64,23 +64,23 @@ class OC_Util { } public static function loadUserMountPoints($user) { - $user_dir = '/'.$user.'/files'; - $user_root = OC_User::getHome($user); + $user_dir = '/'.$user.'/files'; + $user_root = OC_User::getHome($user); $userdirectory = $user_root . '/files'; - if (is_file($user_root.'/mount.php')) { - $mountConfig = include $user_root.'/mount.php'; - if (isset($mountConfig['user'][$user])) { - foreach ($mountConfig['user'][$user] as $mountPoint => $options) { - OC_Filesystem::mount($options['class'], $options['options'], $mountPoint); - } - } - - $mtime=filemtime($user_root.'/mount.php'); - $previousMTime=OC_Preferences::getValue($user,'files','mountconfigmtime',0); - if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated - OC_FileCache::triggerUpdate($user); - OC_Preferences::setValue($user,'files','mountconfigmtime',$mtime); - } + if (is_file($user_root.'/mount.php')) { + $mountConfig = include $user_root.'/mount.php'; + if (isset($mountConfig['user'][$user])) { + foreach ($mountConfig['user'][$user] as $mountPoint => $options) { + OC_Filesystem::mount($options['class'], $options['options'], $mountPoint); + } + } + + $mtime=filemtime($user_root.'/mount.php'); + $previousMTime=OC_Preferences::getValue($user,'files','mountconfigmtime',0); + if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated + OC_FileCache::triggerUpdate($user); + OC_Preferences::setValue($user,'files','mountconfigmtime',$mtime); + } } } @@ -582,6 +582,11 @@ class OC_Util { // creating a test file $testfile = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ).'/'.$filename; + + if(file_exists($testfile)){// already running this test, possible recursive call + return false; + } + $fp = @fopen($testfile, 'w'); @fwrite($fp, $testcontent); @fclose($fp);