本文整理汇总了PHP中DataUtil::mb_unserialize方法的典型用法代码示例。如果您正苦于以下问题:PHP DataUtil::mb_unserialize方法的具体用法?PHP DataUtil::mb_unserialize怎么用?PHP DataUtil::mb_unserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataUtil
的用法示例。
在下文中一共展示了DataUtil::mb_unserialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade_migrateSerialisedUserTemp
/**
* Migrate serialized data in users_temp.
*
* @return void
*/
public function upgrade_migrateSerialisedUserTemp()
{
$array = DBUtil::selectObjectArray('users_temp');
foreach ($array as $obj) {
if (DataUtil::is_serialized($obj['dynamics'])) {
$obj['dynamics'] = serialize(DataUtil::mb_unserialize($obj['dynamics']));
}
DBUtil::updateObject($obj, 'users_temp', '', 'tid');
}
}
示例2: upgrade_fixSerializedData
public function upgrade_fixSerializedData()
{
// fix serialised data in categories
$objArray = DBUtil::selectObjectArray('categories_category');
DBUtil::truncateTable('categories_category');
foreach ($objArray as $category) {
$data = DataUtil::mb_unserialize($category['display_name']);
$category['display_name'] = serialize($data);
$data = DataUtil::mb_unserialize($category['display_desc']);
$category['display_desc'] = serialize($data);
DBUtil::insertObject($category, 'categories_category', 'id', true, true);
}
return;
}
示例3: contentUpgrade_3_1_0
protected function contentUpgrade_3_1_0($oldVersion)
{
$tables = DBUtil::getTables();
// Fix serialisations
foreach (array('content' => 'id', 'history' => 'id', 'translatedcontent' => 'contentId') as $table => $idField) {
$obj = DBUtil::selectObjectArray('content_' . $table);
foreach ($obj as $contentItem) {
$data = DataUtil::mb_unserialize($contentItem['data']);
$contentItem['data'] = serialize($data);
DBUtil::updateObject($contentItem, 'content_' . $table, '', $idField, true);
}
}
// Add active and visiblefor columns in content_content and update tables for indexes etc.
DBUtil::changeTable('content_page');
DBUtil::changeTable('content_content');
// Fix language codes
// Loop through tables to update
foreach (array('page' => 'id', 'translatedcontent' => 'contentId', 'translatedpage' => 'pageId') as $tbl => $idField) {
$table = 'content_' . $tbl;
$obj = DBUtil::selectObjectArray($table);
// if there are records in this table
if (count($obj)) {
$newobj = array();
// Set up object to insert
/// Loop through all records in the table
foreach ($obj as $contentItem) {
// translate l3 -> l2
$l2 = ZLanguage::translateLegacyCode($contentItem['language']);
if ($l2) {
$newobj[] = array($idField => $contentItem[$idField], 'language' => $l2);
}
}
// If anything was updated, insert the object(s)
if (count($newobj)) {
DBUtil::updateObjectArray($newobj, $table, false, $idField);
}
}
// endif count($obj)
}
return true;
}