当前位置: 首页>>代码示例>>PHP>>正文


PHP StorageInterface::deleteAll方法代码示例

本文整理汇总了PHP中Drupal\Core\Config\StorageInterface::deleteAll方法的典型用法代码示例。如果您正苦于以下问题:PHP StorageInterface::deleteAll方法的具体用法?PHP StorageInterface::deleteAll怎么用?PHP StorageInterface::deleteAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Core\Config\StorageInterface的用法示例。


在下文中一共展示了StorageInterface::deleteAll方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: copyConfig

 /**
  * Copies configuration objects from source storage to target storage.
  *
  * @param \Drupal\Core\Config\StorageInterface $source_storage
  *   The source config storage service.
  * @param \Drupal\Core\Config\StorageInterface $target_storage
  *   The target config storage service.
  */
 protected function copyConfig(StorageInterface $source_storage, StorageInterface $target_storage)
 {
     $target_storage->deleteAll();
     foreach ($source_storage->listAll() as $name) {
         $target_storage->write($name, $source_storage->read($name));
     }
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:15,代码来源:ConfigTestTrait.php

示例2: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     if ($path = $form_state->getValue('import_tarball')) {
         $this->configStorage->deleteAll();
         try {
             $archiver = new ArchiveTar($path, 'gz');
             $files = array();
             foreach ($archiver->listContent() as $file) {
                 $files[] = $file['filename'];
             }
             $archiver->extractList($files, config_get_config_directory(CONFIG_STAGING_DIRECTORY));
             drupal_set_message($this->t('Your configuration files were successfully uploaded, ready for import.'));
             $form_state->setRedirect('config.sync');
         } catch (\Exception $e) {
             drupal_set_message($this->t('Could not extract the contents of the tar file. The error message is <em>@message</em>', array('@message' => $e->getMessage())), 'error');
         }
         drupal_unlink($path);
     }
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:22,代码来源:ConfigImportForm.php

示例3: deleteAll

 /**
  * Implements Drupal\Core\Config\StorageInterface::deleteAll().
  */
 public function deleteAll($prefix = '')
 {
     // If the cache was the first to be deleted, another process might start
     // rebuilding the cache before the storage is renamed.
     $names = $this->storage->listAll($prefix);
     if ($this->storage->deleteAll($prefix)) {
         $this->cache->deleteMultiple($this->getCacheKeys($names));
         return TRUE;
     }
     return FALSE;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:14,代码来源:CachedStorage.php

示例4: deleteAll

 /**
  * {@inheritdoc}
  */
 public function deleteAll($prefix = '')
 {
     if ($prefix === '') {
         $this->replacementData[$this->collection] = [];
     } else {
         foreach (array_keys($this->replacementData[$this->collection]) as $name) {
             if (strpos($name, $prefix) === 0) {
                 unset($this->replacementData[$this->collection][$name]);
             }
         }
     }
     return $this->storage->deleteAll($prefix);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:16,代码来源:StorageReplaceDataWrapper.php

示例5: deleteAll

 /**
  * {@inheritdoc}
  */
 public function deleteAll($prefix = '')
 {
     return $this->baseStorage->deleteAll($prefix);
 }
开发者ID:tedbow,项目名称:scheduled-updates-demo,代码行数:7,代码来源:SourceStorage.php

示例6: createSnapshot

 /**
  * {@inheritdoc}
  */
 public function createSnapshot(StorageInterface $source_storage, StorageInterface $snapshot_storage)
 {
     // Empty the snapshot of all configuration.
     $snapshot_storage->deleteAll();
     foreach ($snapshot_storage->getAllCollectionNames() as $collection) {
         $snapshot_collection = $snapshot_storage->createCollection($collection);
         $snapshot_collection->deleteAll();
     }
     foreach ($source_storage->listAll() as $name) {
         $snapshot_storage->write($name, $source_storage->read($name));
     }
     // Copy collections as well.
     foreach ($source_storage->getAllCollectionNames() as $collection) {
         $source_collection = $source_storage->createCollection($collection);
         $snapshot_collection = $snapshot_storage->createCollection($collection);
         foreach ($source_collection->listAll() as $name) {
             $snapshot_collection->write($name, $source_collection->read($name));
         }
     }
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:23,代码来源:ConfigManager.php

示例7: testCRUD

 /**
  * Tests storage CRUD operations.
  *
  * @todo Coverage: Trigger PDOExceptions / Database exceptions.
  */
 function testCRUD()
 {
     $name = 'config_test.storage';
     // Checking whether a non-existing name exists returns FALSE.
     $this->assertIdentical($this->storage->exists($name), FALSE);
     // Reading a non-existing name returns FALSE.
     $data = $this->storage->read($name);
     $this->assertIdentical($data, FALSE);
     // Writing data returns TRUE and the data has been written.
     $data = array('foo' => 'bar');
     $result = $this->storage->write($name, $data);
     $this->assertIdentical($result, TRUE);
     $raw_data = $this->read($name);
     $this->assertIdentical($raw_data, $data);
     // Checking whether an existing name exists returns TRUE.
     $this->assertIdentical($this->storage->exists($name), TRUE);
     // Writing the identical data again still returns TRUE.
     $result = $this->storage->write($name, $data);
     $this->assertIdentical($result, TRUE);
     // Listing all names returns all.
     $names = $this->storage->listAll();
     $this->assertTrue(in_array('system.performance', $names));
     $this->assertTrue(in_array($name, $names));
     // Listing all names with prefix returns names with that prefix only.
     $names = $this->storage->listAll('config_test.');
     $this->assertFalse(in_array('system.performance', $names));
     $this->assertTrue(in_array($name, $names));
     // Rename the configuration storage object.
     $new_name = 'config_test.storage_rename';
     $this->storage->rename($name, $new_name);
     $raw_data = $this->read($new_name);
     $this->assertIdentical($raw_data, $data);
     // Rename it back so further tests work.
     $this->storage->rename($new_name, $name);
     // Deleting an existing name returns TRUE.
     $result = $this->storage->delete($name);
     $this->assertIdentical($result, TRUE);
     // Deleting a non-existing name returns FALSE.
     $result = $this->storage->delete($name);
     $this->assertIdentical($result, FALSE);
     // Deleting all names with prefix deletes the appropriate data and returns
     // TRUE.
     $files = array('config_test.test.biff', 'config_test.test.bang', 'config_test.test.pow');
     foreach ($files as $name) {
         $this->storage->write($name, $data);
     }
     $result = $this->storage->deleteAll('config_test.');
     $names = $this->storage->listAll('config_test.');
     $this->assertIdentical($result, TRUE);
     $this->assertIdentical($names, array());
     // Test renaming an object that does not exist throws an exception.
     try {
         $this->storage->rename('config_test.storage_does_not_exist', 'config_test.storage_does_not_exist_rename');
     } catch (\Exception $e) {
         $class = get_class($e);
         $this->pass($class . ' thrown upon renaming a nonexistent storage bin.');
     }
     // Test renaming to an object that already exists throws an exception.
     try {
         $this->storage->rename('system.cron', 'system.performance');
     } catch (\Exception $e) {
         $class = get_class($e);
         $this->pass($class . ' thrown upon renaming a nonexistent storage bin.');
     }
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:70,代码来源:ConfigStorageTestBase.php

示例8: deleteSnapshot

 /**
  * {@inheritdoc}
  */
 public function deleteSnapshot()
 {
     $this->snapshotExtensionStorage->deleteAll();
     $this->snapshotActiveStorage->deleteAll();
 }
开发者ID:robertfoleyjr,项目名称:robertfoleyjr-d8,代码行数:8,代码来源:ConfigSyncSnapshotter.php


注:本文中的Drupal\Core\Config\StorageInterface::deleteAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。