-
Notifications
You must be signed in to change notification settings - Fork 148
Multilingual Content (PoC) #6282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Cyperghost
wants to merge
20
commits into
6.2
Choose a base branch
from
6.2-multilingual-content-v2
base: 6.2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 12 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
34c0e2d
Add database structure
Cyperghost 8e06574
Add migration script
Cyperghost 57648b1
Moving language values for content in the user ranks to the installat…
Cyperghost 0c1511a
Load rank titles in `UserRankList`
Cyperghost c86cdf3
Implement eager cache for user ranks
Cyperghost aa1fe9d
Save user rank content through the form builder
Cyperghost cb21847
Implement `I18nFormDataProcessor` to handle values from a content table
Cyperghost 8ad0570
Remove unnecessary backwards compatibility code
Cyperghost a649abd
Remove `rankTitle` property from `UserRank`
Cyperghost 448aa14
Add a data processor to handle the value `none` for the CSS class name
Cyperghost 8897a3a
Set `null` as monolingual `langaugeID`
Cyperghost 0b56868
Prevent the execution of an additional (unnecessary) SQL query
Cyperghost 0e84953
Update wcfsetup/install/files/acp/install_com.woltlab.wcf_step2.php
Cyperghost 5444baf
Don't use transaction here
Cyperghost ac89843
Implement `getRank()` method in `UserRankCache` to simply get the use…
Cyperghost edfb753
Do not use `UNIQUE KEY`, as the value `null` can be included
Cyperghost 0761068
Implement helper function to get the subquery for the column of the c…
Cyperghost e4bc9c4
Fix spelling for `$objectIDColumn`
Cyperghost 4a8dad8
Use the langaugeID `null` as `0` array-key instead of an empty string
Cyperghost 31156de
Use `null` instead of the default language id for monolingual content
Cyperghost File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
wcfsetup/install/files/acp/update_com.woltlab.wcf_6.2_userRank.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| <?php | ||
|
|
||
| use wcf\system\database\util\PreparedStatementConditionBuilder; | ||
| use wcf\system\language\LanguageFactory; | ||
| use wcf\system\WCF; | ||
|
|
||
| $sql = "SELECT rankID, rankTitle | ||
| FROM wcf1_user_rank"; | ||
| $statement = WCF::getDB()->prepare($sql); | ||
| $statement->execute(); | ||
| $titles = $statement->fetchMap('rankID', 'rankTitle'); | ||
|
|
||
| $sql = "INSERT INTO wcf1_user_rank_content | ||
| (rankID, languageID, title) | ||
| VALUES (?, ?, ?)"; | ||
| $statement = WCF::getDB()->prepare($sql); | ||
|
|
||
| $languageItems = []; | ||
| foreach ($titles as $rankID => $title) { | ||
| if (\preg_match('~^wcf\.user\.rank\.\w+$~', $title, $matches)) { | ||
| $languageItems[] = $title; | ||
|
|
||
| foreach (LanguageFactory::getInstance()->getLanguages() as $language) { | ||
| $statement->execute([ | ||
| $rankID, | ||
| $language->languageID, | ||
| $language->get($title), | ||
| ]); | ||
| } | ||
| } else { | ||
| $statement->execute([ | ||
| $rankID, | ||
| LanguageFactory::getInstance()->getDefaultLanguageID(), | ||
| $title, | ||
| ]); | ||
| } | ||
| } | ||
|
|
||
| if ($languageItems !== []) { | ||
| $conditionBuilder = new PreparedStatementConditionBuilder(); | ||
| $conditionBuilder->add('languageItem IN (?)', [$languageItems]); | ||
|
|
||
| $sql = "DELETE FROM wcf1_language_item | ||
| {$conditionBuilder}"; | ||
| $statement = WCF::getDB()->prepare($sql); | ||
| $statement->execute($conditionBuilder->getParameters()); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.