当前位置: 首页>>代码示例>>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;未经允许,请勿转载。