In Drupal 8 we can use field storage for the publication and unpublication dates, and we no longer need to keep track of the data in our own table.

Ref. related change records to the parent change record Field info methods are now provided by EntityManager.

Comments

  • pfrenssen committed 211b35e on 2498203
    Issue #2498203: Remove hook_schema().
    
    We will no longer need to...
  • pfrenssen committed fcbb2f9 on 2498203
    Issue #2498203: Define the Scheduler base fields.
    
pfrenssen’s picture

I've started working on this in a feature branch.

  • pfrenssen committed 4d2a023 on 2498203
    Issue #2498203: Simplify logic used to determine if a date is present.
    
  • pfrenssen committed 8119acd on 2498203
    Issue #2498203: Use a datetime widget that does not provide a default...
  • pfrenssen committed 9476f53 on 2498203
    Issue #2498203: Order use statements alphabetically.
    
  • pfrenssen committed cbc2639 on 2498203
    Issue #2498203: Update description.
    
  • pfrenssen committed f9252ff on 2498203
    Issue #2498203 by marcingy: Add a datetime widget that doesn't set a...

  • pfrenssen committed 211b35e on 2498203
    Issue #2498203: Remove hook_schema().
    
    We will no longer need to...
  • pfrenssen committed fcbb2f9 on 2498203
    Issue #2498203: Define the Scheduler base fields.
    
  • pfrenssen committed 1c47651 on 2498203 authored by marcingy
    Issue #2498203 by marcingy: Add a datetime widget that doesn't set a...
  • pfrenssen committed 678770d on 2498203
    Issue #2498203: Use a datetime widget that does not provide a default...
  • pfrenssen committed 5936661 on 2498203
    Issue #2498203: Order use statements alphabetically.
    
  • pfrenssen committed bb73284 on 2498203
    Issue #2498203: Update description.
    
  • pfrenssen committed 5e7c140 on 2498203
    Issue #2498203: Simplify logic used to determine if a date is present.
    

  • pfrenssen committed 1501457 on 2498203
    Issue #2498203: Alter the existing fields, rather than injecting our own...
  • pfrenssen committed 3182d4e on 2498203
    Issue #2498203: Only attach vertical tabs javascript when needed.
    
  • pfrenssen committed 57227c7 on 2498203
    Issue #2498203: Scheduling data now exists on the node.
    
  • pfrenssen committed 8c3d206 on 2498203
    Issue #2498203: Timestamp conversion is no longer necessary.
    
  • pfrenssen committed e7d24a6 on 2498203
    Issue #2498203: Leverage Entity::isNew().
    

  • pfrenssen committed 30c8e73 on 2498203
    Issue #2498203: Since we are using a base field now there's no need to...
  • pfrenssen committed 427950b on 2498203
    Issue #2498203: We don't need to handle default values ourselves any...
  • pfrenssen committed 519ea88 on 2498203
    Issue #2498203: The value is now handled by the base field.
    

  • pfrenssen committed 8b1b151 on 2498203
    Issue #2498203: The publish_on and unpublish_on properties are now a...
  • pfrenssen committed a55c7e5 on 2498203
    Issue #2498203: Conversion to UNIX time is handled by the Datetime...
  • pfrenssen committed d040c89 on 2498203
    Issue #2498203: Storage is now handled by the Entity Field API.
    

  • pfrenssen committed a059fad on 2498203
    Issue #2498203: Port search engine meta tag generation to Drupal 8.
    

  • pfrenssen committed 92fa41c on 2498203
    Issue #2498203: Replace db_select() with entityQuery().
    
  • pfrenssen committed a685f81 on 2498203
    Issue #2498203: Replace variables with third party settings.
    
  • pfrenssen committed fe8244f on 2498203
    Issue #2498203: We depend on the Actions module.
    
pfrenssen’s picture

