Show executed cmd on Solr_Reindex with verbose=1

Makes actual operation a bit clearer, easier to kickstart debugging
This commit is contained in:
Ingo Schommer 2012-07-19 16:35:26 +02:00
parent f09aad3280
commit d7546a4020
1 changed files with 6 additions and 2 deletions

View File

@ -188,8 +188,12 @@ class Solr_Reindex extends BuildTask {
for ($offset = 0; $offset < $total; $offset += $this->stat('recordsPerRequest')) {
echo "$offset..";
$res = `php $script dev/tasks/$self index=$index class=$class start=$offset variantstate=$statevar`;
if (isset($_GET['verbose'])) echo "\n ".preg_replace('/\r\n|\n/', '$0 ', $res)."\n";
$cmd = "php $script dev/tasks/$self index=$index class=$class start=$offset variantstate=$statevar";
$res = `$cmd`;
if (isset($_GET['verbose'])) {
echo "\n Running '$cmd'\n";
echo " ".preg_replace('/\r\n|\n/', '$0 ', $res)."\n";
}
// If we're in dev mode, commit more often for fun and profit
if (Director::isDev()) Solr::service($index)->commit();