Sync the requested folders and files.

@return bool
1542
public function syncSharedFolders()
    {
        $shared = (array) $this->config->getContextually('remote.shared');
        foreach ($shared as &$file) {
            $this->share($file);
        }

        return true;
    }
1046163
public function execute()
    {
        $successful = true;
        try {
            // Dump all databases
            $this->databaseManager->dump();

            // Backup folders if specified
            $this->logger->info('[dizda-backup] Copying folders.');
            $this->processorManager->copyFolders();

            // Compress everything
            $this->logger->info(sprintf('[dizda-backup] Compressing to archive using %s', $this->processorManager->getName()));
            $this->processorManager->compress();

            // Transfer with all clients
            $this->clientManager->upload($this->processorManager->getArchivePath());
        } catch (\Exception $e) {
            // Write log
            $this->logger->critical('[dizda-backup] Unexpected exception.', array('exception' => $e));

            $successful = false;
        }

        try {
            // If we catch an exception or not, we would still like to try cleaning up after us
            $this->logger->info('[dizda-backup] Cleaning up after us.');
            $this->processorManager->cleanUp();
        } catch (IOException $e) {
            $this->logger->error('[dizda-backup] Cleaning up failed.', array('exception' => $e));

            return false;
        }

        if ($successful) {
            $this->eventDispatcher->dispatch(BackupEvent::BACKUP_COMPLETED, new BackupEvent());
        }

        return $successful;
    }
142505
public function accept()
	{
		if( $this->isDot() )
			return FALSE;

		$isDir	= $this->isDir();
		if( !$this->showFiles && !$isDir )
			return FALSE;

		if( $this->stripDotEntries )
		{
			if( preg_match( "@^\.\w@", $this->getFilename() ) )
				return FALSE;
			$pathName	= str_replace( "\\", "/", "/".$this->getPath() );
			if( preg_match( "@/\.\w@", $pathName ) )
				return FALSE;
		}

		return preg_match( $this->pattern, $this->getFilename() );
	}
98029
private function load()
    {
        foreach ($this->filesystem->dates(true) as $date => $path) {
            $raw = $this->filesystem->read($date);
            $this->put($date, RequestLog::make($date, $path, $raw));
        }

        return $this;
    }
707271
private function sync_dir( $path_sync_from , $path_sync_to, $path_region ){
		print 'Copying files and directories...';
		$this->sync_dir_copy_r( $path_sync_from , $path_sync_to, $path_region );
		print "\n";
		print 'Deleting removed files and directories...';
		$this->sync_dir_compare_and_cleanup( $path_sync_to , $path_sync_from, $path_region );
		print "\n";
		return true;
	}
87447
private function syncFilesystemConfig()
    {
        foreach ($this->config()->get('arcanesoft.media.filesystem.disks', []) as $disk => $config) {
            $this->config()->set("filesystems.disks.$disk", $config);
        }
    }
388730
public function all()
	{
		$path = $this->directory;

		$data = array();

		$dirIterator = new \DirectoryIterator($path);
		foreach ($dirIterator as $folder)
		{
			if ($folder->isDot() || !$folder->isDir())
			{
				continue;
			}

			$name = $folder->getFilename();

			$item = new Auditor($name);

			$files = new \DirectoryIterator($path . DS . $name);
			foreach ($files as $file)
			{
				if ($folder->isDot() || $folder->isDir())
				{
					continue;
				}

				$item->tally(filesize($path . '/' . $name . '/' . $file->getFilename()) / 1024);
			}

			$data[$name] = $item;
		}

		return $data;
	}
1276857
protected function doExecute()
    {
        $folders = $this->io->getArguments();

        if (!count($folders)) {
            $this->clearCacheRoot();
        } else {
            foreach ($folders as $folder) {
                $this->clearCacheFolder($folder);
            }
        }

        $this->out('Cache cleared.');

        return true;
    }
70347
protected function preloadAllStorages()
    {

        if ($this->allStoragesLoaded) {
            return $this->storages;
        }

        $filesAndDirs = $this->filesystem->listDirectory($this->url, true, false);

        foreach ($filesAndDirs as $file) {

            if ($this->filesystem->extension($file) != $this->fileExtension()) {
                continue;
            }

            $this->getOrCreateStorage(new Url($file));

        }

        $this->allStoragesLoaded = true;

        return $this->storages;

    }