While working on the conversion of _scheduler_publish() to use the new field storage I hit a fatal error that actions_do() no longer exists. We need to convert it to the new Actions API (ref #1846172: Replace the actions API).

Also still need to convert the queries in _scheduler_unpublish() and scheduler_list().

I'm also having a problem that when I first enable the module I need to manually do a drush updb to create the necessary database tables. This should be done automatically, but that's maybe for a different issue.

pfrenssen’s picture

Solved the drush updb problem.

Here is some more info about actions in Drupal 8: https://www.drupal.org/node/2020549.

  • pfrenssen committed 211b35e on 2498203
    Issue #2498203: Remove hook_schema().
    
    We will no longer need to...
  • pfrenssen committed fcbb2f9 on 2498203
    Issue #2498203: Define the Scheduler base fields.
    
  • pfrenssen committed 1c47651 on 2498203 authored by marcingy
    Issue #2498203 by marcingy: Add a datetime widget that doesn't set a...
  • pfrenssen committed 678770d on 2498203
    Issue #2498203: Use a datetime widget that does not provide a default...
  • pfrenssen committed 5936661 on 2498203
    Issue #2498203: Order use statements alphabetically.
    
  • pfrenssen committed bb73284 on 2498203
    Issue #2498203: Update description.
    
  • pfrenssen committed 5e7c140 on 2498203
    Issue #2498203: Simplify logic used to determine if a date is present.
    
  • pfrenssen committed 57227c7 on 2498203
    Issue #2498203: Scheduling data now exists on the node.
    
  • pfrenssen committed e7d24a6 on 2498203
    Issue #2498203: Leverage Entity::isNew().
    
  • pfrenssen committed 3182d4e on 2498203
    Issue #2498203: Only attach vertical tabs javascript when needed.
    
  • pfrenssen committed 8c3d206 on 2498203
    Issue #2498203: Timestamp conversion is no longer necessary.
    
  • pfrenssen committed 1501457 on 2498203
    Issue #2498203: Alter the existing fields, rather than injecting our own...
  • pfrenssen committed 427950b on 2498203
    Issue #2498203: We don't need to handle default values ourselves any...
  • pfrenssen committed 30c8e73 on 2498203
    Issue #2498203: Since we are using a base field now there's no need to...
  • pfrenssen committed 519ea88 on 2498203
    Issue #2498203: The value is now handled by the base field.
    
  • pfrenssen committed a55c7e5 on 2498203
    Issue #2498203: Conversion to UNIX time is handled by the Datetime...
  • pfrenssen committed 8b1b151 on 2498203
    Issue #2498203: The publish_on and unpublish_on properties are now a...
  • pfrenssen committed d040c89 on 2498203
    Issue #2498203: Storage is now handled by the Entity Field API.
    
  • pfrenssen committed a059fad on 2498203
    Issue #2498203: Port search engine meta tag generation to Drupal 8.
    
  • pfrenssen committed 92fa41c on 2498203
    Issue #2498203: Replace db_select() with entityQuery().
    
  • pfrenssen committed a685f81 on 2498203
    Issue #2498203: Replace variables with third party settings.
    
  • pfrenssen committed fe8244f on 2498203
    Issue #2498203: We depend on the Actions module.
    
  • pfrenssen committed 89ac5bb on 2498203
    Issue #2498203: Update the entity schema when the module is installed or...
pfrenssen’s picture

Seems drupal.org is not really good at following branches yet :)

  • pfrenssen committed 645c43b on 2498203
    Issue #2498203: Replace db_select() with entityQuery().
    
  • pfrenssen committed e104b3d on 2498203
    Issue #2498203: Use the Actions API to (un)publish the nodes.
    
  • pfrenssen committed f787504 on 2498203
    Issue #2498203: Add documentation.
    
pfrenssen’s picture

Converted to Actions API, converted the db_select() in _scheduler_unpublish().

Next steps:

  1. Convert query in scheduler_list().
  2. Fix fatal error when running lightweight cron:

    Call to undefined function scheduler_node_delete() in scheduler.module on line 472

pfrenssen’s picture

Nice to see that even though a completely new DateTime widget has been introduced in this issue, the net saving against the old D7 code is still over 100 lines!

  • pfrenssen committed bdb77f4 on 2498203
    Issue #2498203: Updating the database is no longer needed.
    
  • pfrenssen committed f0a1fb2 on 2498203
    Issue #2498203: Add a reminder.
    
