Plugin Directory

Changeset 788944


Ignore:
Timestamp:
10/16/2013 08:40:27 PM (12 years ago)
Author:
Strunker
Message:

Fixes deleting of options when migrating from 0.2 to 0.3

Location:
polizeipresse/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • polizeipresse/trunk/Polizeipresse.php

    r788210 r788944  
    3737
    3838/**
    39  * Called on plugin installation
    40  */
    41 function polizeipresse_install() {
    42     polizeipresse_set_default_options();
    43 }
    44 register_activation_hook(__FILE__, 'polizeipresse_install');
    45 
    46 /**
    4739 * Called on plugin deinstallation
    4840 */
     
    7365    if ($office_id_old) {
    7466        polizeipresse_update_option(POLIZEIPRESSE_OFFICE_ID0, $office_id_old);
    75         polizeipresse_delete_options(POLIZEIPRESSE_OFFICE_ID);
     67        polizeipresse_delete_option(POLIZEIPRESSE_OFFICE_ID);
     68    }
     69
     70    // Copy office_name to office_name0.
     71    $office_name_old = polizeipresse_get_option(POLIZEIPRESSE_OFFICE_NAME);
     72    if ($office_name_old) {
     73        polizeipresse_update_option(POLIZEIPRESSE_OFFICE_NAME0, $office_name_old);
     74        polizeipresse_delete_option(POLIZEIPRESSE_OFFICE_NAME);
    7675    }
    7776
     
    8079    if ($last_story_id_old) {
    8180        polizeipresse_update_option(POLIZEIPRESSE_CRON_LAST_STORY_ID0, $last_story_id_old);
    82         polizeipresse_delete_options(POLIZEIPRESSE_CRON_LAST_STORY_ID);
     81        polizeipresse_delete_option(POLIZEIPRESSE_CRON_LAST_STORY_ID);
    8382    }
    8483
  • polizeipresse/trunk/options.php

    r788210 r788944  
    9393
    9494/**
     95 * Deletes the option with the given name.
     96 *
     97 * @param name Name of option
     98 */
     99function polizeipresse_delete_option($name) {
     100    $options = polizeipresse_get_options();
     101    unset($options[$name]);
     102    polizeipresse_update_options($options);
     103}
     104
     105/**
    95106 * Deletes all options
    96107 */
Note: See TracChangeset for help on using the changeset viewer.