function merge() { global $argv, $title; printf($title); $sphinx = new Sphinx(); if ($argv[2] == "all") { $indexes = $sphinx->getAllEnabledIndexes(); } else { $indexes = array_slice($argv, 2); } printf("Going to merge %d %s\n\n", count($indexes), count($indexes) == 1 ? "index" : "indexes"); foreach ($indexes as $index) { printf("Merging index '%s'\n", $index); $sphinx->mergeIndex($index); printf("Completed merging index '%s'\n\n", $index); } return true; }