diff options
author | Robin Appelman <icewind1991@gmail.com> | 2010-07-28 22:45:24 +0200 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2010-07-28 22:45:24 +0200 |
commit | 2a782097284950e85876e74c2eecd868e6795335 (patch) | |
tree | 6d483ae16fe505fe00a7fab93dd0f6b5dd1d2948 | |
parent | 98e49c7552815f41c7e13ca282eb053b544a9fed (diff) | |
download | nextcloud-server-2a782097284950e85876e74c2eecd868e6795335.tar.gz nextcloud-server-2a782097284950e85876e74c2eecd868e6795335.zip |
comply with updated version of the plugin.xml syntax
-rw-r--r-- | inc/lib_base.php | 9 | ||||
-rw-r--r-- | inc/lib_plugin.php | 23 | ||||
-rw-r--r-- | inc/templates/footer.php | 4 | ||||
-rw-r--r-- | plugins/ldap/plugin.xml | 11 | ||||
-rw-r--r-- | plugins/music/plugin.xml | 7 | ||||
-rw-r--r-- | plugins/test/plugin.xml | 7 |
6 files changed, 50 insertions, 11 deletions
diff --git a/inc/lib_base.php b/inc/lib_base.php index 521694bf53f..49dfaf811c1 100644 --- a/inc/lib_base.php +++ b/inc/lib_base.php @@ -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; } @@ -129,6 +130,14 @@ 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 * * @param url $url diff --git a/inc/lib_plugin.php b/inc/lib_plugin.php index 178179a05e0..6c63139b747 100644 --- a/inc/lib_plugin.php +++ b/inc/lib_plugin.php @@ -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; diff --git a/inc/templates/footer.php b/inc/templates/footer.php index 47bebd27e02..b82e87777a6 100644 --- a/inc/templates/footer.php +++ b/inc/templates/footer.php @@ -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> diff --git a/plugins/ldap/plugin.xml b/plugins/ldap/plugin.xml index c58ac4dd3d0..2127d13e08d 100644 --- a/plugins/ldap/plugin.xml +++ b/plugins/ldap/plugin.xml @@ -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 diff --git a/plugins/music/plugin.xml b/plugins/music/plugin.xml index 5377e439ae7..bac4f5e8e22 100644 --- a/plugins/music/plugin.xml +++ b/plugins/music/plugin.xml @@ -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> diff --git a/plugins/test/plugin.xml b/plugins/test/plugin.xml index 5f510f2c38f..b666b5bc53c 100644 --- a/plugins/test/plugin.xml +++ b/plugins/test/plugin.xml @@ -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> |