1102746
public function sync()
    {
        $actionMap = $this->Guardian->getActionMap();

        // check existance of all permission entries for each individual group
        /** @var Query $groups */
        $groups = $this->GroupPermissions->Groups->find('all')
            ->where(['Groups.id <>' => 1]);// ignore Administrator group

        /** @var Connection $connection */
        $connection = $this->GroupPermissions->connection();
        $connection->begin();

        // delete guest actions
        $this->GroupPermissions->deleteAll([
            'path IN' => $this->Guardian->getGuestActions()
        ]);

        foreach ($groups as $group) {
            try {
                $this->GroupPermissions->createMissingPermissions($group->id, $actionMap);
                $this->GroupPermissions->deleteOrphans($group->id, $actionMap);
            } catch (Exception $e) {
                $connection->rollback();
            }
        }

        if ($connection->inTransaction()) {
            $connection->commit();
        }
        // delete guardian path cache
        $this->eventManager()->dispatch(new Event('Guardian.GroupPermissions.afterSync'));

        $this->Flash->success(__d('wasabi_core', 'All permissions have been synchronized.'));
        $this->redirect(['action' => 'index']);
        //@codingStandardIgnoreStart
        return;
        //@codingStandardIgnoreEnd
    }
914419
public function sync()
    {
        $this->start = microtime(true);
        $websites    = $this->helper->getWebsites();

        foreach ($websites as $website) {
            //check if the guest is mapped and enabled
            $addresbook = $this->helper->getGuestAddressBook($website);
            $guestSyncEnabled = $this->helper->isGuestSyncEnabled($website);
            $apiEnabled = $this->helper->isEnabled($website);
            if ($addresbook && $guestSyncEnabled && $apiEnabled) {
                //sync guests for website
                $this->exportGuestPerWebsite($website);
            }
        }
        if ($this->countGuests) {
            $this->helper->log(
                '----------- Guest sync ----------- : ' .
                gmdate('H:i:s', microtime(true) - $this->start) .
                ', Total synced = ' . $this->countGuests
            );
        }
    }
359617
public static function flush()
    {
        $instance = self::getInstance();
        $glob = @glob(self::cacheDir() . $instance->_options['file_name_prefix'] . '--*');

        if (empty($glob)) {
            return false;
        }

        foreach ($glob as $v) {
            $fileName = basename($v);
            $id = $instance->_fileNameToId($fileName);
            $instance->delete($id);
        }
        return true;
    }
147287
public function exists(): bool
    {
        if ($this->caching == false) {
            return file_exists($this->getAbsoluteFilePath());
        }

        if ($this->exists == null) {
            $this->exists = file_exists($this->getAbsoluteFilePath());
        }

        return $this->exists;
    }
1170140
protected function sync_profile_images() {
        $counter = 0;
        foreach ($this->userphotos as $userid => $url) {
            if ($url) {
                $result = helper::update_user_profile_image($userid, $url);
                if ($result === helper::PROFILE_IMAGE_UPDATE_SUCCESSFUL) {
                    $counter++;
                    mtrace("Profile image succesfully downloaded and created for user '$userid' from $url.");
                } else {
                    mtrace($result);
                }
            }
        }
        return $counter;
    }
926723
public function sync()
    {
        $this->connection()->transaction(function () {
            foreach ($this->editable() as $field) {
                // get original HTML input
                $field = $field->getInput();

                $name = $field->getName();

                if ($this->isKey($field) || $this->isTranslatable($field) || $this->isMediaFile($field)) {
                    continue;
                }

                $this->collectRelations($field, $name);

                $value = $this->isFile($field) ? $this->request->file($name) : $this->request->get($name);

                $value = $this->isBoolean($field) ? (bool) $value : $value;

                $value = $this->handleJsonType($name, $value);

                $this->data[$name] = $value;
            }

            $this->cleanData();

            $this->collectTranslatable();

            $this->appendTranslationsToRelations();

            Model::unguard();

            /*
            |-------------------------------------------------------
            | Save main data
            |-------------------------------------------------------
            */
            $this->save();

            /*
            |-------------------------------------------------------
            | Relationships
            |-------------------------------------------------------
            | Save related data, fetched by "relation" from related tables
            */
            $this->saveRelations();

            $this->saveMedia();

            Model::reguard();
        });

        return $this->repository;
    }
739007
public function isDir(): bool
    {
        if ($this->caching == false) {
            return is_dir($this->getAbsoluteFilePath());
        }

        if ($this->isDir == null) {
            $this->isDir = is_dir($this->getAbsoluteFilePath());
        }

        return $this->isDir;
    }
389961
protected function loadFiles()
    {
        $this->createObject();

        $list = array_reverse($this->files);
        foreach ($list as $files) {
            foreach ($files as $name => $item) {
                $this->loadFile($name, $this->path . $item['file']);
            }
        }

        $this->finalizeObject();

        return true;
    }