Commit 59b27a88 authored by Jonny Bradley's avatar Jonny Bradley

[MRG] Automatic merge, branches/15.x 57665 to 57678

parent 86b0f41b
......@@ -64,6 +64,7 @@ fi
echo "Cleaning up"
find $MODULE-$VER -name .cvsignore -type f -exec rm -f {} \;
find $MODULE-$VER -name .svnignore -type f -exec rm -f {} \;
find $MODULE-$VER -name .gitignore -type f -exec rm -f {} \;
find $MODULE-$VER/lang/ -type f -name language.php -exec php $MODULE-$VER/doc/devtools/stripcomments.php {} \;
php $MODULE-$VER/doc/devtools/rewritesecdb.php $VER
......
......@@ -51,11 +51,28 @@ class Search_Elastic_Connection
}
}
function getIndexStatus($index)
function getIndexStatus($index = '')
{
$index = $index ? '/' . $index : '';
try {
return $this->get("/$index/_status");
return $this->get("$index/_status");
} catch (Exception $e) {
$message = $e->getMessage();
// in elastic v2 _status has been replaced by _stats so try that next...
if (strpos($message, '[_status]') === false) { // another error
TikiLib::lib('errorreport')->report($message . ' for index ' . $index);
return null;
}
}
try {
return $this->get("$index/_stats"); // v2 "Indices Stats" API result
} catch (Exception $e) {
$message = $e->getMessage();
if (strpos($message, 'no such index') === false) { // suppress no such index "errors"
TikiLib::lib('errorreport')->report($message . ' for index ' . $index);
}
return null;
}
}
......@@ -352,6 +369,9 @@ class Search_Elastic_Connection
throw new Search_Elastic_NotFoundException($content->_type, $content->_id);
} elseif (isset($content->error)) {
$message = $content->error;
if (is_object($message) && !empty($message->reason)) {
$message = $message->reason;
}
if (preg_match('/^MapperParsingException\[No handler for type \[(?P<type>.*)\].*\[(?P<field>.*)\]\]$/', $message, $parts)) {
throw new Search_Elastic_MappingException($parts['type'], $parts['field']);
} elseif (preg_match('/No mapping found for \[(\S+)\] in order to sort on/', $message, $parts)) {
......@@ -368,7 +388,7 @@ class Search_Elastic_Connection
} elseif (preg_match('/QueryParsingException\[\[[^\]]*\] \[[^\]]*\] ([^\]]*)\]/', $message, $parts)) {
throw new Search_Elastic_QueryParsingException($parts[1]);
} else {
throw new Search_Elastic_Exception($message->reason, $content->status);
throw new Search_Elastic_Exception($content->error->reason, $content->status);
}
} else {
return $content;
......
......@@ -35,7 +35,13 @@ class Search_Elastic_Index implements Search_Index_Interface, Search_Index_Query
function exists()
{
return (bool) $this->connection->getIndexStatus($this->index);
$indexStatus = $this->connection->getIndexStatus($this->index);
if (is_object($indexStatus)) {
return !empty($indexStatus->indices->{$this->index});
} else {
return (bool) $indexStatus;
}
}
function addDocument(array $data)
......
......@@ -706,11 +706,17 @@ class UnifiedSearchLib
$info[tr('Node %0', $node->name)] = tr('Using %0, since %1', $node->jvm->mem->heap_used, $node->jvm->uptime);
}
} else {
$status = $connection->rawApi('/_status');
$status = $connection->getIndexStatus();
foreach ($status->indices as $indexName => $data) {
if (strpos($indexName, $prefs['unified_elastic_index_prefix']) === 0) {
$info[tr('Index %0', $indexName)] = tr('%0 documents, totaling %1 bytes',
$data->docs->num_docs, number_format($data->index->primary_size_in_bytes));
if (isset($data->primaries)) { // v2
$info[tr('Index %0', $indexName)] = tr('%0 documents, totaling %1 bytes',
$data->primaries->docs->count, number_format($data->primaries->store->size_in_bytes));
} else { // v1
$info[tr('Index %0', $indexName)] = tr('%0 documents, totaling %1 bytes',
$data->docs->num_docs, number_format($data->index->primary_size_in_bytes));
}
}
}
......
......@@ -24,7 +24,7 @@
<div class="container clearfix middle" id="middle">
<div class="topbar row">
{modulelist zone=topbar}
</div>
</div>
<div class="row">
{if zone_is_empty('left') and zone_is_empty('right')}
<div class="col-md-12 col1" id="col1">
......
......@@ -13,7 +13,7 @@
{include file='tiki-ajax_header.tpl'}
{/if}
<div class="header_outer {if $prefs.site_layout eq 'moving_headers'}navbar navbar-default{/if}">
<div class="header_outer">
<div class="header_container container">
<header class="header page-header">
{modulelist zone=top class='row top_modules'}
......@@ -83,7 +83,7 @@
{else}
<div class="col-md-6 col-md-push-3 col1" id="col1">
{if $prefs.module_zones_pagetop eq 'fixed' or ($prefs.module_zones_pagetop ne 'n' && ! zone_is_empty('pagetop'))}
{modulelist zone=pagetop}
{modulelist zone=pagetop class=row}
{/if}
{error_report}
<div class="pull-right">
......@@ -93,7 +93,7 @@
{block name=navigation}{/block}
{block name=content}{/block}
{if $prefs.module_zones_pagebottom eq 'fixed' or ($prefs.module_zones_pagebottom ne 'n' && ! zone_is_empty('pagebottom'))}
{modulelist zone=pagebottom}
{modulelist zone=pagebottom class=row}
{/if}
</div>
<div class="col-md-3 col-md-pull-6" id="col2">
......@@ -113,7 +113,6 @@
</div>
</div>
</footer>
{include file='footer.tpl'}
</body>
</html>
......
......@@ -453,6 +453,12 @@ if ( $prefs['feature_jquery_ui'] == 'y' ) {
}
}
// restore jquery-ui buttons function, thanks to http://stackoverflow.com/a/23428433/2459703
$headerlib->add_js('
var bootstrapButton = $.fn.button.noConflict() // return $.fn.button to previously assigned value
$.fn.bootstrapBtn = bootstrapButton // give $().bootstrapBtn the Bootstrap functionality
');
if ( $prefs['feature_jquery_ui_theme'] !== 'none' ) {
if ( isset($prefs['javascript_cdn']) && $prefs['javascript_cdn'] == 'jquery' ) {
// // cdn for css not working - this is the only css from a cdn anyway - so use local version
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment