Last active
December 26, 2015 13:42
-
-
Save juampynr/55da77eecc507babed4d to your computer and use it in GitHub Desktop.
Drupal 8: Extract the data of the content view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Extracts the data stored in the database for the Content view. | |
* | |
* Usage: place this file at the root of a Drupal 8 project and then execute | |
* the following command: | |
* | |
* drush scr extract-view-data | |
* | |
* After running it, /tmp/view_data.txt will contain the data of the view. | |
*/ | |
use \Drupal\Core\Database\Database; | |
$data = Database::getConnection('default')->query('select data from {config} where name = :name', array(':name' => 'views.view.content'))->fetchField(); | |
$serialized_data = unserialize($data); | |
file_put_contents('/tmp/view_data.txt', print_r($serialized_data, TRUE)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment