本文整理汇总了PHP中DBUtil::metaTables方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtil::metaTables方法的具体用法?PHP DBUtil::metaTables怎么用?PHP DBUtil::metaTables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBUtil
的用法示例。
在下文中一共展示了DBUtil::metaTables方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade
/**
* upgrade the module from an old version
*
* This function must consider all the released versions of the module!
* If the upgrade fails at some point, it returns the last upgraded version.
*
* @param string $oldVersion version number string to upgrade from
* @return mixed true on success, last valid version string or false if fails
*/
public function upgrade($oldversion)
{
// Upgrade dependent on old version number
switch ($oldversion) {
case '3.6':
// Rename 'thelang' block.
$table = 'blocks';
$sql = "UPDATE {$table} SET bkey = 'lang' WHERE bkey = 'thelang'";
\DBUtil::executeSQL($sql);
// Optional upgrade
if (in_array(\DBUtil::getLimitedTablename('message'), \DBUtil::metaTables())) {
$this->migrateMessages();
}
$this->migrateBlockNames();
$this->migrateExtMenu();
case '3.7':
case '3.7.0':
if (!\DBUtil::changeTable('blocks')) {
return false;
}
case '3.7.1':
$this->newBlockPositions();
case '3.8.0':
// update empty filter fields to an empty array
$entity = $this->name . '\\Entity\\Block';
$dql = "UPDATE {$entity} p SET p.filter = 'a:0:{}' WHERE p.filter = '' OR p.filter = 's:0:\"\";'";
$query = $this->entityManager->createQuery($dql);
$query->getResult();
case '3.8.1':
// future upgrade routines
}
// Update successful
return true;
}
示例2: upgrade
/**
* upgrade the module from an old version
*
* This function must consider all the released versions of the module!
* If the upgrade fails at some point, it returns the last upgraded version.
*
* @param string $oldVersion version number string to upgrade from
* @return mixed true on success, last valid version string or false if fails
*/
public function upgrade($oldversion)
{
// Upgrade dependent on old version number
switch ($oldversion) {
case '3.6':
// Rename 'thelang' block.
$table = 'blocks';
$sql = "UPDATE $table SET bkey = 'lang' WHERE bkey = 'thelang'";
DBUtil::executeSQL($sql);
// Optional upgrade
if (in_array(DBUtil::getLimitedTablename('message'), DBUtil::metaTables())) {
$this->migrateMessages();
}
$this->migrateBlockNames();
$this->migrateExtMenu();
case '3.7':
case '3.7.0':
if (!DBUtil::changeTable('blocks')) {
return false;
}
case '3.7.1':
$this->newBlockPositions();
case '3.8.0':
// update empty filter fields to an empty array
$entity = $this->name . '_Entity_Block';
$dql = "UPDATE $entity p SET p.filter = 'a:0:{}' WHERE p.filter = '' OR p.filter = 's:0:\"\";' OR p.filter = 'a:3:{s:4:\"type\";s:0:\"\";s:9:\"functions\";s:0:\"\";s:10:\"customargs\";s:0:\"\";}'";
$query = $this->entityManager->createQuery($dql);
$query->getResult();
case '3.8.1':
// register ui_hooks for HTML block editing
HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
case '3.8.2':
// future upgrade routines
}
// Update successful
return true;
}
示例3: mediashare_upgrade
/**
* Module upgrade
*/
function mediashare_upgrade($oldVersion)
{
// Upgrade dependent on old version number
switch ($oldVersion) {
case '1.0.0':
case '1.0.1':
if (!mediashare_upgrade_to_1_0_2()) {
return '1.0.1';
}
case '1.0.2':
case '2.0.0':
case '2.0.1':
case '2.1.0':
if (!mediashare_upgrade_to_2_1_1()) {
return '2.1.0';
}
case '2.1.1':
case '2.1.2':
if (!mediashare_upgrade_to_2_2_0()) {
return '2.1.2';
}
case '2.2.0':
if (!mediashare_upgrade_to_2_3_0()) {
return '2.2.0';
}
case '2.3.0':
case '3.0.0':
case '3.0.1':
case '3.1.0':
case '3.1.1':
case '3.2.0':
case '3.3.0':
if (!mediashare_upgrade_to_3_4_0()) {
return '3.3.0';
}
case '3.4.0':
if (!mediashare_upgrade_to_3_4_1()) {
return '3.4.0';
}
case '3.4.1':
mediashare_upgrade_to_3_4_2();
case '3.4.2':
case '4.0.0':
case '4.0.1':
$tables = DBUtil::metaTables();
$ptable = DBUtil::getLimitedTablename('mediashare_photoshare');
if (in_array($ptable, $tables) && !DBUtil::dropTable('mediashare_photoshare')) {
return '4.0.1';
}
case '4.0.2':
case '4.1':
// future
}
// Update successful
return true;
}