/**
  * Harvest OAI-PMH records.
  *
  * @return \Zend\Console\Response
  */
 public function harvestoaiAction()
 {
     $this->checkLocalSetting();
     // Get default options, add the default --ini setting if missing:
     $opts = HarvesterConsoleRunner::getDefaultOptions();
     if (!$opts->getOption('ini')) {
         $ini = \VuFind\Config\Locator::getConfigPath('oai.ini', 'harvest');
         $opts->addArguments(['--ini=' . $ini]);
     }
     // Get the default VuFind HTTP client:
     $client = $this->getServiceLocator()->get('VuFind\\Http')->createClient();
     // Run the job!
     $runner = new HarvesterConsoleRunner($opts, $client, $this->getHarvestRoot());
     return $runner->run() ? $this->getSuccessResponse() : $this->getFailureResponse();
 }
 /**
  * Test basic functionality of console runner w/ settings overridden
  * by command-line options.
  *
  * @return void
  */
 public function testRunFromIniFileWithOptionOverrides()
 {
     $basePath = '/foo/bar';
     $client = $this->getMock('Zend\\Http\\Client');
     $harvester = $this->getMockHarvester();
     $expectedSettings = ['url' => 'http://bar', 'metadataPrefix' => 'oai_dc', 'from' => null, 'until' => null, 'silent' => false, 'verbose' => true, 'timeout' => 45];
     $factory = $this->getMock('VuFindHarvest\\OaiPmh\\HarvesterFactory');
     $factory->expects($this->once())->method('getHarvester')->with($this->equalTo('foo'), $this->equalTo($basePath), $this->equalTo($client), $this->equalTo($expectedSettings))->will($this->returnValue($harvester));
     $opts = HarvesterConsoleRunner::getDefaultOptions();
     $ini = realpath(__DIR__ . '/../../../../fixtures/test.ini');
     $opts->setArguments(['--ini=' . $ini, '-v', '--timeout=45', 'foo']);
     $runner = new HarvesterConsoleRunner($opts, $client, $basePath, $factory, true);
     $this->assertTrue($runner->run());
 }
/**
 * Command-line OAI-PMH harvest tool.
 *
 * PHP version 5
 *
 * Copyright (C) Villanova University 2016.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * @category VuFind
 * @package  Harvest_Tools
 * @author   Demian Katz <*****@*****.**>
 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
 * @link     https://vufind.org Main Page
 */
use VuFindHarvest\OaiPmh\HarvesterConsoleRunner;
require_once __DIR__ . '/../vendor/autoload.php';
$runner = new HarvesterConsoleRunner();
$runner->run();