Skip to content

Commit

Permalink
EZP-24771: Indexing command should only index published content
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom committed Sep 5, 2015
1 parent 450e5c2 commit 178a1c3
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
use eZ\Publish\SPI\Persistence\Content\ContentInfo;
use PDO;

class SolrCreateIndexCommand extends ContainerAwareCommand
Expand Down Expand Up @@ -43,18 +44,18 @@ protected function execute(InputInterface $input, OutputInterface $output)
$databaseHandler = $this->getContainer()->get('ezpublish.connection');

// Indexing Content
$query = $databaseHandler
->createSelectQuery()
->select('count(id)')
->from('ezcontentobject');
$query = $databaseHandler->createSelectQuery();
$query->select('count(id)')
->from('ezcontentobject')
->where($query->expr->eq('status', ContentInfo::STATUS_PUBLISHED));
$stmt = $query->prepare();
$stmt->execute();
$totalCount = $stmt->fetchColumn();

$query = $databaseHandler
->createSelectQuery()
->select('id', 'current_version')
->from('ezcontentobject');
$query = $databaseHandler->createSelectQuery();
$query->select('id', 'current_version')
->from('ezcontentobject')
->where($query->expr->eq('status', ContentInfo::STATUS_PUBLISHED));

$stmt = $query->prepare();
$stmt->execute();
Expand Down

0 comments on commit 178a1c3

Please sign in to comment.