Bug 29056

Summary: Remove demo functionality remnants
Product: Koha Reporter: Andrii Nugged <nugged>
Component: System AdministrationAssignee: Peter Vashchuk <stalkernoid>
Status: CLOSED FIXED QA Contact: Joonas Kylmälä <joonas.kylmala>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, gmcharlt, jonathan.druart, joonas.kylmala, kyle, martin.renvoize, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.11.00,21.05.05,20.11.11
Bug Depends on: 12227    
Bug Blocks:    
Attachments: Bug 29056: Remove the demo functionality leftovers
Bug 29056: Remove the demo functionality leftovers
Bug 29056: Remove the demo functionality leftovers

Description Andrii Nugged 2021-09-20 08:42:07 UTC
found some remnants of "C4::Context->config('demo')": 
in /svc/config/systempreferences line 68:

`unless ( C4::Context->config('demo') ) { ... `

this "demo" was removed everywhere so should be removed in svc/config/systempreferences too
Comment 1 Andrii Nugged 2021-09-20 08:44:53 UTC
also to note maybe for separate tickets later (needs to be analyzed):

this

    `unless ( C4::Context->config('demo') ) { ... `

it's never failed because it returns _REFERENCE_TO_HASH_,
even the hash is empty:


```
sub set_preferences {
    warn C4::Context->config( 'demo' );
    warn C4::Context->config( 'demo' ) ? 'TRUTH' : 'FALSE';
    warn Dumper(C4::Context->config( 'demo' ));

    unless ( C4::Context->config('demo') ) {
        ...
```

Gives:
[2021/09/20 10:42:56] [WARN] HASH(0x5646ead56e00)
[2021/09/20 10:42:56] [WARN] TRUTH
[2021/09/20 10:42:56] [WARN] $VAR1 = {};

We might have other "if/unless ->config" usages not even for the "demo" key in our code which might be degraded with this "always true" trick.
Comment 2 Peter Vashchuk 2021-09-20 11:13:52 UTC
Created attachment 125051 [details] [review]
Bug 29056: Remove the demo functionality leftovers

Remove forgotten code of the old legacy demo functionality that was
removed from elsewhere except systempreferences, this code not only
serves no purpose but also is causing some troubles for our customers.
Comment 3 Martin Renvoize 2021-09-24 14:57:43 UTC
Created attachment 125255 [details] [review]
Bug 29056: Remove the demo functionality leftovers

Remove forgotten code of the old legacy demo functionality that was
removed from elsewhere except systempreferences, this code not only
serves no purpose but also is causing some troubles for our customers.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Joonas Kylmälä 2021-09-25 09:37:19 UTC
Created attachment 125305 [details] [review]
Bug 29056: Remove the demo functionality leftovers

Remove forgotten code of the old legacy demo functionality that was
removed from elsewhere except systempreferences, this code not only
serves no purpose but also is causing some troubles for our customers.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Comment 5 Joonas Kylmälä 2021-09-25 09:39:25 UTC
Passing QA.

@nugged: I wonder how you were able to get C4::Context->config return an empty hash, it seems like somehow somewhere that code didn't manage to find a configuration file or there is a bug in the C4::Context code. Would love to hear more about this in case it turns out to be a bug in C4::Context.
Comment 6 Jonathan Druart 2021-09-28 13:39:36 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 7 Kyle M Hall 2021-10-08 12:02:33 UTC
Pushed to 21.05.x for 21.05.05
Comment 8 Fridolin Somers 2021-10-09 02:34:36 UTC
Pushed to 20.11.x for 20.11.11

Leftovers are always served cold with ketchup ^^
Comment 9 Victor Grousset/tuxayo 2021-10-17 01:17:01 UTC
Not backported to oldoldstable (20.05.x). Feel free to ask if it's needed.