Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env php
- <?php
- include_once('autoload.php');
- ini_set("memory_limit", "-1");
- ini_set("date.timezone", "Europe/London");
- $cli =& eZCLI::instance();
- $script =& eZScript::instance();
- $script->startup();
- $script->initialize();
- $userCreatorId = eZINI::instance()->variable("UserSettings", "UserCreatorID");
- $user = eZUser::fetch($userCreatorId);
- eZUser::setCurrentlyLoggedInUser($user, $userCreatorId);
- $users = eZContentObjectTreeNode::fetch(5);
- print "Retrieved users node.".PHP_EOL;
- $batchedUsersToDelete = array_chunk(array_map(function($node) {
- return $node->attribute('main_node_id');
- }, $users->subTree(array(
- 'ClassFilterType' => 'include',
- 'ClassFilterArray' => array(52)
- ))), 50);
- print "Batched users.".PHP_EOL;
- $totalBatches = count($batchedUsersToDelete);
- foreach ($batchedUsersToDelete as $index => $batch) {
- $index++; // Make human-readable.
- print "Processing {$index}/{$totalBatches}".PHP_EOL;
- eZContentObjectTreeNode::removeSubtrees($batch, false);
- }
- $script->shutdown();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement