Merge branch 'master' into calendar_export
This commit is contained in:
commit
a8da950819
|
@ -326,8 +326,11 @@ class smb_stream_wrapper extends smb {
|
||||||
$this->dir = array_keys($o['info']);
|
$this->dir = array_keys($o['info']);
|
||||||
$this->dir_index = 0;
|
$this->dir_index = 0;
|
||||||
$this->adddircache ($url, $this->dir);
|
$this->adddircache ($url, $this->dir);
|
||||||
|
if(substr($url,-1,1)=='/'){
|
||||||
|
$url=substr($url,0,-1);
|
||||||
|
}
|
||||||
foreach ($o['info'] as $name => $info) {
|
foreach ($o['info'] as $name => $info) {
|
||||||
smb::addstatcache($url . '/' . urlencode($name), $info);
|
smb::addstatcache($url . '/' . $name, $info);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
trigger_error ("dir_opendir(): dir failed for path '".$pu['path']."'", E_USER_WARNING);
|
trigger_error ("dir_opendir(): dir failed for path '".$pu['path']."'", E_USER_WARNING);
|
||||||
|
|
|
@ -47,6 +47,52 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{
|
||||||
$path=substr($path,0,-1);
|
$path=substr($path,0,-1);
|
||||||
}
|
}
|
||||||
return 'smb://'.$this->user.':'.$this->password.'@'.$this->host.$this->share.$this->root.$path;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ function hidePDFviewer() {
|
||||||
function showPDFviewer(dir,filename){
|
function showPDFviewer(dir,filename){
|
||||||
if(!showPDFviewer.shown){
|
if(!showPDFviewer.shown){
|
||||||
$("#editor").hide();
|
$("#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();
|
$('table').hide();
|
||||||
function im(path) { return OC.filePath('files_pdfviewer','js','pdfjs/web/images/'+path); }
|
function im(path) { return OC.filePath('files_pdfviewer','js','pdfjs/web/images/'+path); }
|
||||||
showPDFviewer.oldcode = $("#controls").html();
|
showPDFviewer.oldcode = $("#controls").html();
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
session_write_close();
|
||||||
|
|
||||||
OC_App::loadApps();
|
OC_App::loadApps();
|
||||||
|
|
||||||
|
|
29
lib/app.php
29
lib/app.php
|
@ -489,32 +489,33 @@ class OC_App{
|
||||||
$currentVersion=OC_App::getAppVersion($app);
|
$currentVersion=OC_App::getAppVersion($app);
|
||||||
if ($currentVersion) {
|
if ($currentVersion) {
|
||||||
if (version_compare($currentVersion, $installedVersion, '>')) {
|
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_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
|
* check if the current enabled apps are compatible with the current
|
||||||
$apps =OC_App::getEnabledApps();
|
* ownCloud version. disable them if not.
|
||||||
$version=OC_Util::getVersion();
|
* 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) {
|
foreach($apps as $app) {
|
||||||
|
|
||||||
// check if the app is compatible with this version of ownCloud
|
// 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'])){
|
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_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 );
|
OC_App::disable( $app );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -229,6 +229,7 @@ class OC{
|
||||||
}
|
}
|
||||||
|
|
||||||
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
|
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
|
||||||
|
OC_App::checkAppsRequirements();
|
||||||
}
|
}
|
||||||
|
|
||||||
OC_App::updateApps();
|
OC_App::updateApps();
|
||||||
|
|
|
@ -120,7 +120,7 @@ class OC_DB {
|
||||||
}else{
|
}else{
|
||||||
$dsn='mysql:dbname='.$name.';host='.$host;
|
$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;
|
break;
|
||||||
case 'pgsql':
|
case 'pgsql':
|
||||||
if($port){
|
if($port){
|
||||||
|
|
|
@ -217,7 +217,7 @@ class OC_FileCache{
|
||||||
* - versioned
|
* - versioned
|
||||||
*/
|
*/
|
||||||
public static function getFolderContent($path,$root=false,$mimetype_filter=''){
|
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);
|
OC_FileCache_Update::updateFolder($path,$root);
|
||||||
}
|
}
|
||||||
return OC_FileCache_Cached::getFolderContent($path,$root,$mimetype_filter);
|
return OC_FileCache_Cached::getFolderContent($path,$root,$mimetype_filter);
|
||||||
|
|
|
@ -15,9 +15,10 @@ class OC_FileCache_Update{
|
||||||
* check if a file or folder is updated outside owncloud
|
* check if a file or folder is updated outside owncloud
|
||||||
* @param string path
|
* @param string path
|
||||||
* @param string root (optional)
|
* @param string root (optional)
|
||||||
|
* @param boolean folder
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function hasUpdated($path,$root=false){
|
public static function hasUpdated($path,$root=false,$folder=false){
|
||||||
if($root===false){
|
if($root===false){
|
||||||
$view=OC_Filesystem::getView();
|
$view=OC_Filesystem::getView();
|
||||||
}else{
|
}else{
|
||||||
|
@ -29,7 +30,11 @@ class OC_FileCache_Update{
|
||||||
$cachedData=OC_FileCache_Cached::get($path,$root);
|
$cachedData=OC_FileCache_Cached::get($path,$root);
|
||||||
if(isset($cachedData['mtime'])){
|
if(isset($cachedData['mtime'])){
|
||||||
$cachedMTime=$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
|
}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
|
if(($path=='/' or $path=='') and $root===false){//dont auto update the home folder, it will be scanned
|
||||||
return false;
|
return false;
|
||||||
|
@ -154,9 +159,9 @@ class OC_FileCache_Update{
|
||||||
foreach($cachedContent as $file){
|
foreach($cachedContent as $file){
|
||||||
$size+=$file['size'];
|
$size+=$file['size'];
|
||||||
}
|
}
|
||||||
$mtime=$view->filemtime($path);
|
$mtime=$view->filemtime($path.'/');
|
||||||
$ctime=$view->filectime($path);
|
$ctime=$view->filectime($path.'/');
|
||||||
$writable=$view->is_writable($path);
|
$writable=$view->is_writable($path.'/');
|
||||||
OC_FileCache::put($path,array('size'=>$size,'mtime'=>$mtime,'ctime'=>$ctime,'mimetype'=>$mimetype,'writable'=>$writable));
|
OC_FileCache::put($path,array('size'=>$size,'mtime'=>$mtime,'ctime'=>$ctime,'mimetype'=>$mimetype,'writable'=>$writable));
|
||||||
}else{
|
}else{
|
||||||
$count=0;
|
$count=0;
|
||||||
|
|
33
lib/l10n.php
33
lib/l10n.php
|
@ -228,23 +228,29 @@ class OC_L10N{
|
||||||
return self::$language;
|
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')){
|
if(OC_User::getUser() && OC_Preferences::getValue(OC_User::getUser(), 'core', 'lang')){
|
||||||
$lang = OC_Preferences::getValue(OC_User::getUser(), 'core', 'lang');
|
$lang = OC_Preferences::getValue(OC_User::getUser(), 'core', 'lang');
|
||||||
self::$language = $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;
|
return $lang;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
|
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
|
||||||
$accepted_languages = preg_split('/,\s*/', $_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){
|
foreach($accepted_languages as $i){
|
||||||
$temp = explode(';', $i);
|
$temp = explode(';', $i);
|
||||||
if(array_search($temp[0], $available) !== false){
|
if(array_search($temp[0], $available) !== false){
|
||||||
|
@ -296,4 +302,15 @@ class OC_L10N{
|
||||||
}
|
}
|
||||||
return $available;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue