Import all the files that were created with the skydrive repo to this repo.

@return bool
431086
public static function import_skydrive_files() {
        global $DB;

        if (!self::can_import_skydrive_files()) {
            return false;
        }
        // Should only be one of each.
        $skydrivetype = repository::get_type_by_typename('skydrive');

        $skydriveinstances = repository::get_instances(['type' => 'skydrive']);
        $skydriveinstance = reset($skydriveinstances);
        $onedriveinstances = repository::get_instances(['type' => 'onedrive']);
        $onedriveinstance = reset($onedriveinstances);

        // Update all file references.
        $DB->set_field('files_reference', 'repositoryid', $onedriveinstance->id, ['repositoryid' => $skydriveinstance->id]);

        // Delete and disable the skydrive repo.
        $skydrivetype->delete();
        core_plugin_manager::reset_caches();

        $sql = "SELECT count('x')
                  FROM {repository_instances} i, {repository} r
                 WHERE r.type=:plugin AND r.id=i.typeid";
        $params = array('plugin' => 'skydrive');
        return $DB->count_records_sql($sql, $params) == 0;
    }
778175
protected function copyFiles()
    {
        $skeletonFinder = new SkeletonFinder($this->lookupPaths);
        $sourcePath = $skeletonFinder->findByName($this->skeletonName)->getRealpath();

        $finder = $this->getFinderForFilesToCopy($sourcePath);

        foreach ($finder as $file) {
            $targetFilePath = $this->targetPath.DIRECTORY_SEPARATOR.$file->getRelativePathname();
            $targetFilePath = $this->twigStringRenderer->renderToString($targetFilePath, $this->data);

            $this->fs->copy($file->getRealpath(), $targetFilePath, $this->overwriteEnabled);

            $msg = '[copy] '.$file->getRealpath().' => '.$targetFilePath;

            if ($this->reportingEnabled) {
                $this->report[] = $msg;
            }
        }
    }
522299
public function importLocal() {
    $project_properties = $this->getProjectProperties();

    $drush_commands    = [
      'drush_import_database' => 'zcat < ../vendor/database.sql.gz | drush @self sqlc # Importing local copy of db.'
    ];
    $database_import = $this->taskExec(implode(' && ', $drush_commands))->dir($project_properties['web_root'])->run();

    if ($database_import->wasSuccessful()) {
      return TRUE;
    }
    else {
      $this->yell('Could not read vendor/database.sql.gz into your local database. See if the command "zcat < vendor/database.sql.gz | drush @self sqlc" works outside of robo.');
      return FALSE;
    }
  }
478080
private function importMigrations()
	{
		$databaseFolder = base_path( 'resources/database/migrations/' );
		if( ! file_exists( $databaseFolder ) ) {
			return $this->line( 'no migrations to move' );
		}
		$this->moveFilesToDatabaseMigrations( $databaseFolder );
	}
295265
protected function importMediaImages() {
    $data = $this->loadDataArray('media_image');
    if (!empty($data)) {

      $uuids = [];

      foreach ($data as $item) {

        // Prepare content.
        $values = [
          'bundle' => $item['bundle'],
          'name' => $item['name'],
        ];

        $file = $this->saveFile($item['file']);

        if (!empty($file) && $file instanceof File) {
          $values['field_media_image'] = [
            'target_id' => $file->id(),
            'alt' => $item['alt'],
          ];
        }

        // Set author.
        $values['uid'] = 1;

        // Create Media.
        $entity = $this->entityTypeManager->getStorage('media')->create($values);
        $entity->save();
        $uuids[$entity->uuid()] = 'media';
      }
      $this->storeCreatedContentUuids($uuids);
    }
    return $this;
  }
1195526
public function getFiles()
    {
        $finders = [
            MainConfigurationFinder::class,
            ContextualConfigurationFinder::class,
            PluginsConfigurationFinder::class,
        ];

        // Filter out non-existing folders
        $folders = $this->getFolders();
        if (!$folders) {
            return [];
        }

        $files = [];
        foreach ($folders as $folder) {
            foreach ($finders as $finder) {
                /** @var AbstractConfigurationFinder $finder */
                $finder = new $finder($this->files, $folder);
                $files = array_merge($files, $finder->getFiles());
            }
        }

        // Load consolidated configuration
        $folder = $this->paths->getRocketeerPath();
        if ($this->files->has($folder)) {
            $consolidated = new ConsolidatedConfigurationFinder($this->files, $folder);
            $files = array_merge($files, $consolidated->getFiles());
        }

        return $files;
    }
661414
public static function import()
    {
        $extension = static::getInstance();

        if ($menu = $extension->menu()) {
            if ($extension->validateMenu($menu)) {
                extract($menu);
                static::createMenu($title, $path, $icon);
            }
        }

        if ($permission = $extension->permission()) {
            if ($extension->validatePermission($permission)) {
                extract($permission);
                static::createPermission($name, $slug, $path);
            }
        }
    }
531442
private function key_import()
    {
        // Import process
        if ($data = rcube_utils::get_input_value('_keys', rcube_utils::INPUT_POST)) {
            $this->enigma->load_engine();
            $this->enigma->engine->password_handler();

            $result = $this->enigma->engine->import_key($data);

            if (is_array($result)) {
                if (rcube_utils::get_input_value('_generated', rcube_utils::INPUT_POST)) {
                    $this->rc->output->command('enigma_key_create_success');
                    $this->rc->output->show_message('enigma.keygeneratesuccess', 'confirmation');
                }
                else {
                    $this->rc->output->show_message('enigma.keysimportsuccess', 'confirmation',
                        array('new' => $result['imported'], 'old' => $result['unchanged']));

                    if ($result['imported'] && !empty($_POST['_refresh'])) {
                        $this->rc->output->command('enigma_list', 1, false);
                    }
                }
            }
            else {
                $this->rc->output->show_message('enigma.keysimportfailed', 'error');
            }

            $this->rc->output->send();
        }
        else if ($_FILES['_file']['tmp_name'] && is_uploaded_file($_FILES['_file']['tmp_name'])) {
            $this->enigma->load_engine();
            $result = $this->enigma->engine->import_key($_FILES['_file']['tmp_name'], true);

            if (is_array($result)) {
                // reload list if any keys has been added
                if ($result['imported']) {
                    $this->rc->output->command('parent.enigma_list', 1);
                }
                else {
                    $this->rc->output->command('parent.enigma_loadframe');
                }

                $this->rc->output->show_message('enigma.keysimportsuccess', 'confirmation',
                    array('new' => $result['imported'], 'old' => $result['unchanged']));
            }
            else if ($result instanceof enigma_error && $result->getCode() == enigma_error::BADPASS) {
                $this->password_prompt($result);
            }
            else {
                $this->rc->output->show_message('enigma.keysimportfailed', 'error');
            }

            $this->rc->output->send('iframe');
        }
        else if ($err = $_FILES['_file']['error']) {
            if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) {
                $this->rc->output->show_message('filesizeerror', 'error',
                    array('size' => $this->rc->show_bytes(rcube_utils::max_upload_size())));
            } else {
                $this->rc->output->show_message('fileuploaderror', 'error');
            }

            $this->rc->output->send('iframe');
        }

        $this->rc->output->add_handlers(array(
            'importform' => array($this, 'tpl_key_import_form'),
        ));

        $this->rc->output->set_pagetitle($this->enigma->gettext('keyimport'));
        $this->rc->output->send('enigma.keyimport');
    }
770723
public function enaArchiveFiles()
    {
        $properties = $this->getProperties();
        $extString  = (!empty($properties['acceptedFiles'])) ? $properties['acceptedFiles'] : '';
        $archExts   = $this->getArchiveExtensionConstant();
        foreach ($archExts as $archExt) {
            if (strpos($extString, $archExt) === false) {
                $extString .= ','.$archExt;
            }
        }
        $extString                      = substr($extString, 1);
        $properties                     = $this->getProperties();
        $properties['acceptedFiles']    = $extString;
        $this->setProperties($properties);
        return $this;
    }
81101
public function import() {
    $strategy = $this->getConfigValue('cm.strategy');

    if ($strategy != 'none') {
      $cm_core_key = $this->getConfigValue('cm.core.key');
      $this->logConfig($this->getConfigValue('cm'), 'cm');
      $task = $this->taskDrush();

      $this->invokeHook('pre-config-import');

      // If using core-only or config-split strategies, first check to see if
      // required config is exported.
      if (in_array($strategy, ['core-only', 'config-split'])) {
        $core_config_file = $this->getConfigValue('docroot') . '/' . $this->getConfigValue("cm.core.dirs.$cm_core_key.path") . '/core.extension.yml';

        if (!file_exists($core_config_file)) {
          $this->logger->warning("BLT will NOT import configuration, $core_config_file was not found.");
          // This is not considered a failure.
          return 0;
        }
      }

      // If exported site UUID does not match site active site UUID, set active
      // to equal exported.
      // @see https://www.drupal.org/project/drupal/issues/1613424
      $exported_site_uuid = $this->getExportedSiteUuid($cm_core_key);
      if ($exported_site_uuid) {
        $task->drush("config:set system.site uuid $exported_site_uuid");
      }

      switch ($strategy) {
        case 'core-only':
          $this->importCoreOnly($task, $cm_core_key);
          break;

        case 'config-split':
          $this->importConfigSplit($task, $cm_core_key);
          break;

        case 'features':
          $this->importFeatures($task, $cm_core_key);

          if ($this->getConfigValue('cm.features.no-overrides')) {
            // @codingStandardsIgnoreLine
            $this->checkFeaturesOverrides();
          }
          break;
      }

      $task->drush("cache-rebuild");
      $result = $task->run();
      if (!$result->wasSuccessful()) {
        throw new BltException("Failed to import configuration!");
      }

      $this->checkConfigOverrides($cm_core_key);

      $result = $this->invokeHook('post-config-import');

      return $result;
    }
  }
84819
public function actionImport()
    {
        // Load posted json data into a variable.
        $importData = Craft::$app->request->getBodyParam('importData');

        $updateExisting = (bool) Craft::$app->request->getBodyParam('updateExisting');

        list($parseError, $noErrors, $backup, $results) = Architect::$plugin->architectService->import($importData, false, $updateExisting);

        if ($parseError) {
            $this->renderTemplate('architect/import', [
                'invalidJSON' => $results[0],
                'invalidYAML' => $results[1],
                'updateExisting' => $updateExisting,
                'importData' => $importData,
            ]);
            return;
        }

        $this->renderTemplate('architect/import_results', [
            'noErrors' => $noErrors,
            'backupLocation' => $backup,
            'results' => $results,
            'updateExisting' => $updateExisting,
            'importData' => $importData,
        ]);
    }
1209143
public function complete()
    {
        $filesystem      = new Filesystem();
        $templatesFolder = $this->getConfigKey('Folders', 'templates');
        $finder          = new Finder();
        foreach ($finder->files()->in($templatesFolder) as $file) {
            $from = $file->getPathname();
            $to   = $this->getTargetPath($from);
            $filesystem->ensureDirectoryExists(dirname($to));
            $filesystem->copyThenRemove($from, $to);
        }
    }
162986
public function save()
    {
        if ($this->dirty)
        {
            $path = $this->manifestPath.'/collections.json';

            $this->dirty = false;

            return (bool) $this->files->put($path, $this->entries->toJson());
        }

        return false;
    }
