本文整理汇总了PHP中PMA_tryUpgradeTransformations函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_tryUpgradeTransformations函数的具体用法?PHP PMA_tryUpgradeTransformations怎么用?PHP PMA_tryUpgradeTransformations使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_tryUpgradeTransformations函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_checkRelationsParam
/**
* Defines the relation parameters for the current user
* just a copy of the functions used for relations ;-)
* but added some stuff to check what will work
*
* @access protected
* @return array the relation parameters for the current user
*/
function PMA_checkRelationsParam()
{
$cfgRelation = array();
$cfgRelation['PMA_VERSION'] = PMA_VERSION;
$workToTable = array('relwork' => 'relation', 'displaywork' => array('relation', 'table_info'), 'bookmarkwork' => 'bookmarktable', 'pdfwork' => array('table_coords', 'pdf_pages'), 'commwork' => 'column_info', 'mimework' => 'column_info', 'historywork' => 'history', 'recentwork' => 'recent', 'favoritework' => 'favorite', 'uiprefswork' => 'table_uiprefs', 'trackingwork' => 'tracking', 'userconfigwork' => 'userconfig', 'menuswork' => array('users', 'usergroups'), 'navwork' => 'navigationhiding', 'savedsearcheswork' => 'savedsearches', 'centralcolumnswork' => 'central_columns', 'designersettingswork' => 'designer_settings', 'exporttemplateswork' => 'export_templates');
foreach ($workToTable as $work => $table) {
$cfgRelation[$work] = false;
}
$cfgRelation['allworks'] = false;
$cfgRelation['user'] = null;
$cfgRelation['db'] = null;
if ($GLOBALS['server'] == 0 || empty($GLOBALS['cfg']['Server']['pmadb']) || !$GLOBALS['dbi']->selectDb($GLOBALS['cfg']['Server']['pmadb'], $GLOBALS['controllink'])) {
// No server selected -> no bookmark table
// we return the array with the falses in it,
// to avoid some 'Uninitialized string offset' errors later
$GLOBALS['cfg']['Server']['pmadb'] = false;
return $cfgRelation;
}
$cfgRelation['user'] = $GLOBALS['cfg']['Server']['user'];
$cfgRelation['db'] = $GLOBALS['cfg']['Server']['pmadb'];
// Now I just check if all tables that i need are present so I can for
// example enable relations but not pdf...
// I was thinking of checking if they have all required columns but I
// fear it might be too slow
$tab_query = 'SHOW TABLES FROM ' . PMA\libraries\Util::backquote($GLOBALS['cfg']['Server']['pmadb']);
$tab_rs = PMA_queryAsControlUser($tab_query, false, PMA\libraries\DatabaseInterface::QUERY_STORE);
if (!$tab_rs) {
// query failed ... ?
//$GLOBALS['cfg']['Server']['pmadb'] = false;
return $cfgRelation;
}
while ($curr_table = @$GLOBALS['dbi']->fetchRow($tab_rs)) {
if ($curr_table[0] == $GLOBALS['cfg']['Server']['bookmarktable']) {
$cfgRelation['bookmark'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['relation']) {
$cfgRelation['relation'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['table_info']) {
$cfgRelation['table_info'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['table_coords']) {
$cfgRelation['table_coords'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['column_info']) {
$cfgRelation['column_info'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['pdf_pages']) {
$cfgRelation['pdf_pages'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['history']) {
$cfgRelation['history'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['recent']) {
$cfgRelation['recent'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['favorite']) {
$cfgRelation['favorite'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['table_uiprefs']) {
$cfgRelation['table_uiprefs'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['tracking']) {
$cfgRelation['tracking'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['userconfig']) {
$cfgRelation['userconfig'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['users']) {
$cfgRelation['users'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['usergroups']) {
$cfgRelation['usergroups'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['navigationhiding']) {
$cfgRelation['navigationhiding'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['savedsearches']) {
$cfgRelation['savedsearches'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['central_columns']) {
$cfgRelation['central_columns'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['designer_settings']) {
$cfgRelation['designer_settings'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['export_templates']) {
$cfgRelation['export_templates'] = $curr_table[0];
}
}
// end while
$GLOBALS['dbi']->freeResult($tab_rs);
if (isset($cfgRelation['relation'])) {
$cfgRelation['relwork'] = true;
}
if (isset($cfgRelation['relation']) && isset($cfgRelation['table_info'])) {
$cfgRelation['displaywork'] = true;
}
if (isset($cfgRelation['table_coords']) && isset($cfgRelation['pdf_pages'])) {
$cfgRelation['pdfwork'] = true;
}
if (isset($cfgRelation['column_info'])) {
$cfgRelation['commwork'] = true;
// phpMyAdmin 4.3+
// Check for input transformations upgrade.
$cfgRelation['mimework'] = PMA_tryUpgradeTransformations();
}
if (isset($cfgRelation['history'])) {
$cfgRelation['historywork'] = true;
}
//.........这里部分代码省略.........
示例2: PMA_checkRelationsParam
//.........这里部分代码省略.........
// fear it might be too slow
$tab_query = 'SHOW TABLES FROM ' . PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb']);
$tab_rs = PMA_queryAsControlUser($tab_query, false, PMA_DatabaseInterface::QUERY_STORE);
if (!$tab_rs) {
// query failed ... ?
//$GLOBALS['cfg']['Server']['pmadb'] = false;
return $cfgRelation;
}
while ($curr_table = @$GLOBALS['dbi']->fetchRow($tab_rs)) {
if ($curr_table[0] == $GLOBALS['cfg']['Server']['bookmarktable']) {
$cfgRelation['bookmark'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['relation']) {
$cfgRelation['relation'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['table_info']) {
$cfgRelation['table_info'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['table_coords']) {
$cfgRelation['table_coords'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['column_info']) {
$cfgRelation['column_info'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['pdf_pages']) {
$cfgRelation['pdf_pages'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['history']) {
$cfgRelation['history'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['recent']) {
$cfgRelation['recent'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['favorite']) {
$cfgRelation['favorite'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['table_uiprefs']) {
$cfgRelation['table_uiprefs'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['tracking']) {
$cfgRelation['tracking'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['userconfig']) {
$cfgRelation['userconfig'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['users']) {
$cfgRelation['users'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['usergroups']) {
$cfgRelation['usergroups'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['navigationhiding']) {
$cfgRelation['navigationhiding'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['savedsearches']) {
$cfgRelation['savedsearches'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['central_columns']) {
$cfgRelation['central_columns'] = $curr_table[0];
}
}
// end while
$GLOBALS['dbi']->freeResult($tab_rs);
if (isset($cfgRelation['relation'])) {
$cfgRelation['relwork'] = true;
if (isset($cfgRelation['table_info'])) {
$cfgRelation['displaywork'] = true;
}
}
if (isset($cfgRelation['table_coords']) && isset($cfgRelation['pdf_pages'])) {
$cfgRelation['pdfwork'] = true;
}
if (isset($cfgRelation['column_info'])) {
$cfgRelation['commwork'] = true;
// phpMyAdmin 4.3+
// Check for input transformations upgrade.
$cfgRelation['mimework'] = PMA_tryUpgradeTransformations();
}
if (isset($cfgRelation['history'])) {
$cfgRelation['historywork'] = true;
}
if (isset($cfgRelation['recent'])) {
$cfgRelation['recentwork'] = true;
}
if (isset($cfgRelation['favorite'])) {
$cfgRelation['favoritework'] = true;
}
if (isset($cfgRelation['table_uiprefs'])) {
$cfgRelation['uiprefswork'] = true;
}
if (isset($cfgRelation['tracking'])) {
$cfgRelation['trackingwork'] = true;
}
if (isset($cfgRelation['userconfig'])) {
$cfgRelation['userconfigwork'] = true;
}
if (isset($cfgRelation['bookmark'])) {
$cfgRelation['bookmarkwork'] = true;
}
if (isset($cfgRelation['users']) && isset($cfgRelation['usergroups'])) {
$cfgRelation['menuswork'] = true;
}
if (isset($cfgRelation['navigationhiding'])) {
$cfgRelation['navwork'] = true;
}
if (isset($cfgRelation['savedsearches'])) {
$cfgRelation['savedsearcheswork'] = true;
}
if (isset($cfgRelation['central_columns'])) {
$cfgRelation['central_columnswork'] = true;
}
if ($cfgRelation['relwork'] && $cfgRelation['displaywork'] && $cfgRelation['pdfwork'] && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfgRelation['historywork'] && $cfgRelation['recentwork'] && $cfgRelation['uiprefswork'] && $cfgRelation['trackingwork'] && $cfgRelation['userconfigwork'] && $cfgRelation['bookmarkwork'] && $cfgRelation['central_columnswork'] && $cfgRelation['menuswork'] && $cfgRelation['navwork'] && $cfgRelation['savedsearcheswork'] && $cfgRelation['favoritework']) {
$cfgRelation['allworks'] = true;
}
return $cfgRelation;
}
示例3: testPMATryUpgradeTransformations
/**
* Test for PMA_tryUpgradeTransformations
*
* @return void
*/
public function testPMATryUpgradeTransformations()
{
$dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock();
$dbi->expects($this->any())->method('tryQuery')->will($this->returnValue(true));
$dbi->expects($this->any())->method('numRows')->will($this->returnValue(0));
$dbi->expects($this->any())->method('getError')->will($this->onConsecutiveCalls(true, false));
$GLOBALS['dbi'] = $dbi;
$GLOBALS['cfg']['Server']['pmadb'] = 'pmadb';
$GLOBALS['cfg']['Server']['column_info'] = 'column_info';
// Case 1
$actual = PMA_tryUpgradeTransformations();
$this->assertEquals(false, $actual);
// Case 2
$actual = PMA_tryUpgradeTransformations();
$this->assertEquals(true, $actual);
}