Merge 1.5.2.4 ( ~ r10652)

git-svn-id: http://xe-core.googlecode.com/svn/trunk@10653 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-05-03 05:43:44 +00:00
parent 412816433d
commit f0c12f5756
20 changed files with 3413 additions and 4275 deletions

View file

@ -464,6 +464,48 @@
return true;
}
function deleteDuplicateIndexes()
{
$query = sprintf("
select \"class_name\"
, case
when substr(\"index_name\", 0, %d) = '%s'
then substr(\"index_name\", %d)
else \"index_name\" end as unprefixed_index_name
, \"is_unique\"
from \"db_index\"
where \"class_name\" like %s
group by \"class_name\"
, case
when substr(\"index_name\", 0, %d) = '%s'
then substr(\"index_name\", %d)
else \"index_name\"
end
having count(*) > 1
", strlen($this->prefix)
, $this->prefix
, strlen($this->prefix) + 1
, "'" . $this->prefix . '%' . "'"
, strlen($this->prefix)
, $this->prefix
, strlen($this->prefix) + 1
);
$result = $this->_query ($query);
if ($this->isError ()) return false;
$output = $this->_fetch ($result);
if (!$output) return false;
$indexes_to_be_deleted = $output->data;
foreach($indexes_to_be_deleted as $index)
{
$this->dropIndex($index->class_name, $index->unprefixed_index_name, $index->is_unique == 'YES' ? true : false);
}
return true;
}
/**
* @brief creates a table by using xml file
**/
@ -615,7 +657,7 @@
$query = $this->getInsertSql($queryObject, $with_values);
if(is_a($query, 'Object')) return;
$query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf (' '.$this->comment_syntax, $this->query_id):'';
$query .= (__DEBUG_QUERY__&1 && $queryObject->queryID)?sprintf (' '.$this->comment_syntax, $queryObject->queryID):'';
$result = $this->_query ($query);
if ($result && !$this->transaction_started) {
@ -688,7 +730,7 @@
if (is_a($query, 'Object'))
return;
$query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
$query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $queryObject->queryID) : '';
$result = $this->_query($query, $connection);
if ($this->isError())
@ -722,11 +764,24 @@
// Total count
$temp_where = $queryObject->getWhereString($with_values, false);
$count_query = sprintf('select count(*) as "count" %s %s', 'FROM ' . $queryObject->getFromString($with_values), ($temp_where === '' ? '' : ' WHERE '. $temp_where));
if ($queryObject->getGroupByString() != '') {
$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query);
}
$count_query .= (__DEBUG_QUERY__&1 && $queryObject->query_id)?sprintf (' '.$this->comment_syntax, $this->query_id):'';
// Check for distinct query and if found update count query structure
$temp_select = $queryObject->getSelectString($with_values);
$uses_distinct = strpos(strtolower($temp_select), "distinct") !== false;
$uses_groupby = $queryObject->getGroupByString() != '';
if($uses_distinct || $uses_groupby) {
$count_query = sprintf('select %s %s %s %s'
, $temp_select
, 'FROM ' . $queryObject->getFromString($with_values)
, ($temp_where === '' ? '' : ' WHERE '. $temp_where)
, ($uses_groupby ? ' GROUP BY ' . $queryObject->getGroupByString() : '')
);
// If query uses grouping or distinct, count from original select
$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query);
}
$count_query .= (__DEBUG_QUERY__&1 && $queryObject->queryID)?sprintf (' '.$this->comment_syntax, $queryObject->queryID):'';
$result = $this->_query($count_query, $connection);
$count_output = $this->_fetch($result);
$total_count = (int)(isset($count_output->count) ? $count_output->count : NULL);

View file

@ -565,11 +565,24 @@
// Total count
$temp_where = $queryObject->getWhereString(true, false);
$count_query = sprintf('select count(*) as "count" %s %s', 'FROM ' . $queryObject->getFromString(), ($temp_where === '' ? '' : ' WHERE ' . $temp_where));
if ($queryObject->getGroupByString() != '') {
$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query);
}
$count_query .= (__DEBUG_QUERY__ & 1 && $output->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
// Check for distinct query and if found update count query structure
$temp_select = $queryObject->getSelectString(true);
$uses_distinct = strpos(strtolower($temp_select), "distinct") !== false;
$uses_groupby = $queryObject->getGroupByString() != '';
if($uses_distinct || $uses_groupby) {
$count_query = sprintf('select %s %s %s %s'
, $temp_select
, 'FROM ' . $queryObject->getFromString(true)
, ($temp_where === '' ? '' : ' WHERE '. $temp_where)
, ($uses_groupby ? ' GROUP BY ' . $queryObject->getGroupByString() : '')
);
// If query uses grouping or distinct, count from original select
$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query);
}
$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
$this->param = $queryObject->getArguments();
$result_count = $this->_query($count_query, $connection);
$count_output = $this->_fetch($result_count);

File diff suppressed because it is too large Load diff

View file

@ -101,7 +101,7 @@ class Mobile {
$oMobile =& Mobile::getInstance();
// stripos is only for PHP5.
$mobileAgent = unserialize(strtolower(serialize(array('iPod','iPhone','Android','BlackBerry','SymbianOS','Bada','Kindle','Wii','SCH-','SPH-','CANU-','Windows Phone','Windows CE','POLARIS','Palm','Dorothy Browser','Mobile','Opera Mobi','Opera Mini','Minimo','AvantGo','NetFront','Nokia','LGPlayer','SonyEricsson','HTC','SKT','lgtelecom','Vodafone','DoCoMo'))));
$mobileAgent = unserialize(strtolower(serialize(array('iPod','iPhone','Android','BlackBerry','SymbianOS','Bada','Kindle','Wii','SCH-','SPH-','CANU-','Windows Phone','Windows CE','POLARIS','Palm','Dorothy Browser','Mobile','Opera Mobi','Opera Mini','Minimo','AvantGo','NetFront','Nokia','LGPlayer','SonyEricsson','HTC'))));
if($oMobile->isMobilePadCheckByAgent())
{

View file

@ -406,7 +406,9 @@
if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent())
{
global $lang;
$footer = '<div style="margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0"><p style="text-align:center;margin:1em 0"><a href="'.getUrl('m', '1').'" style="color:#ff0;font-weight:bold;font-size:24px">'.$lang->msg_pc_to_mobile.'</a></p></div>';
$header = '<style type="text/css">div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>';
$footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="'.getUrl('m', '1').'">'.$lang->msg_pc_to_mobile.'</a></p></div>';
Context::addHtmlHeader($header);
Context::addHtmlFooter($footer);
}