]> source.dussan.org Git - nextcloud-server.git/commitdiff
load remote and public paths from info.xml during upgrade instead of setting them...
authorRobin Appelman <icewind@owncloud.com>
Fri, 11 May 2012 18:32:37 +0000 (20:32 +0200)
committerRobin Appelman <icewind@owncloud.com>
Fri, 11 May 2012 18:33:56 +0000 (20:33 +0200)
18 files changed:
apps/calendar/appinfo/app.php
apps/calendar/appinfo/info.xml
apps/calendar/appinfo/version
apps/contacts/appinfo/app.php
apps/contacts/appinfo/info.xml
apps/contacts/appinfo/version
apps/files/appinfo/app.php
apps/files/appinfo/info.xml
apps/files/appinfo/version
apps/files_encryption/tests/proxy.php [new file with mode: 0644]
apps/gallery/appinfo/app.php
apps/gallery/appinfo/info.xml
apps/gallery/appinfo/version
apps/media/appinfo/app.php
apps/media/appinfo/info.xml
apps/media/appinfo/version
apps/media/tomahawk.php [deleted file]
lib/app.php

index 0c91bf8f135b01e004de13d07fe0e8c6d71581a1..b02fc602c6b33cf63c60380c398d5008575f0656 100755 (executable)
@@ -23,5 +23,3 @@ OCP\App::addNavigationEntry( array(
   'name' => $l->t('Calendar')));
 OCP\App::registerPersonal('calendar', 'settings');
 OC_Search::registerProvider('OC_Search_Provider_Calendar');
-OCP\CONFIG::setAppValue('core', 'remote_caldav', '/apps/calendar/appinfo/remote.php');
-OCP\CONFIG::setAppValue('core', 'public_calendar', '/apps/calendar/share.php');
\ No newline at end of file
index 101840aa1fa86f6b30316dc5019e43a7efdf4f15..f45f306e7d0f0184bd513eea6ae752c043f9c30d 100644 (file)
@@ -7,4 +7,12 @@
        <require>2</require>
        <description>Calendar with CalDAV support</description>
        <default_enable/>
+       <remote>
+               <calendar>appinfo/remote.php</calendar>
+               <caldav>appinfo/remote.php</caldav>
+       </remote>
+       <public>
+               <calendar>share.php</calendar>
+               <caldav>share.php</caldav>
+       </public>
 </info>
