/**
  * Import site
  *
  * @return StorageFile
  */
 public function import()
 {
     global $wp_version;
     $storage = StorageArea::getInstance();
     // Create import file
     $import_file = $storage->makeFile($this->options['import']['file']);
     // Extract archive
     try {
         try {
             $zip = ZipFactory::makeZipArchiver($import_file->getName(), !class_exists('ZipArchive'));
             $zip->extractTo($storage->getRootPath());
             $zip->close();
         } catch (Exception $e) {
             $zip = ZipFactory::makeZipArchiver($import_file->getName(), true);
             $zip->extractTo($storage->getRootPath());
             $zip->close();
         }
     } catch (Exception $e) {
         throw new Ai1wm_Import_Exception(_('Site could not be imported!<br />' . 'Archive file is broken or is not compatible with the plugin! Please verify your archive file.'));
     }
     // Verify package
     if ($this->should_import_package()) {
         // Enable maintenance mode
         Ai1wm_Maintenance::enable();
         // Database
         if ($this->should_import_database()) {
             $service = new Ai1wm_Service_Database($this->options);
             $service->import();
         }
         // Media
         if ($this->should_import_media()) {
             $service = new Ai1wm_Service_Media($this->options);
             $service->import();
         }
         // Sites (Network mode)
         if ($this->should_import_sites()) {
             $service = new Ai1wm_Service_Sites($this->options);
             $service->import();
         }
         // Themes
         if ($this->should_import_themes()) {
             $service = new Ai1wm_Service_Themes($this->options);
             $service->import();
         }
         // Plugins
         if ($this->should_import_plugins()) {
             $service = new Ai1wm_Service_Plugins($this->options);
             $service->import();
         }
         // Disable maintenance mode
         Ai1wm_Maintenance::disable();
     } else {
         throw new Ai1wm_Import_Exception(_('Site could not be imported!<br />' . 'Archive file is not compatible with the plugin! Please verify your archive file.'));
     }
     return $import_file;
 }
 /**
  * Add database
  *
  * @return void
  */
 public function database()
 {
     // Set exclude database
     if (!is_file($this->storage()->database())) {
         return $this->route_to('finish');
     }
     // Display progress
     Ai1wm_Status::set(array('message' => __('Restoring database...', AI1WM_PLUGIN_NAME)));
     // Get database file
     $service = new Ai1wm_Service_Database($this->args);
     $service->import();
     // Redirect
     $this->route_to('finish');
 }