Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
302
Merge Requests
302
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
621602df
Commit
621602df
authored
Nov 14, 2012
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1831486
by miro_dietiker, Berdir: Convert comment variables to config/state.
parent
af608d70
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
2 deletions
+22
-2
core/modules/comment/comment.install
core/modules/comment/comment.install
+12
-0
core/modules/comment/comment.module
core/modules/comment/comment.module
+2
-2
core/modules/system/lib/Drupal/system/Tests/Upgrade/StateSystemUpgradePathTest.php
...rupal/system/Tests/Upgrade/StateSystemUpgradePathTest.php
+4
-0
core/modules/system/tests/upgrade/drupal-7.state.system.database.php
...s/system/tests/upgrade/drupal-7.state.system.database.php
+4
-0
No files found.
core/modules/comment/comment.install
View file @
621602df
...
...
@@ -27,6 +27,9 @@ function comment_uninstall() {
variable_del
(
'comment_preview_'
.
$node_type
);
variable_del
(
'comment_subject_field_'
.
$node_type
);
}
// Remove states.
state
()
->
delete
(
'comment.node_comment_statistics_scale'
);
}
/**
...
...
@@ -381,6 +384,15 @@ function comment_update_8003(&$sandbox) {
$sandbox
[
'#finished'
]
=
empty
(
$sandbox
[
'max'
])
?
1
:
(
$sandbox
[
'progress'
]
/
$sandbox
[
'max'
]);
}
/**
* Convert variables to state.
*/
function
comment_update_8004
()
{
update_variables_to_state
(
array
(
'node_cron_comments_scale'
=>
'comment.node_comment_statistics_scale'
,
));
}
/**
* @} End of "addtogroup updates-7.x-to-8.x".
* The next series of updates should start at 9000.
...
...
core/modules/comment/comment.module
View file @
621602df
...
...
@@ -1318,7 +1318,7 @@ function comment_node_update_index(Node $node, $langcode) {
*/
function
comment_update_index
()
{
// Store the maximum possible comments per thread (used for ranking by reply count)
variable_set
(
'node_cron_comment
s_scale'
,
1.0
/
max
(
1
,
db_query
(
'SELECT MAX(comment_count) FROM {node_comment_statistics}'
)
->
fetchField
()));
state
()
->
set
(
'comment.node_comment_statistic
s_scale'
,
1.0
/
max
(
1
,
db_query
(
'SELECT MAX(comment_count) FROM {node_comment_statistics}'
)
->
fetchField
()));
}
/**
...
...
@@ -2004,7 +2004,7 @@ function comment_ranking() {
),
// Inverse law that maps the highest reply count on the site to 1 and 0 to 0.
'score'
=>
'2.0 - 2.0 / (1.0 + node_comment_statistics.comment_count * CAST(:scale AS DECIMAL))'
,
'arguments'
=>
array
(
':scale'
=>
variable_get
(
'node_cron_comments_scale'
,
0
)
),
'arguments'
=>
array
(
':scale'
=>
state
()
->
get
(
'comment.node_comment_statistics_scale'
)
?:
0
),
),
);
}
...
...
core/modules/system/lib/Drupal/system/Tests/Upgrade/StateSystemUpgradePathTest.php
View file @
621602df
...
...
@@ -67,6 +67,10 @@ public function testSystemVariableUpgrade() {
'value'
=>
1304208000
,
'variable_name'
=>
'update_last_email_notification'
,
);
$expected_state
[
'comment.node_comment_statistics_scale'
]
=
array
(
'value'
=>
1.0
/
1000
,
'variable_name'
=>
'node_cron_comments_scale'
,
);
foreach
(
$expected_state
as
$name
=>
$data
)
{
$this
->
assertIdentical
(
state
()
->
get
(
$name
),
$data
[
'value'
]);
...
...
core/modules/system/tests/upgrade/drupal-7.state.system.database.php
View file @
621602df
...
...
@@ -43,3 +43,7 @@
->
key
(
array
(
'name'
=>
'cron_key'
))
->
fields
(
array
(
'value'
=>
serialize
(
'kdm95qppDDlyZrcUOx453YwQqDA4DNmxi4VQcxzFU9M'
)))
->
execute
();
db_merge
(
'variable'
)
->
key
(
array
(
'name'
=>
'node_cron_comments_scale'
))
->
fields
(
array
(
'value'
=>
serialize
(
1.0
/
1000
)))
->
execute
();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment