예제 #1
0
파일: search.php 프로젝트: bix0r/Stjornvisi
//	index article entries.
//
$counter = 0;
$articleService = new Stjornvisi\Service\Article($pdo);
$articles = $articleService->fetchAll();
$adapter = new Zend\Progressbar\Adapter\Console();
echo "\nIndexing News entries\n";
$progressBar = new Zend\ProgressBar\ProgressBar($adapter, $counter, count($articles));
$i = new Stjornvisi\Search\Index\Article();
foreach ($articles as $item) {
    $i->index($item, $index);
    $progressBar->update(++$counter);
}
$index->commit();
$progressBar->finish();
//Group
//	index group entries.
//
$counter = 0;
$groupService = new Stjornvisi\Service\Group($pdo);
$groups = $groupService->fetchAll();
$adapter = new Zend\Progressbar\Adapter\Console();
echo "\nIndexing Group entries\n";
$progressBar = new Zend\ProgressBar\ProgressBar($adapter, $counter, count($groups));
$i = new Stjornvisi\Search\Index\Group();
foreach ($groups as $item) {
    $i->index($item, $index);
    $progressBar->update(++$counter);
}
$index->commit();
$progressBar->finish();
예제 #2
0
     foreach (scandir($sDirPath) as $sFilePath) {
         if ($sFilePath != '.' && $sFilePath != '..' && is_dir($sFilePath = $sDirPath . DIRECTORY_SEPARATOR . $sFilePath) && ($sFilePath = findZendSkeletonApplication($sFilePath))) {
             return realpath($sFilePath);
         }
     }
     return false;
 }
 //Find ZendSkeletonApplication files
 if (!($sTempZendSkeletonApplication = findZendSkeletonApplication($sTempDirPath))) {
     throw new \InvalidArgumentException('ZendSkeletonApplication is not valid');
 }
 //Copy ZendSkeletonApplication files into the deploy directory
 $aFiles = scandir($sTempZendSkeletonApplication);
 if ($bVerbose) {
     $oConsole->writeLine('    - Copy "ZendSkeletonApplication" into deploy directory "' . $sDeployDirPath . '"', \Zend\Console\ColorInterface::GRAY);
     $oProgressBar = new Zend\ProgressBar\ProgressBar(new \Zend\ProgressBar\Adapter\Console(array('width' => $oConsole->getWidth())), 0, count($aFiles));
 }
 foreach ($aFiles as $iKey => $sFileName) {
     if ($bVerbose) {
         $oProgressBar->update($iKey + 1);
     }
     if ($sFileName != '.' && $sFileName != '..') {
         rcopy($sTempZendSkeletonApplication . DIRECTORY_SEPARATOR . $sFileName, $sDeployDirPath . DIRECTORY_SEPARATOR . $sFileName);
     }
 }
 if ($bVerbose) {
     $oProgressBar->finish();
 }
 emptyDir($sTempDirPath);
 if (!rmdir($sTempDirPath)) {
     throw new \RuntimeException('Unable to remove directory "' . $sTempDirPath . '"');