Merge branch 'master' into update-expire-function

Conflicts:
	apps/files_trashbin/appinfo/version
	apps/files_trashbin/lib/trash.php
This commit is contained in:
Björn Schießle 2013-02-25 14:26:59 +01:00
commit 4c980a4851
13 changed files with 288 additions and 125 deletions

View File

@ -123,6 +123,24 @@ a.action>img { max-height:16px; max-width:16px; vertical-align:text-bottom; }
.selectedActions a { display:inline; margin:-.5em 0; padding:.5em !important; }
.selectedActions a img { position:relative; top:.3em; }
#fileList a.action {
display:none;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
}
#fileList tr:hover a.action {
display:inline;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=.5)";
filter: alpha(opacity=.5);
opacity: .5;
}
#fileList tr:hover a.action:hover {
display:inline;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=1)";
filter: alpha(opacity=1);
opacity: 1;
}
#scanning-message{ top:40%; left:40%; position:absolute; display:none; }

View File

@ -524,7 +524,7 @@ $(document).ready(function() {
crumb.text(text);
}
$(window).click(function(){
$(document).click(function(){
$('#new>ul').hide();
$('#new').removeClass('active');
$('#new li').each(function(i,element){

View File

@ -0,0 +1,40 @@
<?php
$installedVersion=OCP\Config::getAppValue('files_trashbin', 'installed_version');
// move versions to new directory
if (version_compare($installedVersion, '0.2', '<')) {
$datadir = \OCP\Config::getSystemValue('datadirectory').'/';
$users = \OCP\User::getUsers();
foreach ($users as $user) {
//create new folders
@mkdir($datadir.$user.'/files_trashbin/files');
@mkdir($datadir.$user.'/files_trashbin/versions');
@mkdir($datadir.$user.'/files_trashbin/keyfiles');
// move files to the new folders
if ($handle = opendir($datadir.$user.'/files_trashbin')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != 'files' && $file != 'versions' && $file != 'keyfiles') {
rename($datadir.$user.'/files_trashbin/'.$file,
$datadir.$user.'/files_trashbin/files/'.$file);
}
}
closedir($handle);
}
// move versions to the new folder
if ($handle = opendir($datadir.$user.'/versions_trashbin')) {
while (false !== ($file = readdir($handle))) {
rename($datadir.$user.'/versions_trashbin/'.$file,
$datadir.$user.'/files_trashbin/versions/'.$file);
}
closedir($handle);
}
@rmdir($datadir.$user.'/versions_trashbin');
}
}

View File

@ -9,7 +9,7 @@ OCP\Util::addScript('files', 'fileactions');
$tmpl = new OCP\Template('files_trashbin', 'index', 'user');
$user = \OCP\User::getUser();
$view = new OC_Filesystemview('/'.$user.'/files_trashbin');
$view = new OC_Filesystemview('/'.$user.'/files_trashbin/files');
OCP\Util::addStyle('files', 'files');
OCP\Util::addScript('files', 'filelist');
@ -19,7 +19,6 @@ $dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : '';
$result = array();
if ($dir) {
$dirlisting = true;
$view = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files_trashbin');
$fullpath = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath($dir);
$dirContent = opendir($fullpath);
$i = 0;
@ -96,6 +95,7 @@ $list->assign('disableDownloadActions', true);
$tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage(), false);
$tmpl->assign('fileList', $list->fetchPage(), false);
$tmpl->assign('files', $files);
$tmpl->assign('dirlisting', $dirlisting);
$tmpl->assign('dir', OC_Filesystem::normalizePath($view->getAbsolutePath()));
$tmpl->printPage();

View File

@ -36,66 +36,77 @@ class Trashbin {
*/
public static function move2trash($file_path) {
$user = \OCP\User::getUser();
$view = new \OC_FilesystemView('/'. $user);
if (!$view->is_dir('files_trashbin')) {
$view->mkdir('files_trashbin');
$view->mkdir("versions_trashbin");
}
$path_parts = pathinfo($file_path);
$deleted = $path_parts['basename'];
$location = $path_parts['dirname'];
$timestamp = time();
$mime = $view->getMimeType('files'.$file_path);
if ( $view->is_dir('files'.$file_path) ) {
$type = 'dir';
} else {
$type = 'file';
$view = new \OC\Files\View('/'. $user);
if (!$view->is_dir('files_trashbin')) {
$view->mkdir('files_trashbin');
$view->mkdir("files_trashbin/files");
$view->mkdir("files_trashbin/versions");
$view->mkdir("files_trashbin/keyfiles");
}
$path_parts = pathinfo($file_path);
$deleted = $path_parts['basename'];
$location = $path_parts['dirname'];
$timestamp = time();
$mime = $view->getMimeType('files'.$file_path);
if ( $view->is_dir('files'.$file_path) ) {
$type = 'dir';
} else {
$type = 'file';
}
$trashbinSize = self::getTrashbinSize($user);
if ( $trashbinSize === false || $trashbinSize < 0 ) {
$trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin'));
$trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/versions_trashbin'));
}
$trashbinSize += self::copy_recursive($file_path, 'files_trashbin/'.$deleted.'.d'.$timestamp, $view);
$trashbinSize += self::copy_recursive($file_path, 'files_trashbin/files/'.$deleted.'.d'.$timestamp, $view);
if ( $view->file_exists('files_trashbin/'.$deleted.'.d'.$timestamp) ) {
$query = \OC_DB::prepare("INSERT INTO *PREFIX*files_trash (id,timestamp,location,type,mime,user)"
." VALUES (?,?,?,?,?,?)");
if ( $view->file_exists('files_trashbin/files/'.$deleted.'.d'.$timestamp) ) {
$query = \OC_DB::prepare("INSERT INTO *PREFIX*files_trash (id,timestamp,location,type,mime,user) VALUES (?,?,?,?,?,?)");
$result = $query->execute(array($deleted, $timestamp, $location, $type, $mime, $user));
if ( !$result ) { // if file couldn't be added to the database than also don't store it in the trash bin.
$view->deleteAll('files_trashbin/'.$deleted.'.d'.$timestamp);
$view->deleteAll('files_trashbin/files/'.$deleted.'.d'.$timestamp);
\OC_Log::write('files_trashbin', 'trash bin database couldn\'t be updated', \OC_log::ERROR);
return;
}
if ( \OCP\App::isEnabled('files_versions') ) {
}
// Take care of file versions
if ( \OCP\App::isEnabled('files_versions') ) {
if ( $view->is_dir('files_versions'.$file_path) ) {
$trashbinSize += self::calculateSize(
new \OC_FilesystemView('/'. $user.'/files_versions/'.$file_path)
);
$view->rename('files_versions'.$file_path, 'versions_trashbin/'. $deleted.'.d'.$timestamp);
} else if ( $versions = \OCA\Files_Versions\Storage::getVersions($file_path) ) {
$trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_versions/'.$file_path));
$view->rename('files_versions'.$file_path, 'files_trashbin/versions'. $deleted.'.d'.$timestamp);
} else if ( $versions = \OCA\Files_Versions\Storage::getVersions($file_path) ) {
foreach ($versions as $v) {
$trashbinSize += $view->filesize('files_versions'.$v['path'].'.v'.$v['version']);
$view->rename('files_versions'.$v['path'].'.v'.$v['version'],
'versions_trashbin/'. $deleted.'.v'.$v['version'].'.d'.$timestamp);
}
$trashbinSize += $view->filesize('files_versions'.$v['path'].'.v'.$v['version']);
$view->rename('files_versions'.$v['path'].'.v'.$v['version'], 'files_trashbin/versions'. $deleted.'.v'.$v['version'].'.d'.$timestamp);
}
}
}
// Take care of encryption keys
$keyfile = \OC_Filesystem::normalizePath('files_encryption/keyfiles/'.$file_path);
if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile.'.key') ) {
if ( $view->is_dir('files'.$file_path) ) {
$trashbinSize += self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile));
$view->rename($keyfile, 'files_trashbin/keyfiles/'. $deleted.'.d'.$timestamp);
} else {
$trashbinSize += $view->filesize($keyfile.'.key');
$view->rename($keyfile.'.key', 'files_trashbin/keyfiles/'. $deleted.'.key.d'.$timestamp);
}
}
} else {
\OC_Log::write('files_trashbin', 'Couldn\'t move '.$file_path.' to the trash bin', \OC_log::ERROR);
}
// get available disk space for user
$quota = \OCP\Util::computerFileSize(\OC_Preferences::getValue($user, 'files', 'quota'));
if ( $quota == null ) {
if ( $quota === null ) {
$quota = \OCP\Util::computerFileSize(\OC_Appconfig::getValue('files', 'default_quota'));
}
if ( $quota == null ) {
if ( $quota === null ) {
$quota = \OC\Files\Filesystem::free_space('/') / count(\OCP\User::getUsers());
}
@ -126,9 +137,8 @@ class Trashbin {
$view = new \OC_FilesystemView('/'.$user);
$trashbinSize = self::getTrashbinSize($user);
if ( $trashbinSize === false || $trashbinSize < 0 ) {
$trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin'));
$trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/versions_trashbin'));
if ( $trashbinSize === false || $trashbinSize < 0 ) {
$trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin'));
}
if ( $timestamp ) {
$query = \OC_DB::prepare('SELECT location,type FROM *PREFIX*files_trash'
@ -147,15 +157,15 @@ class Trashbin {
$location = '';
}
} else {
$path_parts = pathinfo($filename);
$path_parts = pathinfo($file);
$result[] = array(
'location' => $path_parts['dirname'],
'type' => $view->is_dir('/files_trashbin/'.$file) ? 'dir' : 'files',
'type' => $view->is_dir('/files_trashbin/files/'.$file) ? 'dir' : 'files',
);
$location = '';
}
$source = \OC_Filesystem::normalizePath('files_trashbin/'.$file);
$source = \OC_Filesystem::normalizePath('files_trashbin/files/'.$file);
$target = \OC_Filesystem::normalizePath('files/'.$location.'/'.$filename);
// we need a extension in case a file/dir with the same name already exists
@ -175,27 +185,42 @@ class Trashbin {
} else {
$versionedFile = $file;
}
if ( $result[0]['type'] == 'dir' ) {
$trashbinSize -= self::calculateSize(
new \OC_FilesystemView('/'.$user.'/'.'versions_trashbin/'. $file)
);
$view->rename(\OC_Filesystem::normalizePath('versions_trashbin/'. $file),
\OC_Filesystem::normalizePath('files_versions/'.$location.'/'.$filename.$ext));
} else if ( $versions = self::getVersionsFromTrash($versionedFile, $timestamp) ) {
if ( $result[0]['type'] === 'dir' ) {
$trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.'files_trashbin/versions/'. $file));
$view->rename(\OC_Filesystem::normalizePath('files_trashbin/versions/'. $file), \OC_Filesystem::normalizePath('files_versions/'.$location.'/'.$filename.$ext));
} else if ( $versions = self::getVersionsFromTrash($versionedFile, $timestamp) ) {
foreach ($versions as $v) {
if ($timestamp ) {
$trashbinSize -= $view->filesize('versions_trashbin/'.$versionedFile.'.v'.$v.'.d'.$timestamp);
$view->rename('versions_trashbin/'.$versionedFile.'.v'.$v.'.d'.$timestamp,
'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v);
$trashbinSize -= $view->filesize('files_trashbin/versions/'.$versionedFile.'.v'.$v.'.d'.$timestamp);
$view->rename('files_trashbin/versions/'.$versionedFile.'.v'.$v.'.d'.$timestamp, 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v);
} else {
$trashbinSize -= $view->filesize('versions_trashbin/'.$versionedFile.'.v'.$v);
$view->rename('versions_trashbin/'.$versionedFile.'.v'.$v,
'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v);
}
}
$trashbinSize -= $view->filesize('files_trashbin/versions/'.$versionedFile.'.v'.$v);
$view->rename('files_trashbin/versions/'.$versionedFile.'.v'.$v, 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v);
}
}
}
}
// Take care of encryption keys TODO! Get '.key' in file between file name and delete date (also for permanent delete!)
$parts = pathinfo($file);
if ( $result[0]['type'] === 'dir' ) {
$keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$parts['dirname'].'/'.$filename);
} else {
$keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$parts['dirname'].'/'.$filename.'.key');
}
if ($timestamp) {
$keyfile .= '.d'.$timestamp;
}
if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) {
if ( $result[0]['type'] === 'dir' ) {
$trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile));
$view->rename($keyfile, 'files_encryption/keyfiles/'. $location.'/'.$filename);
} else {
$trashbinSize -= $view->filesize($keyfile);
$view->rename($keyfile, 'files_encryption/keyfiles/'. $location.'/'.$filename.'.key');
}
}
if ( $timestamp ) {
$query = \OC_DB::prepare('DELETE FROM *PREFIX*files_trash WHERE user=? AND id=? AND timestamp=?');
$query->execute(array($user,$filename,$timestamp));
@ -223,9 +248,8 @@ class Trashbin {
$size = 0;
$trashbinSize = self::getTrashbinSize($user);
if ( $trashbinSize === false || $trashbinSize < 0 ) {
$trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin'));
$trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/versions_trashbin'));
if ( $trashbinSize === false || $trashbinSize < 0 ) {
$trashbinSize = self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_trashbin'));
}
if ( $timestamp ) {
@ -237,28 +261,47 @@ class Trashbin {
}
if ( \OCP\App::isEnabled('files_versions') ) {
if ($view->is_dir('versions_trashbin/'.$file)) {
$size += self::calculateSize(new \OC_Filesystemview('/'.$user.'/versions_trashbin/'.$file));
$view->unlink('versions_trashbin/'.$file);
if ($view->is_dir('files_trashbin/versions/'.$file)) {
$size += self::calculateSize(new \OC_Filesystemview('/'.$user.'/files_trashbin/versions/'.$file));
$view->unlink('files_trashbin/versions/'.$file);
} else if ( $versions = self::getVersionsFromTrash($filename, $timestamp) ) {
foreach ($versions as $v) {
if ($timestamp ) {
$size += $view->filesize('/versions_trashbin/'.$filename.'.v'.$v.'.d'.$timestamp);
$view->unlink('/versions_trashbin/'.$filename.'.v'.$v.'.d'.$timestamp);
$size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp);
$view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp);
} else {
$size += $view->filesize('/versions_trashbin/'.$filename.'.v'.$v);
$view->unlink('/versions_trashbin/'.$filename.'.v'.$v);
$size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v);
$view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v);
}
}
}
}
if ($view->is_dir('/files_trashbin/'.$file)) {
$size += self::calculateSize(new \OC_Filesystemview('/'.$user.'/files_trashbin/'.$file));
// Take care of encryption keys
$parts = pathinfo($file);
if ( $view->is_dir('/files_trashbin/files/'.$file) ) {
$keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$filename);
} else {
$keyfile = \OC_Filesystem::normalizePath('files_trashbin/keyfiles/'.$filename.'.key');
}
if ($timestamp) {
$keyfile .= '.d'.$timestamp;
}
if ( \OCP\App::isEnabled('files_encryption') && $view->file_exists($keyfile) ) {
if ( $view->is_dir($keyfile) ) {
$size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.$keyfile));
} else {
$size += $view->filesize($keyfile);
}
$view->unlink($keyfile);
}
if ($view->is_dir('/files_trashbin/files/'.$file)) {
$size += self::calculateSize(new \OC_Filesystemview('/'.$user.'/files_trashbin/files/'.$file));
} else {
$size += $view->filesize('/files_trashbin/'.$file);
$size += $view->filesize('/files_trashbin/files/'.$file);
}
$view->unlink('/files_trashbin/'.$file);
$view->unlink('/files_trashbin/files/'.$file);
$trashbinSize -= $size;
self::setTrashbinSize($user, $trashbinSize);
@ -281,7 +324,7 @@ class Trashbin {
$filename = $filename;
}
$target = \OC_Filesystem::normalizePath('files_trashbin/'.$filename);
$target = \OC_Filesystem::normalizePath('files_trashbin/files/'.$filename);
return $view->file_exists($target);
}
@ -307,31 +350,9 @@ class Trashbin {
$timestamp = $r['timestamp'];
$filename = $r['id'];
if ( $r['timestamp'] < $limit ) {
if ($view->is_dir('files_trashbin/'.$filename.'.d'.$timestamp)) {
$size += self::calculateSize(
new \OC_FilesystemView('/'.$user.'/files_trashbin/'.$filename.'.d'.$timestamp)
);
} else {
$size += $view->filesize('files_trashbin/'.$filename.'.d'.$timestamp);
}
$view->unlink('files_trashbin/'.$filename.'.d'.$timestamp);
if ($r['type'] == 'dir') {
$size += self::calculateSize(
new \OC_FilesystemView('/'.$user.'/versions_trashbin/'.$filename.'.d'.$timestamp)
);
$view->unlink('versions_trashbin/'.$filename.'.d'.$timestamp);
} else if ( $versions = self::getVersionsFromTrash($filename, $timestamp) ) {
foreach ($versions as $v) {
$size += $view->filesize('versions_trashbin/'.$filename.'.v'.$v.'.d'.$timestamp);
$view->unlink('versions_trashbin/'.$filename.'.v'.$v.'.d'.$timestamp);
}
}
$size += self::delete($filename, $timestamp);
}
}
$query = \OC_DB::prepare('DELETE FROM *PREFIX*files_trash WHERE user=? AND timestamp<?');
$query->execute(array($user,$limit));
$availableSpace = $availableSpace + $size;
// if size limit for trash bin reached, delete oldest files in trash bin
if ($availableSpace < 0) {
@ -347,6 +368,7 @@ class Trashbin {
$i++;
}
}
return $size;
@ -388,7 +410,7 @@ class Trashbin {
* @param $timestamp timestamp when the file was deleted
*/
private static function getVersionsFromTrash($filename, $timestamp) {
$view = new \OC_FilesystemView('/'.\OCP\User::getUser().'/versions_trashbin');
$view = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files_trashbin/versions');
$versionsName = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath($filename);
$versions = array();
if ($timestamp ) {
@ -486,4 +508,4 @@ class Trashbin {
$query->execute(array($size, $user));
}
}
}

View File

@ -5,7 +5,7 @@
</div>
<div id='notification'></div>
<?php if (isset($_['files']) && count($_['files'])==0):?>
<?php if (isset($_['files']) && count($_['files'])==0 && $_['dirlisting'] == false):?>
<div id="emptyfolder"><?php echo $l->t('Nothing in here. Your trash bin is empty!')?></div>
<?php endif; ?>

View File

@ -1,11 +1,11 @@
<?php
OCP\JSON::checkAppEnabled('files_versions');
$userDirectory = "/".OCP\USER::getUser()."/files";
$source = $_GET['source'];
list ($uid, $filename) = OCA\Files_Versions\Storage::getUidAndFilename($source);
$count = 5; //show the newest revisions
if( ($versions = OCA\Files_Versions\Storage::getVersions( $source, $count)) ) {
if( ($versions = OCA\Files_Versions\Storage::getVersions($uid, $filename, $count)) ) {
$versionsFormatted = array();

View File

@ -35,7 +35,7 @@ class Storage {
6 => array('intervalEndsAfter' => -1, 'step' => 604800),
);
private static function getUidAndFilename($filename) {
public static function getUidAndFilename($filename) {
$uid = \OC\Files\Filesystem::getOwner($filename);
\OC\Files\Filesystem::initMountPoints($uid);
if ( $uid != \OCP\User::getUser() ) {

View File

@ -669,7 +669,7 @@ $(document).ready(function(){
$('#settings #expanddiv').click(function(event){
event.stopPropagation();
});
$(window).click(function(){//hide the settings menu when clicking outside it
$(document).click(function(){//hide the settings menu when clicking outside it
$('#settings #expanddiv').slideUp(200);
});

View File

@ -223,7 +223,7 @@ class OC_App{
// check if the app is compatible with this version of ownCloud
$info=OC_App::getAppInfo($app);
$version=OC_Util::getVersion();
if(!isset($info['require']) or ($version[0]>$info['require'])) {
if(!isset($info['require']) or !self::isAppVersionCompatible($version, $info['require'])) {
OC_Log::write('core',
'App "'.$info['name'].'" can\'t be installed because it is'
.' not compatible with this version of ownCloud',
@ -851,7 +851,7 @@ class OC_App{
foreach($apps as $app) {
// check if the app is compatible with this version of ownCloud
$info = OC_App::getAppInfo($app);
if(!isset($info['require']) or (($version[0].'.'.$version[1])>$info['require'])) {
if(!isset($info['require']) or !self::isAppVersionCompatible($version, $info['require'])) {
OC_Log::write('core',
'App "'.$info['name'].'" ('.$app.') can\'t be used because it is'
.' not compatible with this version of ownCloud',
@ -862,6 +862,36 @@ class OC_App{
}
}
/**
* Compares the app version with the owncloud version to see if the app
* requires a newer version than the currently active one
* @param array $owncloudVersions array with 3 entries: major minor bugfix
* @param string $appRequired the required version from the xml
* major.minor.bugfix
* @return boolean true if compatible, otherwise false
*/
public static function isAppVersionCompatible($owncloudVersions, $appRequired){
$appVersions = explode('.', $appRequired);
for($i=0; $i<count($appVersions); $i++){
$appVersion = (int) $appVersions[$i];
if(isset($owncloudVersions[$i])){
$owncloudVersion = $owncloudVersions[$i];
} else {
$owncloudVersion = 0;
}
if($owncloudVersion < $appVersion){
return false;
}
}
return true;
}
/**
* get the installed version of all apps
*/

View File

@ -275,19 +275,6 @@ class OC_Util {
$web_server_restart= false;
}
$handler = ini_get("session.save_handler");
if($handler == "files") {
$tmpDir = session_save_path();
if($tmpDir != "") {
if(!@is_writable($tmpDir)) {
$errors[]=array('error' => 'The temporary folder used by PHP to save the session data'
.' is either incorrect or not writable! Please check : '.session_save_path().'<br/>',
'hint'=>'Please ask your server administrator to grant write access'
.' or define another temporary folder.');
}
}
}
if($web_server_restart) {
$errors[]=array('error'=>'PHP modules have been installed, but they are still listed as missing?<br/>',
'hint'=>'Please ask your server administrator to restart the web server.');

View File

@ -28,7 +28,7 @@ OC.search.showResults=function(results){
OC.search.hide();
event.stopPropagation();
});
$(window).click(function(event){
$(document).click(function(event){
OC.search.hide();
});
OC.search.lastResults=results;

66
tests/lib/app.php Normal file
View File

@ -0,0 +1,66 @@
<?php
/**
* Copyright (c) 2012 Bernhard Posselt <nukeawhale@gmail.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
class Test_App extends PHPUnit_Framework_TestCase {
public function testIsAppVersionCompatibleSingleOCNumber(){
$oc = array(4);
$app = '4.0';
$this->assertTrue(OC_App::isAppVersionCompatible($oc, $app));
}
public function testIsAppVersionCompatibleMultipleOCNumber(){
$oc = array(4, 3, 1);
$app = '4.3';
$this->assertTrue(OC_App::isAppVersionCompatible($oc, $app));
}
public function testIsAppVersionCompatibleSingleNumber(){
$oc = array(4);
$app = '4';
$this->assertTrue(OC_App::isAppVersionCompatible($oc, $app));
}
public function testIsAppVersionCompatibleSingleAppNumber(){
$oc = array(4, 3);
$app = '4';
$this->assertTrue(OC_App::isAppVersionCompatible($oc, $app));
}
public function testIsAppVersionCompatibleShouldFail(){
$oc = array(4, 3, 1);
$app = '4.3.2';
$this->assertFalse(OC_App::isAppVersionCompatible($oc, $app));
}
public function testIsAppVersionCompatibleShouldFailTwoVersionNumbers(){
$oc = array(4, 3, 1);
$app = '4.4';
$this->assertFalse(OC_App::isAppVersionCompatible($oc, $app));
}
public function testIsAppVersionCompatibleShouldFailOneVersionNumbers(){
$oc = array(4, 3, 1);
$app = '5';
$this->assertFalse(OC_App::isAppVersionCompatible($oc, $app));
}
}