This is a sub-issue of #1775842: [meta] Convert all variables to state and/or config systems. This issue will move variable 'tracker_index_nid' to the state system.

Tasks

  • Move variable_get/_set/_delete to state()->get/set/delete equivalents.
  • Provide upgrade path.
Files: 
CommentFileSizeAuthor
#27 1813184-tracker_index_to_state-drupal8-27.patch5.17 KBACF
PASSED: [[SimpleTest]]: [MySQL] 49,418 pass(es).
[ View ]
#20 1813184-tracker_index_to_state-drupal8-20.patch4.7 KBACF
PASSED: [[SimpleTest]]: [MySQL] 48,992 pass(es).
[ View ]
#16 tracker-index-nid-1813184-16.patch4.7 KBBerdir
PASSED: [[SimpleTest]]: [MySQL] 48,200 pass(es).
[ View ]
#13 drupal-tracker_index_nid-1813184-11.patch4.61 KBbrandenlhamilton
PASSED: [[SimpleTest]]: [MySQL] 47,569 pass(es).
[ View ]
#11 drupal-tracker_index_nid-1813184-10.patch4.56 KBbrandenlhamilton
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-tracker_index_nid-1813184-10.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#9 drupal-tracker_index_nid-1813184-9.patch4.56 KBbrandenlhamilton
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-tracker_index_nid-1813184-9.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#7 drupal-tracker_index_nid-1813184-7.patch3.36 KBbrandenlhamilton
PASSED: [[SimpleTest]]: [MySQL] 46,836 pass(es).
[ View ]
#5 1813184-5-tracker-index-nid.patch3.23 KBLars Toomre
PASSED: [[SimpleTest]]: [MySQL] 42,569 pass(es).
[ View ]
#3 1813184-3-tracker-index-nid.patch2.57 KBLars Toomre
FAILED: [[SimpleTest]]: [MySQL] 42,571 pass(es), 8 fail(s), and 0 exception(s).
[ View ]
#1 1813184-1-tracker-index-nid.patch2.88 KBLars Toomre
FAILED: [[SimpleTest]]: [MySQL] Invalid PHP syntax in core/modules/tracker/tracker.install.
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new2.88 KB
FAILED: [[SimpleTest]]: [MySQL] Invalid PHP syntax in core/modules/tracker/tracker.install.
[ View ]

Here is a locally untested patch that addresses the above.

Status:Needs review» Needs work

The last submitted patch, 1813184-1-tracker-index-nid.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new2.57 KB
FAILED: [[SimpleTest]]: [MySQL] 42,571 pass(es), 8 fail(s), and 0 exception(s).
[ View ]

Looks like misspelling tracker_update_8002() does not help... Here is a revised patch.

Status:Needs review» Needs work

The last submitted patch, 1813184-3-tracker-index-nid.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new3.23 KB
PASSED: [[SimpleTest]]: [MySQL] 42,569 pass(es).
[ View ]

Missed the use in TrackerTest.php... Included in this patch.

Status:Needs review» Needs work

Update function needs to be updated to use the new helper, but looks good otherwise.

Status:Needs work» Needs review
StatusFileSize
new3.36 KB
PASSED: [[SimpleTest]]: [MySQL] 46,836 pass(es).
[ View ]

#6. The patch included in #5 is actually converting the variable to the State API, and uses a different upgrade path from the Config API. However, I did notice that the variable_del() function was still being used in an hook_uninstall implementation. Attached patch removes the hook as well as the function call.

Status:Needs review» Needs work

Yes, and there is a helper function to convert state variables now too, look for update_variables_to_state() :) That document needs to be updated to reflect that...

We should also add an upgrade test, see StateSystemUpgradePathTest, you just need to add it to drupal-7.state.system.database.php and that test class.

Status:Needs work» Needs review
StatusFileSize
new4.56 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-tracker_index_nid-1813184-9.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

@Berdir thanks for giving me the name of the new helper function. For reference, the new function can be found at api.drupal.org. Nevertheless, for completeness, I also updated the original documentation page that I referenced in #7.

I took your suggestion, and added the tracker.index_nid to the upgrade test in StateSystemUpgradePathTest.php and drupal-7.state.system.database.php. Please let me know if I was mistaken in that interpretation.

The attached patch includes the updated state system test, as well as the changes implemented in #7.

Status:Needs review» Needs work

The last submitted patch, drupal-tracker_index_nid-1813184-9.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new4.56 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-tracker_index_nid-1813184-10.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Seems my branch was a bit stale. Fetch/Merge latest and generate new patch.

Status:Needs review» Needs work

The last submitted patch, drupal-tracker_index_nid-1813184-10.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new4.61 KB
PASSED: [[SimpleTest]]: [MySQL] 47,569 pass(es).
[ View ]

Ack! Trying again.

Status:Needs review» Reviewed & tested by the community

Looks good.

Status:Reviewed & tested by the community» Needs work

+++ b/core/modules/tracker/tracker.installundefined
@@ -6,19 +6,12 @@
/**
- * Implements hook_uninstall().
- */
-function tracker_uninstall() {
-  variable_del('tracker_index_nid');

Shouldn't this delete the value from state now?

Status:Needs work» Needs review
StatusFileSize
new4.7 KB
PASSED: [[SimpleTest]]: [MySQL] 48,200 pass(es).
[ View ]

Yes, it should. Thanks :)

#16: tracker-index-nid-1813184-16.patch queued for re-testing.

The most nitpicky thing I think I've ever posted:

+  ->key( array('name' => 'tracker_index_nid'))

There is an unnecessary space after key(

Status:Needs review» Needs work

Needs a reroll based on #18

Status:Needs work» Needs review
StatusFileSize
new4.7 KB
PASSED: [[SimpleTest]]: [MySQL] 48,992 pass(es).
[ View ]

Just a reroll of berdir's patch with tiny fix.

Status:Needs review» Needs work

The last submitted patch, 1813184-tracker_index_to_state-drupal8-20.patch, failed testing.

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, 1813184-tracker_index_to_state-drupal8-20.patch, failed testing.

Status:Needs work» Needs review

Assigned:Lars Toomre» Unassigned

Status:Needs review» Needs work

The function comment for tracker_cron() needs updating, as it still mentions the 'tracker_index_nid' variable.

Status:Needs work» Needs review
StatusFileSize
new5.17 KB
PASSED: [[SimpleTest]]: [MySQL] 49,418 pass(es).
[ View ]

updated comment.

Status:Needs review» Needs work

The last submitted patch, 1813184-tracker_index_to_state-drupal8-27.patch, failed testing.

Status:Needs work» Needs review

Status:Needs review» Reviewed & tested by the community

Looking good, will retest to verify

Status:Reviewed & tested by the community» Fixed

Committed and pushed to 8.x. Thanks!

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Issue summary:View changes

Updated issue summary.