summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-06-04 23:02:05 +0200
committerBart Visscher <bartv@thisnet.nl>2012-06-04 23:02:05 +0200
commit4a5973662c78eb5769e7b06d7d559572f57e663f (patch)
tree774e2f775b3789f5f40bd2459ddec05df1b73c31 /apps
parent786325a4bb976d92de54c472c2c3bd8a73cbef22 (diff)
parent3fee3a4633e5d4d65f7eabf2d387e209efedbc70 (diff)
downloadnextcloud-server-4a5973662c78eb5769e7b06d7d559572f57e663f.tar.gz
nextcloud-server-4a5973662c78eb5769e7b06d7d559572f57e663f.zip
Merge branch 'unstable'
Conflicts: apps/files_external/tests/config.php apps/files_versions/ajax/getVersions.php apps/files_versions/appinfo/app.php apps/files_versions/history.php apps/files_versions/js/versions.js apps/files_versions/templates/history.php apps/files_versions/versions.php lib/base.php
Diffstat (limited to 'apps')
-rw-r--r--apps/files/templates/index.php2
-rw-r--r--apps/files_versions/ajax/getVersions.php9
-rw-r--r--apps/files_versions/history.php2
-rw-r--r--apps/files_versions/js/versions.js2
-rw-r--r--apps/files_versions/templates/history.php6
-rw-r--r--apps/files_versions/versions.php185
-rw-r--r--apps/gallery/ajax/galleryOp.php3
-rw-r--r--apps/gallery/ajax/sharing.php6
-rw-r--r--apps/gallery/index.php4
-rw-r--r--apps/gallery/js/album_cover.js16
-rw-r--r--apps/gallery/lib/album.php31
-rw-r--r--apps/gallery/lib/photo.php20
-rw-r--r--apps/gallery/lib/scanner.php3
-rw-r--r--apps/user_openid/user_openid.php2
14 files changed, 201 insertions, 90 deletions
diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php
index c0a40081fe3..3bd5a1ceef4 100644
--- a/apps/files/templates/index.php
+++ b/apps/files/templates/index.php
@@ -53,7 +53,7 @@
</span>
</th>
<th id="headerSize"><?php echo $l->t( 'Size' ); ?></th>
- <th id="headerDate"><span id="modified"><?php echo $l->t( 'Modified' ); ?></span><span class="selectedActions"><a href="" class="delete"><?php echo $l->t('Delete all')?> <img class="svg" alt="<?php echo $l->t('Delete')?>" src="<?php echo OCP\image_path("core", "actions/delete.svg"); ?>" /></a></span></th>
+ <th id="headerDate"><span id="modified"><?php echo $l->t( 'Modified' ); ?></span><span class="selectedActions"><a href="" class="delete"><?php echo $l->t('Delete')?> <img class="svg" alt="<?php echo $l->t('Delete')?>" src="<?php echo OCP\image_path("core", "actions/delete.svg"); ?>" /></a></span></th>
</tr>
</thead>
<tbody id="fileList" data-readonly="<?php echo $_['readonly'];?>">
diff --git a/apps/files_versions/ajax/getVersions.php b/apps/files_versions/ajax/getVersions.php
index 1d107c1bda0..bee60543339 100644
--- a/apps/files_versions/ajax/getVersions.php
+++ b/apps/files_versions/ajax/getVersions.php
@@ -10,7 +10,14 @@ $source = strip_tags( $source );
if( OCA_Versions\Storage::isversioned( $source ) ) {
$count=5; //show the newest revisions
- $versions = OCA_Versions\Storage::getversions( $source, $count);
+ $versions = OCA_Versions\Storage::getVersions( $source, $count);
+ $versionsFormatted = array();
+
+ foreach ( $versions AS $version ) {
+
+ $versionsFormatted[] = OCP\Util::formatDate( $version );
+
+ }
$versionsSorted = array_reverse( $versions );
diff --git a/apps/files_versions/history.php b/apps/files_versions/history.php
index 11c07ef86ce..cb4726e8d0e 100644
--- a/apps/files_versions/history.php
+++ b/apps/files_versions/history.php
@@ -54,7 +54,7 @@ if ( isset( $_GET['path'] ) ) {
if( OCA_Versions\Storage::isversioned( $path ) ) {
$count = 999; //show the newest revisions
- $versions = OCA_Versions\Storage::getversions( $path, $count );
+ $versions = OCA_Versions\Storage::getVersions( $path, $count);
$tmpl->assign( 'versions', array_reverse( $versions ) );
diff --git a/apps/files_versions/js/versions.js b/apps/files_versions/js/versions.js
index 5e46b2a0eed..82d569fa0f6 100644
--- a/apps/files_versions/js/versions.js
+++ b/apps/files_versions/js/versions.js
@@ -33,7 +33,7 @@ $(document).ready(function(){
});
function createVersionsDropdown(filename, files) {
-
+
var historyUrl = OC.linkTo('files_versions', 'history.php') + '?path='+encodeURIComponent( $( '#dir' ).val() ).replace( /%2F/g, '/' )+'/'+encodeURIComponent( filename );
var html = '<div id="dropdown" class="drop" data-file="'+files+'">';
diff --git a/apps/files_versions/templates/history.php b/apps/files_versions/templates/history.php
index 58fea75a0d0..13e104152b7 100644
--- a/apps/files_versions/templates/history.php
+++ b/apps/files_versions/templates/history.php
@@ -22,8 +22,10 @@ if( isset( $_['message'] ) ) {
foreach ( $_['versions'] as $v ) {
echo ' ';
- echo OCP\Util::formatDate( $v );
- echo ' <a href="'.OCP\Util::linkTo('files_versions', 'history.php').'?path='.urlencode( $_['path'] ).'&revert='. $v .'" class="button">Revert</a><br /><br />';
+ echo OCP\Util::formatDate( $v['version'] );
+ echo ' <a href="'.OCP\Util::linkTo('files_versions', 'history.php').'?path='.urlencode( $_['path'] ).'&revert='. $v['version'] .'" class="button">Revert</a><br /><br />';
+ if ( $v['cur'] ) { echo ' (<b>Current</b>)'; }
+ echo '<br /><br />';
}
diff --git a/apps/files_versions/versions.php b/apps/files_versions/versions.php
index f39b5a7f4eb..bc579014659 100644
--- a/apps/files_versions/versions.php
+++ b/apps/files_versions/versions.php
@@ -27,7 +27,6 @@ class Storage {
//
// todo:
// - port to oc_filesystem to enable network transparency
- // - check if it works well together with encryption
// - implement expire all function. And find a place to call it ;-)
// - add transparent compression. first test if it´s worth it.
@@ -35,7 +34,7 @@ class Storage {
const DEFAULTFOLDER='versions';
const DEFAULTBLACKLIST='avi mp3 mpg mp4 ctmp';
const DEFAULTMAXFILESIZE=1048576; // 10MB
- const DEFAULTMININTERVAL=120; // 2 min
+ const DEFAULTMININTERVAL=1; // 2 min
const DEFAULTMAXVERSIONS=50;
/**
@@ -76,7 +75,7 @@ class Storage {
} else {
$uid = \OCP\User::getUser();
}
- $versionsfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+ $versionsFolderName=\OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
$filesfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/files';
Storage::init();
@@ -103,7 +102,7 @@ class Storage {
// check mininterval if the file is being modified by the owner (all shared files should be versioned despite mininterval)
if ($uid == \OCP\User::getUser()) {
- $matches=glob($versionsfoldername.'/'.$filename.'.v*');
+ $matches=glob($versionsFolderName.'/'.$filename.'.v*');
sort($matches);
$parts=explode('.v',end($matches));
if((end($parts)+Storage::DEFAULTMININTERVAL)>time()){
@@ -114,12 +113,12 @@ class Storage {
// create all parent folders
$info=pathinfo($filename);
- if(!file_exists($versionsfoldername.'/'.$info['dirname'])) mkdir($versionsfoldername.'/'.$info['dirname'],0700,true);
+ if(!file_exists($versionsFolderName.'/'.$info['dirname'])) mkdir($versionsFolderName.'/'.$info['dirname'],0700,true);
// store a new version of a file
- copy($filesfoldername.'/'.$filename,$versionsfoldername.'/'.$filename.'.v'.time());
+ copy($filesfoldername.'/'.$filename,$versionsFolderName.'/'.$filename.'.v'.time());
- // expire old revisions
+ // expire old revisions if necessary
Storage::expire($filename);
}
}
@@ -138,12 +137,12 @@ class Storage {
} else {
$uid = \OCP\User::getUser();
}
- $versionsfoldername=\OCP\Config::getSystemValue('datadirectory').'/'.$uid .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+ $versionsFolderName=\OCP\Config::getSystemValue('datadirectory').'/'.$uid .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
$filesfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/files';
// rollback
- if ( @copy($versionsfoldername.'/'.$filename.'.v'.$revision,$filesfoldername.'/'.$filename) ) {
+ if ( @copy($versionsFolderName.'/'.$filename.'.v'.$revision,$filesfoldername.'/'.$filename) ) {
return true;
@@ -169,10 +168,10 @@ class Storage {
} else {
$uid = \OCP\User::getUser();
}
- $versionsfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+ $versionsFolderName=\OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
// check for old versions
- $matches=glob($versionsfoldername.'/'.$filename.'.v*');
+ $matches=glob($versionsFolderName.'/'.$filename.'.v*');
if(count($matches)>1){
return true;
}else{
@@ -186,10 +185,15 @@ class Storage {
/**
- * get a list of old versions of a file.
+ * @brief get a list of all available versions of a file in descending chronological order
+ * @param $filename file to find versions of, relative to the user files dir
+ * @param $count number of versions to return
+ * @returns array
*/
- public static function getversions($filename,$count=0) {
- if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
+ public static function getVersions( $filename, $count = 0 ) {
+
+ if( \OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true' ) {
+
if (\OCP\App::isEnabled('files_sharing') && $source = \OC_Share::getSource('/'.\OCP\User::getUser().'/files'.$filename)) {
$pos = strpos($source, '/files', 1);
$uid = substr($source, 1, $pos - 1);
@@ -197,29 +201,65 @@ class Storage {
} else {
$uid = \OCP\User::getUser();
}
- $versionsfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
- $versions=array();
-
- // fetch for old versions
- $matches=glob($versionsfoldername.'/'.$filename.'.v*');
- sort($matches);
- foreach($matches as $ma) {
- $parts=explode('.v',$ma);
- $versions[]=(end($parts));
+ $versionsFolderName = \OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+ $versions = array();
+
+ // fetch for old versions
+ $matches = glob( $versionsFolderName.'/'.$filename.'.v*' );
+
+ sort( $matches );
+
+ $i = 0;
+
+ foreach( $matches as $ma ) {
+
+ $i++;
+ $versions[$i]['cur'] = 0;
+ $parts = explode( '.v', $ma );
+ $versions[$i]['version'] = ( end( $parts ) );
+
+ // if file with modified date exists, flag it in array as currently enabled version
+ $curFile['fileName'] = basename( $parts[0] );
+ $curFile['filePath'] = \OCP\Config::getSystemValue('datadirectory').\OC_Filesystem::getRoot().'/'.$curFile['fileName'];
+
+ ( \md5_file( $ma ) == \md5_file( $curFile['filePath'] ) ? $versions[$i]['fileMatch'] = 1 : $versions[$i]['fileMatch'] = 0 );
+
}
+ $versions = array_reverse( $versions );
+
+ foreach( $versions as $key => $value ) {
+
+ // flag the first matched file in array (which will have latest modification date) as current version
+ if ( $versions[$key]['fileMatch'] ) {
+
+ $versions[$key]['cur'] = 1;
+ break;
+
+ }
+
+ }
+
+ $versions = array_reverse( $versions );
+
// only show the newest commits
- if($count<>0 and (count($versions)>$count)) {
- $versions=array_slice($versions,count($versions)-$count);
+ if( $count != 0 and ( count( $versions )>$count ) ) {
+
+ $versions = array_slice( $versions, count( $versions ) - $count );
+
}
- return($versions);
+ return( $versions );
- }else{
- return(array());
+ } else {
+
+ // if versioning isn't enabled then return an empty array
+ return( array() );
+
}
- }
+
+ }
@@ -228,6 +268,7 @@ class Storage {
*/
public static function expire($filename) {
if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
+
if (\OCP\App::isEnabled('files_sharing') && $source = \OC_Share::getSource('/'.\OCP\User::getUser().'/files'.$filename)) {
$pos = strpos($source, '/files', 1);
$uid = substr($source, 1, $pos - 1);
@@ -235,28 +276,92 @@ class Storage {
} else {
$uid = \OCP\User::getUser();
}
- $versionsfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+ $versionsFolderName=\OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
// check for old versions
- $matches=glob($versionsfoldername.'/'.$filename.'.v*');
- if(count($matches)>\OCP\Config::getSystemValue('files_versionmaxversions', Storage::DEFAULTMAXVERSIONS)){
- $numbertodelete=count($matches-\OCP\Config::getSystemValue('files_versionmaxversions', Storage::DEFAULTMAXVERSIONS));
+ $matches = glob( $versionsFolderName.'/'.$filename.'.v*' );
+
+ if( count( $matches ) > \OCP\Config::getSystemValue( 'files_versionmaxversions', Storage::DEFAULTMAXVERSIONS ) ) {
+
+ $numberToDelete = count( $matches-\OCP\Config::getSystemValue( 'files_versionmaxversions', Storage::DEFAULTMAXVERSIONS ) );
// delete old versions of a file
- $deleteitems=array_slice($matches,0,$numbertodelete);
- foreach($deleteitems as $de){
- unlink($versionsfoldername.'/'.$filename.'.v'.$de);
+ $deleteItems = array_slice( $matches, 0, $numberToDelete );
+
+ foreach( $deleteItems as $de ) {
+
+ unlink( $versionsFolderName.'/'.$filename.'.v'.$de );
+
}
}
}
}
/**
- * expire all old versions.
+ * @brief erase all old versions of all user files
+ * @return
*/
- public static function expireall($filename) {
- // todo this should go through all the versions directories and delete all the not needed files and not needed directories.
- // useful to be included in a cleanup cronjob.
+ public static function expireAll() {
+
+ function deleteAll($directory, $empty = false) {
+
+ if(substr($directory,-1) == "/") {
+ $directory = substr($directory,0,-1);
+ }
+
+ if(!file_exists($directory) || !is_dir($directory)) {
+
+ return false;
+
+ } elseif(!is_readable($directory)) {
+
+ return false;
+
+ } else {
+
+ $directoryHandle = opendir($directory);
+
+ while ($contents = readdir($directoryHandle)) {
+
+ if( $contents != '.' && $contents != '..') {
+
+ $path = $directory . "/" . $contents;
+
+ if( is_dir($path) ) {
+
+ deleteAll($path);
+
+ } else {
+
+ unlink($path);
+
+ }
+ }
+
+ }
+
+ closedir( $directoryHandle );
+
+ if( $empty == false ) {
+
+ if(!rmdir($directory)) {
+
+ return false;
+
+ }
+
+ }
+
+ return true;
+ }
+
+ }
+
+ // FIXME: make this path dynamic
+ $dir = '/home/samtuke/owncloud/git/oc5/data/admin/versions';
+
+ ( deleteAll( $dir, 1 ) ? return true : return false );
+
}
diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php
index 0cd825f3e50..b49e52f0bd2 100644
--- a/apps/gallery/ajax/galleryOp.php
+++ b/apps/gallery/ajax/galleryOp.php
@@ -42,7 +42,8 @@ function handleRemove($name) {
function handleGetThumbnails($albumname) {
OCP\Response::enableCaching(3600 * 24); // 24 hour
- $thumbnail = OC::$CONFIG_DATADIRECTORY.'/../gallery/'.urldecode($albumname).'.png';
+ $view = OCP\App::getStorage('gallery');
+ $thumbnail = $view->fopen(urldecode($albumname).'.png', 'r');
header('Content-Type: '.OC_Image::getMimeTypeForFile($thumbnail));
OCP\Response::sendFile($thumbnail);
}
diff --git a/apps/gallery/ajax/sharing.php b/apps/gallery/ajax/sharing.php
index 1223320120b..304757b9e91 100644
--- a/apps/gallery/ajax/sharing.php
+++ b/apps/gallery/ajax/sharing.php
@@ -80,7 +80,8 @@ function handleGetThumbnail($token, $imgpath) {
function handleGetAlbumThumbnail($token, $albumname)
{
$owner = OC_Gallery_Sharing::getTokenOwner($token);
- $file = OCP\Config::getSystemValue("datadirectory").'/'. $owner .'/gallery/'.$albumname.'.png';
+ $view = OCP\App::getStorage('gallery');
+ $file = $view->fopen($albumname.'.png', 'r');
$image = new OC_Image($file);
if ($image->valid()) {
$image->centerCrop();
@@ -93,7 +94,8 @@ function handleGetAlbumThumbnail($token, $albumname)
function handleGetPhoto($token, $photo) {
$owner = OC_Gallery_Sharing::getTokenOwner($token);
- $file = OCP\Config::getSystemValue( "datadirectory", OC::$SERVERROOT."/data" ).'/'.$owner.'/files'.urldecode($photo);
+ $view = OCP\App::getStorage('files');
+ $file = $view->fopen(urldecode($photo), 'r');
header('Content-Type: '.OC_Image::getMimeTypeForFile($file));
OCP\Response::sendFile($file);
}
diff --git a/apps/gallery/index.php b/apps/gallery/index.php
index e47fb3db5d6..a9fe200c4e4 100644
--- a/apps/gallery/index.php
+++ b/apps/gallery/index.php
@@ -27,10 +27,6 @@ OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('gallery');
OCP\App::setActiveNavigationEntry( 'gallery_index' );
-if (!file_exists(OCP\Config::getSystemValue("datadirectory").'/'. OCP\USER::getUser() .'/gallery')) {
- mkdir(OCP\Config::getSystemValue("datadirectory").'/'. OCP\USER::getUser() .'/gallery');
-}
-
if (!isset($_GET['view'])) {
$result = OC_Gallery_Album::find(OCP\USER::getUser());
diff --git a/apps/gallery/js/album_cover.js b/apps/gallery/js/album_cover.js
index d1809462f2f..905034f6fd1 100644
--- a/apps/gallery/js/album_cover.js
+++ b/apps/gallery/js/album_cover.js
@@ -78,14 +78,14 @@ function albumClickHandler(r) {
for (var i in r.photos) {
Albums.photos.push(r.photos[i]);
}
- Albums.shared = r.shared;
- if (Albums.shared) {
- Albums.recursive = r.recursive;
- Albums.token = r.token;
- } else {
- Albums.recursive = false;
- Albums.token = '';
- }
+ Albums.shared = r.shared;
+ if (Albums.shared) {
+ Albums.recursive = r.recursive;
+ Albums.token = r.token;
+ } else {
+ Albums.recursive = false;
+ Albums.token = '';
+ }
$(document).ready(function(){
var targetDiv = $('#gallery_list');
targetDiv.html('');
diff --git a/apps/gallery/lib/album.php b/apps/gallery/lib/album.php
index 5f962f12f12..8ac27b1a70d 100644
--- a/apps/gallery/lib/album.php
+++ b/apps/gallery/lib/album.php
@@ -77,7 +77,7 @@ class OC_Gallery_Album {
$sql .= ' AND parent_path = ?';
$args[] = $parent;
}
- $order = OCP\Config::getUserValue($owner, 'gallery', 'order', 'ASC');
+ $order = OCP\Config::getUserValue($owner, 'gallery', 'order', 'ASC');
$sql .= ' ORDER BY album_name ' . $order;
$stmt = OCP\DB::prepare($sql);
@@ -90,25 +90,22 @@ class OC_Gallery_Album {
}
public static function changeThumbnailPath($oldname, $newname) {
-
- $thumbpath = OC::$CONFIG_DATADIRECTORY.'/../gallery/';
- rename($thumbpath.$oldname.'.png', $thumbpath.$newname.'.png');
+ $view = OCP\App::getStorage('gallery');
+ $view->rename($oldname.'.png', $newname.'.png');
}
public static function getAlbumSize($id){
- $sql = 'SELECT COUNT(*) as size FROM *PREFIX*gallery_photos WHERE album_id = ?';
- $stmt = OCP\DB::prepare($sql);
- $result=$stmt->execute(array($id))->fetchRow();
- return $result['size'];
+ $sql = 'SELECT COUNT(*) as size FROM *PREFIX*gallery_photos WHERE album_id = ?';
+ $stmt = OCP\DB::prepare($sql);
+ $result=$stmt->execute(array($id))->fetchRow();
+ return $result['size'];
}
- public static function getIntermediateGallerySize($path) {
- $path .= '%';
- $sql = 'SELECT COUNT(*) as size FROM *PREFIX*gallery_photos photos, *PREFIX*gallery_albums albums WHERE photos.album_id = albums.album_id AND uid_owner = ? AND file_path LIKE ?';
- $stmt = OCP\DB::prepare($sql);
- $result = $stmt->execute(array(OCP\USER::getUser(), $path))->fetchRow();
- return $result['size'];
- }
+ public static function getIntermediateGallerySize($path) {
+ $path .= '%';
+ $sql = 'SELECT COUNT(*) as size FROM *PREFIX*gallery_photos photos, *PREFIX*gallery_albums albums WHERE photos.album_id = albums.album_id AND uid_owner = ? AND file_path LIKE ?';
+ $stmt = OCP\DB::prepare($sql);
+ $result = $stmt->execute(array(OCP\USER::getUser(), $path))->fetchRow();
+ return $result['size'];
+ }
}
-
-?>
diff --git a/apps/gallery/lib/photo.php b/apps/gallery/lib/photo.php
index 99384af621a..b4b37236b0e 100644
--- a/apps/gallery/lib/photo.php
+++ b/apps/gallery/lib/photo.php
@@ -68,17 +68,17 @@ class OC_Gallery_Photo {
public static function getThumbnail($image_name, $owner = null) {
if (!$owner) $owner = OCP\USER::getUser();
- $save_dir = OCP\Config::getSystemValue("datadirectory").'/'. $owner .'/gallery/';
- $save_dir .= dirname($image_name). '/';
- $image_path = $image_name;
- $thumb_file = $save_dir . basename($image_name);
- if (!is_dir($save_dir)) {
- mkdir($save_dir, 0777, true);
+ $view = OCP\App::getStorage('gallery');
+ $save_dir = dirname($image_name);
+ if (!$view->is_dir($save_dir)) {
+ $view->mkdir($save_dir);
}
- if (file_exists($thumb_file)) {
- $image = new OC_Image($thumb_file);
+ $view->chroot($view->getRoot().'/'.$save_dir);
+ $thumb_file = basename($image_name);
+ if ($view->file_exists($thumb_file)) {
+ $image = new OC_Image($view->fopen($thumb_file, 'r'));
} else {
- $image_path = OC_Filesystem::getLocalFile($image_path);
+ $image_path = OC_Filesystem::getLocalFile($image_name);
if(!file_exists($image_path)) {
return null;
}
@@ -86,7 +86,7 @@ class OC_Gallery_Photo {
if ($image->valid()) {
$image->centerCrop(200);
$image->fixOrientation();
- $image->save($thumb_file);
+ $image->save($view->getLocalFile($thumb_file));
}
}
if ($image->valid()) {
diff --git a/apps/gallery/lib/scanner.php b/apps/gallery/lib/scanner.php
index 7a137cb3f50..e11ba1da454 100644
--- a/apps/gallery/lib/scanner.php
+++ b/apps/gallery/lib/scanner.php
@@ -81,7 +81,8 @@ class OC_Gallery_Scanner {
$image->destroy();
}
}
- imagepng($thumbnail, OCP\Config::getSystemValue("datadirectory").'/'. OCP\USER::getUser() .'/gallery/' . $albumName.'.png');
+ $view = OCP\App::getStorage('gallery');
+ imagepng($thumbnail, $view->getLocalFile($albumName.'.png'));
imagedestroy($thumbnail);
}
diff --git a/apps/user_openid/user_openid.php b/apps/user_openid/user_openid.php
index 3267db3fa0f..e228de95e9e 100644
--- a/apps/user_openid/user_openid.php
+++ b/apps/user_openid/user_openid.php
@@ -24,7 +24,7 @@
require_once('class.openid.v3.php');
/**
- * Class for user management in a SQL Database (e.g. MySQL, SQLite)
+ * Class for user OpenId backend
*/
class OC_USER_OPENID extends OC_User_Backend {
/**