Created
March 9, 2012 03:36
-
-
Save ahawthorne/2004878 to your computer and use it in GitHub Desktop.
Drupal 6 views 2.16 fix
This file contains hidden or 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
| #!/usr/bin/env php | |
| <?php | |
| // set some server variables so Drupal doesn't freak out | |
| $_SERVER['SCRIPT_NAME'] = '/views'; | |
| $_SERVER['SCRIPT_FILENAME'] = '/views'; | |
| $_SERVER['HTTP_HOST'] = 'example.com'; | |
| $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; | |
| $_SERVER['REQUEST_METHOD'] = 'POST'; | |
| // act as the first user | |
| global $user; | |
| $user->uid = 1; | |
| // change to the Drupal directory | |
| chdir('html'); | |
| // Drupal bootstrap throws some errors when run via command line | |
| // so we tone down error reporting temporarily | |
| error_reporting(E_ERROR | E_PARSE); | |
| // run the initial Drupal bootstrap process | |
| require_once('includes/bootstrap.inc'); | |
| drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); | |
| // restore error reporting to its normal setting | |
| error_reporting(E_ALL); | |
| $views = views_get_all_views(); | |
| foreach ($views as $name => $view) { | |
| // get display_ids | |
| foreach ($view->display as $d_id => $d_val) { | |
| //print $name ." -> ". $d_id . "\n"; | |
| foreach($d_val->display_options['fields'] as $f_name => $f_val) { | |
| //print "\t" . $f_name . "\n"; | |
| $f_val['hide_alter_empty'] = 0; | |
| $f = $view->set_item($d_id, 'field', $f_name, $f_val); | |
| } | |
| } | |
| $view->save(); | |
| //print "-------------\n\n"; | |
| } | |
| exit(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment