本文整理匯總了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;
}