comply with updated version of the plugin.xml syntax
This commit is contained in:
parent
98e49c7552
commit
2a78209728
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
<require>1.1</require>
|
||||
</info>
|
||||
<runtime>
|
||||
<include>lib_ldap.php</include>
|
||||
</runtime>
|
||||
</plugin>
|
|
@ -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>
|
||||
<runtime>
|
||||
<include>lib_music.php</include>
|
||||
</runtime>
|
||||
</plugin>
|
||||
|
|
|
@ -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>
|
||||
<runtime>
|
||||
<include>lib_test.php</include>
|
||||
</runtime>
|
||||
</plugin>
|
||||
|
||||
|
|
Loading…
Reference in New Issue