745320
public function importWikiTxtFiles()
    {
        $options          = $this->getOptions();
        $mapper           = $this->getMapper();
        $serviceLocator   = $this->getServiceLocator();
        $categoryMapper   = $serviceLocator->get('dlccategory_category_mapper');
        $categoryMap      = array();
        $priorityService  = $serviceLocator->get('dlcusecase_priority_service');
        $priorityMap      = array();
        $typeService      = $serviceLocator->get('dlcusecase_type_service');
        $typeMap          = array();
        $entityClass      = $mapper->getEntityClass();
        $depClass         = $options->getDependencyEntityClass();
        $objectManager    = $mapper->getObjectManager();
        $simpleProperties = $objectManager->getClassMetadata($entityClass)
                                          ->getFieldNames();

        $categoryService  = $serviceLocator->get('dlccategory_category_service');
        $rootCategoryNode = $categoryService->getRootCategoryNode($options->getRootCategoryId());

        //Drop existing use cases before importing new use cases?
        if ($options->getDropUseCasesBeforeImport()) {
            $this->deleteAll();
        }

        $dir = $options->getUseCaseDokuWikiTxtFilesDir();

        $dokuWikiUrl      = $options->getDokuWikiUrl();
        $dokuWikiIdPrefix = $options->getDokuWikiIdPrefix();

        $excludeFilenames = $options->getExcludeFilenamesFromImport();

        $txtPositions = $options->getTxtImportPositions();

        $entityMap    = array();
        $dependencies = array();

        $objects = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir), \RecursiveIteratorIterator::SELF_FIRST);
        foreach ($objects as $name => $object) {
            if ($object->isFile() && $object->getExtension() == 'txt' && !in_array($object->getFilename(), $excludeFilenames)) {

                $entity = new $entityClass();

                $dokuWikiId = $dokuWikiIdPrefix . str_replace('/', ':', substr($name, strlen($dir), -4));

                $entityMap[$dokuWikiId] = $entity;

                $dokuWikiLink = $dokuWikiUrl . '?id=' . $dokuWikiId;

                $entity->setLink($dokuWikiLink);

                $contents = file_get_contents($name);

                foreach ($txtPositions as $property => $positions) {
                    //Start position
                    $start = strpos($contents, $positions['start']) + strlen($positions['start']);
                    //End position
                    if (null === $positions['end']) {
                        $end = strlen($contents);
                    } else {
                        $end = strpos($contents, $positions['end'])-$start;
                    }

                    $value = substr($contents, $start, $end);

                    if (isset($positions['replace']) && is_array($positions['replace'])) {
                        $value = str_replace($positions['replace']['search'], $positions['replace']['replace'], $value);
                    }

                    if (isset($positions['trim']) && $positions['trim'] === true) {
                        $value = trim($value);
                    }

                    if (in_array($property, $simpleProperties)) {
                        $entity->$property = $value;
                    } elseif ($property == 'type') {
                        if (!array_key_exists($value, $typeMap)) {
                            $typeMap[$value] = $typeService->findOneByName($value);
                        }
                        $entity->setType($typeMap[$value]);
                    } elseif ($property == 'category') {
                        if (!array_key_exists($value, $categoryMap)) {
                            $categoryMap[$value] = $categoryMapper->findOneByTitle($value);

                            //If no categpry was found
                            if (null === $categoryMap[$value]) {
                                //Create new category
                                $category = new \DlcCategory\Entity\Category();
                                $category->setName(strtolower($value))
                                         ->setTitle($value)
                                         ->setDescription('Desc of ' . $value)
                                         ->setThumbnail('/img/no_thumbnail.png');

                                $categoryNode = $rootCategoryNode->addChild($category);

                                $categoryMap[$value] = $category;
                            }
                        }
                        $entity->setCategory($categoryMap[$value]);
                    } elseif ($property == 'priority') {
                        if (strlen($value) < 1) {
                            $value = 'Normal';
                        }
                        if (!array_key_exists($value, $priorityMap)) {
                            $priorityMap[$value] = $priorityService->findOneByName($value);
                        }
                        $entity->setPriority($priorityMap[$value]);
                    } elseif ($property == 'dependencies') {
                        if (preg_match_all('/[a-zA-Z0-9\-\_\:äöüÄÖÜ\ ]+/', $value, $matches)) {
                            $dependencies[$dokuWikiId] = $matches[0];
                        } else {
                            $dependencies[$dokuWikiId] = array();
                        }

                    } else {
                        \Zend\Debug\Debug::dump($value, $property);
                    }
                }

                $objectManager->persist($entity);
            }

        }

        //Add all dependencies
        foreach ($dependencies as $wikiId => $dependencies) {
            if (isset($entityMap[$wikiId])) {
                foreach ($dependencies as $dependencyId) {
                    if (isset($entityMap[$dependencyId])) {
                        $dependency = new $depClass();
                        $dependency->from($entityMap[$wikiId])
                                   ->setType(Dependency::TYPE_ASSOCIATION)
                                   ->to($entityMap[$dependencyId]);

                        $entityMap[$wikiId]->addDependencies($dependency);
                    }
                }
            }
        }

        $objectManager->flush();
    }
351764
protected function set_include_files() {
        // We normally include files.
        $includefiles = true;

        // In an import, we don't need to include files.
        if ($this->get_mode() === backup::MODE_IMPORT) {
            $includefiles = false;
        }

        // When a backup is intended for the same site, we don't need to include the files.
        // Note, this setting is only used for duplication of an entire course.
        if ($this->get_mode() === backup::MODE_SAMESITE) {
            $includefiles = false;
        }

        $this->includefiles = (int) $includefiles;
        $this->log("setting file inclusion to {$this->includefiles}", backup::LOG_DEBUG);
        return $this->includefiles;
    }
1010599
protected function getAllSourceFiles()
	{
		$files = array_merge(
			glob_recursive('build/*.php'),
			glob_recursive('src/*.php'),
			glob_recursive('tests/*.php'),
			glob('*.php')
		);

		sort($files);

		return $files;
	}
712306
protected function importData()
    {
        if (($handle = fopen($this->file, "r")) !== false) {
            $header = fgetcsv($handle, 0, ',');
            $result = [];
            while (false !== ($row = fgetcsv($handle))) {
                $new = [];
                foreach ($header as $key => $value) {
                    $new[$value] = array_get($row, $key);
                }
                $result[] = $new;
                if (count($result) === 500) {
                    $this->insertTableData($result);
                }
            }

            if (count($result) > 0) {
                $this->insertTableData($result, false);
            }

            fclose($handle);
            unlink($this->file);
        } else {
            throw new InternalServerErrorException('Could not open uploaded CSV file.');
        }
    }