當前位置: 首頁>>代碼示例>>PHP>>正文


PHP eZURLAliasML::dbError方法代碼示例

本文整理匯總了PHP中eZURLAliasML::dbError方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZURLAliasML::dbError方法的具體用法?PHP eZURLAliasML::dbError怎麽用?PHP eZURLAliasML::dbError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eZURLAliasML的用法示例。


在下文中一共展示了eZURLAliasML::dbError方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: storePath


//.........這裏部分代碼省略.........
                 break;
             }
             if (!$autoAdjustName) {
                 if ($reportErrors) {
                     eZDebug::writeError("Tried to store path '{$path}' but the path already exists (ID: {$curID}) but with action '{$curAction}', the new action was '{$action}'");
                 }
                 return array('status' => self::LINK_ALREADY_TAKEN, 'path' => $path, 'element' => null);
             }
             // Need to adjust name, re-iterate
             ++$uniqueCounter;
         }
         $textEsc = $db->escapeString($newText);
         // See if there is already a node in the same level with the same action
         if ($newElementID === null) {
             $query = "SELECT * FROM ezurlalias_ml " . "WHERE parent = {$parentID} AND action = '{$actionStr}' AND is_original = 1 AND is_alias = 0";
             $rows = $db->arrayQuery($query);
             if (count($rows) > 0) {
                 $newElementID = (int) $rows[0]['id'];
             }
         }
         // Create or update the element
         if ($curElementID !== null) {
             // Check if an already existing entry at the same level exists, with a different id
             // if so the id must be updated.
             $query = "SELECT * FROM ezurlalias_ml " . "WHERE parent = {$parentID} AND action = '{$actionStr}' AND is_original = 1 AND is_alias = 0";
             $rows = $db->arrayQuery($query);
             if (count($rows) > 0) {
                 $existingEntryId = (int) $rows[0]['id'];
                 if ($existingEntryId != $curElementID) {
                     // move history entry to the same id
                     $query = "UPDATE ezurlalias_ml SET id = {$existingEntryId} " . "WHERE parent = {$parentID} AND text_md5 = {$textMD5}";
                     $res = $db->query($query);
                     if (!$res) {
                         return eZURLAliasML::dbError($db);
                     }
                     $curElementID = $existingEntryId;
                 }
             }
             $bitOr = $db->bitOr($db->bitAnd('lang_mask', ~1), $languageMask);
             // Note: The `text` field is updated too, this ensures case-changes are stored.
             $query = "UPDATE ezurlalias_ml SET link = id, lang_mask = {$bitOr}, text = '{$textEsc}', action = '{$actionStr}', action_type = '{$actionTypeStr}', is_alias = 0, is_original = 1 " . "WHERE parent = {$parentID} AND text_md5 = {$textMD5}";
             $res = $db->query($query);
             if (!$res) {
                 return eZURLAliasML::dbError($db);
             }
             $newElementID = $curElementID;
         } else {
             $element = new eZURLAliasML(array('id' => $newElementID, 'link' => null, 'parent' => $parentID, 'text' => $newText, 'lang_mask' => $languageID | $alwaysMask, 'action' => $action));
             $element->store();
             $newElementID = (int) $element->attribute('id');
             $createdElement = $element;
         }
         $createdPath[] = $newText;
         // OMS-urlalias-fix: We want to retain the lang_mask of url entries, but mark others as history elements is_original = 0
         // Furthermore this change is not performed on custom alias entries.
         $bitAnd = $db->bitAnd('lang_mask', $languageID);
         // First we look at the entries to mark as history entries, if an entry comprise more languages, it must not be set as history element.
         $query = "SELECT * FROM ezurlalias_ml " . "WHERE action = '{$actionStr}' AND ({$bitAnd} > 0) AND is_original = 1 AND is_alias = 0 AND (parent != {$parentID} OR text_md5 != {$textMD5})";
         $toBeUpdated = $db->arrayQuery($query);
         // 0. Check if the entry to be updated represents multiple languages:
         // IF YES:
         //  1. "Downgrade" existing entry, by removing the active translation's language id from the language_mask.
         // IF NO:
         //  1. Mark entry as a history entry
         if (count($toBeUpdated) > 0) {
             $languageMask = $toBeUpdated[0]['lang_mask'];
開發者ID:patrickallaert,項目名稱:ezpublish-legacy-php7,代碼行數:67,代碼來源:ezurlaliasml.php


注:本文中的eZURLAliasML::dbError方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。