/**
  * Set this store as the new asset backend
  *
  * @param string $basedir Basedir to store assets, which will be placed beneath 'assets' folder
  */
 public static function activate($basedir)
 {
     // Assign this as the new store
     $publicAdapter = new PublicAssetAdapter(ASSETS_PATH . '/' . $basedir);
     $publicFilesystem = new Filesystem($publicAdapter, ['visibility' => AdapterInterface::VISIBILITY_PUBLIC]);
     $protectedAdapter = new ProtectedAssetAdapter(ASSETS_PATH . '/' . $basedir . '/.protected');
     $protectedFilesystem = new Filesystem($protectedAdapter, ['visibility' => AdapterInterface::VISIBILITY_PRIVATE]);
     $backend = new AssetStoreTest_SpyStore();
     $backend->setPublicFilesystem($publicFilesystem);
     $backend->setProtectedFilesystem($protectedFilesystem);
     Injector::inst()->registerService($backend, 'AssetStore');
     // Assign flysystem backend to generated asset handler at the same time
     $generated = new FlysystemGeneratedAssetHandler();
     $generated->setFilesystem($publicFilesystem);
     Injector::inst()->registerService($generated, 'GeneratedAssetHandler');
     Requirements::backend()->setAssetHandler($generated);
     // Disable legacy and set defaults
     Config::inst()->remove(get_class(new FlysystemAssetStore()), 'legacy_filenames');
     Config::inst()->update('Director', 'alternate_base_url', '/');
     DBFile::config()->force_resample = false;
     File::config()->force_resample = false;
     self::reset();
     self::$basedir = $basedir;
     // Ensure basedir exists
     \Filesystem::makeFolder(self::base_path());
 }
 /**
  * Set this store as the new asset backend
  *
  * @param string $basedir Basedir to store assets, which will be placed beneath 'assets' folder
  */
 public static function activate($basedir)
 {
     // Assign this as the new store
     $adapter = new AssetAdapter(ASSETS_PATH . '/' . $basedir);
     $filesystem = new Filesystem($adapter);
     $filesystem->addPlugin(new FlysystemUrlPlugin());
     $backend = new AssetStoreTest_SpyStore();
     $backend->setFilesystem($filesystem);
     Injector::inst()->registerService($backend, 'AssetStore');
     // Disable legacy and set defaults
     Config::inst()->remove(get_class(new FlysystemAssetStore()), 'legacy_filenames');
     Config::inst()->update('Director', 'alternate_base_url', '/');
     DBFile::config()->force_resample = false;
     File::config()->force_resample = false;
     self::reset();
     self::$basedir = $basedir;
     // Ensure basedir exists
     SS_Filesystem::makeFolder(self::base_path());
 }