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

archive.php

Blame
  • migrate.php 21.32 KiB
    <?php
    /**
     * ownCloud
     *
     * @author Tom Needham
     * @copyright 2012 Tom Needham tom@owncloud.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 Affero General Public
     * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
     *
     */
    
    
    /**
     * provides an interface to migrate users and whole ownclouds
     */
    class OC_Migrate{
    
    
    	// Array of OC_Migration_Provider objects
    	static private $providers=array();
    	// User id of the user to import/export
    	static private $uid=false;
    	// Holds the ZipArchive object
    	static private $zip=false;
    	// Stores the type of export
    	static private $exporttype=false;
    	// Array of temp files to be deleted after zip creation
    	static private $tmpfiles=array();
    	// Holds the db object
    	static private $MDB2=false;
    	// Schema db object
    	static private $schema=false;
    	// Path to the sqlite db
    	static private $dbpath=false;
    	// Holds the path to the zip file
    	static private $zippath=false;
    	// Holds the OC_Migration_Content object
    	static private $content=false;
    
    	/**
    	 * register a new migration provider
    	 * @param OC_Migrate_Provider $provider
    	 */
    	public static function registerProvider($provider){
    		self::$providers[]=$provider;
    	}
    
    	/**
    	* @brief finds and loads the providers
    	*/
    	static private function findProviders(){
    		// Find the providers
    		$apps = OC_App::getAllApps();
    
    		foreach($apps as $app){
    			$path = OC_App::getAppPath($app) . '/appinfo/migrate.php';
    			if( file_exists( $path ) ){
    				include( $path );
    			}