pfrenssen’s picture

Status: Active » Fixed

I have fixed the fatal error and added a @todo for the query in scheduler_list(). That functionality has not yet been converted to a new route so it is not possible to test at the moment.

That concludes this ticket, merging into 8.x-1.x.

  • pfrenssen committed 1501457 on 8.x-1.x
    Issue #2498203: Alter the existing fields, rather than injecting our own...
  • pfrenssen committed 1c47651 on 8.x-1.x authored by marcingy
    Issue #2498203 by marcingy: Add a datetime widget that doesn't set a...
  • pfrenssen committed 211b35e on 8.x-1.x
    Issue #2498203: Remove hook_schema().
    
    We will no longer need to...
  • pfrenssen committed 30c8e73 on 8.x-1.x
    Issue #2498203: Since we are using a base field now there's no need to...
  • pfrenssen committed 3182d4e on 8.x-1.x
    Issue #2498203: Only attach vertical tabs javascript when needed.
    
  • pfrenssen committed 427950b on 8.x-1.x
    Issue #2498203: We don't need to handle default values ourselves any...
  • pfrenssen committed 519ea88 on 8.x-1.x
    Issue #2498203: The value is now handled by the base field.
    
  • pfrenssen committed 57227c7 on 8.x-1.x
    Issue #2498203: Scheduling data now exists on the node.
    
  • pfrenssen committed 5936661 on 8.x-1.x
    Issue #2498203: Order use statements alphabetically.
    
  • pfrenssen committed 5e7c140 on 8.x-1.x
    Issue #2498203: Simplify logic used to determine if a date is present.
    
  • pfrenssen committed 645c43b on 8.x-1.x
    Issue #2498203: Replace db_select() with entityQuery().
    
  • pfrenssen committed 678770d on 8.x-1.x
    Issue #2498203: Use a datetime widget that does not provide a default...
  • pfrenssen committed 89ac5bb on 8.x-1.x
    Issue #2498203: Update the entity schema when the module is installed or...
  • pfrenssen committed 8b1b151 on 8.x-1.x
    Issue #2498203: The publish_on and unpublish_on properties are now a...
  • pfrenssen committed 8c3d206 on 8.x-1.x
    Issue #2498203: Timestamp conversion is no longer necessary.
    
  • pfrenssen committed 92fa41c on 8.x-1.x
    Issue #2498203: Replace db_select() with entityQuery().
    
  • pfrenssen committed a059fad on 8.x-1.x
    Issue #2498203: Port search engine meta tag generation to Drupal 8.
    
  • pfrenssen committed a55c7e5 on 8.x-1.x
    Issue #2498203: Conversion to UNIX time is handled by the Datetime...
  • pfrenssen committed a685f81 on 8.x-1.x
    Issue #2498203: Replace variables with third party settings.
    
  • pfrenssen committed bb73284 on 8.x-1.x
    Issue #2498203: Update description.
    
  • pfrenssen committed bdb77f4 on 8.x-1.x
    Issue #2498203: Updating the database is no longer needed.
    
  • pfrenssen committed d040c89 on 8.x-1.x
    Issue #2498203: Storage is now handled by the Entity Field API.
    
  • pfrenssen committed e104b3d on 8.x-1.x
    Issue #2498203: Use the Actions API to (un)publish the nodes.
    
  • pfrenssen committed e7d24a6 on 8.x-1.x
    Issue #2498203: Leverage Entity::isNew().
    
  • pfrenssen committed f0a1fb2 on 8.x-1.x
    Issue #2498203: Add a reminder.
    
  • pfrenssen committed f787504 on 8.x-1.x
    Issue #2498203: Add documentation.
    
  • pfrenssen committed fcbb2f9 on 8.x-1.x
    Issue #2498203: Define the Scheduler base fields.
    
  • pfrenssen committed fe8244f on 8.x-1.x
    Issue #2498203: We depend on the Actions module.
    
pfrenssen’s picture

Haha awesome, thanks drupal.org! :)

Status: Fixed » Closed (fixed)

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

jonathan1055’s picture

This is fantastic. Thanks Pieter for taking this big step forward.
Jonathan