Skip to content
Snippets Groups Projects
Select Git revision
  • 6787774a32ccb15b1375aca63f4cc61d16868d50
  • master default protected
2 results

db_structure.xml

Blame
  • plugin.php 10.84 KiB
    <?php
    
    /**
    * ownCloud
    *
    * @author Frank Karlitschek
    * @copyright 2010 Frank Karlitschek karlitschek@kde.org
    *
    * 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 Affero General Public
    * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
    *
    */
    
    class OC_PLUGIN{
    	static private $blacklist=array();
    
    	/**
    	* load the plugin with the given id
    	* @param string id
    	* @return bool
    	*/
    	static public function load($id){
    		global $SERVERROOT;
    		$data=self::getPluginData($id);
    		if($data){
    			if(isset($data['info']['require'])){
    				$minVersion=explode('.',$data['info']['require']);
    				$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;
    					}
    				}
    			}
    			//check for uninstalled db's
    			if(isset($data['install']) and isset($data['install']['database'])){
    				foreach($data['install']['database'] as $db){
    					$installed=OC_APPCONFIG::getValue('plugin_installer','database_installed_'.$id.'_'.$db,'false');
    					if($installed!='true'){
    						self::installDB($id);
    						break;
    					}
    				}
    			}
    
    			if(isset($data['runtime'])){
    				foreach($data['runtime'] as $include){
    					include($SERVERROOT.'/plugins/'.$id.'/'.$include);
    				}
    			}
    		}
    		return false;
    	}