summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--3rdparty/smb4php/smb.php5
-rw-r--r--apps/files_external/lib/smb.php48
-rw-r--r--apps/files_pdfviewer/js/viewer.js2
-rw-r--r--core/minimizer.php1
-rwxr-xr-xlib/app.php29
-rw-r--r--lib/base.php1
-rw-r--r--lib/db.php2
-rw-r--r--lib/filecache.php2
-rw-r--r--lib/filecache/update.php15
-rw-r--r--lib/l10n.php33
10 files changed, 106 insertions, 32 deletions
diff --git a/3rdparty/smb4php/smb.php b/3rdparty/smb4php/smb.php
index 69fb2487bc0..12c5890723b 100644
--- a/3rdparty/smb4php/smb.php
+++ b/3rdparty/smb4php/smb.php
@@ -326,8 +326,11 @@ class smb_stream_wrapper extends smb {
$this->dir = array_keys($o['info']);
$this->dir_index = 0;
$this->adddircache ($url, $this->dir);
+ if(substr($url,-1,1)=='/'){
+ $url=substr($url,0,-1);
+ }
foreach ($o['info'] as $name => $info) {
- smb::addstatcache($url . '/' . urlencode($name), $info);
+ smb::addstatcache($url . '/' . $name, $info);
}
} else {
trigger_error ("dir_opendir(): dir failed for path '".$pu['path']."'", E_USER_WARNING);
diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php
index 9112655194a..5e34deb2337 100644
--- a/apps/files_external/lib/smb.php
+++ b/apps/files_external/lib/smb.php
@@ -47,6 +47,52 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{
$path=substr($path,0,-1);
}
return 'smb://'.$this->user.':'.$this->password.'@'.$this->host.$this->share.$this->root.$path;
-
+ }
+
+ public function stat($path){
+ if(!$path and $this->root=='/'){//mtime doesn't work for shares
+ $mtime=$this->shareMTime();
+ $stat=stat($this->constructUrl($path));
+ $stat['mtime']=$mtime;
+ return $stat;
+ }else{
+ return stat($this->constructUrl($path));
+ }
+ }
+
+ public function filetype($path){
+ return (bool)@$this->opendir($path);//using opendir causes the same amount of requests and caches the content of the folder in one go
+ }
+
+ /**
+ * check if a file or folder has been updated since $time
+ * @param int $time
+ * @return bool
+ */
+ public function hasUpdated($path,$time){
+ if(!$path and $this->root=='/'){
+ //mtime doesn't work for shares, but giving the nature of the backend, doing a full update is still just fast enough
+ return true;
+ }else{
+ $actualTime=$this->filemtime($path);
+ return $actualTime>$time;
+ }
+ }
+
+ /**
+ * get the best guess for the modification time of the share
+ */
+ private function shareMTime(){
+ $dh=$this->opendir('');
+ $lastCtime=0;
+ while($file=readdir($dh)){
+ if($file!='.' and $file!='..'){
+ $ctime=$this->filemtime($file);
+ if($ctime>$lastCtime){
+ $lastCtime=$ctime;
+ }
+ }
+ }
+ return $lastCtime;
}
}
diff --git a/apps/files_pdfviewer/js/viewer.js b/apps/files_pdfviewer/js/viewer.js
index d98bedc5c09..2c9cbb9b431 100644
--- a/apps/files_pdfviewer/js/viewer.js
+++ b/apps/files_pdfviewer/js/viewer.js
@@ -13,7 +13,7 @@ function hidePDFviewer() {
function showPDFviewer(dir,filename){
if(!showPDFviewer.shown){
$("#editor").hide();
- var url = OC.filePath('files','ajax','download.php')+'?files='+encodeURIComponent(filename)+"&dir="+encodeURIComponent(dir);
+ var url = OC.filePath('files','ajax','download.php')+encodeURIComponent('?files='+encodeURIComponent(filename)+"&dir="+encodeURIComponent(dir));
$('table').hide();
function im(path) { return OC.filePath('files_pdfviewer','js','pdfjs/web/images/'+path); }
showPDFviewer.oldcode = $("#controls").html();
diff --git a/core/minimizer.php b/core/minimizer.php
index 6828acc87d8..709c7508e90 100644
--- a/core/minimizer.php
+++ b/core/minimizer.php
@@ -1,4 +1,5 @@
<?php
+session_write_close();
OC_App::loadApps();
diff --git a/lib/app.php b/lib/app.php
index 7fdfc93138f..c08e977b032 100755
--- a/lib/app.php
+++ b/lib/app.php
@@ -489,32 +489,33 @@ class OC_App{
$currentVersion=OC_App::getAppVersion($app);
if ($currentVersion) {
if (version_compare($currentVersion, $installedVersion, '>')) {
- OC_Log::write($app,'starting app upgrade from '.$installedVersion.' to '.$currentVersion,OC_Log::DEBUG);
+ OC_Log::write($app, 'starting app upgrade from '.$installedVersion.' to '.$currentVersion,OC_Log::DEBUG);
OC_App::updateApp($app);
- OC_Appconfig::setValue($app,'installed_version',OC_App::getAppVersion($app));
+ OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app));
}
}
}
+ }
- // check if the current enabled apps are compatible with the current ownCloud version. disable them if not.
- // this is important if you upgrade ownCloud and have non ported 3rd party apps installed
- $apps =OC_App::getEnabledApps();
- $version=OC_Util::getVersion();
+ /**
+ * check if the current enabled apps are compatible with the current
+ * ownCloud version. disable them if not.
+ * This is important if you upgrade ownCloud and have non ported 3rd
+ * party apps installed.
+ */
+ public static function checkAppsRequirements($apps = array()){
+ if (empty($apps)) {
+ $apps = OC_App::getEnabledApps();
+ }
+ $version = OC_Util::getVersion();
foreach($apps as $app) {
-
// check if the app is compatible with this version of ownCloud
- $info=OC_App::getAppInfo($app);
+ $info = OC_App::getAppInfo($app);
if(!isset($info['require']) or ($version[0]>$info['require'])){
OC_Log::write('core','App "'.$info['name'].'" can\'t be used because it is not compatible with this version of ownCloud',OC_Log::ERROR);
OC_App::disable( $app );
}
-
-
-
}
-
-
-
}
/**
diff --git a/lib/base.php b/lib/base.php
index fedc1238851..30f7e5bba63 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -229,6 +229,7 @@ class OC{
}
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
+ OC_App::checkAppsRequirements();
}
OC_App::updateApps();
diff --git a/lib/db.php b/lib/db.php
index a0ad499b601..bcc8657b4a4 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -120,7 +120,7 @@ class OC_DB {
}else{
$dsn='mysql:dbname='.$name.';host='.$host;
}
- $opts[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES 'UTF8'; SET CHARACTER SET 'UTF8';";
+ $opts[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES 'UTF8'";
break;
case 'pgsql':
if($port){
diff --git a/lib/filecache.php b/lib/filecache.php
index 32c6929ff60..9963a5a3baf 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -217,7 +217,7 @@ class OC_FileCache{
* - versioned
*/
public static function getFolderContent($path,$root=false,$mimetype_filter=''){
- if(OC_FileCache_Update::hasUpdated($path,$root)){
+ if(OC_FileCache_Update::hasUpdated($path,$root,true)){
OC_FileCache_Update::updateFolder($path,$root);
}
return OC_FileCache_Cached::getFolderContent($path,$root,$mimetype_filter);
diff --git a/lib/filecache/update.php b/lib/filecache/update.php
index 9e23c6dfe7b..dd77f491ca0 100644
--- a/lib/filecache/update.php
+++ b/lib/filecache/update.php
@@ -15,9 +15,10 @@ class OC_FileCache_Update{
* check if a file or folder is updated outside owncloud
* @param string path
* @param string root (optional)
+ * @param boolean folder
* @return bool
*/
- public static function hasUpdated($path,$root=false){
+ public static function hasUpdated($path,$root=false,$folder=false){
if($root===false){
$view=OC_Filesystem::getView();
}else{
@@ -29,7 +30,11 @@ class OC_FileCache_Update{
$cachedData=OC_FileCache_Cached::get($path,$root);
if(isset($cachedData['mtime'])){
$cachedMTime=$cachedData['mtime'];
- return $view->hasUpdated($path,$cachedMTime);
+ if($folder){
+ return $view->hasUpdated($path.'/',$cachedMTime);
+ }else{
+ return $view->hasUpdated($path,$cachedMTime);
+ }
}else{//file not in cache, so it has to be updated
if(($path=='/' or $path=='') and $root===false){//dont auto update the home folder, it will be scanned
return false;
@@ -154,9 +159,9 @@ class OC_FileCache_Update{
foreach($cachedContent as $file){
$size+=$file['size'];
}
- $mtime=$view->filemtime($path);
- $ctime=$view->filectime($path);
- $writable=$view->is_writable($path);
+ $mtime=$view->filemtime($path.'/');
+ $ctime=$view->filectime($path.'/');
+ $writable=$view->is_writable($path.'/');
OC_FileCache::put($path,array('size'=>$size,'mtime'=>$mtime,'ctime'=>$ctime,'mimetype'=>$mimetype,'writable'=>$writable));
}else{
$count=0;
diff --git a/lib/l10n.php b/lib/l10n.php
index 3596c992bae..ba4bf23780e 100644
--- a/lib/l10n.php
+++ b/lib/l10n.php
@@ -228,23 +228,29 @@ class OC_L10N{
return self::$language;
}
- $available = array();
- if(is_array($app)){
- $available = $app;
- }
- else{
- $available=self::findAvailableLanguages($app);
- }
if(OC_User::getUser() && OC_Preferences::getValue(OC_User::getUser(), 'core', 'lang')){
$lang = OC_Preferences::getValue(OC_User::getUser(), 'core', 'lang');
self::$language = $lang;
- if(array_search($lang, $available) !== false){
+ if(is_array($app)){
+ $available = $app;
+ $lang_exists = array_search($lang, $available) !== false;
+ }
+ else {
+ $lang_exists = self::languageExists($app, $lang);
+ }
+ if($lang_exists){
return $lang;
}
}
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
$accepted_languages = preg_split('/,\s*/', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
+ if(is_array($app)){
+ $available = $app;
+ }
+ else{
+ $available = self::findAvailableLanguages($app);
+ }
foreach($accepted_languages as $i){
$temp = explode(';', $i);
if(array_search($temp[0], $available) !== false){
@@ -296,4 +302,15 @@ class OC_L10N{
}
return $available;
}
+
+ public static function languageExists($app, $lang){
+ if ($lang == 'en'){//english is always available
+ return true;
+ }
+ $dir = self::findI18nDir($app);
+ if(is_dir($dir)){
+ return file_exists($dir.'/'.$lang.'.php');
+ }
+ return false;
+ }
}