index 1d71ef97443918d538e8188167c94d7bbafaf753..e6adf3fc7bb711e3d88c13f2bb5e1b91f865d361 100644 (file)
@@ -1 +1 @@
-0.3
\ No newline at end of file
+0.4
\ No newline at end of file
index 7e196733064ddab8337f37498cbb4424125d2bba..e5e1d572f2dde32d9b3da4aa5c4c13cb0b43e112 100755 (executable)
@@ -25,4 +25,3 @@ OCP\App::addNavigationEntry( array(
 OCP\App::registerPersonal('contacts','settings');
 OCP\Util::addscript('contacts', 'loader');
 OC_Search::registerProvider('OC_Search_Provider_Contacts');
-OCP\CONFIG::setAppValue('core', 'remote_carddav', '/apps/contacts/appinfo/remote.php');
\ No newline at end of file
index 4d2fe383723f274dd58149c1d71794095fa03b02..86692d65b4ff2a9af8dace4ded0418273be95e13 100644 (file)
@@ -8,4 +8,8 @@
        <description>Address book with CardDAV support.</description>
        <standalone/>
        <default_enable/>
+       <remote>
+               <contacts>appinfo/remote.php</contacts>
+               <carddav>appinfo/remote.php</carddav>
+       </remote>
 </info>
index ceab6e11ece0bcec917c12e11d350946f085d549..2f4536184bcac31936bd15a5f9cf931dd526c022 100644 (file)
@@ -1 +1 @@
-0.1
\ No newline at end of file
+0.2
\ No newline at end of file
index e7358242ddbfaa896e128f3dbd3495337f255672..5c0d3c8db83c3a2903a8ce5fa96005cdc114005d 100755 (executable)
@@ -7,4 +7,3 @@ OCP\App::registerAdmin('files','admin');
 OCP\App::addNavigationEntry( array( "id" => "files_index", "order" => 0, "href" => OCP\Util::linkTo( "files", "index.php" ), "icon" => OCP\Util::imagePath( "core", "places/home.svg" ), "name" => $l->t("Files") ));
 
 OC_Search::registerProvider('OC_Search_Provider_File');
-OCP\CONFIG::setAppValue('core', 'remote_webdav', '/apps/files/appinfo/remote.php');
\ No newline at end of file
index 03076dee98cb0ae8d37677df39b8b699be3750c8..76a06a0cb4bd8179cdc8921b6d4e43317e2bc2d8 100644 (file)
@@ -8,4 +8,8 @@
        <require>2</require>
        <standalone/>
        <default_enable/>
+       <remote>
+               <files>appinfo/remote.php</files>
+               <webdav>appinfo/remote.php</webdav>
+       </remote>
 </info>
index 9f8e9b69a33f4e8067d5b21661a35d8856758aba..b123147e2a162f34cf377f8b63d99b0e6f8887c2 100644 (file)
@@ -1 +1 @@
-1.0
\ No newline at end of file
+1.1
\ No newline at end of file
diff --git a/apps/files_encryption/tests/proxy.php b/apps/files_encryption/tests/proxy.php
new file mode 100644 (file)
index 0000000..0450de8
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+class Test_CryptProxy extends UnitTestCase {
+       
+       public function setUp(){
+               //set testing key
+               $_SESSION['enckey']=md5(time());
+       
+               //clear all proxies and hooks so we can do clean testing
+               OC_FileProxy::clearProxies();
+               OC_Hook::clear('OC_Filesystem');
+
+               //enable only the encryption hook
+               OC_FileProxy::register(new OC_FileProxy_Encryption());
+
+               //set up temporary storage
+               OC_Filesystem::clearMounts();
+               OC_Filesystem::mount('OC_Filestorage_Temporary',array(),'/');
+
+               //set up the users home folder in the temp storage
+               $rootView=new OC_FilesystemView('');
+               $rootView->mkdir('/'.OC_User::getUser());
+               $rootView->mkdir('/'.OC_User::getUser().'/files');
+       }
+
+       public function testSimple(){
+               $file=OC::$SERVERROOT.'/3rdparty/MDB2.php';
+               $original=file_get_contents($file);
+
+               OC_Filesystem::file_put_contents('/file',$original);
+               
+               OC_FileProxy::$enabled=false;
+               $stored=OC_Filesystem::file_get_contents('/file');
+               OC_FileProxy::$enabled=true;
+               
+               $fromFile=OC_Filesystem::file_get_contents('/file');
+               $this->assertNotEqual($original,$stored);
+               $this->assertEqual($original,$fromFile);
+       }
+}
index 333b1581ce102171d3f31a20b0e5cda3aafaf810..878da48698ae87ca644fe509041b507e63102eca 100755 (executable)
@@ -56,5 +56,3 @@ class OC_GallerySearchProvider extends OC_Search_Provider{
 OC_Search::registerProvider('OC_GallerySearchProvider');
 
 require_once('apps/gallery/lib/hooks_handlers.php');
-OCP\CONFIG::setAppValue('core', 'public_gallery', '/apps/gallery/sharing.php');
-?>
index 5b5ee0f731b75b0d490269a42731be93e19f245f..43a22bae077058a497fff57918686a61d5555c6a 100644 (file)
@@ -8,4 +8,7 @@
        <description>Dedicated pictures application</description>
        <standalone/>
        <default_enable/>
+       <public>
+               <gallery>sharing.php</gallery>
+       </public>
 </info>
index 267577d47e497a0630bc454b3f74c4fd9a10ced4..2b7c5ae01848a77d95e2792eb83ab605c9aed91a 100644 (file)
@@ -1 +1 @@
-0.4.1
+0.4.2
index 332b73546ec4cb5675326ff3709302302c4de69b..26cb2045549882e6dd630f2d36390d462950dfd2 100755 (executable)
@@ -32,5 +32,3 @@ OCP\App::register( array( 'order' => 3, 'id' => 'media', 'name' => 'Media' ));
 OCP\App::addNavigationEntry(array('id' => 'media_index', 'order' => 2, 'href' => OCP\Util::linkTo('media', 'index.php'), 'icon' => OCP\Util::imagePath('core', 'places/music.svg'), 'name' => $l->t('Music')));
 
 OC_Search::registerProvider('OC_MediaSearchProvider');
-OCP\CONFIG::setAppValue('core', 'remote_ampache', '/apps/media/remote.php');
-OCP\CONFIG::setAppValue('core', 'remote_tomahawk', '/apps/media/tomahawk.php');
index ea5b77c9c8ff21d166af44d07df0c73216c82404..b0f205f8b1dbd44e74bade67c8778ae525ee18f6 100644 (file)
@@ -8,4 +8,7 @@
        <require>2</require>
        <standalone/>
        <default_enable/>
+       <remote>
+               <ampache>remote.php</ampache>
+       </remote>
 </info>
index 1d71ef97443918d538e8188167c94d7bbafaf753..e6adf3fc7bb711e3d88c13f2bb5e1b91f865d361 100644 (file)
@@ -1 +1 @@
-0.3
\ No newline at end of file
+0.4
\ No newline at end of file
diff --git a/apps/media/tomahawk.php b/apps/media/tomahawk.php
deleted file mode 100755 (executable)
index c74d168..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-
-/**
-* ownCloud - media plugin
-*
-* @author Robin Appelman
-* @copyright 2010 Robin Appelman icewind1991@gmail.com
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
-*
-*/
-
-$_POST=$_GET; //debug
-
-OCP\JSON::checkAppEnabled('media');
-require_once(OC::$APPSROOT . '/apps/media/lib_collection.php');
-
-$user=isset($_POST['user'])?$_POST['user']:'';
-$pass=isset($_POST['pass'])?$_POST['pass']:'';
-if(OCP\User::checkPassword($user,$pass)){
-       OC_Util::setupFS($user);
-       OC_MEDIA_COLLECTION::$uid=$user;
-}else{
-       exit;
-}
-
-if(isset($_POST['play']) and $_POST['play']=='true'){
-       if(!isset($_POST['song'])){
-               exit;
-       }
-       $song=OC_MEDIA_COLLECTION::getSong($_POST['song']);
-       $ftype=OC_Filesystem::getMimeType( $song['song_path'] );
-       header('Content-Type:'.$ftype);
-       OCP\Response::disableCaching();
-       header('Content-Length: '.OC_Filesystem::filesize($song['song_path']));
-
-       OC_Filesystem::readfile($song['song_path']);
-}
-
-$artist=isset($_POST['artist'])?'%'.$_POST['artist'].'%':'';
-$album=isset($_POST['album'])?'%'.$_POST['album'].'%':'';
-$song=isset($_POST['song'])?$_POST['song']:'';
-
-$artist=OC_MEDIA_COLLECTION::getArtistId($artist);
-$album=OC_MEDIA_COLLECTION::getAlbumId($album,$artist);
-
-$songs=OC_MEDIA_COLLECTION::getSongs($artist,$album,$song);
-
-$baseUrl=$baseuri;
-
-$results=array();
-foreach($songs as $song) {
-       $results[] = (Object) array(
-               'artist' => OC_MEDIA_COLLECTION::getArtistName($song['song_artist']),
-               'album' => OC_MEDIA_COLLECTION::getAlbumName($song['song_album']),
-               'track' => $song['song_name'],
-               'source' => 'ownCloud',
-               'mimetype' => OC_Filesystem::getMimeType($song['song_path']),
-               'extension' => substr($song['song_path'],strrpos($song['song_path'],'.')),
-               'url' => $baseUrl.'?play=true&song='.$song['song_id'],
-               'bitrate' => round($song['song_id']/$song['song_length'],0),
-               'duration' => round($song['song_length'],0),
-               'size' => $song['song_size'],
-               'score' => (float)1.0
-       );
-}
-OCP\JSON::encodedPrint($results);
index f274194b25cab8457c6018eabb8cbe3ccb5a2ca5..bc4f9c87e96759a8300127bd7950b3d976b20204 100644 (file)
@@ -110,9 +110,9 @@ class OC_App{
                if(!isset(self::$appTypes[$app])){
                        $appData=self::getAppInfo($app);
                        if(isset($appData['types'])){
-                               self::$appTypes[$app]=$appData['types'];
+                               self::$appTypes[$app]=implode(',',$appData['types']);
                        }else{
-                               self::$appTypes[$app]=array();
+                               self::$appTypes[$app]='';
                        }
 
                        OC_Appconfig::setValue($app,'types',implode(',',self::$appTypes[$app]));
@@ -367,8 +367,18 @@ class OC_App{
                }
                $xml = new SimpleXMLElement($content);
                $data['info']=array();
+               $data['remote']=array();
+               $data['public']=array();
                foreach($xml->children() as $child){
-                       if($child->getName()=='types'){
+                       if($child->getName()=='remote'){
+                               foreach($child->children() as $remote){
+                                       $data['remote'][$remote->getName()]=(string)$remote;
+                               }
+                       }elseif($child->getName()=='public'){
+                               foreach($child->children() as $public){
+                                       $data['public'][$public->getName()]=(string)$public;
+                               }
+                       }elseif($child->getName()=='types'){
                                $data['types']=array();
                                foreach($child->children() as $type){
                                        $data['types'][]=$type->getName();
@@ -476,12 +486,16 @@ class OC_App{
        public static function updateApps(){
                // The rest comes here
                $versions = self::getAppVersions();
+               //ensure files app is installed for upgrades
+               if(!isset($versions['files'])){
+                       $versions['files']='0';
+               }
                foreach( $versions as $app=>$installedVersion ){
                        $currentVersion=OC_App::getAppVersion($app);
                        if ($currentVersion) {
                                if (version_compare($currentVersion, $installedVersion, '>')) {
                                        OC_App::updateApp($app);
-          OC_Appconfig::setValue($app,'installed_version',OC_App::getAppVersion($app));
+                                       OC_Appconfig::setValue($app,'installed_version',OC_App::getAppVersion($app));
                                }
                        }
                }
@@ -511,6 +525,15 @@ class OC_App{
                if(file_exists(OC::$APPSROOT.'/apps/'.$appid.'/appinfo/update.php')){
                        include OC::$APPSROOT.'/apps/'.$appid.'/appinfo/update.php';
                }
+
+               //set remote/public handelers
+               $appData=self::getAppInfo($appid);
+               foreach($appData['remote'] as $name=>$path){
+                       OCP\CONFIG::setAppValue('core', 'remote_'.$name, '/apps/'.$appid.'/'.$path);
+               }
+               foreach($appData['public'] as $name=>$path){
+                       OCP\CONFIG::setAppValue('core', 'public_'.$name, '/apps/'.$appid.'/'.$path);
+               }
        }
 
        /**