/mnt/monguz/vufind-instances/6.1.2/vendor/zendframework/zend-log/src/Writer/Stream.php
}
if ('a' != $mode) {
throw new Exception\InvalidArgumentException(sprintf(
'Mode must be "a" on existing streams; received "%s"',
$mode
));
}
$this->stream = $streamOrUrl;
} else {
ErrorHandler::start();
if (isset($filePermissions) && ! file_exists($streamOrUrl) && is_writable(dirname($streamOrUrl))) {
touch($streamOrUrl);
chmod($streamOrUrl, $filePermissions);
}
$this->stream = fopen($streamOrUrl, $mode, false);
$error = ErrorHandler::stop();
if (! $this->stream) {
throw new Exception\RuntimeException(sprintf(
'"%s" cannot be opened with mode "%s"',
$streamOrUrl,
$mode
), 0, $error);
}
}
if (null !== $logSeparator) {
$this->setLogSeparator($logSeparator);
}
if ($this->formatter === null) {
$this->formatter = new SimpleFormatter();
}
}
/**
* Write a message to the log.
*
* @param array $event event data
/mnt/monguz/vufind-instances/6.1.2/vendor/zendframework/zend-log/src/Writer/Stream.php
'Resource is not a stream; received "%s',
get_resource_type($streamOrUrl)
));
}
if ('a' != $mode) {
throw new Exception\InvalidArgumentException(sprintf(
'Mode must be "a" on existing streams; received "%s"',
$mode
));
}
$this->stream = $streamOrUrl;
} else {
ErrorHandler::start();
if (isset($filePermissions) && ! file_exists($streamOrUrl) && is_writable(dirname($streamOrUrl))) {
touch($streamOrUrl);
chmod($streamOrUrl, $filePermissions);
}
$this->stream = fopen($streamOrUrl, $mode, false);
$error = ErrorHandler::stop();
if (! $this->stream) {
throw new Exception\RuntimeException(sprintf(
'"%s" cannot be opened with mode "%s"',
$streamOrUrl,
$mode
), 0, $error);
}
}
if (null !== $logSeparator) {
$this->setLogSeparator($logSeparator);
}
if ($this->formatter === null) {
$this->formatter = new SimpleFormatter();
}
}
/**
/mnt/monguz/vufind-instances/6.1.2/vendor/zendframework/zend-log/src/Writer/Stream.php
'Resource is not a stream; received "%s',
get_resource_type($streamOrUrl)
));
}
if ('a' != $mode) {
throw new Exception\InvalidArgumentException(sprintf(
'Mode must be "a" on existing streams; received "%s"',
$mode
));
}
$this->stream = $streamOrUrl;
} else {
ErrorHandler::start();
if (isset($filePermissions) && ! file_exists($streamOrUrl) && is_writable(dirname($streamOrUrl))) {
touch($streamOrUrl);
chmod($streamOrUrl, $filePermissions);
}
$this->stream = fopen($streamOrUrl, $mode, false);
$error = ErrorHandler::stop();
if (! $this->stream) {
throw new Exception\RuntimeException(sprintf(
'"%s" cannot be opened with mode "%s"',
$streamOrUrl,
$mode
), 0, $error);
}
}
if (null !== $logSeparator) {
$this->setLogSeparator($logSeparator);
}
if ($this->formatter === null) {
$this->formatter = new SimpleFormatter();
}
}
/**
/mnt/monguz/vufind-instances/6.1.2/module/VuFind/src/VuFind/Log/LoggerFactory.php
* @param string $config Configuration
*
* @return void
*/
protected function addFileWriters(Logger $logger, $config)
{
// Make sure to use only the last ':' after second character to avoid trouble
// with Windows drive letters (e.g. "c:\something\logfile:error-5")
$pos = strrpos($config, ':', 2);
if ($pos > 0) {
$file = substr($config, 0, $pos);
$error_types = substr($config, $pos + 1);
} else {
$file = $config;
$error_types = '';
}
// Make Writers
$filters = explode(',', $error_types);
$writer = new Writer\Stream($file);
$this->addWriters($logger, $writer, $filters);
}
/**
* Configure Slack writers.
*
* @param Logger $logger Logger object
* @param ContainerInterface $container Service manager
* @param Config $config Configuration
*
* @return void
*/
protected function addSlackWriters(Logger $logger, ContainerInterface $container,
Config $config
) {
$options = [];
// Get config
list($channel, $error_types) = explode(':', $config->Logging->slack);
if ($error_types == null) {
$error_types = $channel;
/mnt/monguz/vufind-instances/6.1.2/module/VuFind/src/VuFind/Log/LoggerFactory.php
->get('config');
$hasWriter = false;
// DEBUGGER
if (!$config->System->debug == false || $this->hasDynamicDebug($container)) {
$hasWriter = true;
$this->addDebugWriter($logger, $config->System->debug);
}
// Activate database logging, if applicable:
if (isset($config->Logging->database)) {
$hasWriter = true;
$this->addDbWriters($logger, $container, $config->Logging->database);
}
// Activate file logging, if applicable:
if (isset($config->Logging->file)) {
$hasWriter = true;
$this->addFileWriters($logger, $config->Logging->file);
}
// Activate email logging, if applicable:
if (isset($config->Logging->email)) {
$hasWriter = true;
$this->addEmailWriters($logger, $container, $config);
}
// Activate slack logging, if applicable:
if (isset($config->Logging->slack) && isset($config->Logging->slackurl)) {
$hasWriter = true;
$this->addSlackWriters($logger, $container, $config);
}
// Null (no-op) writer to avoid errors
if (!$hasWriter) {
$logger->addWriter(new \Zend\Log\Writer\Noop());
}
}
/mnt/monguz/vufind-instances/6.1.2/module/VuFind/src/VuFind/Log/LoggerFactory.php
* @throws ServiceNotCreatedException if an exception is raised when
* creating a service.
* @throws ContainerException if any other error occurs
*/
public function __invoke(ContainerInterface $container, $requestedName,
array $options = null
) {
if (!empty($options)) {
throw new \Exception('Unexpected options passed to factory.');
}
// Construct the logger as a lazy loading value holder so that
// the object is not instantiated until it is called. This helps break
// potential circular dependencies with other services.
$callback = function (& $wrapped, $proxy) use ($container, $requestedName) {
// Indicate that initialization is complete to avoid reinitialization:
$proxy->setProxyInitializer(null);
// Now build the actual service:
$wrapped = new $requestedName();
$this->configureLogger($container, $wrapped);
};
$cfg = $container->get(\ProxyManager\Configuration::class);
$factory = new \ProxyManager\Factory\LazyLoadingValueHolderFactory($cfg);
return $factory->createProxy($requestedName, $callback);
}
}
/mnt/monguz/vufind-instances/6.1.2/vendor/ocramius/proxy-manager/src/ProxyManager/GeneratorStrategy/EvaluatingGeneratorStrategy.php
* {@inheritDoc}
*/
public function generate(ClassGenerator $classGenerator) : string
{
$code = $classGenerator->generate();
// @codeCoverageIgnoreStart
if (! $this->canEval) {
$fileName = tempnam(sys_get_temp_dir(), 'EvaluatingGeneratorStrategy.php.tmp.');
file_put_contents($fileName, "<?php\n" . $code);
/* @noinspection PhpIncludeInspection */
require $fileName;
unlink($fileName);
return $code;
}
// @codeCoverageIgnoreEnd
eval($code);
return $code;
}
}
/mnt/monguz/vufind-instances/6.1.2/vendor/ocramius/proxy-manager/src/ProxyManager/GeneratorStrategy/EvaluatingGeneratorStrategy.php
* {@inheritDoc}
*/
public function generate(ClassGenerator $classGenerator) : string
{
$code = $classGenerator->generate();
// @codeCoverageIgnoreStart
if (! $this->canEval) {
$fileName = tempnam(sys_get_temp_dir(), 'EvaluatingGeneratorStrategy.php.tmp.');
file_put_contents($fileName, "<?php\n" . $code);
/* @noinspection PhpIncludeInspection */
require $fileName;
unlink($fileName);
return $code;
}
// @codeCoverageIgnoreEnd
eval($code);
return $code;
}
}
/mnt/monguz/vufind-instances/6.1.2/module/VuFind/src/VuFind/Log/LoggerAwareTrait.php
}
/**
* Send a message to the logger.
*
* @param string $level Log level
* @param string $message Log message
* @param array $context Log context
* @param bool $prependClass Prepend class name to message?
*
* @return void
*/
protected function log($level, $message, array $context = [],
$prependClass = false
) {
if ($this->logger) {
if ($prependClass) {
$message = get_class($this) . ': ' . $message;
}
$this->logger->$level($message, $context);
}
}
}
/mnt/monguz/vufind-instances/6.1.2/module/VuFind/src/VuFind/Log/LoggerAwareTrait.php
*
* @return void
*/
protected function logWarning($msg, array $context = [], $prependClass = true)
{
return $this->log('warn', $msg, $context, $prependClass);
}
/**
* Log a debug message.
*
* @param string $msg Log message
* @param array $context Log context
* @param bool $prependClass Prepend class name to message?
*
* @return void
*/
protected function debug($msg, array $context = [], $prependClass = true)
{
return $this->log('debug', $msg, $context, $prependClass);
}
/**
* Send a message to the logger.
*
* @param string $level Log level
* @param string $message Log message
* @param array $context Log context
* @param bool $prependClass Prepend class name to message?
*
* @return void
*/
protected function log($level, $message, array $context = [],
$prependClass = false
) {
if ($this->logger) {
if ($prependClass) {
$message = get_class($this) . ': ' . $message;
}
$this->logger->$level($message, $context);
/mnt/monguz/vufind-instances/6.1.2/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php
* @return string Response body
*/
public function query($handler, ParamBag $params)
{
$urlSuffix = '/' . $handler;
$paramString = implode('&', $params->request());
if (strlen($paramString) > self::MAX_GET_URL_LENGTH) {
$method = Request::METHOD_POST;
$callback = function ($client) use ($paramString) {
$client->setRawBody($paramString);
$client->setEncType(HttpClient::ENC_URLENCODED);
$client->setHeaders(['Content-Length' => strlen($paramString)]);
};
} else {
$method = Request::METHOD_GET;
$urlSuffix .= '?' . $paramString;
$callback = null;
}
$this->debug(sprintf('Query %s', $paramString));
return $this->trySolrUrls($method, $urlSuffix, $callback);
}
/**
* Check if an exception from a Solr request should be thrown rather than retried
*
* @param \Exception $ex Exception
*
* @return bool
*/
protected function isRethrowableSolrException($ex)
{
return $ex instanceof TimeoutException
|| $ex instanceof RequestErrorException;
}
/**
* If an unexpected exception type was received, wrap it in a generic
* BackendException to standardize upstream handling.
*
/mnt/monguz/vufind-instances/6.1.2/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php
*/
public function similar($id, ParamBag $params)
{
$handler = $this->map->getHandler(__FUNCTION__);
$this->map->prepare(__FUNCTION__, $params);
return $this->query($handler, $params);
}
/**
* Execute a search.
*
* @param ParamBag $params Parameters
*
* @return string
*/
public function search(ParamBag $params)
{
$handler = $this->map->getHandler(__FUNCTION__);
$this->map->prepare(__FUNCTION__, $params);
return $this->query($handler, $params);
}
/**
* Extract terms from a SOLR index.
*
* @param ParamBag $params Parameters
*
* @return string
*/
public function terms(ParamBag $params)
{
$handler = $this->map->getHandler(__FUNCTION__);
$this->map->prepare(__FUNCTION__, $params);
return $this->query($handler, $params);
}
/**
* Write to the SOLR index.
*
/mnt/monguz/vufind-instances/6.1.2/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Backend.php
*/
public function search(AbstractQuery $query, $offset, $limit,
ParamBag $params = null
) {
$params = $params ?: new ParamBag();
$this->injectResponseWriter($params);
if (($params->get('facet.sort') != null)
&& ($params->get('facet.sort')[0] == 'index')) {
// "Browse the Collection Alphabetically". Get the real number of facets:
// ex.: q=author_facet:(CA* OR Ca* OR ca*)
if (preg_match('/[A-Za-z]{2,}\*\ OR/', $query->getAllTerms()))
$params->set('json.facet', '{real_facet_count:"unique(author_facet)"}');
else // ex.: q=author_facet:(C* OR c*)
$params->set('debugQuery', 'on');
}
$params->set('rows', $limit);
$params->set('start', $offset);
$params->mergeWith($this->getQueryBuilder()->build($query));
$response = $this->connector->search($params);
$collection = $this->createRecordCollection($response);
$this->injectSourceIdentifier($collection);
return $collection;
}
/**
* Get Random records
*
* @param AbstractQuery $query Search query
* @param int $limit Search limit
* @param ParamBag $params Search backend parameters
*
* @return RecordCollectionInterface
*/
public function random(
AbstractQuery $query, $limit, ParamBag $params = null
) {
$params = $params ?: new ParamBag();
$this->injectResponseWriter($params);
/mnt/monguz/vufind-instances/6.1.2/module/VuFindSearch/src/VuFindSearch/Service.php
* @param string $backend Search backend identifier
* @param Query\AbstractQuery $query Search query
* @param int $offset Search offset
* @param int $limit Search limit
* @param ParamBag $params Search backend parameters
*
* @return RecordCollectionInterface
*/
public function search($backend, Query\AbstractQuery $query, $offset = 0,
$limit = 20, ParamBag $params = null
) {
$params = $params ?: new ParamBag();
$context = __FUNCTION__;
$args = compact('backend', 'query', 'offset', 'limit', 'params', 'context');
$backend = $this->resolve($backend, $args);
$args['backend_instance'] = $backend;
$this->triggerPre($backend, $args);
try {
$response = $backend->search($query, $offset, $limit, $params);
} catch (BackendException $e) {
$this->triggerError($e, $args);
throw $e;
}
$this->triggerPost($response, $args);
return $response;
}
/**
* Retrieve a single record.
*
* @param string $backend Search backend identifier
* @param string $id Record identifier
* @param ParamBag $params Search backend parameters
*
* @return RecordCollectionInterface
*/
public function retrieve($backend, $id, ParamBag $params = null)
{
$params = $params ?: new ParamBag();
/mnt/monguz/vufind-instances/6.1.2/module/VuFind/src/VuFind/Search/Solr/Results.php
* @return void
*/
protected function performSearch()
{
$query = $this->getParams()->getQuery();
$limit = $this->getParams()->getLimit();
$offset = $this->getStartRecord() - 1;
$params = $this->getParams()->getBackendParameters();
$searchService = $this->getSearchService();
$cursorMark = $this->getCursorMark();
if (null !== $cursorMark) {
$params->set('cursorMark', '' === $cursorMark ? '*' : $cursorMark);
// Override any default timeAllowed since it cannot be used with
// cursorMark
$params->set('timeAllowed', -1);
}
try {
$collection = $searchService
->search($this->backendId, $query, $offset, $limit, $params);
} catch (\VuFindSearch\Backend\Exception\BackendException $e) {
// If the query caused a parser error, see if we can clean it up:
if ($e->hasTag('VuFind\Search\ParserError')
&& $newQuery = $this->fixBadQuery($query)
) {
// We need to get a fresh set of $params, since the previous one was
// manipulated by the previous search() call.
$params = $this->getParams()->getBackendParameters();
$collection = $searchService
->search($this->backendId, $newQuery, $offset, $limit, $params);
} else {
throw $e;
}
}
$this->responseFacets = $collection->getFacets();
$this->resultTotal = ($collection->getFacetTotal() > 0)
? $collection->getFacetTotal() : $collection->getTotal();
// Process spelling suggestions
/mnt/monguz/vufind-instances/6.1.2/module/VuFind/src/VuFind/Search/Base/Results.php
$this->helpers[$key] = $value;
}
/**
* Actually execute the search.
*
* @return void
*/
public function performAndProcessSearch()
{
// Initialize variables to defaults (to ensure they don't stay null
// and cause unnecessary repeat processing):
$this->resultTotal = 0;
$this->results = [];
$this->suggestions = [];
$this->errors = [];
// Run the search:
$this->startQueryTimer();
$this->performSearch();
$this->stopQueryTimer();
}
/**
* Returns the stored list of facets for the last search
*
* @param array $filter Array of field => on-screen description listing
* all of the desired facet fields; set to null to get all configured values.
*
* @return array Facets data arrays
*/
abstract public function getFacetList($filter = null);
/**
* Abstract support method for performAndProcessSearch -- perform a search based
* on the parameters passed to the object. This method is responsible for
* filling in all of the key class properties: results, resultTotal, etc.
*
* @return void
*/
/mnt/monguz/vufind-instances/6.1.2/module/VuFind/src/VuFind/Search/SearchRunner.php
$params = $results->getParams();
$params->setLastView($lastView);
$params->initFromRequest($request);
if (is_callable($setupCallback)) {
$setupCallback($this, $params, $runningSearchId);
}
// Trigger the "configuration done" event.
$this->getEventManager()->trigger(
self::EVENT_CONFIGURED, $this,
compact('params', 'request', 'runningSearchId')
);
// Attempt to perform the search; if there is a problem, inspect any Solr
// exceptions to see if we should communicate to the user about them.
try {
// Explicitly execute search within controller -- this allows us to
// catch exceptions more reliably:
$results->performAndProcessSearch();
} catch (\VuFindSearch\Backend\Exception\BackendException $e) {
if ($e->hasTag('VuFind\Search\ParserError')) {
// We need to create and process an "empty results" object to
// ensure that recommendation modules and templates behave
// properly when displaying the error message.
$results = $this->resultsManager->get('EmptySet');
$results->setParams($params);
$results->performAndProcessSearch();
} else {
throw $e;
}
}
// Trigger the "search completed" event.
$this->getEventManager()->trigger(
self::EVENT_COMPLETE, $this, compact('results', 'runningSearchId')
);
return $results;
}
/mnt/monguz/vufind-instances/6.1.2/module/VuFind/src/VuFind/Controller/AbstractSearch.php
public function resultsAction()
{
$view = $this->createViewModel();
// Handle saved search requests:
$savedId = $this->params()->fromQuery('saved', false);
if ($savedId !== false) {
return $this->redirectToSavedSearch($savedId);
}
$runner = $this->serviceLocator->get(\VuFind\Search\SearchRunner::class);
// Send both GET and POST variables to search class:
$request = $this->getRequest()->getQuery()->toArray()
+ $this->getRequest()->getPost()->toArray();
$lastView = $this->getSearchMemory()
->retrieveLastSetting($this->searchClassId, 'view');
$view->results = $results = $runner->run(
$request, $this->searchClassId, $this->getSearchSetupCallback(),
$lastView
);
$view->params = $results->getParams();
// If we received an EmptySet back, that indicates that the real search
// failed due to some kind of syntax error, and we should display a
// warning to the user; otherwise, we should proceed with normal post-search
// processing.
if ($results instanceof \VuFind\Search\EmptySet\Results) {
$view->parseError = true;
} else {
// If a "jumpto" parameter is set, deal with that now:
if ($jump = $this->processJumpTo($results)) {
return $jump;
}
// Remember the current URL as the last search.
$this->rememberSearch($results);
// Add to search history:
/mnt/monguz/vufind-instances/6.1.2/module/VuFind/src/VuFind/Controller/AuthorController.php
return parent::facetListAction();
}
/**
* Sets the configuration for displaying author results
*
* @return mixed
*/
public function resultsAction()
{
$this->searchClassId = 'SolrAuthor';
// Save author searches if next_prev_navigation is enabled - otherwise
// there are wacky results when trying to page through results (the
// next/prev links only appear for records which were included in the
// results for the previous keyword search, and the next/prev links will
// iterate you through that search).
$this->saveToHistory = $this->resultScrollerActive();
return parent::resultsAction();
}
/**
* Sets the configuration for performing an author search
*
* @return mixed
*/
public function searchAction()
{
$this->searchClassId = 'SolrAuthorFacets';
$this->saveToHistory = false;
$this->rememberSearch = false;
return parent::resultsAction();
}
/**
* Displays the proper page for a search action
*
* @return mixed
*/
/mnt/monguz/vufind-instances/6.1.2/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php
*/
public function onDispatch(MvcEvent $e)
{
$routeMatch = $e->getRouteMatch();
if (! $routeMatch) {
/**
* @todo Determine requirements for when route match is missing.
* Potentially allow pulling directly from request metadata?
*/
throw new Exception\DomainException('Missing route matches; unsure how to retrieve action');
}
$action = $routeMatch->getParam('action', 'not-found');
$method = static::getMethodFromAction($action);
if (! method_exists($this, $method)) {
$method = 'notFoundAction';
}
$actionResponse = $this->$method();
$e->setResult($actionResponse);
return $actionResponse;
}
}
/mnt/monguz/vufind-instances/6.1.2/vendor/zendframework/zend-eventmanager/src/EventManager.php
}
if ($this->sharedManager) {
foreach ($this->sharedManager->getListeners($this->identifiers, $name) as $priority => $listeners) {
$listOfListenersByPriority[$priority][] = $listeners;
}
}
// Sort by priority in reverse order
krsort($listOfListenersByPriority);
// Initial value of stop propagation flag should be false
$event->stopPropagation(false);
// Execute listeners
$responses = new ResponseCollection();
foreach ($listOfListenersByPriority as $listOfListeners) {
foreach ($listOfListeners as $listeners) {
foreach ($listeners as $listener) {
$response = $listener($event);
$responses->push($response);
// If the event was asked to stop propagating, do so
if ($event->propagationIsStopped()) {
$responses->setStopped(true);
return $responses;
}
// If the result causes our validation callback to return true,
// stop propagation
if ($callback && $callback($response)) {
$responses->setStopped(true);
return $responses;
}
}
}
}
return $responses;
}
/mnt/monguz/vufind-instances/6.1.2/vendor/zendframework/zend-eventmanager/src/EventManager.php
$event->setParams($argv);
}
return $this->triggerListeners($event, $callback);
}
/**
* @inheritDoc
*/
public function triggerEvent(EventInterface $event)
{
return $this->triggerListeners($event);
}
/**
* @inheritDoc
*/
public function triggerEventUntil(callable $callback, EventInterface $event)
{
return $this->triggerListeners($event, $callback);
}
/**
* @inheritDoc
*/
public function attach($eventName, callable $listener, $priority = 1)
{
if (! is_string($eventName)) {
throw new Exception\InvalidArgumentException(sprintf(
'%s expects a string for the event; received %s',
__METHOD__,
(is_object($eventName) ? get_class($eventName) : gettype($eventName))
));
}
$this->events[$eventName][(int) $priority][0][] = $listener;
return $listener;
}
/**
/mnt/monguz/vufind-instances/6.1.2/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php
* @events dispatch.pre, dispatch.post
* @param Request $request
* @param null|Response $response
* @return Response|mixed
*/
public function dispatch(Request $request, Response $response = null)
{
$this->request = $request;
if (! $response) {
$response = new HttpResponse();
}
$this->response = $response;
$e = $this->getEvent();
$e->setName(MvcEvent::EVENT_DISPATCH);
$e->setRequest($request);
$e->setResponse($response);
$e->setTarget($this);
$result = $this->getEventManager()->triggerEventUntil(function ($test) {
return ($test instanceof Response);
}, $e);
if ($result->stopped()) {
return $result->last();
}
return $e->getResult();
}
/**
* Get request object
*
* @return Request
*/
public function getRequest()
{
if (! $this->request) {
$this->request = new HttpRequest();
}
/mnt/monguz/vufind-instances/6.1.2/vendor/zendframework/zend-mvc/src/Controller/Plugin/Forward.php
// Allow passing parameters to seed the RouteMatch with & copy matched route name
if ($params !== null) {
$routeMatch = new RouteMatch($params);
$routeMatch->setMatchedRouteName($event->getRouteMatch()->getMatchedRouteName());
$event->setRouteMatch($routeMatch);
}
if ($this->numNestedForwards > $this->maxNestedForwards) {
throw new Exception\DomainException(
"Circular forwarding detected: greater than $this->maxNestedForwards nested forwards"
);
}
$this->numNestedForwards++;
// Detach listeners that may cause problems during dispatch:
$sharedEvents = $event->getApplication()->getEventManager()->getSharedManager();
$listeners = $this->detachProblemListeners($sharedEvents);
$return = $controller->dispatch($event->getRequest(), $event->getResponse());
// If we detached any listeners, reattach them now:
$this->reattachProblemListeners($sharedEvents, $listeners);
$this->numNestedForwards--;
return $return;
}
/**
* Detach problem listeners specified by getListenersToDetach() and return an array of information that will
* allow them to be reattached.
*
* @param SharedEvents $sharedEvents Shared event manager
* @return array
*/
protected function detachProblemListeners(SharedEvents $sharedEvents)
{
// Convert the problem list from two-dimensional array to more convenient id => event => class format:
$formattedProblems = [];
/mnt/monguz/vufind-instances/6.1.2/module/VuFind/src/VuFind/Controller/AbstractBase.php
->__invoke($msg, $tokens, $default);
}
/**
* Convenience method to make invocation of forward() helper less verbose.
*
* @param string $controller Controller to invoke
* @param string $action Action to invoke
* @param array $params Extra parameters for the RouteMatch object (no
* need to provide action here, since $action takes care of that)
*
* @return mixed
*/
public function forwardTo($controller, $action, $params = [])
{
// Inject action into the RouteMatch parameters
$params['action'] = $action;
// Dispatch the requested controller/action:
return $this->forward()->dispatch($controller, $params);
}
/**
* Check to see if a form was submitted from its post value
* Also validate the Captcha, if it's activated
*
* @param string $submitElement Name of the post field of the submit button
* @param bool $useRecaptcha Are we using captcha in this situation?
*
* @return bool
*/
protected function formWasSubmitted($submitElement = 'submit',
$useRecaptcha = false
) {
// Fail if the expected submission element was missing from the POST:
// Form was submitted; if CAPTCHA is expected, validate it now.
return $this->params()->fromPost($submitElement, false)
&& (!$useRecaptcha || $this->recaptcha()->validate());
}
/mnt/monguz/vufind-instances/6.1.2/module/VuFind/src/VuFind/Controller/AuthorController.php
public function searchAction()
{
$this->searchClassId = 'SolrAuthorFacets';
$this->saveToHistory = false;
$this->rememberSearch = false;
return parent::resultsAction();
}
/**
* Displays the proper page for a search action
*
* @return mixed
*/
public function homeAction()
{
// If an author was requested, forward to the results page; otherwise,
// display the search form:
$author = $this->params()->fromQuery('author');
return !empty($author)
? $this->forwardTo('Author', 'Results') : parent::homeAction();
}
/**
* Is the result scroller active?
*
* @return bool
*/
protected function resultScrollerActive()
{
$config = $this->serviceLocator->get(\VuFind\Config\PluginManager::class)
->get('config');
return isset($config->Record->next_prev_navigation)
&& $config->Record->next_prev_navigation;
}
}
/mnt/monguz/vufind-instances/6.1.2/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php
*/
public function onDispatch(MvcEvent $e)
{
$routeMatch = $e->getRouteMatch();
if (! $routeMatch) {
/**
* @todo Determine requirements for when route match is missing.
* Potentially allow pulling directly from request metadata?
*/
throw new Exception\DomainException('Missing route matches; unsure how to retrieve action');
}
$action = $routeMatch->getParam('action', 'not-found');
$method = static::getMethodFromAction($action);
if (! method_exists($this, $method)) {
$method = 'notFoundAction';
}
$actionResponse = $this->$method();
$e->setResult($actionResponse);
return $actionResponse;
}
}
/mnt/monguz/vufind-instances/6.1.2/vendor/zendframework/zend-eventmanager/src/EventManager.php
}
if ($this->sharedManager) {
foreach ($this->sharedManager->getListeners($this->identifiers, $name) as $priority => $listeners) {
$listOfListenersByPriority[$priority][] = $listeners;
}
}
// Sort by priority in reverse order
krsort($listOfListenersByPriority);
// Initial value of stop propagation flag should be false
$event->stopPropagation(false);
// Execute listeners
$responses = new ResponseCollection();
foreach ($listOfListenersByPriority as $listOfListeners) {
foreach ($listOfListeners as $listeners) {
foreach ($listeners as $listener) {
$response = $listener($event);
$responses->push($response);
// If the event was asked to stop propagating, do so
if ($event->propagationIsStopped()) {
$responses->setStopped(true);
return $responses;
}
// If the result causes our validation callback to return true,
// stop propagation
if ($callback && $callback($response)) {
$responses->setStopped(true);
return $responses;
}
}
}
}
return $responses;
}
/mnt/monguz/vufind-instances/6.1.2/vendor/zendframework/zend-eventmanager/src/EventManager.php
$event->setParams($argv);
}
return $this->triggerListeners($event, $callback);
}
/**
* @inheritDoc
*/
public function triggerEvent(EventInterface $event)
{
return $this->triggerListeners($event);
}
/**
* @inheritDoc
*/
public function triggerEventUntil(callable $callback, EventInterface $event)
{
return $this->triggerListeners($event, $callback);
}
/**
* @inheritDoc
*/
public function attach($eventName, callable $listener, $priority = 1)
{
if (! is_string($eventName)) {
throw new Exception\InvalidArgumentException(sprintf(
'%s expects a string for the event; received %s',
__METHOD__,
(is_object($eventName) ? get_class($eventName) : gettype($eventName))
));
}
$this->events[$eventName][(int) $priority][0][] = $listener;
return $listener;
}
/**
/mnt/monguz/vufind-instances/6.1.2/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php
* @events dispatch.pre, dispatch.post
* @param Request $request
* @param null|Response $response
* @return Response|mixed
*/
public function dispatch(Request $request, Response $response = null)
{
$this->request = $request;
if (! $response) {
$response = new HttpResponse();
}
$this->response = $response;
$e = $this->getEvent();
$e->setName(MvcEvent::EVENT_DISPATCH);
$e->setRequest($request);
$e->setResponse($response);
$e->setTarget($this);
$result = $this->getEventManager()->triggerEventUntil(function ($test) {
return ($test instanceof Response);
}, $e);
if ($result->stopped()) {
return $result->last();
}
return $e->getResult();
}
/**
* Get request object
*
* @return Request
*/
public function getRequest()
{
if (! $this->request) {
$this->request = new HttpRequest();
}
/mnt/monguz/vufind-instances/6.1.2/vendor/zendframework/zend-mvc/src/DispatchListener.php
);
return $this->complete($return, $e);
} catch (\Throwable $exception) {
$return = $this->marshalBadControllerEvent($controllerName, $e, $application, $exception);
return $this->complete($return, $e);
} catch (\Exception $exception) { // @TODO clean up once PHP 7 requirement is enforced
$return = $this->marshalBadControllerEvent($controllerName, $e, $application, $exception);
return $this->complete($return, $e);
}
if ($controller instanceof InjectApplicationEventInterface) {
$controller->setEvent($e);
}
$request = $e->getRequest();
$response = $application->getResponse();
$caughtException = null;
try {
$return = $controller->dispatch($request, $response);
} catch (\Throwable $ex) {
$caughtException = $ex;
} catch (\Exception $ex) { // @TODO clean up once PHP 7 requirement is enforced
$caughtException = $ex;
}
if ($caughtException !== null) {
$e->setName(MvcEvent::EVENT_DISPATCH_ERROR);
$e->setError($application::ERROR_EXCEPTION);
$e->setController($controllerName);
$e->setControllerClass(get_class($controller));
$e->setParam('exception', $caughtException);
$return = $application->getEventManager()->triggerEvent($e)->last();
if (! $return) {
$return = $e->getResult();
}
}
return $this->complete($return, $e);
/mnt/monguz/vufind-instances/6.1.2/vendor/zendframework/zend-eventmanager/src/EventManager.php
}
if ($this->sharedManager) {
foreach ($this->sharedManager->getListeners($this->identifiers, $name) as $priority => $listeners) {
$listOfListenersByPriority[$priority][] = $listeners;
}
}
// Sort by priority in reverse order
krsort($listOfListenersByPriority);
// Initial value of stop propagation flag should be false
$event->stopPropagation(false);
// Execute listeners
$responses = new ResponseCollection();
foreach ($listOfListenersByPriority as $listOfListeners) {
foreach ($listOfListeners as $listeners) {
foreach ($listeners as $listener) {
$response = $listener($event);
$responses->push($response);
// If the event was asked to stop propagating, do so
if ($event->propagationIsStopped()) {
$responses->setStopped(true);
return $responses;
}
// If the result causes our validation callback to return true,
// stop propagation
if ($callback && $callback($response)) {
$responses->setStopped(true);
return $responses;
}
}
}
}
return $responses;
}
/mnt/monguz/vufind-instances/6.1.2/vendor/zendframework/zend-eventmanager/src/EventManager.php
$event->setParams($argv);
}
return $this->triggerListeners($event, $callback);
}
/**
* @inheritDoc
*/
public function triggerEvent(EventInterface $event)
{
return $this->triggerListeners($event);
}
/**
* @inheritDoc
*/
public function triggerEventUntil(callable $callback, EventInterface $event)
{
return $this->triggerListeners($event, $callback);
}
/**
* @inheritDoc
*/
public function attach($eventName, callable $listener, $priority = 1)
{
if (! is_string($eventName)) {
throw new Exception\InvalidArgumentException(sprintf(
'%s expects a string for the event; received %s',
__METHOD__,
(is_object($eventName) ? get_class($eventName) : gettype($eventName))
));
}
$this->events[$eventName][(int) $priority][0][] = $listener;
return $listener;
}
/**
/mnt/monguz/vufind-instances/6.1.2/vendor/zendframework/zend-mvc/src/Application.php
$response = $result->last();
if ($response instanceof ResponseInterface) {
$event->setName(MvcEvent::EVENT_FINISH);
$event->setTarget($this);
$event->setResponse($response);
$event->stopPropagation(false); // Clear before triggering
$events->triggerEvent($event);
$this->response = $response;
return $this;
}
}
if ($event->getError()) {
return $this->completeRequest($event);
}
// Trigger dispatch event
$event->setName(MvcEvent::EVENT_DISPATCH);
$event->stopPropagation(false); // Clear before triggering
$result = $events->triggerEventUntil($shortCircuit, $event);
// Complete response
$response = $result->last();
if ($response instanceof ResponseInterface) {
$event->setName(MvcEvent::EVENT_FINISH);
$event->setTarget($this);
$event->setResponse($response);
$event->stopPropagation(false); // Clear before triggering
$events->triggerEvent($event);
$this->response = $response;
return $this;
}
$response = $this->response;
$event->setResponse($response);
return $this->completeRequest($event);
}
/**
* Complete the request
/mnt/monguz/vufind-instances/eles/public/index.php
// Ensure vendor/ is on include_path; some PEAR components may not load correctly
// otherwise (i.e. File_MARC may cause a "Cannot redeclare class" error by pulling
// from the shared PEAR directory instead of the local copy):
$pathParts = [];
$pathParts[] = APPLICATION_PATH . '/vendor';
$pathParts[] = get_include_path();
set_include_path(implode(PATH_SEPARATOR, $pathParts));
// Composer autoloading
if (file_exists('vendor/autoload.php')) {
$loader = include 'vendor/autoload.php';
}
if (!class_exists('Zend\Loader\AutoloaderFactory')) {
throw new RuntimeException('Unable to load Zend Framework autoloader.');
}
// Run the application!
Zend\Mvc\Application::init(require 'config/application.config.php')->run();