Created
May 8, 2012 15:33
-
-
Save ecorson/2636376 to your computer and use it in GitHub Desktop.
Iterate over nodes via bootstrap and drush
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
<?php | |
$stdout = fopen('php://stdout', 'w'); | |
fwrite($stdout, "Script Template\n"); | |
// Site specific variables | |
$username = "Dale"; | |
$drupal_base_url = parse_url('http://www.example.com'); | |
require_once 'includes/bootstrap.inc'; | |
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); | |
$result = db_query("SELECT nid, title FROM {node} WHERE type = :type", array( | |
':type' => 'page', | |
)); | |
$nids = array(); | |
foreach($result as $node) { | |
$nids[] = $node->nid; | |
} | |
echo join(', ', $nids); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment