]> source.dussan.org Git - nextcloud-server.git/commitdiff
comply with updated version of the plugin.xml syntax
authorRobin Appelman <icewind1991@gmail.com>
Wed, 28 Jul 2010 20:45:24 +0000 (22:45 +0200)
committerRobin Appelman <icewind1991@gmail.com>
Wed, 28 Jul 2010 20:45:24 +0000 (22:45 +0200)
inc/lib_base.php
inc/lib_plugin.php
inc/templates/footer.php
plugins/ldap/plugin.xml
plugins/music/plugin.xml
plugins/test/plugin.xml

index 521694bf53f0f33dfd45b86c6b637c17d9b3bf40..49dfaf811c11235d5f34e1f0f8162db89c6dd057 100644 (file)
@@ -40,6 +40,7 @@ $SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen($SERVERROOT));
 $WEBROOT=substr($_SERVER["SCRIPT_NAME"],0,strlen($_SERVER["SCRIPT_NAME"])-strlen($SUBURI));
 
 
+
 if($WEBROOT!='' and $WEBROOT[0]!=='/'){
        $WEBROOT='/'.$WEBROOT;
 }
@@ -128,6 +129,14 @@ $loginresult=OC_USER::loginlisener();
 class OC_UTIL {
   public static $scripts=array();
   
+  /**
+  * get the current installed version of ownCloud
+  * @return array
+  */
+       public static function getVersion(){
+               return array(1,0,60);
+       }
+  
   /**
    * add a javascript file
    *
index 178179a05e0f4eae41e738ce9249e9337583551c..6c63139b747adf7a723845b2366577e691ad4a88 100644 (file)
@@ -34,9 +34,30 @@ class OC_PLUGIN{
                if(is_dir($SERVERROOT.'/plugins/'.$id) and is_file($SERVERROOT.'/plugins/'.$id.'/plugin.xml')){
                        $plugin=new DOMDocument();
                        $plugin->load($SERVERROOT.'/plugins/'.$id.'/plugin.xml');
+                       if($plugin->documentElement->getAttribute('version')!=='1.0'){ //we only support this for now
+                               return false;
+                       }
+                       $minVersion=$plugin->getElementsByTagName('require');
+                       if($minVersion->length>0){
+                               $minVersion=$minVersion->item(0)->textContent;
+                               $minVersion=explode('.',$minVersion);
+                               $version=OC_UTIL::getVersion();
+                               $roundTo=count($minVersion);
+                               while(count($version)>$roundTo){
+                                       if($version[count($version)-1]>=50){
+                                               $version[count($version)-2]++;
+                                       }
+                                       unset($version[count($version)-1]);
+                               }
+                               for($i=0;$i<count($minVersion);$i++){
+                                       if($version[$i]<$minVersion[$i]){
+                                               return false;
+                                       }
+                               }
+                       }
                        $pluginId=$plugin->getElementsByTagName('id')->item(0)->textContent;
                        if($pluginId==$id){//sanity check for plugins installed in the wrong folder
-                               $childs=$plugin->documentElement->childNodes;
+                               $childs=$plugin->getElementsByTagName('runtime')->item(0)->childNodes;
                                foreach($childs as $child){
                                        if($child->nodeType==XML_ELEMENT_NODE and $child->tagName=='include'){
                                                $file=$SERVERROOT.'/plugins/'.$id.'/'.$child->textContent;
index 47bebd27e02d4e2cb89b0a1c9c5719749f6c25dd..b82e87777a606a8b9295ca1850e11277f2db5693 100644 (file)
@@ -12,10 +12,10 @@ Hint: Mount it via webdav like this: <a href="webdav://<?php echo($_SERVER["HTTP
 <?php }?>
 <p class="footer">
 <?php
-  echo('<a href="http://ownCloud.org">ownCloud</a> - 1.0 RC 1');
+       $version=implode('.',OC_UTIL::getVersion());
+  echo('<a href="http://ownCloud.org">ownCloud</a> - '.$version);
 ?>
 </p>
 </div>
 </div>
-<!--<p id="debug">debug</p>-->
 </body></html>
index c58ac4dd3d0a072705996b4fedd386628ac962cb..2127d13e08df554d46f6a455097b3c4e1c82dff2 100644 (file)
@@ -1,11 +1,14 @@
 <?xml version="1.0"?> 
-<plugin>
-       <meta>
+<plugin version='1.0'>
+       <info>
                <id>ldap</id>
                <name>LDAP support for ownCloud</name>
                <version>0.1</version>
                <licence>AGPL</licence>
                <author>fabian</author>
-       </meta>
-       <include>lib_ldap.php</include>
+               <require>1.1</require>
+       </info>
+       <runtime>
+               <include>lib_ldap.php</include>
+       </runtime>
 </plugin>
\ No newline at end of file
index 5377e439ae7eaa3e562561197065bca389a843f4..bac4f5e8e223949c7e0971264ea1d27d812a60b2 100644 (file)
@@ -1,11 +1,14 @@
 <?xml version="1.0"?> 
-<plugin>
+<plugin version='1.0'>
        <meta>
                <id>music</id>
                <name>Music player for ownCloud</name>
                <version>0.1</version>
                <licence>AGPL</licence>
                <author>2010 Frank Karlitschek karlitschek@kde.org</author>
+               <require>1.1</require>
        </meta>
-       <include>lib_music.php</include>
+       <runtime>
+               <include>lib_music.php</include>
+       </runtime>
 </plugin> 
index 5f510f2c38f18bdd63fbc99007020fe89d94c8af..b666b5bc53c1095606648d216f3d15ab006f1d1a 100644 (file)
@@ -1,12 +1,15 @@
 <?xml version="1.0"?> 
-<plugin>
+<plugin version='1.0'>
        <meta>
                <id>test</id>
                <name>Test plugin</name>
                <version>0.1</version>
                <licence>AGPL</licence>
                <author>2010 Frank Karlitschek karlitschek@kde.org</author>
+               <require>1.1</require>
        </meta>
-       <include>lib_test.php</include>
+       <runtime>
+               <include>lib_test.php</include>
+       </runtime>
 </plugin>