Code Duplication    Length = 9-12 lines in 3 locations

plugin/advanced_subscription/src/AdvancedSubscriptionPlugin.php 1 location

@@ 126-137 (lines=12) @@
123
     * Drop the database tables for the plugin
124
     * @return void
125
     */
126
    private function uninstallDatabase()
127
    {
128
        /* Drop plugin tables */
129
        $advancedSubscriptionQueueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE);
130
131
        $sql = "DROP TABLE IF EXISTS $advancedSubscriptionQueueTable; ";
132
        Database::query($sql);
133
134
        /* Delete settings */
135
        $settingsTable = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
136
        Database::query("DELETE FROM $settingsTable WHERE subkey = 'advanced_subscription'");
137
    }
138
139
    /**
140
     * Get the error messages list

main/inc/lib/api.lib.php 1 location

@@ 7650-7660 (lines=11) @@
7647
 * @param   bool    $listCampus Whether we authorize
7648
 * @todo the $_settings should be reloaded here. => write api function for this and use this in global.inc.php also.
7649
 */
7650
function api_register_campus($listCampus = true) {
7651
    $tbl_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
7652
7653
    $sql = "UPDATE $tbl_settings SET selected_value='true' WHERE variable='registered'";
7654
    Database::query($sql);
7655
7656
    if (!$listCampus) {
7657
        $sql = "UPDATE $tbl_settings SET selected_value='true' WHERE variable='donotlistcampus'";
7658
        Database::query($sql);
7659
    }
7660
}
7661
7662
/**
7663
 * Checks whether current user is a student boss

main/install/install.lib.php 1 location

@@ 1879-1887 (lines=9) @@
1876
/**
1877
 * Lock settings that can't be changed in other portals
1878
 */
1879
function lockSettings()
1880
{
1881
    $access_url_locked_settings = api_get_locked_settings();
1882
    $table = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
1883
    foreach ($access_url_locked_settings as $setting) {
1884
        $sql = "UPDATE $table SET access_url_locked = 1 WHERE variable  = '$setting'";
1885
        Database::query($sql);
1886
    }
1887
}
1888
1889
/**
1890
 * Update dir values