Code Duplication    Length = 6-12 lines in 5 locations

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

@@ 239-244 (lines=6) @@
236
 * @param   string  Tool ID
237
 * @param   int     Internal ID used in specific tool table
238
 */
239
function delete_all_values_for_item($course_id, $tool_id, $ref_id) {
240
  $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
241
  $sql = 'DELETE FROM %s WHERE course_code = \'%s\' AND tool_id = \'%s\' AND ref_id = %s';
242
  $sql = sprintf($sql, $table_sf_values, $course_id, $tool_id, $ref_id);
243
  Database::query($sql);
244
}
245
246
/**
247
 * Generates a code (one-letter string) for a given field name

main/install/install.lib.php 1 location

@@ 1796-1804 (lines=9) @@
1793
/**
1794
 * Lock settings that can't be changed in other portals
1795
 */
1796
function lockSettings()
1797
{
1798
    $access_url_locked_settings = api_get_locked_settings();
1799
    $table = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
1800
    foreach ($access_url_locked_settings as $setting) {
1801
        $sql = "UPDATE $table SET access_url_locked = 1 WHERE variable  = '$setting'";
1802
        Database::query($sql);
1803
    }
1804
}
1805
1806
/**
1807
 * Update dir values

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

plugin/pens/lib/PENSPlugin.php 1 location

@@ 96-107 (lines=12) @@
93
     * Drop the database tables for the plugin
94
     * @return void
95
     */
96
    private function uninstallDatabase()
97
    {
98
        /* Drop plugin tables */
99
        $pensTable = Database::get_main_table(PENSPlugin::TABLE_PENS);
100
101
        $sql = "DROP TABLE IF EXISTS $pensTable; ";
102
        Database::query($sql);
103
104
        /* Delete settings */
105
        $settingsTable = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
106
        Database::query("DELETE FROM $settingsTable WHERE subkey = 'plugin_pens'");
107
    }
108
109
    /**
110
     * Get the error messages list

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

@@ 7558-7568 (lines=11) @@
7555
 * @param   bool    $listCampus Whether we authorize
7556
 * @todo the $_settings should be reloaded here. => write api function for this and use this in global.inc.php also.
7557
 */
7558
function api_register_campus($listCampus = true) {
7559
    $tbl_settings = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
7560
7561
    $sql = "UPDATE $tbl_settings SET selected_value='true' WHERE variable='registered'";
7562
    Database::query($sql);
7563
7564
    if (!$listCampus) {
7565
        $sql = "UPDATE $tbl_settings SET selected_value='true' WHERE variable='donotlistcampus'";
7566
        Database::query($sql);
7567
    }
7568
}
7569
7570
/**
7571
 * Checks whether current user is a student boss