Source for file indexer.json.php
Documentation is available at indexer.json.php
* @package Joomla.Administrator
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
// Register dependent classes.
JLoader::register('FinderIndexer', JPATH_COMPONENT_ADMINISTRATOR .
'/helpers/indexer/indexer.php');
* Indexer controller class for Finder.
* @package Joomla.Administrator
* Method to start the indexer.
if ($params->get('enable_logging', '0'))
$options['format'] =
'{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}';
$options['text_file'] =
'indexer.php';
// We don't want this form to be cached.
header('Cache-Control: no-cache');
// Check for a valid token. If invalid, send a 403 with the error message.
// Put in a buffer to silence noise.
// Reset the indexer state.
// Import the finder plugins.
// Add the indexer language to JS
// Trigger the onStartIndex event.
// Get the indexer state.
// Catch an exception and return the response.
* Method to run the next batch of content through the indexer.
if ($params->get('enable_logging', '0'))
$options['format'] =
'{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}';
$options['text_file'] =
'indexer.php';
JLog::add('Starting the indexer batch process', JLog::INFO);
// We don't want this form to be cached.
header('Cache-Control: no-cache');
// Check for a valid token. If invalid, send a 403 with the error message.
// Put in a buffer to silence noise.
// Remove the script time limit.
// Get the indexer state.
// Reset the batch offset.
// Update the indexer state.
// Import the finder plugins.
* We are going to swap out the raw document object with an HTML document
* in order to work around some plugins that don't do proper environment
* checks before trying to use HTML document functions.
// Get the document properties.
'language' =>
$lang->getTag(),
'direction' =>
$lang->isRTL() ?
'rtl' :
'ltr'
// Get the HTML document.
// Get the admin application.
// Trigger the onBeforeIndex event.
// Trigger the onBuildIndex event.
// Get the indexer state.
// Swap the documents back.
// Swap the applications back.
// Catch an exception and return the response.
// Swap the documents back.
* Method to optimize the index and perform any necessary cleanup.
// We don't want this form to be cached.
header('Cache-Control: no-cache');
// Check for a valid token. If invalid, send a 403 with the error message.
// Put in a buffer to silence noise.
// Import the finder plugins.
// Get the indexer state.
// Catch an exception and return the response.
* Method to handle a send a JSON response. The body parameter
* can be a Exception object for when an error has occurred or
* a JObject for a good response.
* @param mixed $data JObject on success, Exception on error. [optional]
if ($params->get('enable_logging', '0'))
$options['format'] =
'{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}';
$options['text_file'] =
'indexer.php';
// Send the assigned error code if we are catching an exception.
if ($data instanceof
Exception)
$app->setHeader('status', $data->getCode());
// Create the response object.
// Send the JSON response.
// Close the application.
* Finder Indexer JSON Response Class
* @package Joomla.Administrator
* @param mixed $state The processing state for the indexer
if ($params->get('enable_logging', '0'))
$options['format'] =
'{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}';
$options['text_file'] =
'indexer.php';
// The old token is invalid so send a new one.
// Check if we are dealing with an error.
if ($state instanceof
Exception)
// Prepare the error response.
$this->header =
JText::_('COM_FINDER_INDEXER_HEADER_ERROR');
$this->message =
$state->getMessage();
// Prepare the response data.
$this->batchSize = (int)
$state->batchSize;
$this->batchOffset = (int)
$state->batchOffset;
$this->totalItems = (int)
$state->totalItems;
$this->startTime =
$state->startTime;
$this->start =
!empty($state->start) ? (int)
$state->start :
0;
$this->complete =
!empty($state->complete) ? (int)
$state->complete :
0;
// Set the appropriate messages.
if ($this->totalItems <=
0 &&
$this->complete)
$this->header =
JText::_('COM_FINDER_INDEXER_HEADER_COMPLETE');
$this->message =
JText::_('COM_FINDER_INDEXER_MESSAGE_COMPLETE');
elseif ($this->totalItems <=
0)
$this->header =
JText::_('COM_FINDER_INDEXER_HEADER_OPTIMIZE');
$this->message =
JText::_('COM_FINDER_INDEXER_MESSAGE_OPTIMIZE');
$this->header =
JText::_('COM_FINDER_INDEXER_HEADER_RUNNING');
$this->message =
JText::_('COM_FINDER_INDEXER_MESSAGE_RUNNING');
// Register the error handler.
Documentation generated on Tue, 19 Nov 2013 15:05:29 +0100 by phpDocumentor 1.4.3